query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Except block handles 'BaseException'
bokeh/bokeh/scripts/issues.py
[ { "content": "def issue_section_order(issue):\n \"\"\"Returns the section order for the given issue.\"\"\"\n try:\n return LOG_SECTION.values().index(issue_section(issue))\n except:\n return -1", "metadata": "root.issue_section_order", "header": "['module', '___EOS___']", "index": 76 } ]
[ { "span": "except:", "start_line": 80, "start_column": 4, "end_line": 80, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "issue", "\\u", "section", "\\u", "order_", "(_", "issue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "section", " ", "order", " ", "for", " ", "the", " ", "give", "n", " ", "issue", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "LOG", "\\u", "SECTION_", "._", "values_", "(_", ")_", "._", "index_", "(_", "issue", "\\u", "section_", "(_", "issue_", ")_", ")_", "\\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_", "-_", "1_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Arelle/Arelle/arelle/plugin/functionsXmlCreation.py
[ { "content": "'''\nSample custom functions plugin for formula XML Element, Attribute creation functions\n\n>>> note that this function has been renamed xfi:create-element and moved to FunctionXfi.py <<<\n\n(c) Copyright 2012 Mark V Systems Limited, All rights reserved.\n'''\nfrom arelle import XPathContext, XbrlUtil\nfrom arelle.ModelValue import qname, QName\nfrom arelle.ModelInstanceObject import ModelDimensionValue, XmlUtil\nfrom arelle.FunctionUtil import qnameArg, nodeArg, atomicArg\nfrom arelle import XmlValidate\nfrom lxml import etree\n\n'''\nCreate an XML element in a \"scratchpad\" in-memory XML document, to behave like the results\nof an fn:doc() that would provide XML elements which can be consumed by formula typed\ndimension and OCC constructs.\n\nThe element may be created with attributes and descendant elements, as needed.\n\nxfxc:element(\n qname, // qname of element\n (name-value pairs for creating attributes if any),\n value, if any, otherwise () or ''\n optional nested elements (e.g., xfc:element( ) ... of child nodes)\n )\n \nAttributes may be pairs of string name, value, or pairs of QName, value when attribute\nname is qualified.\n\nA function definition is required in the formula linkbase:\n<variable:function name=\"xfxc:element\" output=\"element()\" xlink:type=\"resource\" xlink:label=\"cust-fn-xfxc-create\">\n <variable:input type=\"xs:QName\" /> <!-- qname of element to create -->\n <variable:input type=\"xs:anyAtomicType*\" /> <!-- sequence of name, value pairs for creating attributes (name can be string or QName) -->\n <variable:input type=\"xs:anyAtomicType\" /> <!-- optional value, () or '' if none -->\n <variable:input type=\"element()*\" /> <!-- optional sequence of child elements, this parameter can be omitted if no child elements -->\n</variable:function>\n'''\n\n\n__pluginInfo__ = {\n 'name': 'Formula Xml Creation Functions',\n 'version': '1.0',\n 'description': \"This plug-in adds a custom function to create xml elements, such as for typed dimensions, implemented by a plug-in. \",\n 'license': 'Apache-2',\n 'author': 'Mark V Systems Limited',\n 'copyright': '(c) Copyright 2012 Mark V Systems Limited, All rights reserved.',\n # classes of mount points (required)\n 'Formula.CustomFunctions': xfxcFunctions,\n}\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def xfxc_element(xc, p, contextItem, args):\n if not 2 <= len(args) <= 4: raise XPathContext.FunctionNumArgs()\n qn = qnameArg(xc, p, args, 0, 'QName', emptyFallback=None)\n attrArg = args[1] if isinstance(args[1],(list,tuple)) else (args[1],)\n # attributes have to be pairs\n if attrArg:\n if len(attrArg) & 1 or any(not isinstance(attrArg[i], (QName, _STR_BASE))\n for i in range(0, len(attrArg),2)):\n raise XPathContext.FunctionArgType(1,\"((xs:qname|xs:string),xs:anyAtomicValue)\", errCode=\"xfxce:AttributesNotNameValuePairs\")\n else:\n attrParam = [(attrArg[i],attrArg[i+1]) # need name-value pairs for XmlUtil function\n for i in range(0, len(attrArg),2)]\n else:\n attrParam = None\n \n value = atomicArg(xc, p, args, 2, \"xs:anyAtomicType\", emptyFallback='') \n if not value: # be sure '' is None so no text node is created\n value = None \n if len(args) < 4:\n childElements = None\n else:\n childElements = xc.flattenSequence(args[3])\n \n # scratchpad instance document emulates fn:doc( ) to hold XML nodes\n scratchpadXmlDocUrl = \"http://www.xbrl.org/2012/function/creation/xml_scratchpad.xml\"\n if scratchpadXmlDocUrl in xc.modelXbrl.urlDocs:\n modelDocument = xc.modelXbrl.urlDocs[scratchpadXmlDocUrl]\n else:\n # create scratchpad xml document\n # this will get the fake instance document in the list of modelXbrl docs so that it is garbage collected\n from arelle import ModelDocument\n modelDocument = ModelDocument.create(xc.modelXbrl, \n ModelDocument.Type.UnknownXML, \n scratchpadXmlDocUrl,\n initialXml=\"<xfc:dummy xmlns:xfc='http://www.xbrl.org/2012/function/creation'/>\")\n \n newElement = XmlUtil.addChild(modelDocument.xmlRootElement,\n qn,\n attributes=attrParam,\n text=value)\n if childElements:\n for element in childElements:\n if isinstance(element, etree.ElementBase):\n newElement.append(element)\n \n # node myst be validated for use in instance creation (typed dimension references)\n XmlValidate.validate(xc.modelXbrl, newElement)\n \n return newElement", "metadata": "root.xfxc_element", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def xfxcFunctions():\n return {\n qname(\"{http://www.xbrl.org/2012/function/xml-creation}xfxc:element\"): xfxc_element,\n }", "metadata": "root.xfxcFunctions", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "from arelle import XPathContext, XbrlUtil", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 41 }, { "span": "from arelle.ModelInstanceObject import ModelDimensionValue, XmlUtil", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 67 }, { "span": "from arelle.FunctionUtil import qnameArg, nodeArg, atomicArg", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Sampl", "e", " ", "custom", " ", "function", "s", " ", "plugin", " ", "for", " ", "formula", " ", "XML", " ", "Element", ",", " ", "Attribute", " ", "creati", "on", " ", "function", "s", "\\", "10", ";", "\\", "10", ";", ">>>", " ", "note", " ", "tha", "t", " ", "this", " ", "function", " ", "has", " ", "bee", "n", " ", "renamed", " ", "xfi", ":", "create", "-", "element", " ", "and", " ", "moved", " ", "to", " ", "Function", "Xf", "i", ".", "py", " ", "<<", "<", "\\", "10", ";", "\\", "10", ";", "(", "c", ")", " ", "Copy", "right", " ", "2012", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "XP", "ath", "Context_", ",_", "Xbrl", "Util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Value_", "import_", "qname_", ",_", "QN", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Insta", "nce", "Object_", "import_", "Model", "Dimen", "sion", "Value_", ",_", "Xm", "l", "Util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Function", "Util_", "import_", "qna", "me", "Arg_", ",_", "node", "Arg_", ",_", "atomi", "c", "Arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "Xm", "l", "Validate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "e", " ", "an", " ", "XML", " ", "element", " ", "in", " ", "a", " ", "\"", "scratch", "pad", "\"", " ", "in", "-", "memory", " ", "XML", " ", "document", ",", " ", "to", " ", "behave", " ", "like", " ", "the", " ", "results", "\\", "10", ";", "of", " ", "an", " ", "fn", ":", "doc", "()", " ", "tha", "t", " ", "wou", "ld", " ", "provide", " ", "XML", " ", "element", "s", " ", "whi", "ch", " ", "can", " ", "be", " ", "consume", "d", " ", "by", " ", "formula", " ", "typed", "\\", "10", ";", "dimension", " ", "and", " ", "OCC", " ", "construct", "s", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "element", " ", "may", " ", "be", " ", "created", " ", "with", " ", "attribute", "s", " ", "and", " ", "descendant", " ", "element", "s", ",", " ", "as", " ", "need", "ed", ".", "\\", "10", ";", "\\", "10", ";", "xf", "xc", ":", "element", "(", "\\", "10", ";", " ", " ", " ", " ", "qna", "me", ",", " ", " ", "//", " ", "qna", "me", " ", "of", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "(", "name", "-", "value", " ", "pair", "s", " ", "for", " ", "creati", "ng", " ", "attribute", "s", " ", "if", " ", "any", "),", "\\", "10", ";", " ", " ", " ", " ", "value", ",", " ", "if", " ", "any", ",", " ", "other", "wis", "e", " ", "()", " ", "or", " ", "''", "\\", "10", ";", " ", " ", " ", " ", "option", "al", " ", "nest", "ed", " ", "element", "s", " ", "(", "e", ".", "g", ".,", " ", "xfc", ":", "element", "(", " ", ")", " ", "...", " ", "of", " ", "child", " ", "nodes", ")", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "Attribute", "s", " ", "may", " ", "be", " ", "pair", "s", " ", "of", " ", "string", " ", "name", ",", " ", "value", ",", " ", "or", " ", "pair", "s", " ", "of", " ", "QN", "ame", ",", " ", "value", " ", "whe", "n", " ", "attribute", "\\", "10", ";", "name", " ", "is", " ", "qualified", ".", "\\", "10", ";", "\\", "10", ";", "A", " ", "function", " ", "definit", "ion", " ", "is", " ", "require", "d", " ", "in", " ", "the", " ", "formula", " ", "link", "base", ":", "\\", "10", ";<", "variab", "le", ":", "function", " ", "name", "=\"", "xf", "xc", ":", "element", "\"", " ", "output", "=\"", "element", "()\"", " ", "xli", "nk", ":", "type", "=\"", "resource", "\"", " ", "xli", "nk", ":", "label", "=\"", "cust", "-", "fn", "-", "xf", "xc", "-", "create", "\">", "\\", "10", ";", " ", " ", "<", "variab", "le", ":", "input", " ", "type", "=\"", "xs", ":", "QN", "ame", "\"", " ", "/>", " ", " ", "<!", "--", " ", "qna", "me", " ", "of", " ", "element", " ", "to", " ", "create", " ", "-->", "\\", "10", ";", " ", " ", "<", "variab", "le", ":", "input", " ", "type", "=\"", "xs", ":", "any", "Atom", "ic", "Type", "*\"", " ", "/>", " ", "<!", "--", " ", "sequence", " ", "of", " ", "name", ",", " ", "value", " ", "pair", "s", " ", "for", " ", "creati", "ng", " ", "attribute", "s", " ", "(", "name", " ", "can", " ", "be", " ", "string", " ", "or", " ", "QN", "ame", ")", " ", "-->", "\\", "10", ";", " ", " ", "<", "variab", "le", ":", "input", " ", "type", "=\"", "xs", ":", "any", "Atom", "ic", "Type", "\"", " ", "/>", " ", "<!", "--", " ", "option", "al", " ", "value", ",", " ", "()", " ", "or", " ", "''", " ", "if", " ", "none", " ", "-->", "\\", "10", ";", " ", " ", "<", "variab", "le", ":", "input", " ", "type", "=\"", "element", "()", "*\"", " ", "/>", " ", "<!", "--", " ", "option", "al", " ", "sequence", " ", "of", " ", "child", " ", "element", "s", ",", " ", "this", " ", "parameter", " ", "can", " ", "be", " ", "omit", "ted", " ", "if", " ", "no", " ", "child", " ", "element", "s", " ", "-->", "\\", "10", ";<", "/", "variab", "le", ":", "function", ">", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u", "plugin", "Info", "\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "Form", "ula", " ", "Xm", "l", " ", "Creat", "ion", " ", "Function", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "\"", "Thi", "s", " ", "plug", "-", "in", " ", "adds", " ", "a", " ", "custom", " ", "function", " ", "to", " ", "create", " ", "xml", " ", "element", "s", ",", " ", "suc", "h", " ", "as", " ", "for", " ", "typed", " ", "dimension", "s", ",", " ", "implemented", " ", "by", " ", "a", " ", "plug", "-", "in", ".", " ", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "license", "'_", ":_", "'", "Ap", "ache", "-", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "'_", ":_", "'", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "copyr", "ight", "'_", ":_", "'(", "c", ")", " ", "Copy", "right", " ", "2012", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classe", "s", " ", "of", " ", "mount", " ", "points", " ", "(", "require", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Form", "ula", ".", "Custom", "Function", "s", "'_", ":_", "xf", "xc", "Functions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "xf", "xc", "\\u", "element_", "(_", "xc_", ",_", "p_", ",_", "context", "Item_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "2_", "<=_", "len_", "(_", "args_", ")_", "<=_", "4_", ":_", "raise_", "XP", "ath", "Context_", "._", "Function", "Num", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qn_", "=_", "qna", "me", "Arg_", "(_", "xc_", ",_", "p_", ",_", "args_", ",_", "0_", ",_", "'", "QN", "ame", "'_", ",_", "empty", "Fallback", "_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "Arg_", "=_", "args_", "[_", "1_", "]_", "if_", "isinstance_", "(_", "args_", "[_", "1_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "else_", "(_", "args_", "[_", "1_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "attribute", "s", " ", "have", " ", "to", " ", "be", " ", "pairs_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "attr", "Arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "attr", "Arg_", ")_", "&_", "1_", "or_", "any_", "(_", "not_", "isinstance_", "(_", "attr", "Arg_", "[_", "i_", "]_", ",_", "(_", "QN", "ame_", ",_", "\\u", "STR", "\\u", "BASE_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "attr", "Arg_", ")_", ",_", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "XP", "ath", "Context_", "._", "Function", "Arg", "Type_", "(_", "1_", ",_", "\"(", "(", "xs", ":", "qna", "me", "|", "xs", ":", "string", "),", "xs", ":", "any", "Atom", "ic", "Value", ")\"_", ",_", "err", "Code_", "=_", "\"", "xf", "xce", ":", "Attribute", "s", "Not", "Name", "Value", "Pair", "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 ", " _", "attr", "Param_", "=_", "[_", "(_", "attr", "Arg_", "[_", "i_", "]_", ",_", "attr", "Arg_", "[_", "i_", "+_", "1_", "]_", ")_", "#", " ", "need", " ", "name", "-", "value", " ", "pair", "s", " ", "for", " ", "Xm", "l", "Ut", "il", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "attr", "Arg_", ")_", ",_", "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 ", " _", "attr", "Param_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "atomi", "c", "Arg_", "(_", "xc_", ",_", "p_", ",_", "args_", ",_", "2_", ",_", "\"", "xs", ":", "any", "Atom", "ic", "Type", "\"_", ",_", "empty", "Fallback", "_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "#", " ", "be", " ", "sure", " ", "''", " ", "is", " ", "Non", "e", " ", "so", " ", "no", " ", "text", " ", "node", " ", "is", " ", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "Elements_", "=_", "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 ", " _", "child", "Elements_", "=_", "xc_", "._", "flat", "ten", "Sequence_", "(_", "args_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scratch", "pad", " ", "instance", " ", "document", " ", "emulate", "s", " ", "fn", ":", "doc", "(", " ", ")", " ", "to", " ", "hold", " ", "XML", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scratch", "pad", "Xm", "l", "Doc", "Url_", "=_", "\"", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2012", "/", "function", "/", "creati", "on", "/", "xml", "\\u", "scratch", "pad", ".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scratch", "pad", "Xm", "l", "Doc", "Url_", "in_", "xc_", "._", "model", "Xbrl", "_", "._", "url", "Docs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Document_", "=_", "xc_", "._", "model", "Xbrl", "_", "._", "url", "Docs", "_", "[_", "scratch", "pad", "Xm", "l", "Doc", "Url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "scratch", "pad", " ", "xml", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "get", " ", "the", " ", "fake", " ", "instance", " ", "document", " ", "in", " ", "the", " ", "list", " ", "of", " ", "model", "Xbrl", " ", "docs", " ", "so", " ", "tha", "t", " ", "it", " ", "is", " ", "gar", "bage", " ", "collected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "are", "lle", "_", "import_", "Model", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Document_", "=_", "Model", "Document_", "._", "create_", "(_", "xc_", "._", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Document_", "._", "Type_", "._", "Un", "know", "n", "XML_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scratch", "pad", "Xm", "l", "Doc", "Url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Xml_", "=_", "\"<", "xfc", ":", "dummy", " ", "xml", "ns", ":", "xfc", "='", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2012", "/", "function", "/", "creati", "on", "'/>", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Element_", "=_", "Xm", "l", "Util_", "._", "add", "Child_", "(_", "model", "Document_", "._", "xml", "Roo", "t", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "attr", "Param_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child", "Elements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "element_", "in_", "child", "Elements_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "element_", ",_", "etree_", "._", "Element", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Element_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "node", " ", "myst", " ", "be", " ", "validat", "ed", " ", "for", " ", "use", " ", "in", " ", "instance", " ", "creati", "on", " ", "(", "typed", " ", "dimension", " ", "reference", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xm", "l", "Validate", "_", "._", "validate_", "(_", "xc_", "._", "model", "Xbrl", "_", ",_", "new", "Element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "new", "Element_", "\\u\\u\\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_", "xf", "xc", "Functions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "qname_", "(_", "\"{", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2012", "/", "function", "/", "xml", "-", "creati", "on", "}", "xf", "xc", ":", "element", "\"_", ")_", ":_", "xf", "xc", "\\u", "element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fp7-ofelia/ocf/ofam/src/src/foam/sfa/rspecs/elements/versions/nitosv1Channel.py
[ { "content": "from foam.sfa.util.sfalogging import logger\nfrom foam.sfa.util.xml import XpathFilter\nfrom foam.sfa.util.xrn import Xrn\n\nfrom foam.sfa.rspecs.elements.element import Element\nfrom foam.sfa.rspecs.elements.node import Node\nfrom foam.sfa.rspecs.elements.sliver import Sliver\nfrom foam.sfa.rspecs.elements.location import Location\nfrom foam.sfa.rspecs.elements.hardware_type import HardwareType\nfrom foam.sfa.rspecs.elements.disk_image import DiskImage\nfrom foam.sfa.rspecs.elements.interface import Interface\nfrom foam.sfa.rspecs.elements.bwlimit import BWlimit\nfrom foam.sfa.rspecs.elements.pltag import PLTag\nfrom foam.sfa.rspecs.elements.versions.nitosv1Sliver import NITOSv1Sliver\nfrom foam.sfa.rspecs.elements.versions.nitosv1PLTag import NITOSv1PLTag\nfrom foam.sfa.rspecs.elements.versions.pgv2Services import PGv2Services\nfrom foam.sfa.rspecs.elements.lease import Lease\nfrom foam.sfa.rspecs.elements.spectrum import Spectrum\nfrom foam.sfa.rspecs.elements.channel import Channel\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NITOSv1Channel:\n\n\n\n", "metadata": "root.NITOSv1Channel", "header": "['module', '___EOS___']", "index": 21 }, { "content": " @staticmethod\n def add_channels(xml, channels):\n \n network_elems = xml.xpath('//network')\n if len(network_elems) > 0:\n network_elem = network_elems[0]\n elif len(channels) > 0:\n # dirty hack that handles no resource manifest rspec \n network_urn = \"omf\"\n network_elem = xml.add_element('network', name = network_urn)\n else:\n network_elem = xml\n\n# spectrum_elems = xml.xpath('//spectrum') \n# spectrum_elem = xml.add_element('spectrum')\n\n# if len(spectrum_elems) > 0:\n# spectrum_elem = spectrum_elems[0]\n# elif len(channels) > 0:\n# spectrum_elem = xml.add_element('spectrum')\n# else:\n# spectrum_elem = xml\n\n spectrum_elem = network_elem.add_instance('spectrum', []) \n \n channel_elems = [] \n for channel in channels:\n channel_fields = ['channel_num', 'frequency', 'standard']\n channel_elem = spectrum_elem.add_instance('channel', channel, channel_fields)\n channel_elems.append(channel_elem)", "metadata": "root.NITOSv1Channel.add_channels", "header": "['class', 'NITOSv1Channel', ':', '___EOS___']", "index": 23 }, { "content": " @staticmethod\n def get_channels(xml, filter={}):\n xpath = '//channel%s | //default:channel%s' % (XpathFilter.xpath(filter), XpathFilter.xpath(filter))\n channel_elems = xml.xpath(xpath)\n return NITOSv1Channel.get_channel_objs(channel_elems)", "metadata": "root.NITOSv1Channel.get_channels", "header": "['class', 'NITOSv1Channel', ':', '___EOS___']", "index": 55 }, { "content": " @staticmethod\n def get_channel_objs(channel_elems):\n channels = [] \n for channel_elem in channel_elems:\n channel = Channel(channel_elem.attrib, channel_elem)\n channel['channel_num'] = channel_elem.attrib['channel_num']\n channel['frequency'] = channel_elem.attrib['frequency']\n channel['standard'] = channel_elem.attrib['standard']\n\n channels.append(channel)\n return channels ", "metadata": "root.NITOSv1Channel.get_channel_objs", "header": "['class', 'NITOSv1Channel', ':', '___EOS___']", "index": 61 } ]
[ { "span": "from foam.sfa.util.sfalogging import logger", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 43 }, { "span": "from foam.sfa.util.xrn import Xrn", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 33 }, { "span": "from foam.sfa.rspecs.elements.element import Element", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 52 }, { "span": "from foam.sfa.rspecs.elements.node import Node", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 46 }, { "span": "from foam.sfa.rspecs.elements.sliver import Sliver", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 50 }, { "span": "from foam.sfa.rspecs.elements.location import Location", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 54 }, { "span": "from foam.sfa.rspecs.elements.hardware_type import HardwareType", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 63 }, { "span": "from foam.sfa.rspecs.elements.disk_image import DiskImage", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 57 }, { "span": "from foam.sfa.rspecs.elements.interface import Interface", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 56 }, { "span": "from foam.sfa.rspecs.elements.bwlimit import BWlimit", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 52 }, { "span": "from foam.sfa.rspecs.elements.pltag import PLTag", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 48 }, { "span": "from foam.sfa.rspecs.elements.versions.nitosv1Sliver import NITOSv1Sliver", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 73 }, { "span": "from foam.sfa.rspecs.elements.versions.nitosv1PLTag import NITOSv1PLTag", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 71 }, { "span": "from foam.sfa.rspecs.elements.versions.pgv2Services import PGv2Services", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 71 }, { "span": "from foam.sfa.rspecs.elements.lease import Lease", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 48 }, { "span": "from foam.sfa.rspecs.elements.spectrum import Spectrum", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 54 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "sfa", "logging_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "xml_", "import_", "Xp", "ath", "Filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "util_", "._", "xr", "n_", "import_", "Xr", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "element_", "import_", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "node_", "import_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "sli", "ver_", "import_", "Sli", "ver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "location_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "hard", "ware", "\\u", "type_", "import_", "Hard", "ware", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "disk", "\\u", "image_", "import_", "Disk", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "interface_", "import_", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "bw", "limit_", "import_", "BW", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "plt", "ag_", "import_", "PL", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "nit", "os", "v1", "Sli", "ver_", "import_", "NIT", "OS", "v1", "Sli", "ver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "nit", "os", "v1", "PL", "Tag_", "import_", "NIT", "OS", "v1", "PL", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "pg", "v2", "Services_", "import_", "PG", "v2", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "lease_", "import_", "Leas", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "spectrum_", "import_", "Spectrum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "foa", "m_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "channel_", "import_", "Channel_", "\\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_", "NIT", "OS", "v1", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Channel_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "channels_", "(_", "xml_", ",_", "channels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "elems_", "=_", "xml_", "._", "xpath_", "(_", "'//", "network", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "network", "\\u", "elems_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "elem_", "=_", "network", "\\u", "elems_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "channels_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dir", "ty", " ", "hack", " ", "tha", "t", " ", "handle", "s", " ", "no", " ", "resource", " ", "manifest", " ", "rsp", "ec", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "urn_", "=_", "\"", "om", "f", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "elem_", "=_", "xml_", "._", "add", "\\u", "element_", "(_", "'", "network", "'_", ",_", "name_", "=_", "network", "\\u", "urn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "elem_", "=_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "spectr", "um", "\\u", "elem", "s", " ", "=", " ", "xml", ".", "xpa", "th", "('", "//", "spectr", "um", "')", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "spectr", "um", "\\u", "elem", " ", "=", " ", "xml", ".", "add", "\\u", "element", "('", "spectr", "um", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "len", "(", "spectr", "um", "\\u", "elem", "s", ")", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "spectr", "um", "\\u", "elem", " ", "=", " ", "spectr", "um", "\\u", "elem", "s", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "eli", "f", " ", "len", "(", "channel", "s", ")", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "spectr", "um", "\\u", "elem", " ", "=", " ", "xml", ".", "add", "\\u", "element", "('", "spectr", "um", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "spectr", "um", "\\u", "elem", " ", "=", " ", "xml_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spectr", "um", "\\u", "elem_", "=_", "network", "\\u", "elem_", "._", "add", "\\u", "instance_", "(_", "'", "spectr", "um", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channel", "\\u", "elems_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "channel_", "in_", "channels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel", "\\u", "fields_", "=_", "[_", "'", "channel", "\\u", "num", "'_", ",_", "'", "freque", "nc", "y", "'_", ",_", "'", "standard", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "\\u", "elem_", "=_", "spectr", "um", "\\u", "elem_", "._", "add", "\\u", "instance_", "(_", "'", "channel", "'_", ",_", "channel_", ",_", "channel", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "\\u", "elems_", "._", "append_", "(_", "channel", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Channel_", ":_", "\\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_", "get", "\\u", "channels_", "(_", "xml_", ",_", "filter_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpath_", "=_", "'//", "channel", "%", "s", " ", "|", " ", "//", "default", ":", "channel", "%", "s", "'_", "%_", "(_", "Xp", "ath", "Filter_", "._", "xpath_", "(_", "filter_", ")_", ",_", "Xp", "ath", "Filter_", "._", "xpath_", "(_", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "\\u", "elems_", "=_", "xml_", "._", "xpath_", "(_", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "NIT", "OS", "v1", "Channel_", "._", "get", "\\u", "channel", "\\u", "objs_", "(_", "channel", "\\u", "elems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "NIT", "OS", "v1", "Channel_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "channel", "\\u", "objs_", "(_", "channel", "\\u", "elems_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "channel", "\\u", "elem_", "in_", "channel", "\\u", "elems_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "channel_", "=_", "Channel_", "(_", "channel", "\\u", "elem_", "._", "attrib_", ",_", "channel", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "channel", "\\u", "num", "'_", "]_", "=_", "channel", "\\u", "elem_", "._", "attrib_", "[_", "'", "channel", "\\u", "num", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "freque", "nc", "y", "'_", "]_", "=_", "channel", "\\u", "elem_", "._", "attrib_", "[_", "'", "freque", "nc", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "[_", "'", "standard", "'_", "]_", "=_", "channel", "\\u", "elem_", "._", "attrib_", "[_", "'", "standard", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", "._", "append_", "(_", "channel_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
RoseOu/flasky/app/api_1_0/posts.py
[ { "content": "from flask import jsonify, request, g, abort, url_for, current_app\nfrom .. import db\nfrom ..models import Post, Permission\nfrom . import api\nfrom .decorators import permission_required\nfrom .errors import forbidden\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@api.route('/posts/')\ndef get_posts():\n page = request.args.get('page', 1, type=int)\n pagination = Post.query.paginate(\n page, per_page=current_app.config['FLASKY_POSTS_PER_PAGE'],\n error_out=False)\n posts = pagination.items\n prev = None\n if pagination.has_prev:\n prev = url_for('api.get_posts', page=page-1, _external=True)\n next = None\n if pagination.has_next:\n next = url_for('api.get_posts', page=page+1, _external=True)\n return jsonify({\n 'posts': [post.to_json() for post in posts],\n 'prev': prev,\n 'next': next,\n 'count': pagination.total\n })", "metadata": "root.get_posts", "header": "['module', '___EOS___']", "index": 8 }, { "content": "@api.route('/posts/<int:id>')\ndef get_post(id):\n post = Post.query.get_or_404(id)\n return jsonify(post.to_json())", "metadata": "root.get_post", "header": "['module', '___EOS___']", "index": 29 }, { "content": "@api.route('/posts/', methods=['POST'])\n@permission_required(Permission.WRITE_ARTICLES)\ndef new_post():\n post = Post.from_json(request.json)\n post.author = g.current_user\n db.session.add(post)\n db.session.commit()\n return jsonify(post.to_json()), 201, \\\n {'Location': url_for('api.get_post', id=post.id, _external=True)}", "metadata": "root.new_post", "header": "['module', '___EOS___']", "index": 35 }, { "content": "@api.route('/posts/<int:id>', methods=['PUT'])\n@permission_required(Permission.WRITE_ARTICLES)\ndef edit_post(id):\n post = Post.query.get_or_404(id)\n if g.current_user != post.author and \\\n not g.current_user.can(Permission.ADMINISTER):\n return forbidden('Insufficient permissions')\n post.body = request.json.get('body', post.body)\n db.session.add(post)\n return jsonify(post.to_json())", "metadata": "root.edit_post", "header": "['module', '___EOS___']", "index": 46 } ]
[ { "span": "from flask import jsonify, request, g, abort, url_for, current_app", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "jsonify_", ",_", "request_", ",_", "g_", ",_", "abort_", ",_", "url", "\\u", "for_", ",_", "current", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "models_", "import_", "Post_", ",_", "Permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "decorators_", "import_", "permissi", "on", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "errors_", "import_", "forbidden", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "api_", "._", "route_", "(_", "'/", "posts", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "posts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pagination_", "=_", "Post_", "._", "query_", "._", "paginate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "page_", ",_", "per", "\\u", "page_", "=_", "current", "\\u", "app_", "._", "config_", "[_", "'", "FLA", "SK", "Y", "\\u", "POST", "S", "\\u", "PER", "\\u", "PAGE", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "out_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posts_", "=_", "pagination_", "._", "items_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pagination_", "._", "has", "\\u", "prev_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev_", "=_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "posts", "'_", ",_", "page_", "=_", "page_", "-_", "1_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pagination_", "._", "has", "\\u", "next_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "=_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "posts", "'_", ",_", "page_", "=_", "page_", "+_", "1_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "posts", "'_", ":_", "[_", "post_", "._", "to", "\\u", "json_", "(_", ")_", "for_", "post_", "in_", "posts_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prev", "'_", ":_", "prev_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "'_", ":_", "next_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "pagination_", "._", "total_", "\\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_", "@_", "api_", "._", "route_", "(_", "'/", "posts", "/", "<", "int", ":", "id", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "post_", "(_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "=_", "Post_", "._", "query_", "._", "get", "\\u", "or", "\\u", "404_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "post_", "._", "to", "\\u", "json_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "api_", "._", "route_", "(_", "'/", "posts", "/'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "Permission_", "._", "WRITE", "\\u", "ARTI", "CLE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "post_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "=_", "Post_", "._", "from", "\\u", "json_", "(_", "request_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post_", "._", "author_", "=_", "g_", "._", "current", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "post_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "post_", "._", "to", "\\u", "json_", "(_", ")_", ")_", ",_", "201_", ",_", "{_", "'", "Locat", "ion", "'_", ":_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "post", "'_", ",_", "id_", "=_", "post_", "._", "id_", ",_", "\\u", "external_", "=_", "True_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "api_", "._", "route_", "(_", "'/", "posts", "/", "<", "int", ":", "id", ">'_", ",_", "methods_", "=_", "[_", "'", "PU", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "Permission_", "._", "WRITE", "\\u", "ARTI", "CLE", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "edit", "\\u", "post_", "(_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post_", "=_", "Post_", "._", "query_", "._", "get", "\\u", "or", "\\u", "404_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "g_", "._", "current", "\\u", "user_", "!=_", "post_", "._", "author_", "and_", "not_", "g_", "._", "current", "\\u", "user_", "._", "can_", "(_", "Permission_", "._", "ADM", "INI", "STE", "R_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "forbidden", "_", "(_", "'", "Ins", "uff", "icient", " ", "permissi", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "post_", "._", "body_", "=_", "request_", "._", "json_", "._", "get_", "(_", "'", "body", "'_", ",_", "post_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_",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layers_relu_driver.py
[ { "content": "#!/usr/bin/env python\n\n\"tune 2 layer ELM + linear regressor on top\"\n\nimport pandas as pd\nimport numpy as np\nimport math\nimport csv\nimport hyperopt\nimport os\nimport sys\n\nfrom time import time\nfrom glob import glob\nfrom math import log\n\nfrom hyperopt import hp, fmin, tpe\n\nfrom elm import *\nfrom random_layer import *\n\nfrom sklearn import pipeline\nfrom sklearn.linear_model import Ridge\nfrom sklearn.metrics import mean_squared_error as MSE\nfrom sklearn.preprocessing import StandardScaler as Scaler\n\n\n\n###\n\ninput_file = 'data/train_num.csv'\ntry:\n\toutput_file = sys.argv[1]\nexcept IndexError:\t\n\toutput_file = 'hyperopt_log_two_layer_relu.csv'\n\ndata = pd.read_csv( input_file )\n\ntrain = data[0:93170]\ntest = data[93170:]\n\nx_train = train[[ c for c in train.columns if c != 'cpu_01_busy' ]]\nx_test = test[[ c for c in train.columns if c != 'cpu_01_busy' ]]\n\nscaler = Scaler()\nx_train = scaler.fit_transform( x_train )\nx_test = scaler.transform( x_test )\n\ny_train = train[ 'cpu_01_busy' ]\ny_test = test[ 'cpu_01_busy' ]\n\n#\n\nmax_evals = 100\nrun_counter = 0\n\n\t\n\t\n\n\n###\n\nspace = ( \n\thp.qloguniform( 'n_hidden_1', log( 10 ), log( 1000 ), 1 ),\n\thp.uniform( 'alpha_1', 0, 1 ),\n\thp.loguniform( 'rbf_width_1', log( 1e-5 ), log( 100 )),\n\t\n\thp.qloguniform( 'n_hidden_2', log( 10 ), log( 1000 ), 1 ),\n\thp.uniform( 'alpha_2', 0, 1 ),\n\thp.loguniform( 'rbf_width_2', log( 1e-5 ), log( 100 )),\n\t\n\thp.loguniform( 'ridge_alpha', -15, 5 )\n)\n\n###\n\nif __name__ == '__main__':\n\n\theaders = [ 'rmse', 'n_hidden_1', 'alpha_1', 'rbf_width_1',\n\t\t'n_hidden_2', 'alpha_2', 'rbf_width_2', 'ridge_alpha' ]\n\to_f = open( output_file, 'wb' )\n\twriter = csv.writer( o_f )\n\twriter.writerow( headers )\n\n\tstart_time = time()\n\tbest = fmin( run_wrapper, space, algo = tpe.suggest, max_evals = max_evals )\n\tend_time = time()\n\n\tprint \"Seconds passed:\", int( round( end_time - start_time ))\n\t#print \"Best run:\", optimizer.get_best_run()\n\tprint best\n\t#print run_test( hyperopt.space_eval( space, best ))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def RMSE( y, p ):\n\treturn math.sqrt( MSE( y, p ))", "metadata": "root.RMSE", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def relu( x ):\n\treturn np.maximum( 0, x )", "metadata": "root.relu", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def run_wrapper( params ):\n\tglobal run_counter\n\tglobal o_f\n\t\n\trun_counter += 1\n\tprint \"run\", run_counter\n\t\n\ts = time()\n\trmse = run_test( params )\n\t\n\tprint\n\tprint \"RMSE:\", rmse\n\tprint \"elapsed: {}s \\n\".format( int( round( time() - s )))\n\n\twriter.writerow( [ rmse ] + list( params ))\n\to_f.flush()\n\treturn rmse", "metadata": "root.run_wrapper", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def run_test( params ):\n\t\n\tn_hidden_1, alpha_1, rbf_width_1, \\\n\t\tn_hidden_2, alpha_2, rbf_width_2, ridge_alpha = params\n\tn_hidden_1 = int( n_hidden_1 )\n\tn_hidden_2 = int( n_hidden_2 )\n\t\n\tprint \"layer 1\"\n\tprint \"n_hidden:\", n_hidden_1\n\tprint \"alpha:\", alpha_1\n\tprint \"rbf_width:\", rbf_width_1\n\tprint\n\tprint \"layer 2\"\n\tprint \"n_hidden:\", n_hidden_2\n\tprint \"alpha:\", alpha_2\n\tprint \"rbf_width:\", rbf_width_2\n\tprint\n\tprint \"ridge_alpha:\", ridge_alpha\n\t\t\n\trl1 = RandomLayer( n_hidden = n_hidden_1, alpha = alpha_1, \n\t\trbf_width = rbf_width_1, activation_func = relu )\n\t\n\trl2 = RandomLayer( n_hidden = n_hidden_2, alpha = alpha_2, \n\t\trbf_width = rbf_width_2, activation_func = relu )\t\n\t\n\tridge = Ridge( alpha = ridge_alpha )\n\t\n\telmr = pipeline.Pipeline( [( 'rl1', rl1 ), ( 'rl2', rl2 ), ( 'ridge', ridge )] )\t\n\t\n\telmr.fit( x_train, y_train )\n\tp = elmr.predict( x_test )\n\n\trmse = RMSE( y_test, p )\n\treturn rmse", "metadata": "root.run_test", "header": "['module', '___EOS___']", "index": 78 } ]
[ { "span": "import hyperopt", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 }, { "span": "from glob import glob", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 21 } ]
[]
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_", "\"", "tune", " ", "2", " ", "layer", " ", "EL", "M", " ", "+", " ", "linear", " ", "regressor", " ", "on", " ", "top", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hyper", "opt_", "\\u\\u\\uNEWLINE\\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_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glob_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hyper", "opt_", "import_", "hp_", ",_", "fmin", "_", ",_", "tp", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "elm_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random", "\\u", "layer_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sklearn_", "import_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "linear", "\\u", "model_", "import_", "Rid", "ge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "metrics_", "import_", "mean", "\\u", "square", "d\\u", "error_", "as_", "MSE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "preprocessing_", "import_", "Standard", "Scaler", "_", "as_", "Scaler", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "file_", "=_", "'", "data", "/", "train", "\\u", "num", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "output", "\\u", "file_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "output", "\\u", "file_", "=_", "'", "hyper", "opt", "\\u", "log", "\\u", "two", "\\u", "layer", "\\u", "relu", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "pd_", "._", "read", "\\u", "csv_", "(_", "input", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train_", "=_", "data_", "[_", "0_", ":_", "931", "70_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "data_", "[_", "931", "70_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "train_", "=_", "train_", "[_", "[_", "c_", "for_", "c_", "in_", "train_", "._", "columns_", "if_", "c_", "!=_", "'", "cpu", "\\u", "01", "\\u", "bus", "y", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "test_", "=_", "test_", "[_", "[_", "c_", "for_", "c_", "in_", "train_", "._", "columns_", "if_", "c_", "!=_", "'", "cpu", "\\u", "01", "\\u", "bus", "y", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scaler_", "=_", "Scaler", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "train_", "=_", "scaler_", "._", "fit", "\\u", "transform_", "(_", "x", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "test_", "=_", "scaler_", "._", "transform_", "(_", "x", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y", "\\u", "train_", "=_", "train_", "[_", "'", "cpu", "\\u", "01", "\\u", "bus", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "test_", "=_", "test_", "[_", "'", "cpu", "\\u", "01", "\\u", "bus", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "evals_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "space_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "ql", "og", "uniform_", "(_", "'", "n", "\\u", "hidden", "\\u", "1", "'_", ",_", "log_", "(_", "10_", ")_", ",_", "log_", "(_", "1000_", ")_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "uniform_", "(_", "'", "alpha", "\\u", "1", "'_", ",_", "0_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "logu", "nif", "orm_", "(_", "'", "rbf", "\\u", "widt", "h", "\\u", "1", "'_", ",_", "log_", "(_", "1e-5_", ")_", ",_", "log_", "(_", "100_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "ql", "og", "uniform_", "(_", "'", "n", "\\u", "hidden", "\\u", "2", "'_", ",_", "log_", "(_", "10_", ")_", ",_", "log_", "(_", "1000_", ")_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "uniform_", "(_", "'", "alpha", "\\u", "2", "'_", ",_", "0_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "logu", "nif", "orm_", "(_", "'", "rbf", "\\u", "widt", "h", "\\u", "2", "'_", ",_", "log_", "(_", "1e-5_", ")_", ",_", "log_", "(_", "100_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hp_", "._", "logu", "nif", "orm_", "(_", "'", "ridge", "\\u", "alpha", "'_", ",_", "-_", "15_", ",_", "5_", ")_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "headers_", "=_", "[_", "'", "rmse", "'_", ",_", "'", "n", "\\u", "hidden", "\\u", "1", "'_", ",_", "'", "alpha", "\\u", "1", "'_", ",_", "'", "rbf", "\\u", "widt", "h", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "\\u", "hidden", "\\u", "2", "'_", ",_", "'", "alpha", "\\u", "2", "'_", ",_", "'", "rbf", "\\u", "widt", "h", "\\u", "2", "'_", ",_", "'", "ridge", "\\u", "alpha", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "f_", "=_", "open_", "(_", "output", "\\u", "file_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "=_", "csv_", "._", "writer_", "(_", "o", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best_", "=_", "fmin", "_", "(_", "run", "\\u", "wrapper_", ",_", "space_", ",_", "algo_", "=_", "tp", "e_", "._", "suggest", "_", ",_", "max", "\\u", "evals_", "=_", "max", "\\u", "evals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Second", "s", " ", "pass", "ed", ":\"_", ",_", "int_", "(_", "round_", "(_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Bes", "t", " ", "run", ":\"", ",", " ", "optimize", "r", ".", "get", "\\u", "best", "\\u", "run", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "best_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "run", "\\u", "test", "(", " ", "hyper", "opt", ".", "space", "\\u", "eval", "(", " ", "space", ",", " ", "best", " ", "))", "_", "\\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_", "RMS", "E_", "(_", "y_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "math_", "._", "sqrt_", "(_", "MSE", "_", "(_", "y_", ",_", "p_", ")_", ")_", "\\u\\u\\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_", "relu_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "np_", "._", "maximum_", "(_", "0_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run", "\\u", "wrapper_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "run", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "o", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "run", "\"_", ",_", "run", "\\u", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmse", "_", "=_", "run", "\\u", "test_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "RMS", "E", ":\"_", ",_", "rmse", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "ela", "pse", "d", ":", " ", "{}", "s", " ", "\\\\", "n", "\"_", "._", "format_", "(_", "int_", "(_", "round_", "(_", "time_", "(_", ")_", "-_", "s_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "[_", "rmse", "_", "]_", "+_", "list_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "f_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rmse", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "test_", "(_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "n", "\\u", "hidden", "\\u", "1_", ",_", "alpha", "\\u", "1_", ",_", "rbf", "\\u", "widt", "h", "\\u", "1_", ",_", "n", "\\u", "hidden", "\\u", "2_", ",_", "alpha", "\\u", "2_", ",_", "rbf", "\\u", "widt", "h", "\\u", "2_", ",_", "ridge", "\\u", "alpha_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "hidden", "\\u", "1_", "=_", "int_", "(_", "n", "\\u", "hidden", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "hidden", "\\u", "2_", "=_", "int_", "(_", "n", "\\u", "hidden", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "layer", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "n", "\\u", "hidden", ":\"_", ",_", "n", "\\u", "hidden", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "alpha", ":\"_", ",_", "alpha", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "rbf", "\\u", "widt", "h", ":\"_", ",_", "rbf", "\\u", "widt", "h", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "layer", " ", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "n", "\\u", "hidden", ":\"_", ",_", "n", "\\u", "hidden", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "alpha", ":\"_", ",_", "alpha", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "rbf", "\\u", "widt", "h", ":\"_", ",_", "rbf", "\\u", "widt", "h", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "ridge", "\\u", "alpha", ":\"_", ",_", "ridge", "\\u", "alpha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rl", "1_", "=_", "Random", "Layer_", "(_", "n", "\\u", "hidden_", "=_", "n", "\\u", "hidden", "\\u", "1_", ",_", "alpha_", "=_", "alpha", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rbf", "\\u", "width_", "=_", "rbf", "\\u", "widt", "h", "\\u", "1_", ",_", "activation", "\\u", "func_", "=_", "relu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rl", "2_", "=_", "Random", "Layer_", "(_", "n", "\\u", "hidden_", "=_", "n", "\\u", "hidden", "\\u", "2_", ",_", "alpha_", "=_", "alpha", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rbf", "\\u", "width_", "=_", "rbf", "\\u", "widt", "h", "\\u", "2_", ",_", "activation", "\\u", "func_", "=_", "relu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ridge", "_", "=_", "Rid", "ge_", "(_", "alpha_", "=_", "ridge", "\\u", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "elm", "r_", "=_", "pipeline_", "._", "Pipeline_", "(_", "[_", "(_", "'", "rl", "1", "'_", ",_", "rl", "1_", ")_", ",_", "(_", "'", "rl", "2", "'_", ",_", "rl", "2_", ")_", ",_", "(_", "'", "ridge", "'_", ",_", "ridge", "_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "elm", "r_", "._", "fit_", "(_", "x", "\\u", "train_", ",_", "y", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "elm", "r_", "._", "predict_", "(_", "x", "\\u", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rmse", "_", "=_", "RMS", "E_", "(_", "y", "\\u", "test_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rmse", "_", "\\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, 0, 1, 1, 2, 0, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
pycollada/pycollada/collada/camera.py
[ { "content": "####################################################################\n# #\n# THIS FILE IS PART OF THE pycollada LIBRARY SOURCE CODE. #\n# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS #\n# GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE #\n# IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. #\n# #\n# THE pycollada SOURCE CODE IS (C) COPYRIGHT 2011 #\n# by Jeff Terrace and contributors #\n# #\n####################################################################\n\n\"\"\"Contains objects for representing cameras\"\"\"\n\nimport numpy\n\nfrom collada.common import DaeObject, E, tag\nfrom collada.common import DaeIncompleteError, DaeBrokenRefError, \\\n DaeMalformedError\nfrom collada.xmlutil import etree as ElementTree\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Camera(DaeObject):\n \"\"\"Base camera class holding data from <camera> tags.\"\"\"\n", "metadata": "root.Camera", "header": "['module', '___EOS___']", "index": 22 }, { "content": " @staticmethod\n def load(collada, localscope, node):\n tecnode = node.find('%s/%s' % (tag('optics'),tag('technique_common')))\n if tecnode is None or len(tecnode) == 0:\n raise DaeIncompleteError('Missing common technique in camera')\n camnode = tecnode[0]\n if camnode.tag == tag('perspective'):\n return PerspectiveCamera.load(collada, localscope, node)\n elif camnode.tag == tag('orthographic'):\n return OrthographicCamera.load(collada, localscope, node)\n else:\n raise DaeUnsupportedError('Unrecognized camera type: %s' % camnode.tag)", "metadata": "root.Camera.load", "header": "['class', 'Camera', '(', 'DaeObject', ')', ':', '___EOS___']", "index": 25 }, { "content": "class PerspectiveCamera(Camera):\n \"\"\"Perspective camera as defined in COLLADA tag <perspective>.\"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.PerspectiveCamera", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def __init__(self, id, znear, zfar, xfov=None, yfov=None,\n aspect_ratio=None, xmlnode = None):\n \"\"\"Create a new perspective camera.\n\n Note: ``aspect_ratio = tan(0.5*xfov) / tan(0.5*yfov)``\n\n You can specify one of:\n * :attr:`xfov` alone\n * :attr:`yfov` alone\n * :attr:`xfov` and :attr:`yfov`\n * :attr:`xfov` and :attr:`aspect_ratio`\n * :attr:`yfov` and :attr:`aspect_ratio`\n\n Any other combination will raise :class:`collada.common.DaeMalformedError`\n\n :param str id:\n Identifier for the camera\n :param float znear:\n Distance to the near clipping plane\n :param float zfar:\n Distance to the far clipping plane\n :param float xfov:\n Horizontal field of view, in degrees\n :param float yfov:\n Vertical field of view, in degrees\n :param float aspect_ratio:\n Aspect ratio of the field of view\n :param xmlnode:\n If loaded from xml, the xml node\n\n \"\"\"\n\n self.id = id\n \"\"\"Identifier for the camera\"\"\"\n self.xfov = xfov\n \"\"\"Horizontal field of view, in degrees\"\"\"\n self.yfov = yfov\n \"\"\"Vertical field of view, in degrees\"\"\"\n self.aspect_ratio = aspect_ratio\n \"\"\"Aspect ratio of the field of view\"\"\"\n self.znear = znear\n \"\"\"Distance to the near clipping plane\"\"\"\n self.zfar = zfar\n \"\"\"Distance to the far clipping plane\"\"\"\n\n self._checkValidParams()\n\n if xmlnode is not None:\n self.xmlnode = xmlnode\n \"\"\"ElementTree representation of the data.\"\"\"\n else:\n self._recreateXmlNode()", "metadata": "root.PerspectiveCamera.__init__", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 42 }, { "content": " def _recreateXmlNode(self):\n perspective_node = E.perspective()\n if self.xfov is not None:\n perspective_node.append(E.xfov(str(self.xfov)))\n if self.yfov is not None:\n perspective_node.append(E.yfov(str(self.yfov)))\n if self.aspect_ratio is not None:\n perspective_node.append(E.aspect_ratio(str(self.aspect_ratio)))\n perspective_node.append(E.znear(str(self.znear)))\n perspective_node.append(E.zfar(str(self.zfar)))\n self.xmlnode = E.camera(\n E.optics(\n E.technique_common(perspective_node)\n )\n , id=self.id, name=self.id)", "metadata": "root.PerspectiveCamera._recreateXmlNode", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 95 }, { "content": " def _checkValidParams(self):\n if self.xfov is not None and self.yfov is None \\\n and self.aspect_ratio is None:\n pass\n elif self.xfov is None and self.yfov is not None \\\n and self.aspect_ratio is None:\n pass\n elif self.xfov is not None and self.yfov is None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xfov is None and self.yfov is not None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xfov is not None and self.yfov is not None \\\n and self.aspect_ratio is None:\n pass\n else:\n raise DaeMalformedError(\"Received invalid combination of xfov (%s), yfov (%s), and aspect_ratio (%s)\" %\n (str(self.xfov), str(self.yfov), str(self.aspect_ratio)))", "metadata": "root.PerspectiveCamera._checkValidParams", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 111 }, { "content": " def save(self):\n \"\"\"Saves the perspective camera's properties back to xmlnode\"\"\"\n self._checkValidParams()\n self._recreateXmlNode()", "metadata": "root.PerspectiveCamera.save", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 131 }, { "content": " @staticmethod\n def load(collada, localscope, node):\n persnode = node.find( '%s/%s/%s'%(tag('optics'),tag('technique_common'),\n tag('perspective') ))\n\n if persnode is None:\n raise DaeIncompleteError('Missing perspective for camera definition')\n\n xfov = persnode.find( tag('xfov') )\n yfov = persnode.find( tag('yfov') )\n aspect_ratio = persnode.find( tag('aspect_ratio') )\n znearnode = persnode.find( tag('znear') )\n zfarnode = persnode.find( tag('zfar') )\n id = node.get('id', '')\n\n try:\n if xfov is not None:\n xfov = float(xfov.text)\n if yfov is not None:\n yfov = float(yfov.text)\n if aspect_ratio is not None:\n aspect_ratio = float(aspect_ratio.text)\n znear = float(znearnode.text)\n zfar = float(zfarnode.text)\n except (TypeError, ValueError) as ex:\n raise DaeMalformedError('Corrupted float values in camera definition')\n\n #There are some exporters that incorrectly output all three of these.\n # Worse, they actually got the caculation of aspect_ratio wrong!\n # So instead of failing to load, let's just add one more hack because of terrible exporters\n if xfov is not None and yfov is not None and aspect_ratio is not None:\n aspect_ratio = None\n\n return PerspectiveCamera(id, znear, zfar, xfov=xfov, yfov=yfov,\n aspect_ratio=aspect_ratio, xmlnode=node)", "metadata": "root.PerspectiveCamera.load", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 137 }, { "content": " def bind(self, matrix):\n \"\"\"Create a bound camera of itself based on a transform matrix.\n\n :param numpy.array matrix:\n A numpy transformation matrix of size 4x4\n\n :rtype: :class:`collada.camera.BoundPerspectiveCamera`\n\n \"\"\"\n return BoundPerspectiveCamera(self, matrix)", "metadata": "root.PerspectiveCamera.bind", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 173 }, { "content": " def __str__(self): return '<PerspectiveCamera id=%s>' % self.id", "metadata": "root.PerspectiveCamera.__str__", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 184 }, { "content": " def __repr__(self): return str(self)", "metadata": "root.PerspectiveCamera.__repr__", "header": "['class', 'PerspectiveCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 185 }, { "content": "class OrthographicCamera(Camera):\n \"\"\"Orthographic camera as defined in COLLADA tag <orthographic>.\"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.OrthographicCamera", "header": "['module', '___EOS___']", "index": 187 }, { "content": " def __init__(self, id, znear, zfar, xmag=None, ymag=None, aspect_ratio=None, xmlnode = None):\n \"\"\"Create a new orthographic camera.\n\n Note: ``aspect_ratio = xmag / ymag``\n\n You can specify one of:\n * :attr:`xmag` alone\n * :attr:`ymag` alone\n * :attr:`xmag` and :attr:`ymag`\n * :attr:`xmag` and :attr:`aspect_ratio`\n * :attr:`ymag` and :attr:`aspect_ratio`\n\n Any other combination will raise :class:`collada.common.DaeMalformedError`\n\n :param str id:\n Identifier for the camera\n :param float znear:\n Distance to the near clipping plane\n :param float zfar:\n Distance to the far clipping plane\n :param float xmag:\n Horizontal magnification of the view\n :param float ymag:\n Vertical magnification of the view\n :param float aspect_ratio:\n Aspect ratio of the field of view\n :param xmlnode:\n If loaded from xml, the xml node\n\n \"\"\"\n\n self.id = id\n \"\"\"Identifier for the camera\"\"\"\n self.xmag = xmag\n \"\"\"Horizontal magnification of the view\"\"\"\n self.ymag = ymag\n \"\"\"Vertical magnification of the view\"\"\"\n self.aspect_ratio = aspect_ratio\n \"\"\"Aspect ratio of the field of view\"\"\"\n self.znear = znear\n \"\"\"Distance to the near clipping plane\"\"\"\n self.zfar = zfar\n \"\"\"Distance to the far clipping plane\"\"\"\n\n self._checkValidParams()\n\n if xmlnode is not None:\n self.xmlnode = xmlnode\n \"\"\"ElementTree representation of the data.\"\"\"\n else:\n self._recreateXmlNode()", "metadata": "root.OrthographicCamera.__init__", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 190 }, { "content": " def _recreateXmlNode(self):\n orthographic_node = E.orthographic()\n if self.xmag is not None:\n orthographic_node.append(E.xmag(str(self.xmag)))\n if self.ymag is not None:\n orthographic_node.append(E.ymag(str(self.ymag)))\n if self.aspect_ratio is not None:\n orthographic_node.append(E.aspect_ratio(str(self.aspect_ratio)))\n orthographic_node.append(E.znear(str(self.znear)))\n orthographic_node.append(E.zfar(str(self.zfar)))\n self.xmlnode = E.camera(\n E.optics(\n E.technique_common(orthographic_node)\n )\n , id=self.id, name=self.id)", "metadata": "root.OrthographicCamera._recreateXmlNode", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 242 }, { "content": " def _checkValidParams(self):\n if self.xmag is not None and self.ymag is None \\\n and self.aspect_ratio is None:\n pass\n elif self.xmag is None and self.ymag is not None \\\n and self.aspect_ratio is None:\n pass\n elif self.xmag is not None and self.ymag is None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xmag is None and self.ymag is not None \\\n and self.aspect_ratio is not None:\n pass\n elif self.xmag is not None and self.ymag is not None \\\n and self.aspect_ratio is None:\n pass\n else:\n raise DaeMalformedError(\"Received invalid combination of xmag (%s), ymag (%s), and aspect_ratio (%s)\" %\n (str(self.xmag), str(self.ymag), str(self.aspect_ratio)))", "metadata": "root.OrthographicCamera._checkValidParams", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 258 }, { "content": " def save(self):\n \"\"\"Saves the orthographic camera's properties back to xmlnode\"\"\"\n self._checkValidParams()\n self._recreateXmlNode()", "metadata": "root.OrthographicCamera.save", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 278 }, { "content": " @staticmethod\n def load(collada, localscope, node):\n orthonode = node.find('%s/%s/%s' % (\n tag('optics'),\n tag('technique_common'),\n tag('orthographic')))\n\n if orthonode is None: raise DaeIncompleteError('Missing orthographic for camera definition')\n\n xmag = orthonode.find( tag('xmag') )\n ymag = orthonode.find( tag('ymag') )\n aspect_ratio = orthonode.find( tag('aspect_ratio') )\n znearnode = orthonode.find( tag('znear') )\n zfarnode = orthonode.find( tag('zfar') )\n id = node.get('id', '')\n\n try:\n if xmag is not None:\n xmag = float(xmag.text)\n if ymag is not None:\n ymag = float(ymag.text)\n if aspect_ratio is not None:\n aspect_ratio = float(aspect_ratio.text)\n znear = float(znearnode.text)\n zfar = float(zfarnode.text)\n except (TypeError, ValueError) as ex:\n raise DaeMalformedError('Corrupted float values in camera definition')\n\n #There are some exporters that incorrectly output all three of these.\n # Worse, they actually got the caculation of aspect_ratio wrong!\n # So instead of failing to load, let's just add one more hack because of terrible exporters\n if xmag is not None and ymag is not None and aspect_ratio is not None:\n aspect_ratio = None\n\n return OrthographicCamera(id, znear, zfar, xmag=xmag, ymag=ymag,\n aspect_ratio=aspect_ratio, xmlnode=node)", "metadata": "root.OrthographicCamera.load", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 284 }, { "content": " def bind(self, matrix):\n \"\"\"Create a bound camera of itself based on a transform matrix.\n\n :param numpy.array matrix:\n A numpy transformation matrix of size 4x4\n\n :rtype: :class:`collada.camera.BoundOrthographicCamera`\n\n \"\"\"\n return BoundOrthographicCamera(self, matrix)", "metadata": "root.OrthographicCamera.bind", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 321 }, { "content": " def __str__(self):\n return '<OrthographicCamera id=%s>' % self.id", "metadata": "root.OrthographicCamera.__str__", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 332 }, { "content": " def __repr__(self):\n return str(self)", "metadata": "root.OrthographicCamera.__repr__", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 335 }, { "content": "class BoundCamera(object):\n \"\"\"Base class for bound cameras\"\"\"\n pass", "metadata": "root.BoundCamera", "header": "['module', '___EOS___']", "index": 338 }, { "content": "class BoundPerspectiveCamera(BoundCamera):\n \"\"\"Perspective camera bound to a scene with a transform. This gets created when a\n camera is instantiated in a scene. Do not create this manually.\"\"\"\n\n\n", "metadata": "root.BoundPerspectiveCamera", "header": "['module', '___EOS___']", "index": 342 }, { "content": " def __init__(self, cam, matrix):\n self.xfov = cam.xfov\n \"\"\"Horizontal field of view, in degrees\"\"\"\n self.yfov = cam.yfov\n \"\"\"Vertical field of view, in degrees\"\"\"\n self.aspect_ratio = cam.aspect_ratio\n \"\"\"Aspect ratio of the field of view\"\"\"\n self.znear = cam.znear\n \"\"\"Distance to the near clipping plane\"\"\"\n self.zfar = cam.zfar\n \"\"\"Distance to the far clipping plane\"\"\"\n self.matrix = matrix\n \"\"\"The matrix bound to\"\"\"\n self.position = matrix[:3,3]\n \"\"\"The position of the camera\"\"\"\n self.direction = -matrix[:3,2]\n \"\"\"The direction the camera is facing\"\"\"\n self.up = matrix[:3,1]\n \"\"\"The up vector of the camera\"\"\"\n self.original = cam\n \"\"\"Original :class:`collada.camera.PerspectiveCamera` object this is bound to.\"\"\"", "metadata": "root.BoundPerspectiveCamera.__init__", "header": "['class', 'BoundPerspectiveCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 346 }, { "content": " def __str__(self):\n return '<BoundPerspectiveCamera bound to %s>' % self.original.id", "metadata": "root.BoundPerspectiveCamera.__str__", "header": "['class', 'BoundPerspectiveCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 368 }, { "content": " def __repr__(self):\n return str(self)", "metadata": "root.BoundPerspectiveCamera.__repr__", "header": "['class', 'BoundPerspectiveCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 371 }, { "content": "class BoundOrthographicCamera(BoundCamera):\n \"\"\"Orthographic camera bound to a scene with a transform. This gets created when a\n camera is instantiated in a scene. Do not create this manually.\"\"\"\n\n\n", "metadata": "root.BoundOrthographicCamera", "header": "['module', '___EOS___']", "index": 374 }, { "content": " def __init__(self, cam, matrix):\n self.xmag = cam.xmag\n \"\"\"Horizontal magnification of the view\"\"\"\n self.ymag = cam.ymag\n \"\"\"Vertical magnification of the view\"\"\"\n self.aspect_ratio = cam.aspect_ratio\n \"\"\"Aspect ratio of the field of view\"\"\"\n self.znear = cam.znear\n \"\"\"Distance to the near clipping plane\"\"\"\n self.zfar = cam.zfar\n \"\"\"Distance to the far clipping plane\"\"\"\n self.matrix = matrix\n \"\"\"The matrix bound to\"\"\"\n self.position = matrix[:3,3]\n \"\"\"The position of the camera\"\"\"\n self.direction = -matrix[:3,2]\n \"\"\"The direction the camera is facing\"\"\"\n self.up = matrix[:3,1]\n \"\"\"The up vector of the camera\"\"\"\n self.original = cam\n \"\"\"Original :class:`collada.camera.OrthographicCamera` object this is bound to.\"\"\"", "metadata": "root.BoundOrthographicCamera.__init__", "header": "['class', 'BoundOrthographicCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 378 }, { "content": " def __str__(self):\n return '<BoundOrthographicCamera bound to %s>' % self.original.id", "metadata": "root.BoundOrthographicCamera.__str__", "header": "['class', 'BoundOrthographicCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 400 }, { "content": " def __repr__(self):\n return str(self)", "metadata": "root.BoundOrthographicCamera.__repr__", "header": "['class', 'BoundOrthographicCamera', '(', 'BoundCamera', ')', ':', '___EOS___']", "index": 403 } ]
[ { "span": "import numpy", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 12 }, { "span": "from collada.common import DaeIncompleteError, DaeBrokenRefError, \\\n DaeMalformedError", "start_line": 17, "start_column": 0, "end_line": 18, "end_column": 25 }, { "span": "from collada.xmlutil import etree as ElementTree", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "FILE", " ", "IS", " ", "PART", " ", "OF", " ", "THE", " ", "pyco", "lla", "da", " ", "LIBRARY", " ", "SOU", "RC", "E", " ", "CODE", ".", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USE", ",", " ", "DISTRI", "BUT", "ION", " ", "AND", " ", "REP", "RO", "DU", "CTION", " ", "OF", " ", "THIS", " ", "LIBRARY", " ", "SOU", "RC", "E", " ", "IS", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GO", "VER", "NED", " ", "BY", " ", "A", " ", "BS", "D", "-", "STYLE", " ", "SOU", "RC", "E", " ", "LICENSE", " ", "INCLUDE", "D", " ", "WITH", " ", "THIS", " ", "SOU", "RC", "E", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IN", " ", "'", "COPY", "ING", "'.", " ", "PLE", "AS", "E", " ", "READ", " ", "THE", "SE", " ", "TERM", "S", " ", "BEFORE", " ", "DISTRI", "BUT", "ING", ".", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "pyco", "lla", "da", " ", "SOU", "RC", "E", " ", "CODE", " ", "IS", " ", "(", "C", ")", " ", "COPY", "RIG", "HT", " ", "2011", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "Je", "ff", " ", "Terra", "ce", " ", "and", " ", "contributor", "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_", "\"\"\"", "Contain", "s", " ", "object", "s", " ", "for", " ", "represent", "ing", " ", "cameras", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colla", "da_", "._", "common_", "import_", "Da", "e", "Object_", ",_", "E_", ",_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colla", "da_", "._", "common_", "import_", "Da", "e", "Incomp", "lete", "Error_", ",_", "Da", "e", "Bro", "ken", "Ref", "Error_", ",_", "Da", "e", "Mal", "formed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colla", "da_", "._", "xml", "util_", "import_", "etree_", "as_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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_", "Camera_", "(_", "Da", "e", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "came", "ra", " ", "class", " ", "holding", " ", "data", " ", "from", " ", "<", "came", "ra", ">", " ", "tags", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Camera_", "(_", "Da", "e", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tec", "node_", "=_", "node_", "._", "find_", "(_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "tag_", "(_", "'", "optic", "s", "'_", ")_", ",_", "tag_", "(_", "'", "technique", "\\u", "common", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tec", "node_", "is_", "None_", "or_", "len_", "(_", "tec", "node_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Missing", " ", "common", " ", "technique", " ", "in", " ", "came", "ra", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cam", "node_", "=_", "tec", "node_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cam", "node_", "._", "tag_", "==_", "tag_", "(_", "'", "perspective", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Pers", "pect", "ive", "Camera_", "._", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cam", "node_", "._", "tag_", "==_", "tag_", "(_", "'", "ortho", "graphic", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ortho", "graphic", "Camera_", "._", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Unsu", "ppo", "rted", "Error_", "(_", "'", "Unre", "cogni", "zed", " ", "came", "ra", " ", "type", ":", " ", "%", "s", "'_", "%_", "cam", "node_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pers", "pect", "ive", " ", "came", "ra", " ", "as", " ", "defin", "ed", " ", "in", " ", "COLL", "ADA", " ", "tag", " ", "<", "perspective", ">.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", ",_", "zn", "ear_", ",_", "zf", "ar_", ",_", "xf", "ov_", "=_", "None_", ",_", "yf", "ov_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "None_", ",_", "xml", "node_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "perspective", " ", "came", "ra", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "``", "aspect", "\\u", "ratio", " ", "=", " ", "tan", "(", "0.", "5", "*", "xf", "ov", ")", " ", "/", " ", "tan", "(", "0.", "5", "*", "yf", "ov", ")`", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "speci", "fy", " ", "one", " ", "of", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xf", "ov", "`", " ", "alo", "ne", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "yf", "ov", "`", " ", "alo", "ne", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xf", "ov", "`", " ", "and", " ", ":", "attr", ":`", "yf", "ov", "`", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xf", "ov", "`", " ", "and", " ", ":", "attr", ":`", "aspect", "\\u", "ratio", "`", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "yf", "ov", "`", " ", "and", " ", ":", "attr", ":`", "aspect", "\\u", "ratio", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "other", " ", "combinat", "ion", " ", "will", " ", "raise", " ", ":", "class", ":`", "colla", "da", ".", "common", ".", "Da", "e", "Mal", "formed", "Error", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "id", ":", "\\", "10", ";", " ", " ", "Identifie", "r", " ", "for", " ", "the", " ", "came", "ra", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "zn", "ear", ":", "\\", "10", ";", " ", " ", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "zf", "ar", ":", "\\", "10", ";", " ", " ", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "xf", "ov", ":", "\\", "10", ";", " ", " ", "Horiz", "onta", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "yf", "ov", ":", "\\", "10", ";", " ", " ", "Vertica", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "aspect", "\\u", "ratio", ":", "\\", "10", ";", " ", " ", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "xml", "node", ":", "\\", "10", ";", " ", " ", "If", " ", "load", "ed", " ", "from", " ", "xml", ",", " ", "the", " ", "xml", " ", "node", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Identifie", "r", " ", "for", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xf", "ov_", "=_", "xf", "ov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Horiz", "onta", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yf", "ov_", "=_", "yf", "ov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Vertica", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "ratio_", "=_", "aspect", "\\u", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zn", "ear_", "=_", "zn", "ear_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zf", "ar_", "=_", "zf", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "check", "Valid", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xml", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xml", "node_", "=_", "xml", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Element", "Tree", " ", "represent", "ation", " ", "of", " ", "the", " ", "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 ", " _", "self_", "._", "\\u", "recreate", "Xm", "l", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "recreate", "Xm", "l", "Node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perspective", "\\u", "node_", "=_", "E_", "._", "perspective", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perspective", "\\u", "node_", "._", "append_", "(_", "E_", "._", "xf", "ov_", "(_", "str_", "(_", "self_", "._", "xf", "ov_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perspective", "\\u", "node_", "._", "append_", "(_", "E_", "._", "yf", "ov_", "(_", "str_", "(_", "self_", "._", "yf", "ov_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "perspective", "\\u", "node_", "._", "append_", "(_", "E_", "._", "aspect", "\\u", "ratio_", "(_", "str_", "(_", "self_", "._", "aspect", "\\u", "ratio_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "perspective", "\\u", "node_", "._", "append_", "(_", "E_", "._", "zn", "ear_", "(_", "str_", "(_", "self_", "._", "zn", "ear_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perspective", "\\u", "node_", "._", "append_", "(_", "E_", "._", "zf", "ar_", "(_", "str_", "(_", "self_", "._", "zf", "ar_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml", "node_", "=_", "E_", "._", "camera_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "optic", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "technique", "\\u", "common_", "(_", "perspective", "\\u", "node_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "name_", "=_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "Valid", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "yf", "ov_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "\"", "Receive", "d", " ", "invalid", " ", "combinat", "ion", " ", "of", " ", "xf", "ov", " ", "(%", "s", "),", " ", "yf", "ov", " ", "(%", "s", "),", " ", "and", " ", "aspect", "\\u", "ratio", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "str_", "(_", "self_", "._", "xf", "ov_", ")_", ",_", "str_", "(_", "self_", "._", "yf", "ov_", ")_", ",_", "str_", "(_", "self_", "._", "aspect", "\\u", "ratio_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", "s", " ", "the", " ", "perspective", " ", "came", "ra", "'", "s", " ", "proper", "ties", " ", "back", " ", "to", " ", "xml", "node", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "Valid", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recreate", "Xm", "l", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pers", "node_", "=_", "node_", "._", "find_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "tag_", "(_", "'", "optic", "s", "'_", ")_", ",_", "tag_", "(_", "'", "technique", "\\u", "common", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "perspective", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pers", "node_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Missing", " ", "perspective", " ", "for", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xf", "ov_", "=_", "pers", "node_", "._", "find_", "(_", "tag_", "(_", "'", "xf", "ov", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yf", "ov_", "=_", "pers", "node_", "._", "find_", "(_", "tag_", "(_", "'", "yf", "ov", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "pers", "node_", "._", "find_", "(_", "tag_", "(_", "'", "aspect", "\\u", "ratio", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zn", "earn", "ode_", "=_", "pers", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zn", "ear", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "arn", "ode_", "=_", "pers", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zf", "ar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "node_", "._", "get_", "(_", "'", "id", "'_", ",_", "''_", ")_", "\\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 ", " _", "if_", "xf", "ov_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xf", "ov_", "=_", "float_", "(_", "xf", "ov_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "yf", "ov_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yf", "ov_", "=_", "float_", "(_", "yf", "ov_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "float_", "(_", "aspect", "\\u", "ratio_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zn", "ear_", "=_", "float_", "(_", "zn", "earn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "ar_", "=_", "float_", "(_", "zf", "arn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "'", "Corr", "upt", "ed", " ", "float", " ", "values", " ", "in", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "There", " ", "are", " ", "some", " ", "exporter", "s", " ", "tha", "t", " ", "incorrect", "ly", " ", "output", " ", "all", " ", "three", " ", "of", " ", "these", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wor", "se", ",", " ", "the", "y", " ", "actual", "ly", " ", "got", " ", "the", " ", "cac", "ulation", " ", "of", " ", "aspect", "\\u", "ratio", " ", "wrong", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "inst", "ead", " ", "of", " ", "faili", "ng", " ", "to", " ", "load", ",", " ", "let", "'", "s", " ", "just", " ", "add", " ", "one", " ", "more", " ", "hack", " ", "bec", "aus", "e", " ", "of", " ", "terr", "ibl", "e", " ", "exporter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xf", "ov_", "is_", "not_", "None_", "and_", "yf", "ov_", "is_", "not_", "None_", "and_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Pers", "pect", "ive", "Camera_", "(_", "id_", ",_", "zn", "ear_", ",_", "zf", "ar_", ",_", "xf", "ov_", "=_", "xf", "ov_", ",_", "yf", "ov_", "=_", "yf", "ov_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "aspect", "\\u", "ratio_", ",_", "xml", "node_", "=_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bind_", "(_", "self_", ",_", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "bound", " ", "came", "ra", " ", "of", " ", "its", "elf", " ", "based", " ", "on", " ", "a", " ", "transform", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "nump", "y", ".", "array", " ", "matrix", ":", "\\", "10", ";", " ", " ", "A", " ", "nump", "y", " ", "transformation", " ", "matrix", " ", "of", " ", "size", " ", "4", "x4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "colla", "da", ".", "came", "ra", ".", "Bound", "Pers", "pect", "ive", "Came", "ra", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Bound", "Pers", "pect", "ive", "Camera_", "(_", "self_", ",_", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "return_", "'<", "Pers", "pect", "ive", "Came", "ra", " ", "id", "=", "%", "s", ">'_", "%_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pers", "pect", "ive", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "return_", "str_", "(_", "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_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ortho", "graphic", " ", "came", "ra", " ", "as", " ", "defin", "ed", " ", "in", " ", "COLL", "ADA", " ", "tag", " ", "<", "ortho", "graphic", ">.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", ",_", "zn", "ear_", ",_", "zf", "ar_", ",_", "xma", "g_", "=_", "None_", ",_", "yma", "g_", "=_", "None_", ",_", "aspect", "\\u", "ratio_", "=_", "None_", ",_", "xml", "node_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "ortho", "graphic", " ", "came", "ra", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "``", "aspect", "\\u", "ratio", " ", "=", " ", "xma", "g", " ", "/", " ", "yma", "g", "``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "speci", "fy", " ", "one", " ", "of", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xma", "g", "`", " ", "alo", "ne", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "yma", "g", "`", " ", "alo", "ne", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xma", "g", "`", " ", "and", " ", ":", "attr", ":`", "yma", "g", "`", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "xma", "g", "`", " ", "and", " ", ":", "attr", ":`", "aspect", "\\u", "ratio", "`", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", ":", "attr", ":`", "yma", "g", "`", " ", "and", " ", ":", "attr", ":`", "aspect", "\\u", "ratio", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "other", " ", "combinat", "ion", " ", "will", " ", "raise", " ", ":", "class", ":`", "colla", "da", ".", "common", ".", "Da", "e", "Mal", "formed", "Error", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "id", ":", "\\", "10", ";", " ", " ", "Identifie", "r", " ", "for", " ", "the", " ", "came", "ra", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "zn", "ear", ":", "\\", "10", ";", " ", " ", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "zf", "ar", ":", "\\", "10", ";", " ", " ", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "xma", "g", ":", "\\", "10", ";", " ", " ", "Horiz", "onta", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "yma", "g", ":", "\\", "10", ";", " ", " ", "Vertica", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "float", " ", "aspect", "\\u", "ratio", ":", "\\", "10", ";", " ", " ", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "xml", "node", ":", "\\", "10", ";", " ", " ", "If", " ", "load", "ed", " ", "from", " ", "xml", ",", " ", "the", " ", "xml", " ", "node", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Identifie", "r", " ", "for", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xma", "g_", "=_", "xma", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Horiz", "onta", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yma", "g_", "=_", "yma", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Vertica", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "ratio_", "=_", "aspect", "\\u", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zn", "ear_", "=_", "zn", "ear_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zf", "ar_", "=_", "zf", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "check", "Valid", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xml", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xml", "node_", "=_", "xml", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Element", "Tree", " ", "represent", "ation", " ", "of", " ", "the", " ", "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 ", " _", "self_", "._", "\\u", "recreate", "Xm", "l", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\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", "recreate", "Xm", "l", "Node_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "graphic", "\\u", "node_", "=_", "E_", "._", "ortho", "graphic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "xma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "graphic", "\\u", "node_", "._", "append_", "(_", "E_", "._", "xma", "g_", "(_", "str_", "(_", "self_", "._", "xma", "g_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "yma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "graphic", "\\u", "node_", "._", "append_", "(_", "E_", "._", "yma", "g_", "(_", "str_", "(_", "self_", "._", "yma", "g_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "graphic", "\\u", "node_", "._", "append_", "(_", "E_", "._", "aspect", "\\u", "ratio_", "(_", "str_", "(_", "self_", "._", "aspect", "\\u", "ratio_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ortho", "graphic", "\\u", "node_", "._", "append_", "(_", "E_", "._", "zn", "ear_", "(_", "str_", "(_", "self_", "._", "zn", "ear_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ortho", "graphic", "\\u", "node_", "._", "append_", "(_", "E_", "._", "zf", "ar_", "(_", "str_", "(_", "self_", "._", "zf", "ar_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml", "node_", "=_", "E_", "._", "camera_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "optic", "s_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "E_", "._", "technique", "\\u", "common_", "(_", "ortho", "graphic", "\\u", "node_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "name_", "=_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "Valid", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "xma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "yma", "g_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xma", "g_", "is_", "None_", "and_", "self_", "._", "yma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "yma", "g_", "is_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xma", "g_", "is_", "None_", "and_", "self_", "._", "yma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "xma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "yma", "g_", "is_", "not_", "None_", "and_", "self_", "._", "aspect", "\\u", "ratio_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "\"", "Receive", "d", " ", "invalid", " ", "combinat", "ion", " ", "of", " ", "xma", "g", " ", "(%", "s", "),", " ", "yma", "g", " ", "(%", "s", "),", " ", "and", " ", "aspect", "\\u", "ratio", " ", "(%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "str_", "(_", "self_", "._", "xma", "g_", ")_", ",_", "str_", "(_", "self_", "._", "yma", "g_", ")_", ",_", "str_", "(_", "self_", "._", "aspect", "\\u", "ratio_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\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 ", " _", "\"\"\"", "Save", "s", " ", "the", " ", "ortho", "graphic", " ", "came", "ra", "'", "s", " ", "proper", "ties", " ", "back", " ", "to", " ", "xml", "node", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "Valid", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "recreate", "Xm", "l", "Node_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "node_", "=_", "node_", "._", "find_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "optic", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "technique", "\\u", "common", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "ortho", "graphic", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ortho", "node_", "is_", "None_", ":_", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Missing", " ", "ortho", "graphic", " ", "for", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xma", "g_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "xma", "g", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yma", "g_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "yma", "g", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "aspect", "\\u", "ratio", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zn", "earn", "ode_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zn", "ear", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "arn", "ode_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zf", "ar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "node_", "._", "get_", "(_", "'", "id", "'_", ",_", "''_", ")_", "\\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 ", " _", "if_", "xma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xma", "g_", "=_", "float_", "(_", "xma", "g_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "yma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yma", "g_", "=_", "float_", "(_", "yma", "g_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "float_", "(_", "aspect", "\\u", "ratio_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zn", "ear_", "=_", "float_", "(_", "zn", "earn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "ar_", "=_", "float_", "(_", "zf", "arn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "'", "Corr", "upt", "ed", " ", "float", " ", "values", " ", "in", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "There", " ", "are", " ", "some", " ", "exporter", "s", " ", "tha", "t", " ", "incorrect", "ly", " ", "output", " ", "all", " ", "three", " ", "of", " ", "these", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wor", "se", ",", " ", "the", "y", " ", "actual", "ly", " ", "got", " ", "the", " ", "cac", "ulation", " ", "of", " ", "aspect", "\\u", "ratio", " ", "wrong", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "inst", "ead", " ", "of", " ", "faili", "ng", " ", "to", " ", "load", ",", " ", "let", "'", "s", " ", "just", " ", "add", " ", "one", " ", "more", " ", "hack", " ", "bec", "aus", "e", " ", "of", " ", "terr", "ibl", "e", " ", "exporter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xma", "g_", "is_", "not_", "None_", "and_", "yma", "g_", "is_", "not_", "None_", "and_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Ortho", "graphic", "Camera_", "(_", "id_", ",_", "zn", "ear_", ",_", "zf", "ar_", ",_", "xma", "g_", "=_", "xma", "g_", ",_", "yma", "g_", "=_", "yma", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "aspect", "\\u", "ratio_", ",_", "xml", "node_", "=_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bind_", "(_", "self_", ",_", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "bound", " ", "came", "ra", " ", "of", " ", "its", "elf", " ", "based", " ", "on", " ", "a", " ", "transform", " ", "matrix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "nump", "y", ".", "array", " ", "matrix", ":", "\\", "10", ";", " ", " ", "A", " ", "nump", "y", " ", "transformation", " ", "matrix", " ", "of", " ", "size", " ", "4", "x4", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "colla", "da", ".", "came", "ra", ".", "Bound", "Ortho", "graphic", "Came", "ra", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Bound", "Ortho", "graphic", "Camera_", "(_", "self_", ",_", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\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_", "'<", "Ortho", "graphic", "Came", "ra", " ", "id", "=", "%", "s", ">'_", "%_", "self_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\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_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bound", "Camera_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "bound", " ", "cameras", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bound", "Pers", "pect", "ive", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pers", "pect", "ive", " ", "came", "ra", " ", "bound", " ", "to", " ", "a", " ", "scen", "e", " ", "with", " ", "a", " ", "transform", ".", " ", "Thi", "s", " ", "gets", " ", "created", " ", "whe", "n", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "came", "ra", " ", "is", " ", "instantiate", "d", " ", "in", " ", "a", " ", "scen", "e", ".", " ", "Do", " ", "not", " ", "create", " ", "this", " ", "manu", "ally", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Bound", "Pers", "pect", "ive", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cam_", ",_", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xf", "ov_", "=_", "cam_", "._", "xf", "ov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Horiz", "onta", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yf", "ov_", "=_", "cam_", "._", "yf", "ov_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Vertica", "l", " ", "field", " ", "of", " ", "view", ",", " ", "in", " ", "degr", "ees", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "ratio_", "=_", "cam_", "._", "aspect", "\\u", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zn", "ear_", "=_", "cam_", "._", "zn", "ear_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zf", "ar_", "=_", "cam_", "._", "zf", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "matrix_", "=_", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "matrix", " ", "bound", " ", "to", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "matrix_", "[_", ":_", "3_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "position", " ", "of", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "direction_", "=_", "-_", "matrix_", "[_", ":_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "direction", " ", "the", " ", "came", "ra", " ", "is", " ", "facing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up_", "=_", "matrix_", "[_", ":_", "3_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "up", " ", "vector", " ", "of", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "original_", "=_", "cam_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Origina", "l", " ", ":", "class", ":`", "colla", "da", ".", "came", "ra", ".", "Pers", "pect", "ive", "Came", "ra", "`", " ", "object", " ", "this", " ", "is", " ", "bound", " ", "to", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bound", "Pers", "pect", "ive", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\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_", "'<", "Bound", "Pers", "pect", "ive", "Came", "ra", " ", "bound", " ", "to", " ", "%", "s", ">'_", "%_", "self_", "._", "original_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bound", "Pers", "pect", "ive", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\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_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bound", "Ortho", "graphic", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ortho", "graphic", " ", "came", "ra", " ", "bound", " ", "to", " ", "a", " ", "scen", "e", " ", "with", " ", "a", " ", "transform", ".", " ", "Thi", "s", " ", "gets", " ", "created", " ", "whe", "n", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "came", "ra", " ", "is", " ", "instantiate", "d", " ", "in", " ", "a", " ", "scen", "e", ".", " ", "Do", " ", "not", " ", "create", " ", "this", " ", "manu", "ally", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Bound", "Ortho", "graphic", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cam_", ",_", "matrix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xma", "g_", "=_", "cam_", "._", "xma", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Horiz", "onta", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "yma", "g_", "=_", "cam_", "._", "yma", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Vertica", "l", " ", "magni", "fication", " ", "of", " ", "the", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aspect", "\\u", "ratio_", "=_", "cam_", "._", "aspect", "\\u", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Asp", "ect", " ", "ratio", " ", "of", " ", "the", " ", "field", " ", "of", " ", "view", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zn", "ear_", "=_", "cam_", "._", "zn", "ear_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "near", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zf", "ar_", "=_", "cam_", "._", "zf", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Distan", "ce", " ", "to", " ", "the", " ", "far", " ", "clipping", " ", "plane", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "matrix_", "=_", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "matrix", " ", "bound", " ", "to", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "matrix_", "[_", ":_", "3_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "position", " ", "of", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "direction_", "=_", "-_", "matrix_", "[_", ":_", "3_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "direction", " ", "the", " ", "came", "ra", " ", "is", " ", "facing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up_", "=_", "matrix_", "[_", ":_", "3_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "up", " ", "vector", " ", "of", " ", "the", " ", "came", "ra", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "original_", "=_", "cam_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Origina", "l", " ", ":", "class", ":`", "colla", "da", ".", "came", "ra", ".", "Ortho", "graphic", "Came", "ra", "`", " ", "object", " ", "this", " ", "is", " ", "bound", " ", "to", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bound", "Ortho", "graphic", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\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_", "'<", "Bound", "Ortho", "graphic", "Came", "ra", " ", "bound", " ", "to", " ", "%", "s", ">'_", "%_", "self_", "._", "original_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bound", "Ortho", "graphic", "Camera_", "(_", "Bound", "Camera_", ")_", ":_", "\\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_", "str_", "(_", "self_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
spotify/luigi/test/retcodes_test.py
[ { "content": " def test_task_failed(self):\n class FailingTask(luigi.Task):\n def run(self):\n raise ValueError()\n\n self.run_and_expect('FailingTask', 0) # Test default value to be 0\n self.run_and_expect('FailingTask --retcode-task-failed 5', 5)\n self.run_with_config(dict(task_failed='3'), 'FailingTask', 3)", "metadata": "root.RetcodesTest.test_task_failed", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_missing_data(self):\n class MissingDataTask(luigi.ExternalTask):\n def complete(self):\n return False\n\n self.run_and_expect('MissingDataTask', 0) # Test default value to be 0\n self.run_and_expect('MissingDataTask --retcode-missing-data 5', 5)\n self.run_with_config(dict(missing_data='3'), 'MissingDataTask', 3)", "metadata": "root.RetcodesTest.test_missing_data", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_already_running(self):\n class AlreadyRunningTask(luigi.Task):\n def run(self):\n pass\n\n old_func = luigi.scheduler.CentralPlannerScheduler.get_work\n\n def new_func(*args, **kwargs):\n kwargs['current_tasks'] = None\n old_func(*args, **kwargs)\n res = old_func(*args, **kwargs)\n res['running_tasks'][0]['worker'] = \"not me :)\" # Otherwise it will be filtered\n return res\n\n with mock.patch('luigi.scheduler.CentralPlannerScheduler.get_work', new_func):\n self.run_and_expect('AlreadyRunningTask', 0) # Test default value to be 0\n self.run_and_expect('AlreadyRunningTask --retcode-already-running 5', 5)\n self.run_with_config(dict(already_running='3'), 'AlreadyRunningTask', 3)", "metadata": "root.RetcodesTest.test_already_running", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_failure_in_complete(self):\n class FailingComplete(luigi.Task):\n def complete(self):\n raise Exception\n\n class RequiringTask(luigi.Task):\n def requires(self):\n yield FailingComplete()\n\n self.run_and_expect('RequiringTask', 0)", "metadata": "root.RetcodesTest.test_failure_in_complete", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_failure_in_requires(self):\n class FailingRequires(luigi.Task):\n def requires(self):\n raise Exception\n\n self.run_and_expect('FailingRequires', 0)", "metadata": "root.RetcodesTest.test_failure_in_requires", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_validate_dependency_error(self):\n # requires() from RequiringTask expects a Task object\n class DependencyTask(object):\n pass\n\n class RequiringTask(luigi.Task):\n def requires(self):\n yield DependencyTask()\n\n self.run_and_expect('RequiringTask', 4)", "metadata": "root.RetcodesTest.test_validate_dependency_error", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def test_unhandled_exception(self):\n def new_func(*args, **kwargs):\n raise Exception()\n\n with mock.patch('luigi.worker.Worker.add', new_func):\n self.run_and_expect('Task', 4)\n self.run_and_expect('Task --retcode-unhandled-exception 2', 2)\n\n class TaskWithRequiredParam(luigi.Task):\n param = luigi.Parameter()\n\n self.run_and_expect('TaskWithRequiredParam --param hello', 0)\n self.run_and_expect('TaskWithRequiredParam', 4)", "metadata": "root.RetcodesTest.test_unhandled_exception", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def test_when_mixed_errors(self):\n\n class FailingTask(luigi.Task):\n def run(self):\n raise ValueError()\n\n class MissingDataTask(luigi.ExternalTask):\n def complete(self):\n return False\n\n class RequiringTask(luigi.Task):\n def requires(self):\n yield FailingTask()\n yield MissingDataTask()\n\n self.run_and_expect('RequiringTask --retcode-task-failed 4 --retcode-missing-data 5', 5)\n self.run_and_expect('RequiringTask --retcode-task-failed 7 --retcode-missing-data 6', 7)", "metadata": "root.RetcodesTest.test_when_mixed_errors", "header": "['class', 'RetcodesTest', '(', 'LuigiTestCase', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "FailingTask(", "start_line": 34, "start_column": 14, "end_line": 34, "end_column": 25 }, { "span": "MissingDataTask(", "start_line": 43, "start_column": 14, "end_line": 43, "end_column": 29 }, { "span": "AlreadyRunningTask(", "start_line": 52, "start_column": 14, "end_line": 52, "end_column": 32 }, { "span": "RequiringTask(", "start_line": 84, "start_column": 14, "end_line": 84, "end_column": 27 }, { "span": "FailingRequires(", "start_line": 91, "start_column": 14, "end_line": 91, "end_column": 29 }, { "span": "RequiringTask(", "start_line": 102, "start_column": 14, "end_line": 102, "end_column": 27 }, { "span": "TaskWithRequiredParam(", "start_line": 116, "start_column": 14, "end_line": 116, "end_column": 35 }, { "span": "RequiringTask(", "start_line": 132, "start_column": 14, "end_line": 132, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "task", "\\u", "failed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Fail", "ing", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\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 ", " _", "raise_", "Value", "Error_", "(_", ")_", "\\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_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Fail", "ing", "Task", "'_", ",_", "0_", ")_", "#", " ", "Test", " ", "default", " ", "value", " ", "to", " ", "be", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Fail", "ing", "Task", " ", "--", "ret", "code", "-", "task", "-", "fail", "ed", " ", "5", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "with", "\\u", "config_", "(_", "dict_", "(_", "task", "\\u", "failed_", "=_", "'", "3", "'_", ")_", ",_", "'", "Fail", "ing", "Task", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Missing", "Data", "Task_", "(_", "luigi_", "._", "Exter", "nal", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Missing", "Data", "Task", "'_", ",_", "0_", ")_", "#", " ", "Test", " ", "default", " ", "value", " ", "to", " ", "be", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Missing", "Data", "Task", " ", "--", "ret", "code", "-", "missi", "ng", "-", "data", " ", "5", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "with", "\\u", "config_", "(_", "dict_", "(_", "missi", "ng", "\\u", "data_", "=_", "'", "3", "'_", ")_", ",_", "'", "Missing", "Data", "Task", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alr", "ead", "y", "\\u", "running_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Al", "read", "y", "Run", "ning", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\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 ", " _", "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_", "old", "\\u", "func_", "=_", "luigi_", "._", "scheduler_", "._", "Cent", "ral", "Plann", "er", "Scheduler_", "._", "get", "\\u", "work_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "new", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "current", "\\u", "task", "s", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "old", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "'", "runn", "ing", "\\u", "task", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "worker", "'_", "]_", "=_", "\"", "not", " ", "me", " ", ":)", "\"_", "#", " ", "Ot", "her", "wis", "e", " ", "it", " ", "will", " ", "be", " ", "filtered_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "lui", "gi", ".", "schedule", "r", ".", "Cent", "ral", "Plann", "er", "Schedule", "r", ".", "get", "\\u", "work", "'_", ",_", "new", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Al", "read", "y", "Run", "ning", "Task", "'_", ",_", "0_", ")_", "#", " ", "Test", " ", "default", " ", "value", " ", "to", " ", "be", " ", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Al", "read", "y", "Run", "ning", "Task", " ", "--", "ret", "code", "-", "alr", "ead", "y", "-", "runn", "ing", " ", "5", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "with", "\\u", "config_", "(_", "dict_", "(_", "alr", "ead", "y", "\\u", "running_", "=_", "'", "3", "'_", ")_", ",_", "'", "Al", "read", "y", "Run", "ning", "Task", "'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "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", "fail", "ure", "\\u", "in", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Fail", "ing", "Complete_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Requ", "iri", "ng", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "requires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Fail", "ing", "Complete_", "(_", ")_", "\\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_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Requ", "iri", "ng", "Task", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "ure", "\\u", "in", "\\u", "requires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Fail", "ing", "Requ", "ires", "_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "requires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "\\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_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Fail", "ing", "Requ", "ires", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "validat", "e\\u", "dependen", "cy", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "require", "s", "()", " ", "from", " ", "Requ", "iri", "ng", "Task", " ", "expect", "s", " ", "a", " ", "Task", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Dependenc", "y", "Task_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Requ", "iri", "ng", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "requires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Dependenc", "y", "Task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Requ", "iri", "ng", "Task", "'_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "unhandled", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "new", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "lui", "gi", ".", "worker", ".", "Worke", "r", ".", "add", "'_", ",_", "new", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Task", "'_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Task", " ", "--", "ret", "code", "-", "unhandled", "-", "exception", " ", "2", "'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Task", "With", "Requ", "ired", "Param_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param_", "=_", "luigi_", "._", "Parameter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Task", "With", "Requ", "ired", "Param", " ", "--", "param", " ", "hell", "o", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Task", "With", "Requ", "ired", "Param", "'_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ret", "codes", "Test_", "(_", "Lu", "igi", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "whe", "n", "\\u", "mixed", "\\u", "errors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Fail", "ing", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\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 ", " _", "raise_", "Value", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Missing", "Data", "Task_", "(_", "luigi_", "._", "Exter", "nal", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Requ", "iri", "ng", "Task_", "(_", "luigi_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "requires_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "Fail", "ing", "Task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Missing", "Data", "Task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Requ", "iri", "ng", "Task", " ", "--", "ret", "code", "-", "task", "-", "fail", "ed", " ", "4", " ", "--", "ret", "code", "-", "missi", "ng", "-", "data", " ", "5", "'_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "and", "\\u", "expect_", "(_", "'", "Requ", "iri", "ng", "Task", " ", "--", "ret", "code", "-", "task", "-", "fail", "ed", " ", "7", " ", "--", "ret", "code", "-", "missi", "ng", "-", "data", " ", "6", "'_", ",_", "7_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 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, 4, 2, 2, 2, 2, 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,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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 ]
Variable defined multiple times
apache/libcloud/docs/examples/compute/openstack/hpcloud.py
[ { "content": "from libcloud.compute.types import Provider\nfrom libcloud.compute.providers import get_driver\n\nHPCLOUD_AUTH_URL_USWEST = \\\n 'https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens'\nHPCLOUD_AUTH_URL_USEAST = \\\n 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens'\n\nOpenStack = get_driver(Provider.OPENSTACK)\n\n# HP Cloud US West\ndriver = OpenStack('your_auth_username', 'your_auth_password',\n ex_force_auth_version='2.0_password',\n ex_force_auth_url=HPCLOUD_AUTH_URL_USWEST,\n ex_tenant_name='your_tenant_name',\n ex_force_service_region='region-a.geo-1',\n ex_force_service_name='Compute')\n\n# HP Cloud US East\ndriver = OpenStack('your_auth_username', 'your_auth_password',\n ex_force_auth_version='2.0_password',\n ex_force_auth_url=HPCLOUD_AUTH_URL_USEAST,\n ex_tenant_name='your_tenant_name',\n ex_force_service_region='region-b.geo-1',\n ex_force_service_name='Compute')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "driver ", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 6 } ]
[ { "span": "driver ", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "types_", "import_", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "providers_", "import_", "get", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HP", "CLOUD", "\\u", "AUTH", "\\u", "URL", "\\u", "US", "WES", "T_", "=_", "'", "https", "://", "region", "-", "a", ".", "geo", "-1", ".", "identi", "ty", ".", "hp", "clouds", "vc", ".", "com", ":", "353", "5", "7", "/", "v2", ".0", "/", "token", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HP", "CLOUD", "\\u", "AUTH", "\\u", "URL", "\\u", "USE", "AST_", "=_", "'", "https", "://", "region", "-", "b", ".", "geo", "-1", ".", "identi", "ty", ".", "hp", "clouds", "vc", ".", "com", ":", "353", "5", "7", "/", "v2", ".0", "/", "token", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Open", "Stack_", "=_", "get", "\\u", "driver_", "(_", "Provider_", "._", "OPENS", "TACK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HP", " ", "Cloud", " ", "US", " ", "West", "_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "Open", "Stack_", "(_", "'", "your", "\\u", "auth", "\\u", "user", "name", "'_", ",_", "'", "your", "\\u", "auth", "\\u", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "auth", "\\u", "version_", "=_", "'", "2.0", "\\u", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "auth", "\\u", "url_", "=_", "HP", "CLOUD", "\\u", "AUTH", "\\u", "URL", "\\u", "US", "WES", "T_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "tenan", "t", "\\u", "name_", "=_", "'", "your", "\\u", "tenan", "t", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "service", "\\u", "region_", "=_", "'", "region", "-", "a", ".", "geo", "-1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "service", "\\u", "name_", "=_", "'", "Compute", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HP", " ", "Cloud", " ", "US", " ", "Eas", "t_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "Open", "Stack_", "(_", "'", "your", "\\u", "auth", "\\u", "user", "name", "'_", ",_", "'", "your", "\\u", "auth", "\\u", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "auth", "\\u", "version_", "=_", "'", "2.0", "\\u", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "auth", "\\u", "url_", "=_", "HP", "CLOUD", "\\u", "AUTH", "\\u", "URL", "\\u", "USE", "AST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "tenan", "t", "\\u", "name_", "=_", "'", "your", "\\u", "tenan", "t", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "service", "\\u", "region_", "=_", "'", "region", "-", "b", ".", "geo", "-1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "force", "\\u", "service", "\\u", "name_", "=_", "'", "Compute", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ustuehler/git-cvs/tests/test_git.py
[ { "content": "\"\"\"Test the cvsgit.git module\n\nThis test suite requires at least Python 2.5 with 'with_statement'\nfeature enabled or Python 2.6.\n\"\"\"\n\nimport os\nimport shutil\nimport tempfile\nimport unittest\n\nfrom os.path import dirname, join, isdir, isfile, exists\n\nfrom cvsgit.git import Git\nfrom cvsgit.utils import Tempdir\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Test(unittest.TestCase):\n\n\n\n", "metadata": "root.Test", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def test_init_working_directory(self):\n \"\"\"Initialize a Git repository in the working directory.\n \"\"\"\n with Tempdir(cwd=True) as tempdir:\n git = Git()\n self.assertEquals(tempdir, git.git_work_tree)\n self.assertEquals(join(tempdir, '.git'), git.git_dir)\n\n git.init(quiet=True)\n self.assertEquals(tempdir, git.git_work_tree)\n self.assertEquals(join(tempdir, '.git'), git.git_dir)\n self.assertTrue(isdir(join(tempdir, '.git')))\n\n git.destroy()\n self.assertFalse(isdir(tempdir))", "metadata": "root.Test.test_init_working_directory", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_init_bare_working_directory(self):\n \"\"\"Initialize a bare repository in the working directory.\n \"\"\"\n with Tempdir(cwd=True) as tempdir:\n git = Git()\n self.assertEquals(tempdir, git.git_work_tree)\n self.assertEquals(join(tempdir, '.git'), git.git_dir)\n\n git.init(bare=True, quiet=True)\n self.assertEquals(None, git.git_work_tree)\n self.assertEquals(tempdir, git.git_dir)\n self.assertFalse(isdir(join(tempdir, '.git')))\n self.assertTrue(isfile(join(tempdir, 'config')))\n self.assertTrue(isdir(join(tempdir, 'objects')))\n\n git.destroy()\n self.assertFalse(isdir(tempdir))", "metadata": "root.Test.test_init_bare_working_directory", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_init_specified_directory(self):\n \"\"\"Initialize a Git repository in another directory.\n \"\"\"\n with Tempdir(cwd=True) as tempdir:\n directory = join(tempdir, 'repo')\n git = Git(directory)\n git.init(quiet=True)\n self.assertEquals(directory, git.git_work_tree)\n self.assertEquals(join(directory, '.git'), git.git_dir)\n self.assertTrue(isdir(join(directory, '.git')))\n\n git.destroy()\n self.assertFalse(isdir(directory))\n self.assertTrue(isdir(tempdir))", "metadata": "root.Test.test_init_specified_directory", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_config_set_and_get(self):\n \"\"\"Set and get per-repository config values.\n \"\"\"\n with Tempdir(cwd=True) as tempdir:\n git = Git()\n self.assertEquals(None, git.config_get('foo.bar'))\n git.init(quiet=True)\n git.config_set('foo.bar', 'baz')\n self.assertEquals('baz', git.config_get('foo.bar'))", "metadata": "root.Test.test_config_set_and_get", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 67 } ]
[ { "span": "import os", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 }, { "span": "import shutil", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 13 }, { "span": "import tempfile", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "from os.path import dirname, join, isdir, isfile, exists", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 56 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", " ", "the", " ", "cvs", "git", ".", "git", " ", "module", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "test", " ", "suit", "e", " ", "require", "s", " ", "at", " ", "leas", "t", " ", "Pyth", "on", " ", "2.5", " ", "with", " ", "'", "with", "\\u", "statem", "ent", "'", "\\", "10", ";", "feature", " ", "enable", "d", " ", "or", " ", "Pyth", "on", " ", "2.6", ".", "\\", "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_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "dirname_", ",_", "join_", ",_", "isdir_", ",_", "isfile_", ",_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cvs", "git_", "._", "git_", "import_", "Git", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cvs", "git_", "._", "utils_", "import_", "Temp", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "init", "\\u", "working", "\\u", "directory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "Git", " ", "repos", "itor", "y", " ", "in", " ", "the", " ", "working", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Temp", "dir_", "(_", "cwd_", "=_", "True_", ")_", "as_", "tempdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "Git", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "tempdir_", ",_", "git_", "._", "git", "\\u", "work", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "join_", "(_", "tempdir_", ",_", "'.", "git", "'_", ")_", ",_", "git_", "._", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "._", "init_", "(_", "quiet_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "tempdir_", ",_", "git_", "._", "git", "\\u", "work", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "join_", "(_", "tempdir_", ",_", "'.", "git", "'_", ")_", ",_", "git_", "._", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isdir_", "(_", "join_", "(_", "tempdir_", ",_", "'.", "git", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "isdir_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init", "\\u", "bare", "\\u", "working", "\\u", "directory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "bare", " ", "repos", "itor", "y", " ", "in", " ", "the", " ", "working", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Temp", "dir_", "(_", "cwd_", "=_", "True_", ")_", "as_", "tempdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "Git", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "tempdir_", ",_", "git_", "._", "git", "\\u", "work", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "join_", "(_", "tempdir_", ",_", "'.", "git", "'_", ")_", ",_", "git_", "._", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "._", "init_", "(_", "bare", "_", "=_", "True_", ",_", "quiet_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "None_", ",_", "git_", "._", "git", "\\u", "work", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "tempdir_", ",_", "git_", "._", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "isdir_", "(_", "join_", "(_", "tempdir_", ",_", "'.", "git", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isfile_", "(_", "join_", "(_", "tempdir_", ",_", "'", "config", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isdir_", "(_", "join_", "(_", "tempdir_", ",_", "'", "object", "s", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "isdir_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init", "\\u", "specified", "\\u", "directory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "a", " ", "Git", " ", "repos", "itor", "y", " ", "in", " ", "anot", "her", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Temp", "dir_", "(_", "cwd_", "=_", "True_", ")_", "as_", "tempdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "directory_", "=_", "join_", "(_", "tempdir_", ",_", "'", "repo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "=_", "Git", "_", "(_", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "._", "init_", "(_", "quiet_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "directory_", ",_", "git_", "._", "git", "\\u", "work", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "join_", "(_", "directory_", ",_", "'.", "git", "'_", ")_", ",_", "git_", "._", "git", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isdir_", "(_", "join_", "(_", "directory_", ",_", "'.", "git", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "git_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "isdir_", "(_", "directory_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isdir_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "config", "\\u", "set\\u", "and", "\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "and", " ", "get", " ", "per", "-", "repos", "itor", "y", " ", "config", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Temp", "dir_", "(_", "cwd_", "=_", "True_", ")_", "as_", "tempdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "Git", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "None_", ",_", "git_", "._", "config", "\\u", "get_", "(_", "'", "foo", ".", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "._", "init_", "(_", "quiet_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "._", "config", "\\u", "set_", "(_", "'", "foo", ".", "bar", "'_", ",_", "'", "ba", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "'", "ba", "z", "'_", ",_", "git_", "._", "config", "\\u", "get_", "(_", "'", "foo", ".", "bar", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 0, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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/many_to_one_regress/tests.py
[ { "content": " def test_fk_assignment_and_related_object_cache(self):\n # Tests of ForeignKey assignment and the related-object cache (see #6886).\n\n p = Parent.objects.create(name=\"Parent\")\n c = Child.objects.create(name=\"Child\", parent=p)\n\n # Look up the object again so that we get a \"fresh\" object.\n c = Child.objects.get(name=\"Child\")\n p = c.parent\n\n # Accessing the related object again returns the exactly same object.\n self.assertTrue(c.parent is p)\n\n # But if we kill the cache, we get a new object.\n del c._parent_cache\n self.assertFalse(c.parent is p)\n\n # Assigning a new object results in that object getting cached immediately.\n p2 = Parent.objects.create(name=\"Parent 2\")\n c.parent = p2\n self.assertTrue(c.parent is p2)\n\n # Assigning None succeeds if field is null=True.\n p.bestchild = None\n self.assertTrue(p.bestchild is None)\n\n # bestchild should still be None after saving.\n p.save()\n self.assertTrue(p.bestchild is None)\n\n # bestchild should still be None after fetching the object again.\n p = Parent.objects.get(name=\"Parent\")\n self.assertTrue(p.bestchild is None)\n\n # Assigning None fails: Child.parent is null=False.\n self.assertRaises(ValueError, setattr, c, \"parent\", None)\n\n # You also can't assign an object of the wrong type here\n self.assertRaises(ValueError, setattr, c, \"parent\", First(id=1, second=1))\n\n # Nor can you explicitly assign None to Child.parent during object\n # creation (regression for #9649).\n self.assertRaises(ValueError, Child, name='xyzzy', parent=None)\n self.assertRaises(ValueError, Child.objects.create, name='xyzzy', parent=None)\n\n # Creation using keyword argument should cache the related object.\n p = Parent.objects.get(name=\"Parent\")\n c = Child(parent=p)\n self.assertTrue(c.parent is p)\n\n # Creation using keyword argument and unsaved related instance (#8070).\n p = Parent()\n c = Child(parent=p)\n self.assertTrue(c.parent is p)\n\n # Creation using attname keyword argument and an id will cause the\n # related object to be fetched.\n p = Parent.objects.get(name=\"Parent\")\n c = Child(parent_id=p.id)\n self.assertFalse(c.parent is p)\n self.assertEqual(c.parent, p)", "metadata": "root.ManyToOneRegressionTests.test_fk_assignment_and_related_object_cache", "header": "['class', 'ManyToOneRegressionTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "self.assertTrue(c.parent is p)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 38 }, { "span": "self.assertFalse(c.parent is p)", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 39 }, { "span": "self.assertTrue(c.parent is p2)", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 39 }, { "span": "self.assertTrue(p.bestchild is None)", "start_line": 39, "start_column": 8, "end_line": 39, "end_column": 44 }, { "span": "self.assertTrue(p.bestchild is None)", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 44 }, { "span": "self.assertTrue(p.bestchild is None)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 44 }, { "span": "self.assertTrue(c.parent is p)", "start_line": 63, "start_column": 8, "end_line": 63, "end_column": 38 }, { "span": "self.assertTrue(c.parent is p)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 38 }, { "span": "self.assertFalse(c.parent is p)", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Many", "To", "One", "Regr", "ession", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fk", "\\u", "assign", "ment", "\\u", "and", "\\u", "relate", "d\\u", "object\\u", "cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", "s", " ", "of", " ", "Fore", "ign", "Key", " ", "assign", "ment", " ", "and", " ", "the", " ", "relate", "d", "-", "object", " ", "cache", " ", "(", "see", " ", "#", "688", "6", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "Parent_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Child_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Chil", "d", "\"_", ",_", "parent_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "up", " ", "the", " ", "object", " ", "again", " ", "so", " ", "tha", "t", " ", "we", " ", "get", " ", "a", " ", "\"", "fresh", "\"", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Child_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "\"", "Chil", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "c_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Access", "ing", " ", "the", " ", "relate", "d", " ", "object", " ", "again", " ", "return", "s", " ", "the", " ", "exact", "ly", " ", "same", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "c_", "._", "parent_", "is_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "t", " ", "if", " ", "we", " ", "kill", " ", "the", " ", "cache", ",", " ", "we", " ", "get", " ", "a", " ", "new", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "del_", "c_", "._", "\\u", "parent", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "c_", "._", "parent_", "is_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", "ing", " ", "a", " ", "new", " ", "object", " ", "results", " ", "in", " ", "tha", "t", " ", "object", " ", "getti", "ng", " ", "cache", "d", " ", "immediate", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "p2_", "=_", "Parent_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Parent", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "parent_", "=_", "p2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "c_", "._", "parent_", "is_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", "ing", " ", "Non", "e", " ", "succeeds", " ", "if", " ", "field", " ", "is", " ", "null", "=", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "best", "child_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p_", "._", "best", "child_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "best", "child", " ", "shou", "ld", " ", "still", " ", "be", " ", "Non", "e", " ", "after", " ", "saving", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p_", "._", "best", "child_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "best", "child", " ", "shou", "ld", " ", "still", " ", "be", " ", "Non", "e", " ", "after", " ", "fetch", "ing", " ", "the", " ", "object", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Parent_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "\"", "Parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "p_", "._", "best", "child_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", "ing", " ", "Non", "e", " ", "fail", "s", ":", " ", "Chil", "d", ".", "parent", " ", "is", " ", "null", "=", "Fal", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "c_", ",_", "\"", "parent", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "als", "o", " ", "can", "'", "t", " ", "assign", " ", "an", " ", "object", " ", "of", " ", "the", " ", "wrong", " ", "type", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "setattr_", ",_", "c_", ",_", "\"", "parent", "\"_", ",_", "First_", "(_", "id_", "=_", "1_", ",_", "second_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nor", " ", "can", " ", "you", " ", "explicit", "ly", " ", "assign", " ", "Non", "e", " ", "to", " ", "Chil", "d", ".", "parent", " ", "dur", "ing", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "creati", "on", " ", "(", "regress", "ion", " ", "for", " ", "#", "964", "9", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Child_", ",_", "name_", "=_", "'", "xyz", "zy", "'_", ",_", "parent_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Child_", "._", "objects_", "._", "create_", ",_", "name_", "=_", "'", "xyz", "zy", "'_", ",_", "parent_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "ion", " ", "usi", "ng", " ", "keyw", "ord", " ", "argu", "ment", " ", "shou", "ld", " ", "cache", " ", "the", " ", "relate", "d", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Parent_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "\"", "Parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Child_", "(_", "parent_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "c_", "._", "parent_", "is_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "ion", " ", "usi", "ng", " ", "keyw", "ord", " ", "argu", "ment", " ", "and", " ", "unsa", "ved", " ", "relate", "d", " ", "instance", " ", "(", "#", "807", "0", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Parent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Child_", "(_", "parent_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "c_", "._", "parent_", "is_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "ion", " ", "usi", "ng", " ", "attn", "ame", " ", "keyw", "ord", " ", "argu", "ment", " ", "and", " ", "an", " ", "id", " ", "will", " ", "caus", "e", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relate", "d", " ", "object", " ", "to", " ", "be", " ", "fetched", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Parent_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "\"", "Parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Child_", "(_", "parent", "\\u", "id_", "=_", "p_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "c_", "._", "parent_", "is_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._",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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, 0, 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, 0, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
SublimeHaskell/SublimeHaskell/hsdev.py
[ { "content": "def parse_module_declaration(d, parse_module_info = True):\n try:\n m = None\n if 'module-id' in d and parse_module_info:\n m = parse_module_id(d['module-id'])\n\n loc = parse_location(d['module-id'].get('location'))\n decl = parse_declaration(d['declaration'])\n\n if not decl:\n return None\n\n decl.module = m\n\n return decl\n except:\n return None", "metadata": "root.parse_module_declaration", "header": "['module', '___EOS___']", "index": 240 }, { "content": " @staticmethod\n def start_server(port = 4567, cache = None, log_file = None, log_config = None):\n cmd = concat_args([\n (True, [\"hsdev\", \"start\"]),\n (port, [\"--port\", str(port)]),\n (cache, [\"--cache\", cache]),\n (log_file, [\"--log\", log_file]),\n (log_config, [\"--log-config\", log_config])])\n\n def parse_response(s):\n try:\n return {} if s.isspace() else json.loads(s)\n except Exception as e:\n return {'error': 'Invalid response', 'details': s}\n\n log('Starting hsdev server', log_info)\n\n ret = call_and_wait_tool(cmd, 'hsdev', '', None, None, None, check_enabled = False)\n if ret is not None:\n return ret\n return None", "metadata": "root.HsDev.start_server", "header": "['class', 'HsDev', '(', 'object', ')', ':', '___EOS___']", "index": 551 } ]
[ { "span": "loc ", "start_line": 246, "start_column": 8, "end_line": 246, "end_column": 11 }, { "span": "parse_response(", "start_line": 560, "start_column": 12, "end_line": 560, "end_column": 26 } ]
[]
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_", "def_", "parse", "\\u", "module", "\\u", "declaration_", "(_", "d_", ",_", "parse", "\\u", "module", "\\u", "info_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "module", "-", "id", "'_", "in_", "d_", "and_", "parse", "\\u", "module", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "parse", "\\u", "module", "\\u", "id_", "(_", "d_", "[_", "'", "module", "-", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loc_", "=_", "parse", "\\u", "location_", "(_", "d_", "[_", "'", "module", "-", "id", "'_", "]_", "._", "get_", "(_", "'", "location", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decl_", "=_", "parse", "\\u", "declaration_", "(_", "d_", "[_", "'", "declaration", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "decl_", ":_", "\\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_", "decl_", "._", "module_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "decl_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hs", "Dev_", "(_", "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_", "start", "\\u", "server_", "(_", "port_", "=_", "4567", "_", ",_", "cache_", "=_", "None_", ",_", "log", "\\u", "file_", "=_", "None_", ",_", "log", "\\u", "config_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "conc", "at", "\\u", "args_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "True_", ",_", "[_", "\"", "hs", "dev", "\"_", ",_", "\"", "start", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "port_", ",_", "[_", "\"--", "port", "\"_", ",_", "str_", "(_", "port_", ")_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cache_", ",_", "[_", "\"--", "cache", "\"_", ",_", "cache_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "log", "\\u", "file_", ",_", "[_", "\"--", "log", "\"_", ",_", "log", "\\u", "file_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "log", "\\u", "config_", ",_", "[_", "\"--", "log", "-", "config", "\"_", ",_", "log", "\\u", "config_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "response_", "(_", "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 ", " _", "return_", "{_", "}_", "if_", "s_", "._", "isspace", "_", "(_", ")_", "else_", "json_", "._", "loads_", "(_", "s_", ")_", "\\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 ", " _", "return_", "{_", "'", "error", "'_", ":_", "'", "Inva", "lid", " ", "response", "'_", ",_", "'", "deta", "il", "s", "'_", ":_", "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_", "log_", "(_", "'", "Start", "ing", " ", "hs", "dev", " ", "server", "'_", ",_", "log", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "call", "\\u", "and", "\\u", "wait", "\\u", "tool_", "(_", "cmd_", ",_", "'", "hs", "dev", "'_", ",_", "''_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "check", "\\u", "enabled_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ret_", "\\u\\u\\uNEWLINE\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
cornell-brg/pymtl/pclib/cl/OutValRdyInelasticPipeAdapter.py
[ { "content": " def __init__( s, out, nstages=1 ):\n\n s.nstages = nstages\n\n # instantiate a single-entry bypass queue adapter\n s.out_q = OutValRdyQueueAdapter( out )\n\n # instantiate a cycle-level pipeline\n if s.nstages > 0:\n s.pipe = Pipeline( s.nstages )", "metadata": "root.OutValRdyInelasticPipeAdapter.__init__", "header": "['class', 'OutValRdyInelasticPipeAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def full( s ):\n if s.nstages == 0:\n return s.out_q.full()\n else:\n return not s.pipe.data[0] == None", "metadata": "root.OutValRdyInelasticPipeAdapter.full", "header": "['class', 'OutValRdyInelasticPipeAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 30 }, { "content": " def enq( s, item ):\n assert not s.full()\n if s.nstages == 0:\n s.out_q.enq( item )\n else:\n s.pipe.insert( item )", "metadata": "root.OutValRdyInelasticPipeAdapter.enq", "header": "['class', 'OutValRdyInelasticPipeAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def xtick( s ):\n\n # Call the xtick of output bypass queue adapter\n s.out_q.xtick()\n\n # Model the pipeline behavior\n if s.nstages != 0:\n\n # If the output bypass queue adapter is not full\n if not s.out_q.full():\n\n # Items graduating from pipeline, add to output queue\n if s.pipe.ready():\n s.out_q.enq( s.pipe.remove() )\n\n # Advance the pipeline\n s.pipe.advance()", "metadata": "root.OutValRdyInelasticPipeAdapter.xtick", "header": "['class', 'OutValRdyInelasticPipeAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " def __str__( s ):\n if s.nstages > 0:\n return ''.join([ (\"*\" if x != None else ' ') for x in s.pipe.data ])\n else:\n return \"\"", "metadata": "root.OutValRdyInelasticPipeAdapter.__str__", "header": "['class', 'OutValRdyInelasticPipeAdapter', '(', 'object', ')', ':', '___EOS___']", "index": 61 } ]
[ { "span": "def __init__( s, out, nstages=1 ):", "start_line": 19, "start_column": 2, "end_line": 19, "end_column": 36 }, { "span": "def full( s ):", "start_line": 30, "start_column": 2, "end_line": 30, "end_column": 16 }, { "span": "def enq( s, item ):", "start_line": 36, "start_column": 2, "end_line": 36, "end_column": 21 }, { "span": "def xtick( s ):", "start_line": 43, "start_column": 2, "end_line": 43, "end_column": 17 }, { "span": "def __str__( s ):", "start_line": 61, "start_column": 2, "end_line": 61, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Out", "Val", "Rd", "y", "Ine", "lasti", "c", "Pipe", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "s_", ",_", "out_", ",_", "nsta", "ges_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "nsta", "ges_", "=_", "nsta", "ges_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instantiate", " ", "a", " ", "single", "-", "entry", " ", "bypass", " ", "queue", " ", "adapter_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "out", "\\u", "q_", "=_", "Out", "Val", "Rd", "y", "Queue", "Adapter_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instantiate", " ", "a", " ", "cycle", "-", "level", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "._", "nsta", "ges_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "pipe_", "=_", "Pipeline_", "(_", "s_", "._", "nsta", "ges_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Out", "Val", "Rd", "y", "Ine", "lasti", "c", "Pipe", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "full_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "nsta", "ges_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "out", "\\u", "q_", "._", "full_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "s_", "._", "pipe_", "._", "data_", "[_", "0_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Out", "Val", "Rd", "y", "Ine", "lasti", "c", "Pipe", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "en", "q_", "(_", "s_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "s_", "._", "full_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "nsta", "ges_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "out", "\\u", "q_", "._", "en", "q_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "pipe_", "._", "insert_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Out", "Val", "Rd", "y", "Ine", "lasti", "c", "Pipe", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "xtick", "_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "the", " ", "xtick", " ", "of", " ", "output", " ", "bypass", " ", "queue", " ", "adapter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "out", "\\u", "q_", "._", "xtick", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", " ", "the", " ", "pipeline", " ", "behavior_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "s_", "._", "nsta", "ges_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "output", " ", "bypass", " ", "queue", " ", "adapter", " ", "is", " ", "not", " ", "full_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "s_", "._", "out", "\\u", "q_", "._", "full_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Item", "s", " ", "gradu", "ati", "ng", " ", "from", " ", "pipeline", ",", " ", "add", " ", "to", " ", "output", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "pipe_", "._", "ready_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "out", "\\u", "q_", "._", "en", "q_", "(_", "s_", "._", "pipe_", "._", "remove_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Advance", " ", "the", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "._", "pipe_", "._", "advance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Out", "Val", "Rd", "y", "Ine", "lasti", "c", "Pipe", "Adapter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "._", "nsta", "ges_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "._", "join_", "(_", "[_", "(_", "\"*\"_", "if_", "x_", "!=_", "None_", "else_", "'", " ", "'_", ")_", "for_", "x_", "in_", "s_", "._", "pipe_", "._", "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_", "\"\"_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 4, 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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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 ]
Imprecise assert
GoogleCloudPlatform/gcloud-python/gcloud/datastore/test_client.py
[ { "content": " def test_ctor_w_implicit_inputs(self):\n from gcloud._testing import _Monkey\n from gcloud.datastore import client as _MUT\n from gcloud import client as _base_client\n\n OTHER = 'other'\n creds = object()\n default_called = []\n\n def fallback_mock(project):\n default_called.append(project)\n return project or OTHER\n\n klass = self._getTargetClass()\n with _Monkey(_MUT,\n _determine_default_project=fallback_mock):\n with _Monkey(_base_client,\n get_credentials=lambda: creds):\n client = klass()\n self.assertEqual(client.project, OTHER)\n self.assertEqual(client.namespace, None)\n self.assertTrue(isinstance(client.connection, _MockConnection))\n self.assertTrue(client.connection.credentials is creds)\n self.assertTrue(client.connection.http is None)\n self.assertTrue(client.current_batch is None)\n self.assertTrue(client.current_transaction is None)\n self.assertEqual(default_called, [None])", "metadata": "root.TestClient.test_ctor_w_implicit_inputs", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_ctor_w_explicit_inputs(self):\n OTHER = 'other'\n NAMESPACE = 'namespace'\n creds = object()\n http = object()\n client = self._makeOne(project=OTHER,\n namespace=NAMESPACE,\n credentials=creds,\n http=http)\n self.assertEqual(client.project, OTHER)\n self.assertEqual(client.namespace, NAMESPACE)\n self.assertTrue(isinstance(client.connection, _MockConnection))\n self.assertTrue(client.connection.credentials is creds)\n self.assertTrue(client.connection.http is http)\n self.assertTrue(client.current_batch is None)\n self.assertEqual(list(client._batch_stack), [])", "metadata": "root.TestClient.test_ctor_w_explicit_inputs", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def test__push_batch_and__pop_batch(self):\n creds = object()\n client = self._makeOne(credentials=creds)\n batch = client.batch()\n xact = client.transaction()\n client._push_batch(batch)\n self.assertEqual(list(client._batch_stack), [batch])\n self.assertTrue(client.current_batch is batch)\n self.assertTrue(client.current_transaction is None)\n client._push_batch(xact)\n self.assertTrue(client.current_batch is xact)\n self.assertTrue(client.current_transaction is xact)\n # list(_LocalStack) returns in reverse order.\n self.assertEqual(list(client._batch_stack), [xact, batch])\n self.assertTrue(client._pop_batch() is xact)\n self.assertEqual(list(client._batch_stack), [batch])\n self.assertTrue(client._pop_batch() is batch)\n self.assertEqual(list(client._batch_stack), [])", "metadata": "root.TestClient.test__push_batch_and__pop_batch", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 195 }, { "content": " def test_get_miss(self):\n _called_with = []\n\n def _get_multi(*args, **kw):\n _called_with.append((args, kw))\n return []\n\n creds = object()\n client = self._makeOne(credentials=creds)\n client.get_multi = _get_multi\n\n key = object()\n\n self.assertTrue(client.get(key) is None)\n\n self.assertEqual(_called_with[0][0], ())\n self.assertEqual(_called_with[0][1]['keys'], [key])\n self.assertTrue(_called_with[0][1]['missing'] is None)\n self.assertTrue(_called_with[0][1]['deferred'] is None)", "metadata": "root.TestClient.test_get_miss", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def test_get_hit(self):\n _called_with = []\n _entity = object()\n\n def _get_multi(*args, **kw):\n _called_with.append((args, kw))\n return [_entity]\n\n creds = object()\n client = self._makeOne(credentials=creds)\n client.get_multi = _get_multi\n\n key, missing, deferred = object(), [], []\n\n self.assertTrue(client.get(key, missing, deferred) is _entity)\n\n self.assertEqual(_called_with[0][0], ())\n self.assertEqual(_called_with[0][1]['keys'], [key])\n self.assertTrue(_called_with[0][1]['missing'] is missing)\n self.assertTrue(_called_with[0][1]['deferred'] is deferred)", "metadata": "root.TestClient.test_get_hit", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 234 }, { "content": " def test_get_multi_w_deferred_from_backend_but_not_passed(self):\n from gcloud.datastore._generated import entity_pb2\n from gcloud.datastore.entity import Entity\n from gcloud.datastore.key import Key\n\n key1 = Key('Kind', project=self.PROJECT)\n key1_pb = key1.to_protobuf()\n key2 = Key('Kind', 2345, project=self.PROJECT)\n key2_pb = key2.to_protobuf()\n\n entity1_pb = entity_pb2.Entity()\n entity1_pb.key.CopyFrom(key1_pb)\n entity2_pb = entity_pb2.Entity()\n entity2_pb.key.CopyFrom(key2_pb)\n\n creds = object()\n client = self._makeOne(credentials=creds)\n # mock up two separate requests\n client.connection._add_lookup_result([entity1_pb], deferred=[key2_pb])\n client.connection._add_lookup_result([entity2_pb])\n\n missing = []\n found = client.get_multi([key1, key2], missing=missing)\n self.assertEqual(len(found), 2)\n self.assertEqual(len(missing), 0)\n\n # Check the actual contents on the response.\n self.assertTrue(isinstance(found[0], Entity))\n self.assertEqual(found[0].key.path, key1.path)\n self.assertEqual(found[0].key.project, key1.project)\n\n self.assertTrue(isinstance(found[1], Entity))\n self.assertEqual(found[1].key.path, key2.path)\n self.assertEqual(found[1].key.project, key2.project)\n\n cw = client.connection._lookup_cw\n self.assertEqual(len(cw), 2)\n\n ds_id, k_pbs, eventual, tid = cw[0]\n self.assertEqual(ds_id, self.PROJECT)\n self.assertEqual(len(k_pbs), 2)\n self.assertEqual(key1_pb, k_pbs[0])\n self.assertEqual(key2_pb, k_pbs[1])\n self.assertFalse(eventual)\n self.assertTrue(tid is None)\n\n ds_id, k_pbs, eventual, tid = cw[1]\n self.assertEqual(ds_id, self.PROJECT)\n self.assertEqual(len(k_pbs), 1)\n self.assertEqual(key2_pb, k_pbs[0])\n self.assertFalse(eventual)\n self.assertTrue(tid is None)", "metadata": "root.TestClient.test_get_multi_w_deferred_from_backend_but_not_passed", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 335 }, { "content": " def test_get_multi_hit(self):\n from gcloud.datastore.key import Key\n\n KIND = 'Kind'\n ID = 1234\n PATH = [{'kind': KIND, 'id': ID}]\n\n # Make a found entity pb to be returned from mock backend.\n entity_pb = _make_entity_pb(self.PROJECT, KIND, ID, 'foo', 'Foo')\n\n # Make a connection to return the entity pb.\n creds = object()\n client = self._makeOne(credentials=creds)\n client.connection._add_lookup_result([entity_pb])\n\n key = Key(KIND, ID, project=self.PROJECT)\n result, = client.get_multi([key])\n new_key = result.key\n\n # Check the returned value is as expected.\n self.assertFalse(new_key is key)\n self.assertEqual(new_key.project, self.PROJECT)\n self.assertEqual(new_key.path, PATH)\n self.assertEqual(list(result), ['foo'])\n self.assertEqual(result['foo'], 'Foo')", "metadata": "root.TestClient.test_get_multi_hit", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 388 }, { "content": " def test_put_multi_no_batch_w_partial_key(self):\n from gcloud.datastore.helpers import _property_tuples\n from gcloud.datastore.test_batch import _Entity\n from gcloud.datastore.test_batch import _Key\n from gcloud.datastore.test_batch import _KeyPB\n from gcloud.datastore.test_batch import _mutated_pb\n\n entity = _Entity(foo=u'bar')\n key = entity.key = _Key(self.PROJECT)\n key._id = None\n\n creds = object()\n client = self._makeOne(credentials=creds)\n client.connection._commit.append([_KeyPB(key)])\n\n result = client.put_multi([entity])\n self.assertTrue(result is None)\n\n self.assertEqual(len(client.connection._commit_cw), 1)\n (project,\n commit_req, transaction_id) = client.connection._commit_cw[0]\n self.assertEqual(project, self.PROJECT)\n\n mutated_entity = _mutated_pb(self, commit_req.mutations, 'insert')\n self.assertEqual(mutated_entity.key, key.to_protobuf())\n\n prop_list = list(_property_tuples(mutated_entity))\n self.assertTrue(len(prop_list), 1)\n name, value_pb = prop_list[0]\n self.assertEqual(name, 'foo')\n self.assertEqual(value_pb.string_value, u'bar')\n\n self.assertTrue(transaction_id is None)", "metadata": "root.TestClient.test_put_multi_no_batch_w_partial_key", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 516 }, { "content": " def test_delete_multi_no_batch(self):\n from gcloud.datastore.test_batch import _Key\n from gcloud.datastore.test_batch import _mutated_pb\n\n key = _Key(self.PROJECT)\n\n creds = object()\n client = self._makeOne(credentials=creds)\n client.connection._commit.append([])\n\n result = client.delete_multi([key])\n self.assertEqual(result, None)\n self.assertEqual(len(client.connection._commit_cw), 1)\n (project,\n commit_req, transaction_id) = client.connection._commit_cw[0]\n self.assertEqual(project, self.PROJECT)\n\n mutated_key = _mutated_pb(self, commit_req.mutations, 'delete')\n self.assertEqual(mutated_key, key.to_protobuf())\n self.assertTrue(transaction_id is None)", "metadata": "root.TestClient.test_delete_multi_no_batch", "header": "['class', 'TestClient', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 597 } ]
[ { "span": "self.assertTrue(client.connection.credentials is creds)", "start_line": 172, "start_column": 8, "end_line": 172, "end_column": 63 }, { "span": "self.assertTrue(client.connection.http is None)", "start_line": 173, "start_column": 8, "end_line": 173, "end_column": 55 }, { "span": "self.assertTrue(client.current_batch is None)", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 53 }, { "span": "self.assertTrue(client.current_transaction is None)", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 59 }, { "span": "self.assertTrue(client.connection.credentials is creds)", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 63 }, { "span": "self.assertTrue(client.connection.http is http)", "start_line": 191, "start_column": 8, "end_line": 191, "end_column": 55 }, { "span": "self.assertTrue(client.current_batch is None)", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 53 }, { "span": "self.assertTrue(client.current_batch is batch)", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 54 }, { "span": "self.assertTrue(client.current_transaction is None)", "start_line": 203, "start_column": 8, "end_line": 203, "end_column": 59 }, { "span": "self.assertTrue(client.current_batch is xact)", "start_line": 205, "start_column": 8, "end_line": 205, "end_column": 53 }, { "span": "self.assertTrue(client.current_transaction is xact)", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 59 }, { "span": "self.assertTrue(client._pop_batch() is xact)", "start_line": 209, "start_column": 8, "end_line": 209, "end_column": 52 }, { "span": "self.assertTrue(client._pop_batch() is batch)", "start_line": 211, "start_column": 8, "end_line": 211, "end_column": 53 }, { "span": "self.assertTrue(client.get(key) is None)", "start_line": 227, "start_column": 8, "end_line": 227, "end_column": 48 }, { "span": "self.assertTrue(_called_with[0][1]['missing'] is None)", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 62 }, { "span": "self.assertTrue(_called_with[0][1]['deferred'] is None)", "start_line": 232, "start_column": 8, "end_line": 232, "end_column": 63 }, { "span": "self.assertTrue(client.get(key, missing, deferred) is _entity)", "start_line": 248, "start_column": 8, "end_line": 248, "end_column": 70 }, { "span": "self.assertTrue(_called_with[0][1]['missing'] is missing)", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 65 }, { "span": "self.assertTrue(_called_with[0][1]['deferred'] is deferred)", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 67 }, { "span": "self.assertTrue(tid is None)", "start_line": 379, "start_column": 8, "end_line": 379, "end_column": 36 }, { "span": "self.assertTrue(tid is None)", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 36 }, { "span": "self.assertFalse(new_key is key)", "start_line": 408, "start_column": 8, "end_line": 408, "end_column": 40 }, { "span": "self.assertTrue(result is None)", "start_line": 532, "start_column": 8, "end_line": 532, "end_column": 39 }, { "span": "self.assertTrue(transaction_id is None)", "start_line": 548, "start_column": 8, "end_line": 548, "end_column": 47 }, { "span": "self.assertTrue(transaction_id is None)", "start_line": 616, "start_column": 8, "end_line": 616, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "ctor", "\\u", "w", "\\u", "implicit", "\\u", "inputs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "\\u", "testing_", "import_", "\\u", "Mon", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "import_", "client_", "as_", "\\u", "MUT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "import_", "client_", "as_", "\\u", "base", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OTHER", "_", "=_", "'", "other", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "called_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fall", "back", "\\u", "mock_", "(_", "project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "called_", "._", "append_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "project_", "or_", "OTHER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "klass_", "=_", "self_", "._", "\\u", "get", "Target", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "\\u", "Mon", "key_", "(_", "\\u", "MUT", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dete", "rmin", "e\\u", "default", "\\u", "project_", "=_", "fall", "back", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "\\u", "Mon", "key_", "(_", "\\u", "base", "\\u", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "credentials_", "=_", "lambda_", ":_", "creds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "klass_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "project_", ",_", "OTHER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "namespace_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "client_", "._", "connection_", ",_", "\\u", "Moc", "k", "Connection_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "connection_", "._", "credentials_", "is_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "connection_", "._", "http_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "batch_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "transaction_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "default", "\\u", "called_", ",_", "[_", "None_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ctor", "\\u", "w", "\\u", "explicit", "\\u", "inputs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OTHER", "_", "=_", "'", "other", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NAMESPACE_", "=_", "'", "namespace", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "project_", "=_", "OTHER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "NAMESPACE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "=_", "creds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "=_", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "project_", ",_", "OTHER", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "client_", "._", "namespace_", ",_", "NAMESPACE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "client_", "._", "connection_", ",_", "\\u", "Moc", "k", "Connection_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "connection_", "._", "credentials_", "is_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "connection_", "._", "http_", "is_", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "batch_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "client_", "._", "\\u", "batch", "\\u", "stack_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "\\u", "push", "\\u", "batch", "\\u", "and", "\\u\\u", "pop", "\\u", "batch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch_", "=_", "client_", "._", "batch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xac", "t_", "=_", "client_", "._", "transaction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "push", "\\u", "batch_", "(_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "client_", "._", "\\u", "batch", "\\u", "stack_", ")_", ",_", "[_", "batch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "batch_", "is_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "transaction_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "\\u", "push", "\\u", "batch_", "(_", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "batch_", "is_", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "current", "\\u", "transaction_", "is_", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "list", "(\\u", "Local", "Stack", ")", " ", "return", "s", " ", "in", " ", "reverse", " ", "order", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "client_", "._", "\\u", "batch", "\\u", "stack_", ")_", ",_", "[_", "xac", "t_", ",_", "batch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "pop", "\\u", "batch_", "(_", ")_", "is_", "xac", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "client_", "._", "\\u", "batch", "\\u", "stack_", ")_", ",_", "[_", "batch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "\\u", "pop", "\\u", "batch_", "(_", ")_", "is_", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "client_", "._", "\\u", "batch", "\\u", "stack_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "miss", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "call", "ed", "\\u", "with_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "multi_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "call", "ed", "\\u", "with_", "._", "append_", "(_", "(_", "args_", ",_", "kw_", ")_", ")_", "\\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_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "get", "\\u", "multi_", "=_", "\\u", "get", "\\u", "multi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "get_", "(_", "key_", ")_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "keys", "'_", "]_", ",_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "missi", "ng", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "defer", "red", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "hit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "call", "ed", "\\u", "with_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "entity_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "multi_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "call", "ed", "\\u", "with_", "._", "append_", "(_", "(_", "args_", ",_", "kw_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u", "entity_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "get", "\\u", "multi_", "=_", "\\u", "get", "\\u", "multi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", ",_", "missing_", ",_", "deferred_", "=_", "object_", "(_", ")_", ",_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "client_", "._", "get_", "(_", "key_", ",_", "missing_", ",_", "deferred_", ")_", "is_", "\\u", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "keys", "'_", "]_", ",_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "missi", "ng", "'_", "]_", "is_", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u", "call", "ed", "\\u", "with_", "[_", "0_", "]_", "[_", "1_", "]_", "[_", "'", "defer", "red", "'_", "]_", "is_", "deferred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "multi", "\\u", "w", "\\u", "defer", "red", "\\u", "from", "\\u", "back", "end", "\\u", "but", "\\u", "not", "\\u", "passed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "datastore_", "._", "\\u", "generated_", "import_", "entity", "\\u", "pb2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "entity_", "import_", "Entity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "key_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key1_", "=_", "Key_", "(_", "'", "Kin", "d", "'_", ",_", "project_", "=_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "1", "\\u", "pb_", "=_", "key1_", "._", "to", "\\u", "protobuf_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key2_", "=_", "Key_", "(_", "'", "Kin", "d", "'_", ",_", "2345", "_", ",_", "project_", "=_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "2", "\\u", "pb_", "=_", "key2_", "._", "to", "\\u", "protobuf_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "entity", "1", "\\u", "pb_", "=_", "entity", "\\u", "pb2_", "._", "Entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "1", "\\u", "pb_", "._", "key_", "._", "Copy", "From_", "(_", "key", "1", "\\u", "pb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "2", "\\u", "pb_", "=_", "entity", "\\u", "pb2_", "._", "Entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "2", "\\u", "pb_", "._", "key_", "._", "Copy", "From_", "(_", "key", "2", "\\u", "pb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mock", " ", "up", " ", "two", " ", "separate", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "._", "connection_", "._", "\\u", "add", "\\u", "look", "up", "\\u", "result_", "(_", "[_", "entity", "1", "\\u", "pb_", "]_", ",_", "deferred_", "=_", "[_", "key", "2", "\\u", "pb_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connection_", "._", "\\u", "add", "\\u", "look", "up", "\\u", "result_", "(_", "[_", "entity", "2", "\\u", "pb_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "missing_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "client_", "._", "get", "\\u", "multi_", "(_", "[_", "key1_", ",_", "key2_", "]_", ",_", "missing_", "=_", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "found_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "missing_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "actual", " ", "content", "s", " ", "on", " ", "the", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "found_", "[_", "0_", "]_", ",_", "Entity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found_", "[_", "0_", "]_", "._", "key_", "._", "path_", ",_", "key1_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found_", "[_", "0_", "]_", "._", "key_", "._", "project_", ",_", "key1_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "found_", "[_", "1_", "]_", ",_", "Entity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found_", "[_", "1_", "]_", "._", "key_", "._", "path_", ",_", "key2_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found_", "[_", "1_", "]_", "._", "key_", "._", "project_", ",_", "key2_", "._", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cw_", "=_", "client_", "._", "connection_", "._", "\\u", "look", "up", "\\u", "cw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cw_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ds", "\\u", "id_", ",_", "k", "\\u", "pbs", "_", ",_", "eventual", "_", ",_", "tid_", "=_", "cw_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ds", "\\u", "id_", ",_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "k", "\\u", "pbs", "_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key", "1", "\\u", "pb_", ",_", "k", "\\u", "pbs", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key", "2", "\\u", "pb_", ",_", "k", "\\u", "pbs", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "eventual", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tid_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ds", "\\u", "id_", ",_", "k", "\\u", "pbs", "_", ",_", "eventual", "_", ",_", "tid_", "=_", "cw_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ds", "\\u", "id_", ",_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "k", "\\u", "pbs", "_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "key", "2", "\\u", "pb_", ",_", "k", "\\u", "pbs", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "eventual", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tid_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "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", "multi", "\\u", "hit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "datastore_", "._", "key_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "KIND", "_", "=_", "'", "Kin", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ID_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "[_", "{_", "'", "kind", "'_", ":_", "KIND", "_", ",_", "'", "id", "'_", ":_", "ID_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "found", " ", "entity", " ", "pb", " ", "to", " ", "be", " ", "return", "ed", " ", "from", " ", "mock", " ", "back", "end", "._", "\\u\\u\\uNL\\u\\u\\u_", "entity", "\\u", "pb_", "=_", "\\u", "make", "\\u", "entity", "\\u", "pb_", "(_", "self_", "._", "PROJECT_", ",_", "KIND", "_", ",_", "ID_", ",_", "'", "foo", "'_", ",_", "'", "Foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "connecti", "on", " ", "to", " ", "return", " ", "the", " ", "entity", " ", "pb", "._", "\\u\\u\\uNL\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connection_", "._", "\\u", "add", "\\u", "look", "up", "\\u", "result_", "(_", "[_", "entity", "\\u", "pb_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "Key_", "(_", "KIND", "_", ",_", "ID_", ",_", "project_", "=_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", ",_", "=_", "client_", "._", "get", "\\u", "multi_", "(_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "key_", "=_", "result_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "return", "ed", " ", "value", " ", "is", " ", "as", " ", "expected", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "new", "\\u", "key_", "is_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "project_", ",_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "\\u", "key_", "._", "path_", ",_", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "result_", ")_", ",_", "[_", "'", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "[_", "'", "foo", "'_", "]_", ",_", "'", "Foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "put", "\\u", "multi", "\\u", "no", "\\u", "batch", "\\u", "w", "\\u", "partial", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "datastore_", "._", "helpers_", "import_", "\\u", "property", "\\u", "tuples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "Entity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "Key", "PB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "mutate", "d\\u", "pb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "\\u", "Entity_", "(_", "foo_", "=_", "u", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "entity_", "._", "key_", "=_", "\\u", "Key_", "(_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "._", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connection_", "._", "\\u", "commit_", "._", "append_", "(_", "[_", "\\u", "Key", "PB", "_", "(_", "key_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "client_", "._", "put", "\\u", "multi_", "(_", "[_", "entity_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "client_", "._", "connection_", "._", "\\u", "commit", "\\u", "cw_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "commit", "\\u", "req_", ",_", "transaction", "\\u", "id_", ")_", "=_", "client_", "._", "connection_", "._", "\\u", "commit", "\\u", "cw_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "project_", ",_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mutate", "d\\u", "entity_", "=_", "\\u", "mutate", "d\\u", "pb_", "(_", "self_", ",_", "commit", "\\u", "req_", "._", "mutations_", ",_", "'", "insert", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mutate", "d\\u", "entity_", "._", "key_", ",_", "key_", "._", "to", "\\u", "protobuf_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prop", "\\u", "list_", "=_", "list_", "(_", "\\u", "property", "\\u", "tuples_", "(_", "mutate", "d\\u", "entity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "prop", "\\u", "list_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", ",_", "value", "\\u", "pb_", "=_", "prop", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "value", "\\u", "pb_", "._", "string", "\\u", "value_", ",_", "u", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "transaction", "\\u", "id_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Client_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "delete", "\\u", "multi", "\\u", "no", "\\u", "batch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gcloud", "_", "._", "datastore_", "._", "test\\u", "batch_", "import_", "\\u", "mutate", "d\\u", "pb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "\\u", "Key_", "(_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creds_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "self_", "._", "\\u", "make", "One_", "(_", "credentials_", "=_", "creds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connection_", "._", "\\u", "commit_", "._", "append_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "client_", "._", "delete", "\\u", "multi_", "(_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "client_", "._", "connection_", "._", "\\u", "commit", "\\u", "cw_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "commit", "\\u", "req_", ",_", "transaction", "\\u", "id_", ")_", "=_", "client_", "._", "connection_", "._", "\\u", "commit", "\\u", "cw_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "project_", ",_", "self_", "._", "PROJECT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mutate", "d\\u", "key_", "=_", "\\u", "mutate", "d\\u", "pb_", "(_", "self_", ",_", "commit", "\\u", "req_", "._", "mutations_", ",_", "'", "delete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mutate", "d\\u", "key_", ",_", "key_", "._", "to", "\\u", "protobuf_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "transaction", "\\u", "id_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Duplicate key in dict literal
CenterForOpenScience/osf.io/api_tests/base/test_filters.py
[ { "content": " def test_parse_query_params_supports_multiple_filters(self):\n query_params = {\n 'filter[string_field]': 'foo',\n 'filter[string_field]': 'bar',\n }\n\n fields = self.view.parse_query_params(query_params)\n assert_in('string_field', fields)\n for match in fields['string_field']:\n assert_in(match['value'], ('foo', 'bar'))", "metadata": "root.TestFilterMixin.test_parse_query_params_supports_multiple_filters", "header": "['class', 'TestFilterMixin', '(', 'ApiTestCase', ')', ':', '___EOS___']", "index": 187 } ]
[ { "span": "'filter[string_field]':", "start_line": 189, "start_column": 12, "end_line": 189, "end_column": 34 } ]
[ { "span": "'filter[string_field]':", "start_line": 190, "start_column": 12, "end_line": 190, "end_column": 34 } ]
1
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "Test", "Filter", "Mixin_", "(_", "Ap", "i", "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", "parse", "\\u", "query", "\\u", "params", "\\u", "support", "s", "\\u", "multiple", "\\u", "filters_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "[", "string", "\\u", "field", "]'_", ":_", "'", "foo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "[", "string", "\\u", "field", "]'_", ":_", "'", "bar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "self_", "._", "view_", "._", "parse", "\\u", "query", "\\u", "params_", "(_", "query", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "in_", "(_", "'", "string", "\\u", "field", "'_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "fields_", "[_", "'", "string", "\\u", "field", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "in_", "(_", "match_", "[_", "'", "value", "'_", "]_", ",_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 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 ]
Unused import
scipy-conference/scipy_proceedings/publisher/mail/_mailer.py
[ { "content": "import argparse\nimport smtplib\nimport os\nimport getpass\nfrom email.mime.text import MIMEText\n\nimport sys\nsys.path.insert(0, '..')\nfrom conf import work_dir\nfrom options import cfg2dict\nfrom build_template import _from_template\n\n\nargs = None\npassword = None\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def parse_args():\n parser = argparse.ArgumentParser(description=\"Invite reviewers.\")\n parser.add_argument('--send', action='store_true')\n parser.add_argument('--template', default=None)\n\n global args\n args = parser.parse_args()\n args.dry_run = not args.send\n\n if args.dry_run:\n print '*** This is a dry run. Use --send to send emails.'\n\n return args", "metadata": "root.parse_args", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def load_config(conf_file):\n return cfg2dict(conf_file)", "metadata": "root.load_config", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def get_password(sender):\n global password\n if not args.dry_run and not password:\n password = getpass.getpass(sender + \"'s password: \")", "metadata": "root.get_password", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def email_addr_from(name_email):\n return '\"%s\" <%s>' % (name_email['name'], name_email['email'])", "metadata": "root.email_addr_from", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def send_template(sender, recipient, template, template_data,\n smtp_server='smtp.gmail.com', smtp_port=587):\n if args.dry_run:\n print 'Dry run -> not sending mail to %s' % recipient\n else:\n get_password(sender['login'])\n print '-> %s' % recipient\n\n template_data['email'] = recipient\n message = _from_template('../mail/templates/' + template, template_data)\n\n if args.dry_run:\n print \"=\" * 80\n print message\n print \"=\" * 80\n\n return\n\n session = smtplib.SMTP(smtp_server, smtp_port)\n\n session.ehlo()\n session.starttls()\n session.ehlo\n session.login(sender['login'], password)\n\n session.sendmail(sender['name'], recipient, message)\n session.quit()", "metadata": "root.send_template", "header": "['module', '___EOS___']", "index": 46 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "from email.mime.text import MIMEText", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 36 }, { "span": "from conf import work_dir", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "smtplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "._", "mime_", "._", "text_", "import_", "MIME", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "conf_", "import_", "work", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "options_", "import_", "cfg", "2di", "ct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "build", "\\u", "template_", "import_", "\\u", "from", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "args_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Invite", " ", "reviewer", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "send", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "template", "'_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "dry", "\\u", "run_", "=_", "not_", "args_", "._", "send_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'**", "*", " ", "Thi", "s", " ", "is", " ", "a", " ", "dry", " ", "run", ".", " ", " ", "Us", "e", " ", "--", "send", " ", "to", " ", "send", " ", "email", "s", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "config_", "(_", "conf", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cfg", "2di", "ct_", "(_", "conf", "\\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_", "get", "\\u", "password_", "(_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "args_", "._", "dry", "\\u", "run_", "and_", "not_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "getpass_", "._", "getpass_", "(_", "sender_", "+_", "\"'", "s", " ", "password", ":", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "email", "\\u", "addr", "\\u", "from_", "(_", "name", "\\u", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'\"", "%", "s", "\"", " ", "<", "%", "s", ">'_", "%_", "(_", "name", "\\u", "email_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "email_", "[_", "'", "email", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "template_", "(_", "sender_", ",_", "recipient_", ",_", "template_", ",_", "template", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "smt", "p", "\\u", "server_", "=_", "'", "smt", "p", ".", "gma", "il", ".", "com", "'_", ",_", "smt", "p", "\\u", "port_", "=_", "587", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Dry", " ", "run", " ", "->", " ", "not", " ", "sendin", "g", " ", "mail", " ", "to", " ", "%", "s", "'_", "%_", "recipient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "password_", "(_", "sender_", "[_", "'", "login", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'->", " ", "%", "s", "'_", "%_", "recipient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "template", "\\u", "data_", "[_", "'", "email", "'_", "]_", "=_", "recipient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\\u", "from", "\\u", "template_", "(_", "'../", "mail", "/", "template", "s", "/'_", "+_", "template_", ",_", "template", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"=\"_", "*_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"=\"_", "*_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "=_", "smtplib_", "._", "SMTP_", "(_", "smt", "p", "\\u", "server_", ",_", "smt", "p", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "eh", "lo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "startt", "ls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "eh", "lo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "login_", "(_", "sender_", "[_", "'", "login", "'_", "]_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "._", "sendmail_", "(_", "sender_", "[_", "'", "name", "'_", "]_", ",_", "recipient_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "quit_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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, 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, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
azoft-dev-team/imagrium/jars/Lib/sikuli/Sikuli.py
[ { "content": "# Copyright 2010-2013, Sikuli.org\n# Released under the MIT License.\n# modified RaiMan 2013\n\nfrom __future__ import with_statement\nfrom org.sikuli.basics import Debug\nDebug.log(3, \"Jython: sikuli: Sikuli: entering\")\nimport time\nimport __builtin__\nimport __main__\nimport types\nimport sys\nimport os\nimport inspect\n\nDebug.log(3, \"Jython: sikuli: Sikuli: constants\")\nimport org.sikuli.script.FindFailed as FindFailed\nfrom org.sikuli.script.FindFailedResponse import *\nfrom org.sikuli.script.Constants import *\nimport org.sikuli.script.Button as Button\nfrom org.sikuli.script.Button import WHEEL_UP, WHEEL_DOWN\nfrom org.sikuli.basics import OS\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Region\")\nfrom org.sikuli.script import Region as JRegion\nfrom Region import *\nfrom org.sikuli.script import Observing\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Screen\")\nfrom org.sikuli.script import Screen as JScreen\nfrom Screen import *\n\nDebug.log(3, \"Jython: sikuli: Sikuli: Env.addHotkey\")\nfrom Env import *\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Match\")\nfrom org.sikuli.script import Match\nDebug.log(3, \"Jython: sikuli: Sikuli: import Pattern\")\nfrom org.sikuli.script import Pattern\nDebug.log(3, \"Jython: sikuli: Sikuli: import Location\")\nfrom org.sikuli.script import Location\nDebug.log(3, \"Jython: sikuli: Sikuli: import ScreenUnion\")\nfrom org.sikuli.script import ScreenUnion\nDebug.log(3, \"Jython: sikuli: Sikuli: import Finder\")\nfrom org.sikuli.script import Finder\nfrom org.sikuli.script import ImageFinder\nfrom org.sikuli.script import ImageFind\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import Image\")\nfrom org.sikuli.script import Image\nfrom org.sikuli.script import ImageGroup\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import ImagePath\")\nfrom org.sikuli.script import ImagePath\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import App\")\nfrom org.sikuli.script import App\nDebug.log(3, \"Jython: sikuli: Sikuli: import KeyBoard/Mouse\")\nfrom org.sikuli.script import Key\nfrom org.sikuli.script import KeyModifier\nfrom org.sikuli.script.KeyModifier import KEY_CTRL, KEY_SHIFT, KEY_META, KEY_CMD, KEY_WIN, KEY_ALT\nfrom org.sikuli.script import Mouse\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import from Basics\")\nfrom org.sikuli.basics import Settings\nfrom org.sikuli.basics import ExtensionManager\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import from compare\")\nfrom org.sikuli.script.compare import DistanceComparator\nfrom org.sikuli.script.compare import VerticalComparator\nfrom org.sikuli.script.compare import HorizontalComparator\n\nDebug.log(3, \"Jython: sikuli: Sikuli: init SikuliImporter\")\nimport SikuliImporter\n\nDebug.log(3, \"Jython: sikuli: Sikuli: import SikuliX\")\nfrom org.sikuli.basics import SikuliScript\nfrom org.sikuli.basics import SikuliX\n\n##\n# some support for handling unicode and strings\n#\n## use instead of print if unicode strings present\n# usage: uprint(s1, u1, u2, u3, s3, ...)\n#\n\n##\n# to make an utf8-encoded string from a str object\n#\n\n\n##\n# loads a Sikuli extension (.jar) from\n# 1. user's sikuli data path\n# 2. bundle path\n#\n\n##\n# append the given path sys.path if not yet contained\n#\n\n##\n# append the given path image path list if not yet contained\n#\n\n##\n# return the current image path list\n#\n\n##\n# remove the given path from the image path\n#\n\n##\n# reset the image path, so it only contains the bundlepath\n#\n\n##\n# Sets the path for searching images in all Sikuli Script methods. <br/>\n# Sikuli IDE sets this to the path of the bundle of source code (.sikuli)\n# automatically. If you write Sikuli scripts by the Sikuli IDE, you should\n# not call this method.\n#\n\n##\n# return the current bundlepath (usually the folder .sikuli) or None if no bundlepath is defined\n#\n\n##\n# return the parent folder of the current bundlepath\n# (usually the folder containing the current script folder.sikuli)\n# or None if no bundlepath is defined\n#\n\n##\n# make a valid path by joining the two paths (path2 might be a list)\n#\n\n##\n# Sikuli shows actions (click, dragDrop, ... etc.) if this flag is set to <i>True</i>.\n# The default setting is <i>False</i>.\n#\n\n##\n# Shows a message dialog containing the given message.\n# @param msg The given message string.\n\n##\n# Shows a question-message dialog requesting input from the user.\n# @param msg The message to display.\n# @param default The preset text of the input field (default empty).\n# @param title the title for the dialog (default: Sikuli input request)\n# @param hidden =true makes the dialog run as a password input (input hidden with bullets)\n# @return The user's input string.\n#\n##\n# Shows a dialog request to enter text in a multiline text field\n# Though not all text might be visible, everything entered is delivered with the returned text\n# The main purpose for this feature is to allow pasting text from somewhere\n# @param msg the message to display.\n# @param title the title for the dialog (default: Sikuli input request)\n# @param lines the maximum number of lines visible in the text field (default 9)\n# @param width the maximum number of characters visible in one line (default 20)\n# @return The user's input including the line breaks.\n\n\n\n\n##\n# set the default screen to given or primary screen\n#\n# TODO where else to remember an opened remote screen?\nremoteScreen = None\n\n\n##\n# set the default screen to given remote screen\n#\n\n##\n# Switches the frontmost application to the given application.\n# If the given application is not running, it will be launched by openApp()\n# automatically. <br/>\n# Note: On Windows, Sikule searches in the text on the title bar\n# instead of the application name.\n# @param app The name of the application. (case-insensitive)\n#\n\n##\n# Opens the given application. <br/>\n# @param app The name of an application if it is in the environment variable PATH, or the full path to an application.\n#\n\n##\n# Closes the given application. <br/>\n# @param app The name of the application. (case-insensitive)\n#\n\n##\n# Sleeps until the given amount of time in seconds has elapsed.\n# @param sec The amount of sleeping time in seconds.\n\n##\n# shutdown and return given exit code\n#\n\n##\n# Runs the given string command.\n# @param msg The given string command.\n# @return Returns the output from the executed command.\n\n##\n# display some help in interactive mode\n\n##\n# helper functions, that can be used when sorting lists of regions\n#\n\n\n\n\n\n\n##\n################## internal use only ###########################################\n#\n\n\n############### set SCREEN as primary screen at startup ################\nuse()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def uprint(*args):\n for e in args[:-1]:\n if isinstance(e, str): print e,\n else: print e.encode(\"utf8\"),\n if isinstance(args[-1], str): print args[-1]\n else: print args[-1].encode(\"utf8\")", "metadata": "root.uprint", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def unicd(s):\n return ucode(s)", "metadata": "root.unicd", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def ucode(s):\n return (unicode(s, \"utf8\"))", "metadata": "root.ucode", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def load(jar):\n def _load(abspath):\n if os.path.exists(abspath):\n if not abspath in sys.path:\n sys.path.append(abspath)\n return True\n return False\n\n if _load(jar):\n return True\n path = getBundlePath()\n if path:\n jarInBundle = os.path.join(path, jar)\n if _load(jarInBundle):\n return True\n path = ExtensionManager.getInstance().getLoadPath(jar)\n if path and _load(path):\n return True\n return False", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def addImportPath(path):\n addModPath(path)", "metadata": "root.addImportPath", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def addImagePath(path):\n ImagePath.add(path)", "metadata": "root.addImagePath", "header": "['module', '___EOS___']", "index": 135 }, { "content": "def getImagePath():\n return [e.pathGiven for e in ImagePath.getPaths() if e]", "metadata": "root.getImagePath", "header": "['module', '___EOS___']", "index": 141 }, { "content": "def removeImagePath(path):\n ImagePath.remove(path)", "metadata": "root.removeImagePath", "header": "['module', '___EOS___']", "index": 147 }, { "content": "def resetImagePath(path = None):\n if not path:\n path = getBundlePath();\n ImagePath.reset(path)", "metadata": "root.resetImagePath", "header": "['module', '___EOS___']", "index": 153 }, { "content": "def setBundlePath(path):\n ImagePath.setBundlePath(path)", "metadata": "root.setBundlePath", "header": "['module', '___EOS___']", "index": 164 }, { "content": "def getBundlePath():\n return ImagePath.getBundlePath()", "metadata": "root.getBundlePath", "header": "['module', '___EOS___']", "index": 170 }, { "content": "def getParentPath():\n return ImagePath.getBundleParentPath();", "metadata": "root.getParentPath", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def makePath(path1, path2):\n if (not isinstance(path2, List)):\n path = os.path.join(path1, path2)\n else:\n path = path1\n for p in path2:\n path = os.path.join(path, p)\n return path", "metadata": "root.makePath", "header": "['module', '___EOS___']", "index": 184 }, { "content": "def setShowActions(flag):\n Settings.setShowActions(flag)", "metadata": "root.setShowActions", "header": "['module', '___EOS___']", "index": 197 }, { "content": "def popup(msg, title=\"Sikuli\"):\n SikuliX.popup(msg, title)", "metadata": "root.popup", "header": "['module', '___EOS___']", "index": 203 }, { "content": "def input(msg=\"\", default=\"\", title=\"\", hidden=False):\n if (hidden):\n default = \"\"\n return SikuliX.input(msg, default, title, hidden)", "metadata": "root.input", "header": "['module', '___EOS___']", "index": 214 }, { "content": "def inputText(msg=\"\", title=\"\", lines=0, width=0):\n return SikuliX.input(msg, title, width, lines)", "metadata": "root.inputText", "header": "['module', '___EOS___']", "index": 227 }, { "content": "def capture(*args):\n scr = ScreenUnion()\n if len(args) == 0:\n simg = scr.userCapture()\n if simg:\n return simg.getFilename()\n else:\n return None\n elif len(args) == 1:\n if __builtin__.type(args[0]) is types.StringType or __builtin__.type(args[0]) is types.UnicodeType:\n simg = scr.userCapture(args[0])\n if simg:\n return simg.getFilename()\n else:\n return None\n else:\n return scr.capture(args[0]).getFilename()\n elif len(args) == 4:\n return scr.capture(args[0], args[1], args[2], args[3]).getFilename()\n else:\n return None", "metadata": "root.capture", "header": "['module', '___EOS___']", "index": 230 }, { "content": "def selectRegion(msg=None):\n if msg:\n r = ScreenUnion().selectRegion(msg)\n else:\n r = ScreenUnion().selectRegion()\n if r:\n return Region(r)\n else:\n return None", "metadata": "root.selectRegion", "header": "['module', '___EOS___']", "index": 253 }, { "content": "def use(scr = None, remote = False):\n if remote:\n theGlobals = inspect.currentframe().f_back.f_back.f_globals\n else:\n theGlobals = inspect.currentframe().f_back.f_globals\n global remoteScreen\n if remoteScreen:\n remoteScreen.close()\n remoteScreen = None\n if not scr:\n SCREEN = Screen()\n else:\n SCREEN = scr\n Debug.log(3, \"Jython: requested to use as default region: \" + SCREEN.toStringShort())\n globals()['SIKULISAVED'] = _exposeAllMethods(SCREEN, globals().get('SIKULISAVED'), theGlobals, None)\n theGlobals['SCREEN'] = SCREEN\n if remote:\n remoteScreen = SCREEN\n return SCREEN", "metadata": "root.use", "header": "['module', '___EOS___']", "index": 269 }, { "content": "def useRemote(adr, port = 0):\n global remoteScreen\n import org.sikuli.script.ScreenRemote as SR\n SCREEN = SR(adr, str(port))\n if SCREEN.isValid():\n return use(SCREEN, True)\n else:\n return None", "metadata": "root.useRemote", "header": "['module', '___EOS___']", "index": 292 }, { "content": "def switchApp(app):\n return App.focus(app)", "metadata": "root.switchApp", "header": "['module', '___EOS___']", "index": 309 }, { "content": "def openApp(app):\n return App.open(app)", "metadata": "root.openApp", "header": "['module', '___EOS___']", "index": 316 }, { "content": "def closeApp(app):\n return App.close(app)", "metadata": "root.closeApp", "header": "['module', '___EOS___']", "index": 323 }, { "content": "def sleep(sec):\n time.sleep(sec)", "metadata": "root.sleep", "header": "['module', '___EOS___']", "index": 329 }, { "content": "def exit(code=0):\n global remoteScreen\n if remoteScreen:\n remoteScreen.close()\n remoteScreen = None\n SikuliX.cleanUp(code)\n sys.exit(code)", "metadata": "root.exit", "header": "['module', '___EOS___']", "index": 335 }, { "content": "def run(cmd):\n return SikuliX.run(cmd)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 347 }, { "content": "def shelp():\n SikuliScript.shelp()", "metadata": "root.shelp", "header": "['module', '___EOS___']", "index": 352 }, { "content": "def byDistanceTo(x, y=None):\n \"\"\" Method to compare two Region objects by distance of their top left.\n or a regions top left to the given point by coordinates\"\"\"\n return DistanceComparator(x, y)", "metadata": "root.byDistanceTo", "header": "['module', '___EOS___']", "index": 358 }, { "content": "def byX(m):\n \"\"\" Method to compare two Region objects by x value. \"\"\"\n return HorizontalComparator().compare", "metadata": "root.byX", "header": "['module', '___EOS___']", "index": 363 }, { "content": "def byY(m):\n \"\"\" Method to compare two Region objects by y value. \"\"\"\n return VerticalComparator().compare", "metadata": "root.byY", "header": "['module', '___EOS___']", "index": 367 }, { "content": "def verticalComparator():\n \"\"\" Method to compare two Region objects by y value. \"\"\"\n return VerticalComparator().compare", "metadata": "root.verticalComparator", "header": "['module', '___EOS___']", "index": 371 }, { "content": "def horizontalComparator():\n \"\"\" Method to compare two Region objects by x value. \"\"\"\n return HorizontalComparator().compare", "metadata": "root.horizontalComparator", "header": "['module', '___EOS___']", "index": 375 }, { "content": "def distanceComparator(x, y=None):\n \"\"\" Method to compare two Region objects by distance of their top left.\n or a regions top left to the given point by coordinates\"\"\"\n if y is None:\n return DistanceComparator(x).compare # x is Region or Location\n return DistanceComparator(x, y).compare # x/y as coordinates", "metadata": "root.distanceComparator", "header": "['module', '___EOS___']", "index": 379 }, { "content": "def addModPath(path):\n if path[-1] == Settings.getFilePathSeperator():\n path = path[:-1]\n if not path in sys.path:\n sys.path.append(path)", "metadata": "root.addModPath", "header": "['module', '___EOS___']", "index": 389 }, { "content": "def _exposeAllMethods(anyObject, saved, theGlobals, exclude_list):\n if not exclude_list:\n exclude_list = [ 'class', 'classDictInit', 'clone', 'equals', 'finalize',\n 'getClass', 'hashCode', 'notify', 'notifyAll',\n 'toGlobalCoord', 'toString', 'getLocationFromPSRML', 'getRegionFromPSRM',\n 'capture', 'selectRegion', 'create', 'observeInBackground', 'waitAll',\n 'updateSelf', 'findNow', 'findAllNow', 'getEventManager',\n 'lastMatch', 'lastMatches', 'lastScreenImage', 'lastScreenImageFile']\n #Debug.log(3, \"Sikuli: _exposeAllMethods: %s called from: %s\", anyObject, theGlobals['__name__'])\n tosave = []\n if not saved:\n saved = []\n for name in dir(anyObject):\n if name in exclude_list: continue\n try:\n if not inspect.ismethod(getattr(anyObject,name)): continue\n except:\n continue\n if name[0] != '_' and name[:7] != 'super__':\n try:\n saved.remove(name)\n except:\n pass\n tosave.append(name)\n #print \"added:\", name\n theGlobals[name] = eval(\"anyObject.\"+name)\n if name == 'checkWith': Debug.log(3, \"%s %s\", name, str(dict[name])[1:])\n for name in saved:\n if name in theGlobals:\n #print \"removed:\", name\n theGlobals.pop(name)\n return tosave", "metadata": "root._exposeAllMethods", "header": "['module', '___EOS___']", "index": 395 } ]
[ { "span": "import org.sikuli.script.FindFailed as FindFailed", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 49 }, { "span": "import org.sikuli.script.Button as Button", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 41 }, { "span": "from org.sikuli.script.Button import WHEEL_UP, WHEEL_DOWN", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 57 }, { "span": "from org.sikuli.basics import OS", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 32 }, { "span": "from org.sikuli.script import Region as JRegion", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 47 }, { "span": "from org.sikuli.script import Observing", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 39 }, { "span": "from org.sikuli.script import Screen as JScreen", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 47 }, { "span": "from org.sikuli.script import Match", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 35 }, { "span": "from org.sikuli.script import Pattern", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 37 }, { "span": "from org.sikuli.script import Location", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 38 }, { "span": "from org.sikuli.script import Finder", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 36 }, { "span": "from org.sikuli.script import ImageFinder", "start_line": 45, "start_column": 0, "end_line": 45, "end_column": 41 }, { "span": "from org.sikuli.script import ImageFind", "start_line": 46, "start_column": 0, "end_line": 46, "end_column": 39 }, { "span": "from org.sikuli.script import Image", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 35 }, { "span": "from org.sikuli.script import ImageGroup", "start_line": 50, "start_column": 0, "end_line": 50, "end_column": 40 }, { "span": "from org.sikuli.script import Key", "start_line": 58, "start_column": 0, "end_line": 58, "end_column": 33 }, { "span": "from org.sikuli.script import KeyModifier", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 41 }, { "span": "from org.sikuli.script.KeyModifier import KEY_CTRL, KEY_SHIFT, KEY_META, KEY_CMD, KEY_WIN, KEY_ALT", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 98 }, { "span": "from org.sikuli.script import Mouse", "start_line": 61, "start_column": 0, "end_line": 61, "end_column": 35 }, { "span": "import SikuliImporter", "start_line": 73, "start_column": 0, "end_line": 73, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", "-", "2013", ",", " ", "Si", "kul", "i", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Release", "d", " ", "under", " ", "the", " ", "MIT", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modifi", "ed", " ", "Rai", "Man", " ", "2013_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "entering", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "\\u\\u", "builtin\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "constant", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Fin", "d", "Failed_", "as_", "Fin", "d", "Failed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Fin", "d", "Fail", "ed", "Response_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Button_", "as_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Button_", "import_", "WHE", "EL", "\\u", "UP_", ",_", "WHE", "EL", "\\u", "DOWN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "OS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Region", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Region_", "as_", "JR", "egi", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Region_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Observ", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Scr", "een", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Screen_", "as_", "JS", "creen", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Screen_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "Env", ".", "add", "Hot", "key", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Env_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Match", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Pat", "tern", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Locat", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Scr", "een", "Uni", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Scr", "een", "Union_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Fin", "der", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Find_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Image", "Path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Image", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "App", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "App_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Key", "Boa", "rd", "/", "Mouse", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Key", "Modifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Key", "Modifier_", "import_", "KEY", "\\u", "CTR", "L_", ",_", "KEY", "\\u", "SHIFT_", ",_", "KEY", "\\u", "META_", ",_", "KEY", "\\u", "CMD_", ",_", "KEY", "\\u", "WIN", "_", ",_", "KEY", "\\u", "ALT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "import_", "Mouse", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "from", " ", "Basic", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Ext", "ensi", "on", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "from", " ", "compare", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Distan", "ce", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Vertica", "l", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "compare_", "import_", "Horiz", "onta", "l", "Compara", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "init", " ", "Si", "kul", "i", "Import", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Si", "kul", "i", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "si", "kul", "i", ":", " ", "Si", "kul", "i", ":", " ", "import", " ", "Si", "kul", "i", "X", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Si", "kul", "i", "Script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "org_", "._", "si", "kul", "i_", "._", "basics", "_", "import_", "Si", "kul", "i", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "support", " ", "for", " ", "handling", " ", "unicode", " ", "and", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "use", " ", "inst", "ead", " ", "of", " ", "print", " ", "if", " ", "unicode", " ", "string", "s", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usage", ":", " ", "upr", "int", "(", "s1", ",", " ", "u1", ",", " ", "u2", ",", " ", "u", "3", ",", " ", "s3", ",", " ", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "make", " ", "an", " ", "utf", "8", "-", "encode", "d", " ", "string", " ", "from", " ", "a", " ", "str", " ", "object_", "\\u\\u\\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_", "#", " ", "load", "s", " ", "a", " ", "Si", "kul", "i", " ", "extensi", "on", " ", "(.", "jar", ")", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "1", ".", " ", "user", "'", "s", " ", "si", "kul", "i", " ", "data", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "2", ".", " ", "bundle", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "give", "n", " ", "path", " ", "sys", ".", "path", " ", "if", " ", "not", " ", "ye", "t", " ", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "the", " ", "give", "n", " ", "path", " ", "image", " ", "path", " ", "list", " ", "if", " ", "not", " ", "ye", "t", " ", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "current", " ", "image", " ", "path", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "the", " ", "give", "n", " ", "path", " ", "from", " ", "the", " ", "image", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "the", " ", "image", " ", "path", ",", " ", "so", " ", "it", " ", "only", " ", "contain", "s", " ", "the", " ", "bundle", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "s", " ", "the", " ", "path", " ", "for", " ", "search", "ing", " ", "images", " ", "in", " ", "all", " ", "Si", "kul", "i", " ", "Script", " ", "method", "s", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Si", "kul", "i", " ", "IDE", " ", "sets", " ", "this", " ", "to", " ", "the", " ", "path", " ", "of", " ", "the", " ", "bundle", " ", "of", " ", "source", " ", "code", " ", "(.", "si", "kul", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", ".", " ", "If", " ", "you", " ", "write", " ", "Si", "kul", "i", " ", "scripts", " ", "by", " ", "the", " ", "Si", "kul", "i", " ", "IDE", ",", " ", "you", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "call", " ", "this", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "current", " ", "bundle", "path", " ", "(", "usual", "ly", " ", "the", " ", "folder", " ", ".", "si", "kul", "i", ")", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "bundle", "path", " ", "is", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "parent", " ", "folder", " ", "of", " ", "the", " ", "current", " ", "bundle", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "usual", "ly", " ", "the", " ", "folder", " ", "contain", "ing", " ", "the", " ", "current", " ", "script", " ", "folder", ".", "si", "kul", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "bundle", "path", " ", "is", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "valid", " ", "path", " ", "by", " ", "join", "ing", " ", "the", " ", "two", " ", "path", "s", " ", "(", "path", "2", " ", "mig", "ht", " ", "be", " ", "a", " ", "list", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Si", "kul", "i", " ", "show", "s", " ", "action", "s", " ", "(", "click", ",", " ", "drag", "Drop", ",", " ", "...", " ", "etc", ".)", " ", "if", " ", "this", " ", "flag", " ", "is", " ", "set", " ", "to", " ", "<", "i", ">", "Tru", "e", "</", "i", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "setti", "ng", " ", "is", " ", "<", "i", ">", "Fal", "se", "</", "i", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "message", " ", "dialog", " ", "contain", "ing", " ", "the", " ", "give", "n", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "give", "n", " ", "message", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "question", "-", "message", " ", "dialog", " ", "request", "ing", " ", "input", " ", "from", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "message", " ", "to", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "default", " ", "The", " ", "prese", "t", " ", "text", " ", "of", " ", "the", " ", "input", " ", "field", " ", "(", "default", " ", "empty", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "title", " ", "the", " ", "title", " ", "for", " ", "the", " ", "dialog", " ", "(", "default", ":", " ", "Si", "kul", "i", " ", "input", " ", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "hidden", " ", "=", "true", " ", "make", "s", " ", "the", " ", "dialog", " ", "run", " ", "as", " ", "a", " ", "password", " ", "input", " ", "(", "input", " ", "hidden", " ", "with", " ", "bullet", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "The", " ", "user", "'", "s", " ", "input", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "a", " ", "dialog", " ", "request", " ", "to", " ", "enter", " ", "text", " ", "in", " ", "a", " ", "multiline", " ", "text", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tho", "ugh", " ", "not", " ", "all", " ", "text", " ", "mig", "ht", " ", "be", " ", "visi", "ble", ",", " ", "every", "thing", " ", "enter", "ed", " ", "is", " ", "deliver", "ed", " ", "with", " ", "the", " ", "return", "ed", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "main", " ", "purpose", " ", "for", " ", "this", " ", "feature", " ", "is", " ", "to", " ", "allow", " ", "past", "ing", " ", "text", " ", "from", " ", "some", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "the", " ", "message", " ", "to", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "title", " ", "the", " ", "title", " ", "for", " ", "the", " ", "dialog", " ", "(", "default", ":", " ", "Si", "kul", "i", " ", "input", " ", "request", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "lines", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "lines", " ", "visi", "ble", " ", "in", " ", "the", " ", "text", " ", "field", " ", "(", "default", " ", "9", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "widt", "h", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "character", "s", " ", "visi", "ble", " ", "in", " ", "one", " ", "line", " ", "(", "default", " ", "20", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "The", " ", "user", "'", "s", " ", "input", " ", "inclu", "ding", " ", "the", " ", "line", " ", "breaks", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "set", " ", "the", " ", "default", " ", "screen", " ", "to", " ", "give", "n", " ", "or", " ", "primary", " ", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "where", " ", "else", " ", "to", " ", "remember", " ", "an", " ", "opene", "d", " ", "remote", " ", "screen", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "Screen_", "=_", "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_", "#", " ", "set", " ", "the", " ", "default", " ", "screen", " ", "to", " ", "give", "n", " ", "remote", " ", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Switche", "s", " ", "the", " ", "front", "most", " ", "applica", "tion", " ", "to", " ", "the", " ", "give", "n", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "give", "n", " ", "applica", "tion", " ", "is", " ", "not", " ", "runn", "ing", ",", " ", "it", " ", "will", " ", "be", " ", "launched", " ", "by", " ", "open", "App", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "On", " ", "Window", "s", ",", " ", "Si", "kul", "e", " ", "searche", "s", " ", "in", " ", "the", " ", "text", " ", "on", " ", "the", " ", "title", " ", "bar_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "the", " ", "applica", "tion", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "the", " ", "applica", "tion", ".", " ", "(", "case", "-", "inse", "nsitive", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opens", " ", "the", " ", "give", "n", " ", "applica", "tion", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "an", " ", "applica", "tion", " ", "if", " ", "it", " ", "is", " ", "in", " ", "the", " ", "environ", "ment", " ", "variab", "le", " ", "PATH", ",", " ", "or", " ", "the", " ", "full", " ", "path", " ", "to", " ", "an", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Closes", " ", "the", " ", "give", "n", " ", "applica", "tion", ".", " ", "<", "br", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "app", " ", "The", " ", "name", " ", "of", " ", "the", " ", "applica", "tion", ".", " ", "(", "case", "-", "inse", "nsitive", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sleep", "s", " ", "unti", "l", " ", "the", " ", "give", "n", " ", "amo", "unt", " ", "of", " ", "time", " ", "in", " ", "second", "s", " ", "has", " ", "ela", "pse", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "sec", " ", "The", " ", "amo", "unt", " ", "of", " ", "sleep", "ing", " ", "time", " ", "in", " ", "second", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shut", "down", " ", "and", " ", "return", " ", "give", "n", " ", "exit", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", "s", " ", "the", " ", "give", "n", " ", "string", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "msg", " ", "The", " ", "give", "n", " ", "string", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "Return", "s", " ", "the", " ", "output", " ", "from", " ", "the", " ", "executed", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "display", " ", "some", " ", "help", " ", "in", " ", "interactive", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", "er", " ", "function", "s", ",", " ", "tha", "t", " ", "can", " ", "be", " ", "used", " ", "whe", "n", " ", "sorting", " ", "lists", " ", "of", " ", "regions_", "\\u\\u\\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\\uNL\\u\\u\\u_", "###########", "######", "#", " ", "internal", " ", "use", " ", "only", " ", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\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_", "###########", "###", "#", " ", "set", " ", "SCREEN", " ", "as", " ", "primary", " ", "screen", " ", "at", " ", "start", "up", " ", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "use_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "upr", "int_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "args_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "e_", ",_", "str_", ")_", ":_", "print_", "e_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "print_", "e_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "args_", "[_", "-_", "1_", "]_", ",_", "str_", ")_", ":_", "print_", "args_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "print_", "args_", "[_", "-_", "1_", "]_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uni", "cd_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "uco", "de_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uco", "de_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "unicode_", "(_", "s_", ",_", "\"", "utf", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "jar_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "load_", "(_", "abspath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "abspath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "abspath_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "append_", "(_", "abspath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "load_", "(_", "jar_", ")_", ":_", "\\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_", "path_", "=_", "get", "Bun", "dle", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jar", "In", "Bundle_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "jar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "load_", "(_", "jar", "In", "Bundle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "Ext", "ensi", "on", "Manager_", "._", "get", "Instance_", "(_", ")_", "._", "get", "Load", "Path_", "(_", "jar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "and_", "\\u", "load_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Import", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Mod", "Path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Image", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "Path_", "._", "add_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Image", "Path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "e_", "._", "path", "Give", "n_", "for_", "e_", "in_", "Image", "Path_", "._", "get", "Paths_", "(_", ")_", "if_", "e_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Image", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "Path_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset", "Image", "Path_", "(_", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "get", "Bun", "dle", "Path_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Image", "Path_", "._", "reset_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Bun", "dle", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Image", "Path_", "._", "set", "Bun", "dle", "Path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bun", "dle", "Path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Image", "Path_", "._", "get", "Bun", "dle", "Path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Parent", "Path_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Image", "Path_", "._", "get", "Bun", "dle", "Parent", "Path_", "(_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Path_", "(_", "path1_", ",_", "path2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "isinstance_", "(_", "path2_", ",_", "List_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path1_", ",_", "path2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "path1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "path2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Show", "Actions_", "(_", "flag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Settings_", "._", "set", "Show", "Actions_", "(_", "flag_", ")_", "\\u\\u\\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_", "popup_", "(_", "msg_", ",_", "title_", "=_", "\"", "Si", "kul", "i", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Si", "kul", "i", "X_", "._", "popup_", "(_", "msg_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input_", "(_", "msg_", "=_", "\"\"_", ",_", "default_", "=_", "\"\"_", ",_", "title_", "=_", "\"\"_", ",_", "hidden_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "hidden_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Si", "kul", "i", "X_", "._", "input_", "(_", "msg_", ",_", "default_", ",_", "title_", ",_", "hidden_", ")_", "\\u\\u\\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_", "input", "Text_", "(_", "msg_", "=_", "\"\"_", ",_", "title_", "=_", "\"\"_", ",_", "lines_", "=_", "0_", ",_", "width_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Si", "kul", "i", "X_", "._", "input_", "(_", "msg_", ",_", "title_", ",_", "width_", ",_", "lines_", ")_", "\\u\\u\\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_", "capture_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "=_", "Scr", "een", "Union_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sim", "g_", "=_", "scr_", "._", "user", "Capture_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sim", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sim", "g_", "._", "get", "Filename_", "(_", ")_", "\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "builtin\\u\\u_", "._", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "is_", "types_", "._", "String", "Type_", "or_", "\\u\\u", "builtin\\u\\u_", "._", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "is_", "types_", "._", "Unic", "ode", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sim", "g_", "=_", "scr_", "._", "user", "Capture_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sim", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sim", "g_", "._", "get", "Filename_", "(_", ")_", "\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "scr_", "._", "capture_", "(_", "args_", "[_", "0_", "]_", ")_", "._", "get", "Filename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "scr_", "._", "capture_", "(_", "args_", "[_", "0_", "]_", ",_", "args_", "[_", "1_", "]_", ",_", "args_", "[_", "2_", "]_", ",_", "args_", "[_", "3_", "]_", ")_", "._", "get", "Filename_", "(_", ")_", "\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "Region_", "(_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "Scr", "een", "Union_", "(_", ")_", "._", "select", "Region_", "(_", "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 ", " _", "r_", "=_", "Scr", "een", "Union_", "(_", ")_", "._", "select", "Region_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Region_", "(_", "r_", ")_", "\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "use_", "(_", "scr_", "=_", "None_", ",_", "remote_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "remote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Globals_", "=_", "inspect_", "._", "currentframe_", "(_", ")_", "._", "f", "\\u", "back_", "._", "f", "\\u", "back_", "._", "f", "\\u", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Globals_", "=_", "inspect_", "._", "currentframe_", "(_", ")_", "._", "f", "\\u", "back_", "._", "f", "\\u", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "remote", "Screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "Screen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "Screen_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "Screen_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "scr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SCREEN", "_", "=_", "Screen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SCREEN", "_", "=_", "scr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"", "Jy", "tho", "n", ":", " ", "request", "ed", " ", "to", " ", "use", " ", "as", " ", "default", " ", "region", ":", " ", "\"_", "+_", "SCREEN", "_", "._", "to", "String", "Short_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globals_", "(_", ")_", "[_", "'", "SI", "KU", "LIS", "AV", "ED", "'_", "]_", "=_", "\\u", "expos", "e", "All", "Methods_", "(_", "SCREEN", "_", ",_", "globals_", "(_", ")_", "._", "get_", "(_", "'", "SI", "KU", "LIS", "AV", "ED", "'_", ")_", ",_", "the", "Globals_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "the", "Globals_", "[_", "'", "SCREEN", "'_", "]_", "=_", "SCREEN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "Screen_", "=_", "SCREEN", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "SCREEN", "_", "\\u\\u\\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_", "use", "Remote_", "(_", "adr", "_", ",_", "port_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "remote", "Screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "org_", "._", "si", "kul", "i_", "._", "script_", "._", "Scr", "een", "Remote_", "as_", "SR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SCREEN", "_", "=_", "SR_", "(_", "adr", "_", ",_", "str_", "(_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "SCREEN", "_", "._", "is", "Valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "use_", "(_", "SCREEN", "_", ",_", "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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "switch", "App_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "App_", "._", "focus_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "App_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "App_", "._", "open_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close", "App_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "App_", "._", "close_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sleep_", "(_", "sec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "sec_", ")_", "\\u\\u\\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_", "exit_", "(_", "code_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "remote", "Screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "Screen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "remote", "Screen_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "Screen_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Si", "kul", "i", "X_", "._", "clean", "Up_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Si", "kul", "i", "X_", "._", "run_", "(_", "cmd_", ")_", "\\u\\u\\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_", "she", "lp_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Si", "kul", "i", "Script_", "._", "she", "lp_", "(_", ")_", "\\u\\u\\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_", "by", "Distan", "ce", "To_", "(_", "x_", ",_", "y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "distance", " ", "of", " ", "thei", "r", " ", "top", " ", "left", ".", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "a", " ", "regions", " ", "top", " ", "left", " ", "to", " ", "the", " ", "give", "n", " ", "point", " ", "by", " ", "coordinate", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Distan", "ce", "Compara", "tor_", "(_", "x_", ",_", "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_", "by", "X_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "x", " ", "value", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Horiz", "onta", "l", "Compara", "tor_", "(_", ")_", "._", "compare_", "\\u\\u\\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_", "by", "Y_", "(_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "y", " ", "value", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Vertica", "l", "Compara", "tor_", "(_", ")_", "._", "compare_", "\\u\\u\\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_", "vertical", "Compara", "tor_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "y", " ", "value", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Vertica", "l", "Compara", "tor_", "(_", ")_", "._", "compare_", "\\u\\u\\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_", "horizon", "tal", "Compara", "tor_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "x", " ", "value", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Horiz", "onta", "l", "Compara", "tor_", "(_", ")_", "._", "compare_", "\\u\\u\\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_", "distance", "Compara", "tor_", "(_", "x_", ",_", "y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meth", "od", " ", "to", " ", "compare", " ", "two", " ", "Region", " ", "object", "s", " ", "by", " ", "distance", " ", "of", " ", "thei", "r", " ", "top", " ", "left", ".", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "a", " ", "regions", " ", "top", " ", "left", " ", "to", " ", "the", " ", "give", "n", " ", "point", " ", "by", " ", "coordinate", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Distan", "ce", "Compara", "tor_", "(_", "x_", ")_", "._", "compare_", "#", " ", "x", " ", "is", " ", "Region", " ", "or", " ", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Distan", "ce", "Compara", "tor_", "(_", "x_", ",_", "y_", ")_", "._", "compare_", "#", " ", "x", "/", "y", " ", "as", " ", "coordinates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mod", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "[_", "-_", "1_", "]_", "==_", "Settings_", "._", "get", "File", "Path", "Se", "perat", "or_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "path_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "path_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "expos", "e", "All", "Methods_", "(_", "any", "Object_", ",_", "saved_", ",_", "the", "Globals_", ",_", "exclu", "de", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "exclu", "de", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exclu", "de", "\\u", "list_", "=_", "[_", "'", "class", "'_", ",_", "'", "class", "Dict", "Ini", "t", "'_", ",_", "'", "clone", "'_", ",_", "'", "equals", "'_", ",_", "'", "finalize", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "Class", "'_", ",_", "'", "hash", "Code", "'_", ",_", "'", "notif", "y", "'_", ",_", "'", "notif", "y", "All", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "Global", "Coord", "'_", ",_", "'", "to", "String", "'_", ",_", "'", "get", "Locat", "ion", "Fro", "m", "PSR", "ML", "'_", ",_", "'", "get", "Region", "Fro", "m", "PSR", "M", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "captur", "e", "'_", ",_", "'", "select", "Region", "'_", ",_", "'", "create", "'_", ",_", "'", "observe", "In", "Back", "ground", "'_", ",_", "'", "wait", "All", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "Self", "'_", ",_", "'", "find", "No", "w", "'_", ",_", "'", "find", "All", "No", "w", "'_", ",_", "'", "get", "Event", "Manager", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "Match", "'_", ",_", "'", "last", "Match", "es", "'_", ",_", "'", "last", "Scr", "een", "Image", "'_", ",_", "'", "last", "Scr", "een", "Image", "File", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Deb", "ug", ".", "log", "(", "3", ",", " ", "\"", "Si", "kul", "i", ":", " ", "\\u", "expos", "e", "All", "Meth", "ods", ":", " ", "%", "s", " ", "call", "ed", " ", "from", ":", " ", "%", "s", "\",", " ", "any", "Object", ",", " ", "the", "Global", "s", "['", "\\u\\u", "name", "\\u\\u'", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tos", "ave_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "saved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "dir_", "(_", "any", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "exclu", "de", "\\u", "list_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "inspect_", "._", "isme", "thod", "_", "(_", "getattr_", "(_", "any", "Object_", ",_", "name_", ")_", ")_", ":_", "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\\uDEDENT\\u\\u\\u_", "if_", "name_", "[_", "0_", "]_", "!=_", "'\\u'_", "and_", "name_", "[_", ":_", "7_", "]_", "!=_", "'", "super", "\\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 ", " _", "saved_", "._", "remove_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tos", "ave_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "adde", "d", ":\"", ",", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "the", "Globals_", "[_", "name_", "]_", "=_", "eval_", "(_", "\"", "any", "Object", ".\"_", "+_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "check", "With", "'_", ":_", "Debug_", "._", "log_", "(_", "3_", ",_", "\"%", "s", " ", "%", "s", "\"_", ",_", "name_", ",_", "str_", "(_", "dict_", "[_", "name_", "]_", ")_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "saved_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "the", "Globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "remove", "d", ":\"", ",", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "the", "Globals_", "._", "pop_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tos", "ave_", "\\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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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 ]
Except block handles 'BaseException'
kuri65536/python-for-android/python-modules/twisted/twisted/words/protocols/irc.py
[ { "content": " def handleCommand(self, command, prefix, params):\n \"\"\"\n Determine the function to call for the given command and call it with\n the given arguments.\n \"\"\"\n method = getattr(self, \"irc_%s\" % command, None)\n try:\n if method is not None:\n method(prefix, params)\n else:\n self.irc_unknown(prefix, command, params)\n except:\n log.deferr()", "metadata": "root.IRC.handleCommand", "header": "['class', 'IRC', '(', 'protocol', '.', 'Protocol', ')', ':', '___EOS___']", "index": 309 }, { "content": " def handleCommand(self, command, prefix, params):\n \"\"\"Determine the function to call for the given command and call\n it with the given arguments.\n \"\"\"\n method = getattr(self, \"irc_%s\" % command, None)\n try:\n if method is not None:\n method(prefix, params)\n else:\n self.irc_unknown(prefix, command, params)\n except:\n log.deferr()", "metadata": "root.IRCClient.handleCommand", "header": "['class', 'IRCClient', '(', 'basic', '.', 'LineReceiver', ')', ':', '___EOS___']", "index": 2321 }, { "content": "def fileSize(file):\n \"\"\"I'll try my damndest to determine the size of this file object.\n \"\"\"\n size = None\n if hasattr(file, \"fileno\"):\n fileno = file.fileno()\n try:\n stat_ = os.fstat(fileno)\n size = stat_[stat.ST_SIZE]\n except:\n pass\n else:\n return size\n\n if hasattr(file, \"name\") and path.exists(file.name):\n try:\n size = path.getsize(file.name)\n except:\n pass\n else:\n return size\n\n if hasattr(file, \"seek\") and hasattr(file, \"tell\"):\n try:\n try:\n file.seek(0, 2)\n size = file.tell()\n finally:\n file.seek(0, 0)\n except:\n pass\n else:\n return size\n\n return size", "metadata": "root.fileSize", "header": "['module', '___EOS___']", "index": 2450 } ]
[ { "span": "except:", "start_line": 320, "start_column": 8, "end_line": 320, "end_column": 15 }, { "span": "except:", "start_line": 2331, "start_column": 8, "end_line": 2331, "end_column": 15 }, { "span": "except:", "start_line": 2459, "start_column": 8, "end_line": 2459, "end_column": 15 }, { "span": "except:", "start_line": 2467, "start_column": 8, "end_line": 2467, "end_column": 15 }, { "span": "except:", "start_line": 2479, "start_column": 8, "end_line": 2479, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "IR", "C_", "(_", "protocol_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Command_", "(_", "self_", ",_", "command_", ",_", "prefix_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", " ", "the", " ", "function", " ", "to", " ", "call", " ", "for", " ", "the", " ", "give", "n", " ", "command", " ", "and", " ", "call", " ", "it", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "getattr_", "(_", "self_", ",_", "\"", "irc", "\\u", "%", "s", "\"_", "%_", "command_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "(_", "prefix_", ",_", "params_", ")_", "\\u\\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_", "._", "irc", "\\u", "unknown_", "(_", "prefix_", ",_", "command_", ",_", "params_", ")_", "\\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 ", " _", "log_", "._", "defer", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IR", "CC", "lient_", "(_", "basic_", "._", "Line", "Receiver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Command_", "(_", "self_", ",_", "command_", ",_", "prefix_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "the", " ", "function", " ", "to", " ", "call", " ", "for", " ", "the", " ", "give", "n", " ", "command", " ", "and", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "with", " ", "the", " ", "give", "n", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "getattr_", "(_", "self_", ",_", "\"", "irc", "\\u", "%", "s", "\"_", "%_", "command_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "(_", "prefix_", ",_", "params_", ")_", "\\u\\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_", "._", "irc", "\\u", "unknown_", "(_", "prefix_", ",_", "command_", ",_", "params_", ")_", "\\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 ", " _", "log_", "._", "defer", "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_", "def_", "file", "Size_", "(_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "I", "'", "ll", " ", "try", " ", "my", " ", "dam", "nde", "st", " ", "to", " ", "dete", "rmin", "e", " ", "the", " ", "size", " ", "of", " ", "this", " ", "file", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "file_", ",_", "\"", "filen", "o", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fileno_", "=_", "file_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stat", "\\u_", "=_", "os_", "._", "fsta", "t_", "(_", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "stat", "\\u_", "[_", "stat_", "._", "ST", "\\u", "SIZE_", "]_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "file_", ",_", "\"", "name", "\"_", ")_", "and_", "path_", "._", "exists_", "(_", "file_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "path_", "._", "getsize_", "(_", "file_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "file_", ",_", "\"", "seek", "\"_", ")_", "and_", "hasattr_", "(_", "file_", ",_", "\"", "tell", "\"_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file_", "._", "seek_", "(_", "0_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "file_", "._", "tell_", "(_", ")_", "\\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 ", " _", "file_", "._", "seek_", "(_", "0_", ",_", "0_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "size_", "\\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,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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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
goFrendiAsgard/kokoropy/kokoropy/model.py
[ { "content": " def assign_from_dict(self, variable):\n for column_name in self._automatic_assigned_column:\n if column_name in self._get_actual_column_names():\n column_type = self._get_actual_column_type(column_name)\n if column_name in variable and variable[column_name] != '':\n value = variable[column_name]\n if self.is_coltype_match(column_name, Upload): # upload\n value = value.filename if hasattr(value,'filename') else None\n elif isinstance(column_type, Date): # date\n if value != '' and value is not None:\n y,m,d = value.split('-')\n y,m,d = int(y), int(m), int(d)\n value = datetime.date(y,m,d)\n else:\n value = None\n elif isinstance(column_type, DateTime): # datetime\n if value != '' and value is not None:\n date_part, time_part = value.split(' ')\n y,m,d = date_part.split('-')\n h,i,s = time_part.split(':')\n y,m,d = int(y), int(m), int(d)\n h,i,s = int(h), int(i), int(s)\n value = datetime.datetime(y,m,d,h,i,s)\n else:\n value = None\n elif isinstance(column_type, Boolean):\n if value == '0':\n value = False\n else:\n value = True\n if value is not None:\n value = decode_string(value)\n setattr(self, column_name, value)\n elif column_name in self._get_relation_names():\n relation_metadata = self._get_relation_metadata(column_name)\n # one to many\n if relation_metadata.uselist:\n ref_class = self._get_relation_class(column_name)\n\n ref_obj = ref_class()\n # determine if the model is ordered\n is_ordered = isinstance(ref_obj, Ordered_DB_Model)\n # custom_label and shown column\n custom_label = self.__detail_column_label__[column_name]\\\n if column_name in self.__detail_column_label__ else {}\n shown_column = self._get_detail_column_list(column_name)\n\n # if only one column to be shown and it is a relationship\n if len(shown_column) == 1 and shown_column[0] in ref_obj._get_relation_names():\n list_val = [] # value from variable\n list_lookup = [] # lookup (from list_val)\n list_old = [] # old lookup value (from database)\n relation_value = [] # old relation value (from database)\n lookup_class = ref_obj._get_relation_class(shown_column[0])\n # get list value\n variable_key = column_name + '[]'\n if hasattr(variable, 'getall') and variable_key in variable: \n list_val = variable.getall(variable_key)\n # get list_lookup based on list_val \n for val in list_val:\n list_lookup.append(lookup_class.find(val))\n # get old relation_value\n relation_value = self._get_relation_value(column_name)\n # if old_val not in list_lookup, delete it\n for child in relation_value:\n old_val = getattr(child, shown_column[0])\n list_old.append(old_val)\n # delete\n if old_val not in list_lookup:\n if child in getattr(self, column_name):\n getattr(self, column_name).remove(child)\n child.trash()\n # edit if is_ordered\n elif is_ordered:\n for index, val in enumerate(list_lookup):\n if old_val == val:\n child._index = index + 1\n break\n # if list_lookup not in old_val.shown_column[0], add it, set index if is_ordered\n for index, val in enumerate(list_lookup):\n if val not in list_old:\n param = {shown_column[0] : val}\n if is_ordered:\n param['_index'] = index + 1\n new_record = ref_class(**param)\n getattr(self, column_name).append(new_record)\n # else, it must be tabular \n else:\n # one to many\n old_id_list = [] # old id from database \n deleted_list = [] # deleted id from variable (form)\n relation_variable_list = [] # from variable (form)\n index_list = [] # indexes from variable (form)\n record_count = 0 # total record count (from variable)\n # by default bottle request doesn't automatically accept \n # POST with [] name\n for variable_key in variable:\n if hasattr(variable, 'getall') and variable_key[0:len(column_name)] == column_name and variable_key[-2:] == '[]':\n # get list value\n list_val = variable.getall(variable_key) \n # make list of dictionary (as much as needed)\n while record_count < len(list_val):\n relation_variable_list.append({})\n record_count +=1\n new_variable_key = variable_key[len(column_name)+1:-2]\n for i in xrange(record_count):\n relation_variable_list[i][new_variable_key] = list_val[i]\n # special variables\n if hasattr(variable, 'getall'):\n old_id_list = variable.getall('_' + column_name + '_id[]')\n deleted_list = variable.getall('_' + column_name + '_delete[]')\n if issubclass(ref_class, Ordered_DB_Model):\n index_list = variable.getall('_' + column_name + '_index[]')\n # get relation\n relation_value = self._get_relation_value(column_name)\n for i in xrange(record_count):\n old_id = old_id_list[i]\n deleted = deleted_list[i] == \"1\"\n relation_variable = relation_variable_list[i]\n if is_ordered:\n index = index_list[i]\n ref_obj = None\n for child in relation_value:\n if isinstance(child, DB_Model):\n if child.id == old_id:\n ref_obj = child\n ref_obj.assign_from_dict(relation_variable)\n break\n if ref_obj is None:\n ref_obj = ref_class()\n ref_obj.assign_from_dict(relation_variable)\n getattr(self, column_name).append(ref_obj)\n if is_ordered:\n ref_obj._index = index\n if deleted:\n if ref_obj in getattr(self, column_name):\n getattr(self, column_name).remove(ref_obj)\n ref_obj.trash()\n else:\n # many to one\n if column_name in variable and variable[column_name] != '':\n value = variable[column_name]\n if value != '':\n ref_class = self._get_relation_class(column_name)\n value = ref_class.find(value)\n setattr(self, column_name, value)", "metadata": "root.DB_Model.assign_from_dict", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 808 }, { "content": " @_db_operation_method \n def save(self, already_saved_object = []):\n # is it insert or update?\n inserting = False\n if self._real_id is None:\n inserting = True\n # before insert\n if self.success:\n self.before_insert()\n # insert\n if self.success:\n self.session.add(self)\n else:\n #before update\n if self.success:\n self.before_update()\n # before save\n if self.success:\n self.before_save()\n # also upload the file\n if self.success:\n for column_name in self._get_actual_column_names(): \n colmetadata = self._get_actual_column_metadata(column_name)\n upload = request.files.get(column_name)\n if self.is_coltype_match(column_name, Upload) and upload is not None:\n save_uploaded_asset(column_name, path='uploads', application_name = self.__application_name__)\n setattr(self, column_name, upload.filename)\n # save\n if self.success:\n self.session.commit()\n # generate id if not exists and re-save\n if self.success:\n if self.id is None:\n self.generate_id()\n self.session.commit()\n # after insert, after update and after save\n if self.success:\n if inserting:\n self.after_insert()\n else:\n self.after_update()\n if self.success:\n self.after_save()\n if self.success:\n # don't save the same object twice, it will make endless recursive\n already_saved_object.append(self)\n # also trigger save of relation\n self._save_detail(already_saved_object)", "metadata": "root.DB_Model.save", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 1091 }, { "content": " def _build_many_to_one_input(self, column_name, **kwargs):\n value = getattr(self, column_name) \\\n if hasattr(self, column_name) and getattr(self, column_name) is not None \\\n else ''\n kwargs = self._build_input_attribute(column_name, kwargs)\n tabular = kwargs.pop('tabular', False)\n input_attribute = kwargs.pop('input_attribute', {})\n input_name = input_attribute.pop('name')\n input_id = input_attribute.pop('id')\n input_class = input_attribute.pop('class')\n # assemble input_selector\n input_selector = '#' + input_id\n if input_class != '':\n input_selector += '.' + input_class\n # many to one\n ref_class = self._get_relation_class(column_name)\n option_obj = ref_class.get()\n option_count = ref_class.count()\n input_element = ''\n if option_count == 0:\n input_element += 'No option available'\n else:\n input_selector += '.form-control._chosen'\n options = {'': 'None'}\n for obj in option_obj:\n if isinstance(obj, DB_Model):\n options[obj.id] = obj.as_text()\n value = value.id if hasattr(value,'id') else ''\n input_element = HTML.select(input_selector, input_name, options, value)\n # add mutator\n self.generated_css.append(base_url('assets/chosen/chosen.min.css'))\n self.generated_js.append(base_url('assets/chosen/chosen.jquery.min.js'))\n self.generated_js += self._mutator_js('chosen', \n '$(\"._chosen\").chosen();'\n )\n return input_element", "metadata": "root.DB_Model._build_many_to_one_input", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 1284 }, { "content": " def _build_column_input(self, column_name, **kwargs):\n value = getattr(self, column_name) \\\n if hasattr(self, column_name) and getattr(self, column_name) is not None \\\n else ''\n kwargs = self._build_input_attribute(column_name, kwargs)\n tabular = kwargs.pop('tabular', False)\n input_attribute = kwargs.pop('input_attribute', {})\n input_name = input_attribute.pop('name')\n input_id = input_attribute.pop('id')\n input_class = input_attribute.pop('class')\n # assemble input_selector\n input_selector = '#' + input_id\n if input_class != '':\n input_selector += '.' + input_class\n # get placeholder\n placeholder = self.build_label(column_name, **kwargs)\n input_element = ''\n # check type\n actual_column_type = self._get_actual_column_type(column_name)\n # get metadata and coltype\n colmetadata = self._get_actual_column_metadata(column_name)\n coltype = colmetadata._coltype\n # Option\n if self.is_coltype_match(column_name, Option):\n input_selector += '.form-control._chosen'\n if coltype.multiple:\n value = value.split(', ')\n input_element = HTML.select(input_selector, input_name, coltype.options, value, coltype.multiple)\n # add mutator\n self.generated_css.append(base_url('assets/chosen/chosen.min.css'))\n self.generated_js.append(base_url('assets/chosen/chosen.jquery.min.js'))\n self.generated_js += self._mutator_js('chosen', \n '$(\"._chosen\").chosen();'\n )\n # Upload\n elif self.is_coltype_match(column_name, Upload):\n input_selector += '._file-input'\n input_element = HTML.div(self.build_representation(column_name)) if value is not None else ''\n input_element += HTML.input_file(input_selector, input_name)\n # add mutator script\n self.generated_js.append(base_url('assets/jquery-ui-bootstrap/third-party/jQuery-UI-FileInput/js/enhance.min.js'))\n self.generated_js.append(base_url('assets/jquery-ui-bootstrap/third-party/jQuery-UI-FileInput/js/fileinput.jquery.js'))\n self.generated_js += self._mutator_js('file_input', \n '$(\"._file-input:not(._mutated)\").customFileInput({button_position : \"right\"});' +\\\n '$(\"._file-input\").addClass(\"_mutated\");'\n )\n # RichText\n elif self.is_coltype_match(column_name, RichText):\n input_selector += '.form-control._richtext-textarea'\n input_element = HTML.textarea(input_selector, input_name, value, placeholder)\n # add mutator script\n self.generated_js.append(base_url('assets/ckeditor/ckeditor.js'))\n self.generated_js.append(base_url('assets/ckeditor/adapters/jquery.js'))\n self.generated_js += self._mutator_js('richtext_textarea', \n '$(\"._richtext-textarea\").ckeditor();'\n )\n # Code\n elif self.is_coltype_match(column_name, Code):\n theme = self.get_coltype_attr(column_name, 'theme', 'monokai')\n language = self.get_coltype_attr(column_name, 'language', 'python')\n input_selector += '.form-control._code-textarea._code_' + language + '_' + theme\n input_element = HTML.textarea(input_selector, input_name, value, placeholder)\n # add mutator script\n self.generated_js.append(base_url('assets/jquery-ace/ace/ace.js'))\n self.generated_js.append(base_url('assets/jquery-ace/ace/theme-' + theme + '.js'))\n self.generated_js.append(base_url('assets/jquery-ace/ace/mode-' + language + '.js'))\n self.generated_js.append(base_url('assets/jquery-ace/jquery-ace.min.js'))\n self.generated_js += self._mutator_js('code_' + language + '_' + theme + '_textarea',\n '$(\"._code_' + language + '_' + theme + '\").ace({' +\\\n ' theme: \"' + theme + '\",' +\\\n ' lang: \"' + language + '\",' +\\\n '});'+\\\n '$(\"._code_' + language + '_' + theme + '\").each(function(){' +\\\n ' var ace = $(this).data(\"ace\").editor.ace;' +\\\n ' ace.setOptions({\"minLines\": 5, \"maxLines\": 30, \"fontSize\": 16});' +\\\n '});'\n )\n # Password\n elif self.is_coltype_match(column_name, Password):\n input_selector += '.form-control'\n input_element = HTML.input_password(input_selector, input_name, value, placeholder) \n # Boolean\n elif isinstance(actual_column_type, Boolean):\n input_element = HTML.input_hidden(input_name, 0) +\\\n HTML.input_checkbox(input_selector, input_name, 1, bool(value))\n # Text\n elif isinstance(actual_column_type, Text):\n input_selector += '.form-control._autosize-textarea'\n input_element = HTML.textarea(input_selector, input_name, value, placeholder)\n # add mutator script\n self.generated_js.append(base_url('assets/autosize/jquery.autosize.min.js'))\n self.generated_js += self._mutator_js('autosize_textarea', \n '$(\"._autosize-textarea\").autosize();'\n )\n # Others (Date, Integer, and normal string)\n else:\n value = str(encode_string(value))\n # DateTime\n if isinstance(actual_column_type, DateTime):\n input_selector += '.form-control._datetime-input'\n # add mutator script\n self.generated_js.append(base_url('assets/jquery-ui-timepicker-addon.js'))\n self.generated_js += self._mutator_js('datetime_input',\n '$(\"._datetime-input\").datetimepicker({' +\\\n ' defaultDate: null,'+\\\n ' changeMonth: true,'+\\\n ' changeYear: true,'+\\\n ' numberOfMonths: 1,'+\\\n ' dateFormat: \"yy-mm-dd\",'+\\\n ' timeFormat: \"HH:mm:ss\",'+\\\n ' yearRange: \"c-50:c+50\",'+\\\n '});'\n )\n # Date\n elif isinstance(actual_column_type, Date):\n input_selector += '.form-control._date-input'\n # add mutator script\n self.generated_js += self._mutator_js('date_input', \n '$(\"._date-input\").datepicker({' +\\\n ' defaultDate: null,'+\\\n ' changeMonth: true,'+\\\n ' changeYear: true,'+\\\n ' numberOfMonths: 1,'+\\\n ' dateFormat: \"yy-mm-dd\",'+\\\n ' yearRange: \"c-50:c+50\",'+\\\n '});'\n )\n # Integer\n elif isinstance(actual_column_type, Integer):\n input_selector += '._integer-input'\n value = '0' if value == '' else value\n # add mutator script\n self.generated_js += self._mutator_js('integer_input', \n '$(\"._integer-input\").spinner();'\n )\n # Normal String\n else: \n input_selector += '.form-control'\n\n # generate input element\n input_element = HTML.input_text(input_selector, input_name, value, placeholder)\n\n return input_element", "metadata": "root.DB_Model._build_column_input", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 1536 }, { "content": " def _build_column_representation(self, column_name, **kwargs):\n # get value \n value = getattr(self, column_name) if hasattr(self, column_name) else None\n if self.is_coltype_match(column_name, RichText):\n input_selector = '#_field_' + column_name + '.form-control._richtext-textarea'\n value = '' if value is None else value\n value = HTML.textarea(input_selector, '', value)\n # add mutator script\n self.generated_js.append(base_url('assets/ckeditor/ckeditor.js'))\n self.generated_js.append(base_url('assets/ckeditor/adapters/jquery.js'))\n self.generated_js += self._mutator_js('richtext_textarea', \n '$(\"._richtext-textarea\").ckeditor({readOnly:true});'\n )\n # Code\n elif self.is_coltype_match(column_name, Code):\n theme = self.get_coltype_attr(column_name, 'theme', 'monokai')\n language = self.get_coltype_attr(column_name, 'language', 'python')\n input_selector = '.form-control._code-textarea._code_' + language + '_' + theme\n value = '' if value is None else value\n value = HTML.textarea(input_selector, '', value)\n # add mutator script\n self.generated_js.append(base_url('assets/jquery-ace/ace/ace.js'))\n self.generated_js.append(base_url('assets/jquery-ace/ace/theme-' + theme + '.js'))\n self.generated_js.append(base_url('assets/jquery-ace/ace/mode-' + language + '.js'))\n self.generated_js.append(base_url('assets/jquery-ace/jquery-ace.min.js'))\n self.generated_js += self._mutator_js('code_' + language + '_' + theme + '_textarea',\n '$(\"._code_' + language + '_' + theme + '\").ace({' +\\\n ' theme: \"' + theme + '\",' +\\\n ' lang: \"' + language + '\",' +\\\n '});'+\\\n '$(\"._code_' + language + '_' + theme + '\").each(function(){' +\\\n ' var ace = $(this).data(\"ace\").editor.ace;' +\\\n ' ace.setOptions({\"minLines\": 5, \"maxLines\": 30, \"fontSize\": 16});' +\\\n ' ace.setReadOnly(true);' +\\\n '});'\n )\n elif isinstance(value, unicode) or isinstance(value, str):\n value = HTML.presented_html_code(value)\n colmetadata = self._get_actual_column_metadata(column_name)\n if value is None:\n value = 'Not available'\n elif self.is_coltype_match(column_name, Upload):\n # get inner value\n if self.is_coltype_attr_match(column_name, 'is_image', True):\n inner_html = HTML.img(\n base_url(self.__application_name__+ '/assets/uploads/' + value),\n style = 'max-width:100px;'\n )\n else:\n inner_html = value\n # generate link if necessary\n if self.is_list_state():\n value = inner_html\n else:\n value = HTML.a(\n base_url(self.__application_name__ + '/assets/uploads/' + value),\n inner_html,\n target = 'blank'\n )\n return value", "metadata": "root.DB_Model._build_column_representation", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 1793 }, { "content": " def _include_default_resource(self):\n base_url = base_url()\n self._generated_js.append_compiled(asset.JQUI_BOOTSTRAP_SCRIPT)\n self._generated_js.append_compiled(asset.KOKORO_CRUD_SCRIPT)\n self._generated_css.append_compiled(asset.JQUI_BOOTSTRAP_STYLE)\n self._generated_css.append_compiled(asset.KOKORO_CRUD_STYLE)", "metadata": "root.DB_Model._include_default_resource", "header": "['class', 'DB_Model', '(', 'Base', ')', ':', '___EOS___']", "index": 1893 } ]
[ { "span": "custom_label ", "start_line": 851, "start_column": 20, "end_line": 851, "end_column": 32 }, { "span": "colmetadata ", "start_line": 1113, "start_column": 16, "end_line": 1113, "end_column": 27 }, { "span": "tabular ", "start_line": 1289, "start_column": 8, "end_line": 1289, "end_column": 15 }, { "span": "tabular ", "start_line": 1541, "start_column": 8, "end_line": 1541, "end_column": 15 }, { "span": "colmetadata ", "start_line": 1831, "start_column": 8, "end_line": 1831, "end_column": 19 }, { "span": "base_url ", "start_line": 1894, "start_column": 8, "end_line": 1894, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assign", "\\u", "from", "\\u", "dict_", "(_", "self_", ",_", "variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "column", "\\u", "name_", "in_", "self_", "._", "\\u", "automati", "c\\u", "assign", "ed", "\\u", "column_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "column", "\\u", "name_", "in_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "column", "\\u", "type_", "=_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "type_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "column", "\\u", "name_", "in_", "variable_", "and_", "variable_", "[_", "column", "\\u", "name_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "variable_", "[_", "column", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Upload_", ")_", ":_", "#", " ", "upload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "value_", "._", "filename_", "if_", "hasattr_", "(_", "value_", ",_", "'", "filename", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "column", "\\u", "type_", ",_", "Date_", ")_", ":_", "#", " ", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "value_", "!=_", "''_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "y_", ",_", "m_", ",_", "d_", "=_", "value_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", ",_", "m_", ",_", "d_", "=_", "int_", "(_", "y_", ")_", ",_", "int_", "(_", "m_", ")_", ",_", "int_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "datetime_", "._", "date_", "(_", "y_", ",_", "m_", ",_", "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 ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "column", "\\u", "type_", ",_", "Date", "Time_", ")_", ":_", "#", " ", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "value_", "!=_", "''_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "date", "\\u", "part_", ",_", "time", "\\u", "part_", "=_", "value_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", ",_", "m_", ",_", "d_", "=_", "date", "\\u", "part_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "i_", ",_", "s_", "=_", "time", "\\u", "part_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", ",_", "m_", ",_", "d_", "=_", "int_", "(_", "y_", ")_", ",_", "int_", "(_", "m_", ")_", ",_", "int_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", ",_", "i_", ",_", "s_", "=_", "int_", "(_", "h_", ")_", ",_", "int_", "(_", "i_", ")_", ",_", "int_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "datetime_", "._", "datetime_", "(_", "y_", ",_", "m_", ",_", "d_", ",_", "h_", ",_", "i_", ",_", "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 ", " ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "column", "\\u", "type_", ",_", "Boolean_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "value_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "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 ", " ", " _", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "decode", "\\u", "string_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "column", "\\u", "name_", "in_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relation", "\\u", "metadata_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "metadata_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "one", " ", "to", " ", "many_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "relation", "\\u", "metadata_", "._", "usel", "ist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ref", "\\u", "class_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "class_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "\\u", "obj_", "=_", "ref", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "if", " ", "the", " ", "model", " ", "is", " ", "ordered_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "ordered_", "=_", "isinstance_", "(_", "ref", "\\u", "obj_", ",_", "Order", "ed", "\\u", "DB", "\\u", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "custom", "\\u", "label", " ", "and", " ", "shown", " ", "column_", "\\u\\u\\uNL\\u\\u\\u_", "custom", "\\u", "label_", "=_", "self_", "._", "\\u\\u", "deta", "il", "\\u", "column", "\\u", "label", "\\u\\u_", "[_", "column", "\\u", "name_", "]_", "if_", "column", "\\u", "name_", "in_", "self_", "._", "\\u\\u", "deta", "il", "\\u", "column", "\\u", "label", "\\u\\u_", "else_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shown", "\\u", "column_", "=_", "self_", "._", "\\u", "get", "\\u", "deta", "il", "\\u", "column", "\\u", "list_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "only", " ", "one", " ", "column", " ", "to", " ", "be", " ", "shown", " ", "and", " ", "it", " ", "is", " ", "a", " ", "relationship_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "shown", "\\u", "column_", ")_", "==_", "1_", "and_", "shown", "\\u", "column_", "[_", "0_", "]_", "in_", "ref", "\\u", "obj_", "._", "\\u", "get", "\\u", "relation", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "list", "\\u", "val_", "=_", "[_", "]_", "#", " ", "value", " ", "from", " ", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "lookup_", "=_", "[_", "]_", "#", " ", "look", "up", " ", "(", "from", " ", "list", "\\u", "val", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "old_", "=_", "[_", "]_", "#", " ", "old", " ", "look", "up", " ", "value", " ", "(", "from", " ", "databa", "se", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "\\u", "value_", "=_", "[_", "]_", "#", " ", "old", " ", "relation", " ", "value", " ", "(", "from", " ", "databa", "se", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "look", "up", "\\u", "class_", "=_", "ref", "\\u", "obj_", "._", "\\u", "get", "\\u", "relation", "\\u", "class_", "(_", "shown", "\\u", "column_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "variab", "le", "\\u", "key_", "=_", "column", "\\u", "name_", "+_", "'[]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "variable_", ",_", "'", "geta", "ll", "'_", ")_", "and_", "variab", "le", "\\u", "key_", "in_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "list", "\\u", "val_", "=_", "variable_", "._", "geta", "ll_", "(_", "variab", "le", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "list", "\\u", "look", "up", " ", "based", " ", "on", " ", "list", "\\u", "val", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "list", "\\u", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "list", "\\u", "lookup_", "._", "append_", "(_", "look", "up", "\\u", "class_", "._", "find_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "old", " ", "relation", "\\u", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "relation", "\\u", "value_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "value_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "old", "\\u", "val", " ", "not", " ", "in", " ", "list", "\\u", "look", "up", ",", " ", "delete", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "child_", "in_", "relation", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "val_", "=_", "getattr_", "(_", "child_", ",_", "shown", "\\u", "column_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "old_", "._", "append_", "(_", "old", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "old", "\\u", "val_", "not_", "in_", "list", "\\u", "lookup_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "child_", "in_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "._", "remove_", "(_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child_", "._", "trash", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "edit", " ", "if", " ", "is", "\\u", "ordered_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "ordered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "index_", ",_", "val_", "in_", "enumerate_", "(_", "list", "\\u", "lookup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "old", "\\u", "val_", "==_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "child_", "._", "\\u", "index_", "=_", "index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "list", "\\u", "look", "up", " ", "not", " ", "in", " ", "old", "\\u", "val", ".", "shown", "\\u", "column", "[", "0", "],", " ", "add", " ", "it", ",", " ", "set", " ", "index", " ", "if", " ", "is", "\\u", "ordered_", "\\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_", "for_", "index_", ",_", "val_", "in_", "enumerate_", "(_", "list", "\\u", "lookup_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "val_", "not_", "in_", "list", "\\u", "old_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "=_", "{_", "shown", "\\u", "column_", "[_", "0_", "]_", ":_", "val_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "ordered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "param_", "[_", "'\\u", "index", "'_", "]_", "=_", "index_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "record_", "=_", "ref", "\\u", "class_", "(_", "**_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "._", "append_", "(_", "new", "\\u", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", ",", " ", "it", " ", "must", " ", "be", " ", "tabular", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "one", " ", "to", " ", "many_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "id", "\\u", "list_", "=_", "[_", "]_", "#", " ", "old", " ", "id", " ", "from", " ", "databa", "se", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "list_", "=_", "[_", "]_", "#", " ", "delete", "d", " ", "id", " ", "from", " ", "variab", "le", " ", "(", "form", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "\\u", "variab", "le", "\\u", "list_", "=_", "[_", "]_", "#", " ", "from", " ", "variab", "le", " ", "(", "form", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "list_", "=_", "[_", "]_", "#", " ", "indexe", "s", " ", "from", " ", "variab", "le", " ", "(", "form", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "count_", "=_", "0_", "#", " ", "total", " ", "record", " ", "count", " ", "(", "from", " ", "variab", "le", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", " ", "default", " ", "bottle", " ", "request", " ", "doe", "sn", "'", "t", " ", "automati", "call", "y", " ", "accept", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POST", " ", "with", " ", "[]", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "variab", "le", "\\u", "key_", "in_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "hasattr_", "(_", "variable_", ",_", "'", "geta", "ll", "'_", ")_", "and_", "variab", "le", "\\u", "key_", "[_", "0_", ":_", "len_", "(_", "column", "\\u", "name_", ")_", "]_", "==_", "column", "\\u", "name_", "and_", "variab", "le", "\\u", "key_", "[_", "-_", "2_", ":_", "]_", "==_", "'[]'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "list", "\\u", "val_", "=_", "variable_", "._", "geta", "ll_", "(_", "variab", "le", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "list", " ", "of", " ", "dictionar", "y", " ", "(", "as", " ", "muc", "h", " ", "as", " ", "need", "ed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "record", "\\u", "count_", "<_", "len_", "(_", "list", "\\u", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "relation", "\\u", "variab", "le", "\\u", "list_", "._", "append_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "variab", "le", "\\u", "key_", "=_", "variab", "le", "\\u", "key_", "[_", "len_", "(_", "column", "\\u", "name_", ")_", "+_", "1_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "record", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "relation", "\\u", "variab", "le", "\\u", "list_", "[_", "i_", "]_", "[_", "new", "\\u", "variab", "le", "\\u", "key_", "]_", "=_", "list", "\\u", "val_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "special", " ", "variables_", "\\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_", "hasattr_", "(_", "variable_", ",_", "'", "geta", "ll", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "id", "\\u", "list_", "=_", "variable_", "._", "geta", "ll_", "(_", "'\\u'_", "+_", "column", "\\u", "name_", "+_", "'\\u", "id", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "d\\u", "list_", "=_", "variable_", "._", "geta", "ll_", "(_", "'\\u'_", "+_", "column", "\\u", "name_", "+_", "'\\u", "delete", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "issubclass_", "(_", "ref", "\\u", "class_", ",_", "Order", "ed", "\\u", "DB", "\\u", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index", "\\u", "list_", "=_", "variable_", "._", "geta", "ll_", "(_", "'\\u'_", "+_", "column", "\\u", "name_", "+_", "'\\u", "index", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "relation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "relation", "\\u", "value_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "value_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "record", "\\u", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "old", "\\u", "id_", "=_", "old", "\\u", "id", "\\u", "list_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "delete", "d\\u", "list_", "[_", "i_", "]_", "==_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation", "\\u", "variable_", "=_", "relation", "\\u", "variab", "le", "\\u", "list_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "ordered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index_", "=_", "index", "\\u", "list_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "\\u", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "relation", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "child_", ",_", "DB", "\\u", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "child_", "._", "id_", "==_", "old", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "ref", "\\u", "obj_", "=_", "child_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "obj_", "._", "assign", "\\u", "from", "\\u", "dict_", "(_", "relation", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ref", "\\u", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "\\u", "obj_", "=_", "ref", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "\\u", "obj_", "._", "assign", "\\u", "from", "\\u", "dict_", "(_", "relation", "\\u", "variable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "._", "append_", "(_", "ref", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "ordered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "\\u", "obj_", "._", "\\u", "index_", "=_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "deleted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "ref", "\\u", "obj_", "in_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "._", "remove_", "(_", "ref", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "\\u", "obj_", "._", "trash", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "many", " ", "to", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "column", "\\u", "name_", "in_", "variable_", "and_", "variable_", "[_", "column", "\\u", "name_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "variable_", "[_", "column", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ref", "\\u", "class_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "class_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "ref", "\\u", "class_", "._", "find_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "\\u", "db", "\\u", "operati", "on", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "alr", "ead", "y", "\\u", "saved", "\\u", "object_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", " ", "it", " ", "insert", " ", "or", " ", "update", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "real", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insert", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bef", "ore", " ", "insert_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bef", "ore", "\\u", "insert_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "add_", "(_", "self_", ")_", "\\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_", "#", "bef", "ore", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bef", "ore", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bef", "ore", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bef", "ore", "\\u", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "als", "o", " ", "upload", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "column", "\\u", "name_", "in_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "metadata_", "=_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "metadata_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload_", "=_", "request_", "._", "files_", "._", "get_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Upload_", ")_", "and_", "upload_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "save", "\\u", "uploade", "d\\u", "asset_", "(_", "column", "\\u", "name_", ",_", "path_", "=_", "'", "uploads", "'_", ",_", "applica", "tion", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "applica", "tion", "\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "upload_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "save_", "\\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_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "id", " ", "if", " ", "not", " ", "exist", "s", " ", "and", " ", "re", "-", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "generat", "e\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "after", " ", "insert", ",", " ", "after", " ", "update", " ", "and", " ", "after", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "insert", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "after", "\\u", "insert_", "(_", ")_", "\\u\\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_", "._", "after", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "after", "\\u", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "save", " ", "the", " ", "same", " ", "object", " ", "twi", "ce", ",", " ", "it", " ", "will", " ", "make", " ", "endl", "ess", " ", "recursive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alr", "ead", "y", "\\u", "saved", "\\u", "object_", "._", "append_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "als", "o", " ", "trigger", " ", "save", " ", "of", " ", "relation_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "detail_", "(_", "alr", "ead", "y", "\\u", "saved", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "many", "\\u", "to", "\\u", "one", "\\u", "input_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "if_", "hasattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "and_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "self_", "._", "\\u", "build", "\\u", "input", "\\u", "attribute_", "(_", "column", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tabular", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "tabular", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "attribute_", "=_", "kwargs_", "._", "pop_", "(_", "'", "input", "\\u", "attribute", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "name_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "id_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "class_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assemble", " ", "input", "\\u", "selector_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "selector_", "=_", "'#'_", "+_", "input", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "class_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.'_", "+_", "input", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "many", " ", "to", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref", "\\u", "class_", "=_", "self_", "._", "\\u", "get", "\\u", "relation", "\\u", "class_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "obj_", "=_", "ref", "\\u", "class_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "count_", "=_", "ref", "\\u", "class_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "option", "\\u", "count_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "element_", "+=_", "'", "No", " ", "option", " ", "avail", "able", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "chosen", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "{_", "''_", ":_", "'", "Non", "e", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "option", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "DB", "\\u", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "options_", "[_", "obj_", "._", "id_", "]_", "=_", "obj_", "._", "as", "\\u", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "value_", "._", "id_", "if_", "hasattr_", "(_", "value_", ",_", "'", "id", "'_", ")_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "select_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "options_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "css_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "chosen", "/", "chosen", ".", "min", ".", "css", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "chosen", "/", "chosen", ".", "jq", "uer", "y", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "chosen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "chosen", "\")", ".", "chosen", "();", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "input", "\\u", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "column", "\\u", "input_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "if_", "hasattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "and_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "self_", "._", "\\u", "build", "\\u", "input", "\\u", "attribute_", "(_", "column", "\\u", "name_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tabular", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "tabular", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "attribute_", "=_", "kwargs_", "._", "pop_", "(_", "'", "input", "\\u", "attribute", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "name_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "id_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "class_", "=_", "input", "\\u", "attribute_", "._", "pop_", "(_", "'", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assemble", " ", "input", "\\u", "selector_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "selector_", "=_", "'#'_", "+_", "input", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "input", "\\u", "class_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.'_", "+_", "input", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "placeholder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "placeholder_", "=_", "self_", "._", "build", "\\u", "label_", "(_", "column", "\\u", "name_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "actual", "\\u", "column", "\\u", "type_", "=_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "type_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "metadata", " ", "and", " ", "col", "type_", "\\u\\u\\uNL\\u\\u\\u_", "col", "metadata_", "=_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "metadata_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "type_", "=_", "col", "metadata_", "._", "\\u", "col", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Option_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "chosen", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "col", "type_", "._", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "split_", "(_", "',", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "select_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "col", "type_", "._", "options_", ",_", "value_", ",_", "col", "type_", "._", "multiple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "css_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "chosen", "/", "chosen", ".", "min", ".", "css", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "chosen", "/", "chosen", ".", "jq", "uer", "y", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "chosen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "chosen", "\")", ".", "chosen", "();", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Upload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Upload_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "\\u", "file", "-", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "div_", "(_", "self_", "._", "build", "\\u", "representation_", "(_", "column", "\\u", "name_", ")_", ")_", "if_", "value_", "is_", "not_", "None_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "+=_", "HTML_", "._", "input", "\\u", "file_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ui", "-", "boots", "trap", "/", "third", "-", "part", "y", "/", "j", "Query", "-", "UI", "-", "File", "Inp", "ut", "/", "js", "/", "enhance", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ui", "-", "boots", "trap", "/", "third", "-", "part", "y", "/", "j", "Query", "-", "UI", "-", "File", "Inp", "ut", "/", "js", "/", "filein", "put", ".", "jq", "uer", "y", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "file", "\\u", "input", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "file", "-", "input", ":", "not", "(.", "\\u", "mutate", "d", ")\"", ").", "custom", "File", "Inp", "ut", "({", "button", "\\u", "position", " ", ":", " ", "\"", "right", "\"}", ");'_", "+_", "'$", "(\".", "\\u", "file", "-", "input", "\")", ".", "add", "Class", "(\"", "\\u", "mutate", "d", "\");", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rich", "Text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Rich", "Text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "rich", "text", "-", "text", "area", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "text", "area_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "value_", ",_", "placeholder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "cked", "itor", "/", "cked", "itor", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "cked", "itor", "/", "adapter", "s", "/", "jq", "uer", "y", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "rich", "text", "\\u", "text", "area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "rich", "text", "-", "text", "area", "\")", ".", "cked", "itor", "();", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theme_", "=_", "self_", "._", "get", "\\u", "col", "type", "\\u", "attr_", "(_", "column", "\\u", "name_", ",_", "'", "them", "e", "'_", ",_", "'", "mono", "kai", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language_", "=_", "self_", "._", "get", "\\u", "col", "type", "\\u", "attr_", "(_", "column", "\\u", "name_", ",_", "'", "language", "'_", ",_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "code", "-", "text", "area", ".\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "text", "area_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "value_", ",_", "placeholder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "ace", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "them", "e-", "'_", "+_", "theme_", "+_", "'.", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "mode", "-'_", "+_", "language_", "+_", "'.", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "jq", "uer", "y", "-", "ace", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\\u", "text", "area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\"", ").", "ace", "({", "'_", "+_", "'", " ", " ", " ", " ", "them", "e", ":", " ", "\"'_", "+_", "theme_", "+_", "'\",", "'_", "+_", "'", " ", " ", " ", " ", "lang", ":", " ", "\"'_", "+_", "language_", "+_", "'\",", "'_", "+_", "'})", ";'_", "+_", "'$", "(\".", "\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\"", ").", "each", "(", "function", "()", "{'_", "+_", "'", " ", " ", " ", " ", "var", " ", "ace", " ", "=", " ", "$(", "this", ").", "data", "(\"", "ace", "\")", ".", "editor", ".", "ace", ";'_", "+_", "'", " ", " ", " ", " ", "ace", ".", "set", "Optio", "ns", "({", "\"", "min", "Line", "s", "\":", " ", "5", ",", " ", "\"", "max", "Line", "s", "\":", " ", "30", ",", " ", "\"", "font", "Size", "\":", " ", "16", "})", ";'_", "+_", "'})", ";'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "input", "\\u", "password_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "value_", ",_", "placeholder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Boolean_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "actual", "\\u", "column", "\\u", "type_", ",_", "Boolean_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "element_", "=_", "HTML_", "._", "input", "\\u", "hidden_", "(_", "input", "\\u", "name_", ",_", "0_", ")_", "+_", "HTML_", "._", "input", "\\u", "checkbox_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "1_", ",_", "bool_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "actual", "\\u", "column", "\\u", "type_", ",_", "Text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "autos", "ize", "-", "text", "area", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "text", "area_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "value_", ",_", "placeholder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "autos", "ize", "/", "jq", "uer", "y", ".", "autos", "ize", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "autos", "ize", "\\u", "text", "area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "autos", "ize", "-", "text", "area", "\")", ".", "autos", "ize", "();", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "hers", " ", "(", "Date", ",", " ", "Integer", ",", " ", "and", " ", "normal", " ", "string", ")_", "\\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 ", " _", "value_", "=_", "str_", "(_", "encode", "\\u", "string_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Date", "Time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "actual", "\\u", "column", "\\u", "type_", ",_", "Date", "Time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "datetime", "-", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ui", "-", "timep", "ick", "er", "-", "addon", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "datetime", "\\u", "input", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "datetime", "-", "input", "\")", ".", "datetime", "picker", "({", "'_", "+_", "'", " ", " ", " ", " ", "default", "Date", ":", " ", "null", ",'_", "+_", "'", " ", " ", " ", " ", "change", "Mont", "h", ":", " ", "true", ",'_", "+_", "'", " ", " ", " ", " ", "change", "Year", ":", " ", "true", ",'_", "+_", "'", " ", " ", " ", " ", "number", "Of", "Mont", "hs", ":", " ", "1", ",'_", "+_", "'", " ", " ", " ", " ", "date", "Format", ":", " ", "\"", "yy", "-", "mm", "-", "dd", "\",'_", "+_", "'", " ", " ", " ", " ", "time", "Format", ":", " ", "\"", "HH", ":", "mm", ":", "ss", "\",'_", "+_", "'", " ", " ", " ", " ", "year", "Range", ":", " ", "\"", "c", "-", "50", ":", "c", "+", "50", "\",'_", "+_", "'})", ";'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "actual", "\\u", "column", "\\u", "type_", ",_", "Date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", ".\\u", "date", "-", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "date", "\\u", "input", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "date", "-", "input", "\")", ".", "date", "picker", "({", "'_", "+_", "'", " ", " ", " ", " ", "default", "Date", ":", " ", "null", ",'_", "+_", "'", " ", " ", " ", " ", "change", "Mont", "h", ":", " ", "true", ",'_", "+_", "'", " ", " ", " ", " ", "change", "Year", ":", " ", "true", ",'_", "+_", "'", " ", " ", " ", " ", "number", "Of", "Mont", "hs", ":", " ", "1", ",'_", "+_", "'", " ", " ", " ", " ", "date", "Format", ":", " ", "\"", "yy", "-", "mm", "-", "dd", "\",'_", "+_", "'", " ", " ", " ", " ", "year", "Range", ":", " ", "\"", "c", "-", "50", ":", "c", "+", "50", "\",'_", "+_", "'})", ";'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "actual", "\\u", "column", "\\u", "type_", ",_", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "+=_", "'.", "\\u", "integ", "er", "-", "input", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "'", "0", "'_", "if_", "value_", "==_", "''_", "else_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "integ", "er", "\\u", "input", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "integ", "er", "-", "input", "\")", ".", "spinn", "er", "();", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Normal", " ", "String_", "\\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 ", " _", "input", "\\u", "selector_", "+=_", "'.", "form", "-", "control", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "input", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "element_", "=_", "HTML_", "._", "input", "\\u", "text_", "(_", "input", "\\u", "selector_", ",_", "input", "\\u", "name_", ",_", "value_", ",_", "placeholder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "input", "\\u", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "column", "\\u", "representation_", "(_", "self_", ",_", "column", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "value", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "if_", "hasattr_", "(_", "self_", ",_", "column", "\\u", "name_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Rich", "Text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "selector_", "=_", "'#", "\\u", "field", "\\u'_", "+_", "column", "\\u", "name_", "+_", "'.", "form", "-", "control", ".\\u", "rich", "text", "-", "text", "area", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "''_", "if_", "value_", "is_", "None_", "else_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "HTML_", "._", "text", "area_", "(_", "input", "\\u", "selector_", ",_", "''_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "cked", "itor", "/", "cked", "itor", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "cked", "itor", "/", "adapter", "s", "/", "jq", "uer", "y", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "rich", "text", "\\u", "text", "area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "rich", "text", "-", "text", "area", "\")", ".", "cked", "itor", "({", "read", "On", "ly", ":", "true", "})", ";'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "theme_", "=_", "self_", "._", "get", "\\u", "col", "type", "\\u", "attr_", "(_", "column", "\\u", "name_", ",_", "'", "them", "e", "'_", ",_", "'", "mono", "kai", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language_", "=_", "self_", "._", "get", "\\u", "col", "type", "\\u", "attr_", "(_", "column", "\\u", "name_", ",_", "'", "language", "'_", ",_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "selector_", "=_", "'.", "form", "-", "control", ".\\u", "code", "-", "text", "area", ".\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "''_", "if_", "value_", "is_", "None_", "else_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "HTML_", "._", "text", "area_", "(_", "input", "\\u", "selector_", ",_", "''_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "mutat", "or", " ", "script_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "ace", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "them", "e-", "'_", "+_", "theme_", "+_", "'.", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "ace", "/", "mode", "-'_", "+_", "language_", "+_", "'.", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "._", "append_", "(_", "base", "\\u", "url_", "(_", "'", "asset", "s", "/", "jq", "uer", "y", "-", "ace", "/", "jq", "uer", "y", "-", "ace", ".", "min", ".", "js", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generat", "ed", "\\u", "js_", "+=_", "self_", "._", "\\u", "mutat", "or", "\\u", "js_", "(_", "'", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\\u", "text", "area", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'$", "(\".", "\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\"", ").", "ace", "({", "'_", "+_", "'", " ", " ", " ", " ", "them", "e", ":", " ", "\"'_", "+_", "theme_", "+_", "'\",", "'_", "+_", "'", " ", " ", " ", " ", "lang", ":", " ", "\"'_", "+_", "language_", "+_", "'\",", "'_", "+_", "'})", ";'_", "+_", "'$", "(\".", "\\u", "code", "\\u'_", "+_", "language_", "+_", "'\\u'_", "+_", "theme_", "+_", "'\"", ").", "each", "(", "function", "()", "{'_", "+_", "'", " ", " ", " ", " ", "var", " ", "ace", " ", "=", " ", "$(", "this", ").", "data", "(\"", "ace", "\")", ".", "editor", ".", "ace", ";'_", "+_", "'", " ", " ", " ", " ", "ace", ".", "set", "Optio", "ns", "({", "\"", "min", "Line", "s", "\":", " ", "5", ",", " ", "\"", "max", "Line", "s", "\":", " ", "30", ",", " ", "\"", "font", "Size", "\":", " ", "16", "})", ";'_", "+_", "'", " ", " ", " ", " ", "ace", ".", "set", "Read", "On", "ly", "(", "true", ");'_", "+_", "'})", ";'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "unicode_", ")_", "or_", "isinstance_", "(_", "value_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "HTML_", "._", "presente", "d\\u", "html", "\\u", "code_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "col", "metadata_", "=_", "self_", "._", "\\u", "get", "\\u", "actual", "\\u", "column", "\\u", "metadata_", "(_", "column", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "'", "Not", " ", "avail", "able", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "col", "type", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "Upload_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "inner", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "col", "type", "\\u", "attr", "\\u", "match_", "(_", "column", "\\u", "name_", ",_", "'", "is", "\\u", "image", "'_", ",_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inner", "\\u", "html_", "=_", "HTML_", "._", "img_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "(_", "self_", "._", "\\u\\u", "applica", "tion", "\\u", "name\\u\\u_", "+_", "'/", "asset", "s", "/", "uploads", "/'_", "+_", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "'", "max", "-", "widt", "h", ":", "100", "px", ";'_", "\\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 ", " _", "inner", "\\u", "html_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "link", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "list", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "inner", "\\u", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "HTML_", "._", "a_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "(_", "self_", "._", "\\u\\u", "applica", "tion", "\\u", "name\\u\\u_", "+_", "'/", "asset", "s", "/", "uploads", "/'_", "+_", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inner", "\\u", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "'", "blank", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DB", "\\u", "Model_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "include", "\\u", "default", "\\u", "resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "url_", "=_", "base", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "generat", "ed", "\\u", "js_", "._", "append", "\\u", "compiled_", "(_", "asset_", "._", "JQ", "UI", "\\u", "BOOT", "STRA", "P", "\\u", "SCRIPT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "generat", "ed", "\\u", "js_", "._", "append", "\\u", "compiled_", "(_", "asset_", "._", "KO", "KO", "RO", "\\u", "CRUD", "\\u", "SCRIPT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "generat", "ed", "\\u", "css_", "._", "append", "\\u", "compiled_", "(_", "asset_", "._", "JQ", "UI", "\\u", "BOOT", "STRA", "P", "\\u", "STYLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "generat", "ed", "\\u", "css_", "._", "append", "\\u", "compiled_", "(_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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 ]
First parameter of a method is not named 'self'
python-beaver/python-beaver/beaver/tests/test_kafka_transport.py
[ { "content": " def test_builtin_kafka(cls):\n cls.beaver_config.set('transport', 'kafka')\n cls.beaver_config.set('logstash_version', 1)\n cls.beaver_config.set('kafka_hosts', cls.server.host + \":\" + str(cls.server.port))\n\n transport = create_transport(cls.beaver_config, logger=cls.logger)\n\n cls.assertIsInstance(transport, beaver.transports.kafka_transport.KafkaTransport)\n\n data = {}\n lines = []\n n=100\n for i in range(n):\n lines.append('log' + str(i) + '\\n')\n new_lines = []\n for line in lines:\n message = unicode_dammit(line)\n if len(message) == 0:\n continue\n new_lines.append(message)\n data['lines'] = new_lines\n data['fields'] = []\n transport.callback(\"test.log\", **data)\n\n messages = cls._consume_messages(cls.server.host, cls.server.port)\n cls.assertEqual(n, messages.__len__())\n for message in messages:\n cls.assertIn('\"file\": \"test.log\", \"message\": \"log', message.message.value);\n print(message)\n print('\\n')\n\n transport.interrupt()", "metadata": "root.KafkaTests.test_builtin_kafka", "header": "['class', 'KafkaTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def _consume_messages(cls, host, port):\n kafka = KafkaClient(cls.server.host + \":\" + str(cls.server.port))\n consumer = MultiProcessConsumer(kafka, None, cls.beaver_config.get('kafka_topic'), num_procs=5)\n return consumer.get_messages(count=100, block=True, timeout=5)", "metadata": "root.KafkaTests._consume_messages", "header": "['class', 'KafkaTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 } ]
[ { "span": "def test_builtin_kafka(cls):", "start_line": 51, "start_column": 4, "end_line": 51, "end_column": 32 }, { "span": "def _consume_messages(cls, host, port):", "start_line": 84, "start_column": 4, "end_line": 84, "end_column": 43 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Ka", "fk", "a", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bui", "lti", "n", "\\u", "kaf", "ka_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "bea", "ver", "\\u", "config_", "._", "set_", "(_", "'", "transport", "'_", ",_", "'", "kaf", "ka", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "bea", "ver", "\\u", "config_", "._", "set_", "(_", "'", "logst", "ash", "\\u", "version", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "bea", "ver", "\\u", "config_", "._", "set_", "(_", "'", "kaf", "ka", "\\u", "host", "s", "'_", ",_", "cls_", "._", "server_", "._", "host_", "+_", "\":\"_", "+_", "str_", "(_", "cls_", "._", "server_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transport_", "=_", "create", "\\u", "transport_", "(_", "cls_", "._", "bea", "ver", "\\u", "config_", ",_", "logger_", "=_", "cls_", "._", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "assert", "Is", "Instance_", "(_", "transport_", ",_", "bea", "ver_", "._", "transports_", "._", "kaf", "ka", "\\u", "transport_", "._", "Ka", "fk", "a", "Transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "'", "log", "'_", "+_", "str_", "(_", "i_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "unicode", "\\u", "dam", "mit_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "message_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "lines_", "._", "append_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "'", "lines", "'_", "]_", "=_", "new", "\\u", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "fields", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transport_", "._", "callback_", "(_", "\"", "test", ".", "log", "\"_", ",_", "**_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "=_", "cls_", "._", "\\u", "consume", "\\u", "messages_", "(_", "cls_", "._", "server_", "._", "host_", ",_", "cls_", "._", "server_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "assert", "Equal_", "(_", "n_", ",_", "messages_", "._", "\\u\\u", "len\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "message_", "in_", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "assert", "In_", "(_", "'\"", "file", "\":", " ", "\"", "test", ".", "log", "\",", " ", "\"", "message", "\":", " ", "\"", "log", "'_", ",_", "message_", "._", "message_", "._", "value_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "transport_", "._", "interrupt", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ka", "fk", "a", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "consume", "\\u", "messages_", "(_", "cls_", ",_", "host_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kaf", "ka_", "=_", "Ka", "fk", "a", "Client_", "(_", "cls_", "._", "server_", "._", "host_", "+_", "\":\"_", "+_", "str_", "(_", "cls_", "._", "server_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consumer_", "=_", "Multi", "Process", "Consumer_", "(_", "kaf", "ka_", ",_", "None_", ",_", "cls_", "._", "bea", "ver", "\\u", "config_", "._", "get_", "(_", "'", "kaf", "ka", "\\u", "topic", "'_", ")_", ",_", "num", "\\u", "procs_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "consumer_", "._", "get", "\\u", "messages_", "(_", "count_", "=_", "100_", ",_", "block_", "=_", "True_", ",_", "timeout_", "=_", "5_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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 ]
Variable defined multiple times
simpeg/simpeg/tests/em/fdem/inverse/derivs/test_FDEM_derivs.py
[ { "content": " def test_Jvec_exr_Eform(self):\n self.assertTrue(derivTest('e', 'exr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_exr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_Jvec_eyr_Eform(self):\n self.assertTrue(derivTest('e', 'eyr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_eyr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_Jvec_ezr_Eform(self):\n self.assertTrue(derivTest('e', 'ezr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_ezr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_Jvec_exi_Eform(self):\n self.assertTrue(derivTest('e', 'exi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_exi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_Jvec_eyi_Eform(self):\n self.assertTrue(derivTest('e', 'eyi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_eyi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_Jvec_ezi_Eform(self):\n self.assertTrue(derivTest('e', 'ezi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_ezi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_Jvec_bxr_Eform(self):\n self.assertTrue(derivTest('e', 'bxr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bxr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def test_Jvec_byr_Eform(self):\n self.assertTrue(derivTest('e', 'byr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_byr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 60 }, { "content": " def test_Jvec_bzr_Eform(self):\n self.assertTrue(derivTest('e', 'bzr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bzr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_Jvec_bxi_Eform(self):\n self.assertTrue(derivTest('e', 'bxi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bxi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_Jvec_byi_Eform(self):\n self.assertTrue(derivTest('e', 'byi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_byi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_Jvec_bzi_Eform(self):\n self.assertTrue(derivTest('e', 'bzi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bzi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_Jvec_exr_Eform(self):\n self.assertTrue(derivTest('e', 'jxr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_exr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_Jvec_eyr_Eform(self):\n self.assertTrue(derivTest('e', 'jyr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_eyr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_Jvec_ezr_Eform(self):\n self.assertTrue(derivTest('e', 'jzr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_ezr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_Jvec_exi_Eform(self):\n self.assertTrue(derivTest('e', 'jxi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_exi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_Jvec_eyi_Eform(self):\n self.assertTrue(derivTest('e', 'jyi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_eyi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_Jvec_ezi_Eform(self):\n self.assertTrue(derivTest('e', 'jzi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_ezi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_Jvec_bxr_Eform(self):\n self.assertTrue(derivTest('e', 'hxr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bxr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_Jvec_byr_Eform(self):\n self.assertTrue(derivTest('e', 'hyr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_byr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_Jvec_bzr_Eform(self):\n self.assertTrue(derivTest('e', 'hzr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bzr_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def test_Jvec_bxi_Eform(self):\n self.assertTrue(derivTest('e', 'hxi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bxi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_Jvec_byi_Eform(self):\n self.assertTrue(derivTest('e', 'hyi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_byi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def test_Jvec_bzi_Eform(self):\n self.assertTrue(derivTest('e', 'hzi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_bzi_Eform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_Jvec_hxr_Hform(self):\n self.assertTrue(derivTest('h', 'hxr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hxr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 205 }, { "content": " def test_Jvec_hyr_Hform(self):\n self.assertTrue(derivTest('h', 'hyr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hyr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test_Jvec_hzr_Hform(self):\n self.assertTrue(derivTest('h', 'hzr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hzr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 209 }, { "content": " def test_Jvec_hxi_Hform(self):\n self.assertTrue(derivTest('h', 'hxi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hxi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_Jvec_hyi_Hform(self):\n self.assertTrue(derivTest('h', 'hyi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hyi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " def test_Jvec_hzi_Hform(self):\n self.assertTrue(derivTest('h', 'hzi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hzi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 215 }, { "content": " def test_Jvec_hxr_Hform(self):\n self.assertTrue(derivTest('h', 'jxr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hxr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 218 }, { "content": " def test_Jvec_hyr_Hform(self):\n self.assertTrue(derivTest('h', 'jyr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hyr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_Jvec_hzr_Hform(self):\n self.assertTrue(derivTest('h', 'jzr'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hzr_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 222 }, { "content": " def test_Jvec_hxi_Hform(self):\n self.assertTrue(derivTest('h', 'jxi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hxi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def test_Jvec_hyi_Hform(self):\n self.assertTrue(derivTest('h', 'jyi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hyi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 226 }, { "content": " def test_Jvec_hzi_Hform(self):\n self.assertTrue(derivTest('h', 'jzi'))", "metadata": "root.FDEM_DerivTests.test_Jvec_hzi_Hform", "header": "['class', 'FDEM_DerivTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 228 } ]
[ { "span": "test_Jvec_exr_Eform(", "start_line": 45, "start_column": 12, "end_line": 45, "end_column": 31 }, { "span": "test_Jvec_eyr_Eform(", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 31 }, { "span": "test_Jvec_ezr_Eform(", "start_line": 49, "start_column": 12, "end_line": 49, "end_column": 31 }, { "span": "test_Jvec_exi_Eform(", "start_line": 51, "start_column": 12, "end_line": 51, "end_column": 31 }, { "span": "test_Jvec_eyi_Eform(", "start_line": 53, "start_column": 12, "end_line": 53, "end_column": 31 }, { "span": "test_Jvec_ezi_Eform(", "start_line": 55, "start_column": 12, "end_line": 55, "end_column": 31 }, { "span": "test_Jvec_bxr_Eform(", "start_line": 58, "start_column": 12, "end_line": 58, "end_column": 31 }, { "span": "test_Jvec_byr_Eform(", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 31 }, { "span": "test_Jvec_bzr_Eform(", "start_line": 62, "start_column": 12, "end_line": 62, "end_column": 31 }, { "span": "test_Jvec_bxi_Eform(", "start_line": 64, "start_column": 12, "end_line": 64, "end_column": 31 }, { "span": "test_Jvec_byi_Eform(", "start_line": 66, "start_column": 12, "end_line": 66, "end_column": 31 }, { "span": "test_Jvec_bzi_Eform(", "start_line": 68, "start_column": 12, "end_line": 68, "end_column": 31 }, { "span": "test_Jvec_hxr_Hform(", "start_line": 205, "start_column": 12, "end_line": 205, "end_column": 31 }, { "span": "test_Jvec_hyr_Hform(", "start_line": 207, "start_column": 12, "end_line": 207, "end_column": 31 }, { "span": "test_Jvec_hzr_Hform(", "start_line": 209, "start_column": 12, "end_line": 209, "end_column": 31 }, { "span": "test_Jvec_hxi_Hform(", "start_line": 211, "start_column": 12, "end_line": 211, "end_column": 31 }, { "span": "test_Jvec_hyi_Hform(", "start_line": 213, "start_column": 12, "end_line": 213, "end_column": 31 }, { "span": "test_Jvec_hzi_Hform(", "start_line": 215, "start_column": 12, "end_line": 215, "end_column": 31 } ]
[ { "span": "test_Jvec_exr_Eform(", "start_line": 71, "start_column": 12, "end_line": 71, "end_column": 31 }, { "span": "test_Jvec_eyr_Eform(", "start_line": 73, "start_column": 12, "end_line": 73, "end_column": 31 }, { "span": "test_Jvec_ezr_Eform(", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 31 }, { "span": "test_Jvec_exi_Eform(", "start_line": 77, "start_column": 12, "end_line": 77, "end_column": 31 }, { "span": "test_Jvec_eyi_Eform(", "start_line": 79, "start_column": 12, "end_line": 79, "end_column": 31 }, { "span": "test_Jvec_ezi_Eform(", "start_line": 81, "start_column": 12, "end_line": 81, "end_column": 31 }, { "span": "test_Jvec_bxr_Eform(", "start_line": 84, "start_column": 12, "end_line": 84, "end_column": 31 }, { "span": "test_Jvec_byr_Eform(", "start_line": 86, "start_column": 12, "end_line": 86, "end_column": 31 }, { "span": "test_Jvec_bzr_Eform(", "start_line": 88, "start_column": 12, "end_line": 88, "end_column": 31 }, { "span": "test_Jvec_bxi_Eform(", "start_line": 90, "start_column": 12, "end_line": 90, "end_column": 31 }, { "span": "test_Jvec_byi_Eform(", "start_line": 92, "start_column": 12, "end_line": 92, "end_column": 31 }, { "span": "test_Jvec_bzi_Eform(", "start_line": 94, "start_column": 12, "end_line": 94, "end_column": 31 }, { "span": "test_Jvec_hxr_Hform(", "start_line": 218, "start_column": 12, "end_line": 218, "end_column": 31 }, { "span": "test_Jvec_hyr_Hform(", "start_line": 220, "start_column": 12, "end_line": 220, "end_column": 31 }, { "span": "test_Jvec_hzr_Hform(", "start_line": 222, "start_column": 12, "end_line": 222, "end_column": 31 }, { "span": "test_Jvec_hxi_Hform(", "start_line": 224, "start_column": 12, "end_line": 224, "end_column": 31 }, { "span": "test_Jvec_hyi_Hform(", "start_line": 226, "start_column": 12, "end_line": 226, "end_column": 31 }, { "span": "test_Jvec_hzi_Hform(", "start_line": 228, "start_column": 12, "end_line": 228, "end_column": 31 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Jv", "ec", "\\u", "ex", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "ex", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ey", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "ey", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ez", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "ez", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "exi", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "exi", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ey", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "ey", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ez", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "ez", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bx", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "bx", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "by", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "by", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bzr", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "bzr", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bx", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "bx", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "by", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "by", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bz", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "bz", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ex", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jx", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ey", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jy", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ez", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jz", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "exi", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jx", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ey", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jy", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "ez", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "jz", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bx", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hx", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "by", "r", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hy", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bzr", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hz", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bx", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hx", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "by", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hy", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "bz", "i", "\\u", "Ef", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "e", "'_", ",_", "'", "hz", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Jv", "ec", "\\u", "hx", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hx", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hy", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hy", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hz", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hz", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hx", "i", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hx", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hy", "i", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hy", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hz", "i", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "hz", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hx", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "jx", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hy", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "jy", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hz", "r", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "jz", "r", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hx", "i", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "jx", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Jv", "ec", "\\u", "hy", "i", "\\u", "Hf", "orm_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "deriv", "Test_", "(_", "'", "h", "'_", ",_", "'", "jy", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FD", "EM", "\\u", "Der", "iv", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLIN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sheet_names=None):\n logger.debug('data: %s')\n if not isinstance(data, collections.Mapping):\n try:\n logger.debug('attempting to construct pd.DataFrame from data')\n dfs = {'Sheet 1' : pd.DataFrame(data)}\n except:\n logger.debug('exception while constructing pd.DataFrame, checking for sequence')\n if isinstance(data, collections.Sequence):\n logger.debug('constructing dict from sequence')\n if sheet_names is not None:\n assert len(sheet_names) == len(data), 'sheet_names must have the same length as the `dfs` Sequence'\n else:\n sheet_names = ['Sheet %d' % i for i in range(len(data))]\n dfs = dict(zip(sheet_names, data))\n else:\n dfs = data\n else:\n dfs = data\n assert isinstance(dfs, collections.Mapping), 'type: %s, dfs: %s' % (type(dfs), dfs)\n\n writer = pd.ExcelWriter(fname)\n for sheet_name, df in dfs.items():\n try:\n df = pd.DataFrame(df)\n except:\n logger.exception('could not convert data object: %s into pandas.DataFrame', df)\n df.to_excel(writer, sheet_name, index=False)\n writer.save()", "metadata": "root.write_xlsx", "header": "['module', '___EOS___']", "index": 131 } ]
[ { "span": "except:", "start_line": 137, "start_column": 8, "end_line": 137, "end_column": 15 }, { "span": "except:", "start_line": 156, "start_column": 8, "end_line": 156, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "xls", "x_", "(_", "data_", ",_", "fname_", ",_", "sheet", "\\u", "names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "data", ":", " ", "%", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "data_", ",_", "collections_", "._", "Mapping_", ")_", ":_", "\\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 ", " _", "logger_", "._", "debug_", "(_", "'", "atte", "mpt", "ing", " ", "to", " ", "construct", " ", "pd", ".", "Data", "Frame", " ", "from", " ", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dfs_", "=_", "{_", "'", "She", "et", " ", "1", "'_", ":_", "pd_", "._", "Data", "Frame_", "(_", "data_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "exception", " ", "whi", "le", " ", "constructi", "ng", " ", "pd", ".", "Data", "Frame", ",", " ", "checking", " ", "for", " ", "sequence", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "collections_", "._", "Sequence_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "constructi", "ng", " ", "dict", " ", "from", " ", "sequence", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sheet", "\\u", "names_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "len_", "(_", "sheet", "\\u", "names_", ")_", "==_", "len_", "(_", "data_", ")_", ",_", "'", "sheet", "\\u", "names", " ", "must", " ", "have", " ", "the", " ", "same", " ", "length", " ", "as", " ", "the", " ", "`", "dfs", "`", " ", "Sequ", "ence", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sheet", "\\u", "names_", "=_", "[_", "'", "She", "et", " ", "%", "d", "'_", "%_", "i_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dfs_", "=_", "dict_", "(_", "zip_", "(_", "sheet", "\\u", "names_", ",_", "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 ", " _", "dfs_", "=_", "data_", "\\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 ", " _", "dfs_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "isinstance_", "(_", "dfs_", ",_", "collections_", "._", "Mapping_", ")_", ",_", "'", "type", ":", " ", "%", "s", ",", " ", "dfs", ":", " ", "%", "s", "'_", "%_", "(_", "type_", "(_", "dfs_", ")_", ",_", "dfs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writer_", "=_", "pd_", "._", "Exce", "l", "Writer_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sheet", "\\u", "name_", ",_", "df_", "in_", "dfs_", "._", "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 ", " _", "df_", "=_", "pd_", "._", "Data", "Frame_", "(_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "coul", "d", " ", "not", " ", "convert", " ", "data", " ", "object", ":", " ", "%", "s", " ", "int", "o", " ", "panda", "s", ".", "Data", "Frame", "'_", ",_", "df_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "df_", "._", "to", "\\u", "excel_", "(_", "writer_", ",_", "sheet", "\\u", "name_", ",_", "index_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "save_", "(_", ")_", "\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Modification of dictionary returned by locals()
maxtepkeev/architect/tests/models/sqlalchemy.py
[ { "content": "from __future__ import absolute_import\n\nimport os\n\nfrom sqlalchemy import create_engine, Column, String, Integer, DateTime\nfrom sqlalchemy.ext.declarative import declarative_base\n\nfrom architect import install\n\ndatabases = {\n 'sqlite': 'sqlite://',\n 'pgsql': 'postgresql+psycopg2://postgres@localhost/architect',\n 'postgresql': 'postgresql+psycopg2://postgres@localhost/architect',\n 'mysql': 'mysql+pymysql://root@localhost/architect'\n}\n\ndsn = databases[os.environ.get('DB')]\nengine = create_engine(dsn)\nBase = declarative_base()\n\n# Generation of entities for date range partitioning\nfor item in ('day', 'week', 'month', 'year'):\n name = 'RangeDate{0}'.format(item.capitalize())\n partition = install('partition', type='range', subtype='date', constraint=item, column='created', db=engine.url)\n\n locals()[name] = partition(type(name, (Base,), {\n '__tablename__': 'test_rangedate{0}'.format(item),\n 'id': Column(Integer, primary_key=True),\n 'name': Column(String(length=255)),\n 'created': Column(DateTime, nullable=True)\n }))\n\nif os.environ.get('DB') in ('pgsql', 'postgresql'):\n # Generation of entities for integer range partitioning\n for item in ('2', '5'):\n name = 'RangeInteger{0}'.format(item)\n partition = install('partition', type='range', subtype='integer', constraint=item, column='num', db=engine.url)\n\n locals()[name] = partition(type(name, (Base,), {\n '__tablename__': 'test_rangeinteger{0}'.format(item),\n 'id': Column(Integer, primary_key=True),\n 'name': Column(String(length=255)),\n 'num': Column(Integer, nullable=True)\n }))\n\n # Generation of entities for string range partitioning\n for subtype in ('string_firstchars', 'string_lastchars'):\n for item in ('2', '5'):\n name = 'Range{0}{1}'.format(''.join(s.capitalize() for s in subtype.split('_')), item)\n partition = install('partition', type='range', subtype=subtype, constraint=item, column='title', db=engine.url)\n\n locals()[name] = partition(type(name, (Base,), {\n '__tablename__': 'test_range{0}{1}'.format(subtype, item),\n 'id': Column(Integer, primary_key=True),\n 'name': Column(String(length=255)),\n 'title': Column(String(length=255), nullable=True)\n }))\n\nBase.metadata.create_all(engine)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "locals()[name] ", "start_line": 25, "start_column": 4, "end_line": 25, "end_column": 18 }, { "span": "locals()[name] ", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 22 }, { "span": "locals()[name] ", "start_line": 51, "start_column": 12, "end_line": 51, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "dictionary_", "returned_", "by_", "locals_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "create", "\\u", "engine_", ",_", "Column_", ",_", "String_", ",_", "Integer_", ",_", "Date", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "ext_", "._", "declarative", "_", "import_", "declarative", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "archi", "tect", "_", "import_", "install_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "databases_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sql", "ite", "'_", ":_", "'", "sql", "ite", "://'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pgs", "ql", "'_", ":_", "'", "postgres", "ql", "+", "psy", "cop", "g2", "://", "postgres", "@", "local", "host", "/", "archi", "tect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "postgres", "ql", "'_", ":_", "'", "postgres", "ql", "+", "psy", "cop", "g2", "://", "postgres", "@", "local", "host", "/", "archi", "tect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mysql", "'_", ":_", "'", "mysql", "+", "pymysql", "://", "root", "@", "local", "host", "/", "archi", "tect", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dsn_", "=_", "databases_", "[_", "os_", "._", "environ_", "._", "get_", "(_", "'", "DB", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "=_", "create", "\\u", "engine_", "(_", "dsn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base_", "=_", "declarative", "\\u", "base_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generat", "ion", " ", "of", " ", "entit", "ies", " ", "for", " ", "date", " ", "range", " ", "partitioning", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "(_", "'", "day", "'_", ",_", "'", "week", "'_", ",_", "'", "month", "'_", ",_", "'", "year", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Range", "Date", "{", "0", "}'_", "._", "format_", "(_", "item_", "._", "capitalize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "partition_", "=_", "install_", "(_", "'", "partit", "ion", "'_", ",_", "type_", "=_", "'", "range", "'_", ",_", "subtype_", "=_", "'", "date", "'_", ",_", "constraint_", "=_", "item_", ",_", "column_", "=_", "'", "created", "'_", ",_", "db_", "=_", "engine_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "(_", ")_", "[_", "name_", "]_", "=_", "partition_", "(_", "type_", "(_", "name_", ",_", "(_", "Base_", ",_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "tablename", "\\u\\u'_", ":_", "'", "test\\u", "range", "date", "{", "0", "}'_", "._", "format_", "(_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Column_", "(_", "String_", "(_", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "Column_", "(_", "Date", "Time_", ",_", "nullable_", "=_", "True_", ")_", "\\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_", "os_", "._", "environ_", "._", "get_", "(_", "'", "DB", "'_", ")_", "in_", "(_", "'", "pgs", "ql", "'_", ",_", "'", "postgres", "ql", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generat", "ion", " ", "of", " ", "entit", "ies", " ", "for", " ", "integ", "er", " ", "range", " ", "partitioning", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "(_", "'", "2", "'_", ",_", "'", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Range", "Integer", "{", "0", "}'_", "._", "format_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "partition_", "=_", "install_", "(_", "'", "partit", "ion", "'_", ",_", "type_", "=_", "'", "range", "'_", ",_", "subtype_", "=_", "'", "integ", "er", "'_", ",_", "constraint_", "=_", "item_", ",_", "column_", "=_", "'", "num", "'_", ",_", "db_", "=_", "engine_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "(_", ")_", "[_", "name_", "]_", "=_", "partition_", "(_", "type_", "(_", "name_", ",_", "(_", "Base_", ",_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "tablename", "\\u\\u'_", ":_", "'", "test\\u", "range", "integ", "er", "{", "0", "}'_", "._", "format_", "(_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Column_", "(_", "String_", "(_", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "'_", ":_", "Column_", "(_", "Integer_", ",_", "nullable_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generat", "ion", " ", "of", " ", "entit", "ies", " ", "for", " ", "string", " ", "range", " ", "partitioning", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subtype_", "in_", "(_", "'", "string", "\\u", "first", "char", "s", "'_", ",_", "'", "string", "\\u", "lastc", "har", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "(_", "'", "2", "'_", ",_", "'", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Range", "{", "0", "}{", "1", "}'_", "._", "format_", "(_", "''_", "._", "join_", "(_", "s_", "._", "capitalize_", "(_", ")_", "for_", "s_", "in_", "subtype_", "._", "split_", "(_", "'\\u'_", ")_", ")_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "partition_", "=_", "install_", "(_", "'", "partit", "ion", "'_", ",_", "type_", "=_", "'", "range", "'_", ",_", "subtype_", "=_", "subtype_", ",_", "constraint_", "=_", "item_", ",_", "column_", "=_", "'", "title", "'_", ",_", "db_", "=_", "engine_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "(_", ")_", "[_", "name_", "]_", "=_", "partition_", "(_", "type_", "(_", "name_", ",_", "(_", "Base_", ",_", ")_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "tablename", "\\u\\u'_", ":_", "'", "test\\u", "range", "{", "0", "}{", "1", "}'_", "._", "format_", "(_", "subtype_", ",_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "Column_", "(_", "String_", "(_", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "Column_", "(_", "String_", "(_", "length_", "=_", "255_", ")_", ",_", "nullable_", "=_", "True_", ")_", "\\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_", "Base_", "._", "metadata_", "._", "create", "\\u", "all_", "(_", "engine_", ")_" ]
[ 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,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default/paragraph.py
[ { "content": "def expand_to_paragraph(view, tp):\n sr = view.full_line(tp)\n if is_paragraph_separating_line(view, sr):\n return sublime.Region(tp, tp)\n\n required_prefix = None\n\n # If the current line starts with a comment, only select lines that are also\n # commented\n (line_comments, block_comments) = comment.build_comment_data(view, tp)\n dataStart = comment.advance_to_first_non_white_space_on_line(view, sr.begin())\n for c in line_comments:\n (start, disable_indent) = c\n comment_region = sublime.Region(dataStart,\n dataStart + len(start))\n if view.substr(comment_region) == start:\n required_prefix = view.substr(sublime.Region(sr.begin(), comment_region.end()))\n break\n\n first = sr.begin()\n prev = sr\n while True:\n prev = previous_line(view, prev)\n if (prev == None or is_paragraph_separating_line(view, prev) or\n not has_prefix(view, prev, required_prefix)):\n break\n else:\n first = prev.begin()\n\n last = sr.end()\n next = sr\n while True:\n next = next_line(view, next)\n if (next == None or is_paragraph_separating_line(view, next) or\n not has_prefix(view, next, required_prefix)):\n break\n else:\n last = next.end()\n\n return sublime.Region(first, last)", "metadata": "root.expand_to_paragraph", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def all_paragraphs_intersecting_selection(view, sr):\n paragraphs = []\n\n para = expand_to_paragraph(view, sr.begin())\n if not para.empty():\n paragraphs.append(para)\n\n while True:\n line = next_line(view, para)\n if line == None or line.begin() >= sr.end():\n break;\n\n if not is_paragraph_separating_line(view, line):\n para = expand_to_paragraph(view, line.begin())\n paragraphs.append(para)\n else:\n para = line\n\n return paragraphs", "metadata": "root.all_paragraphs_intersecting_selection", "header": "['module', '___EOS___']", "index": 77 } ]
[ { "span": "prev == None ", "start_line": 59, "start_column": 12, "end_line": 59, "end_column": 24 }, { "span": "next == None ", "start_line": 69, "start_column": 12, "end_line": 69, "end_column": 24 }, { "span": "line == None ", "start_line": 86, "start_column": 11, "end_line": 86, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "to", "\\u", "paragraph_", "(_", "view_", ",_", "tp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr_", "=_", "view_", "._", "full", "\\u", "line_", "(_", "tp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "paragraph", "\\u", "separa", "ting", "\\u", "line_", "(_", "view_", ",_", "sr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sublime_", "._", "Region_", "(_", "tp_", ",_", "tp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "require", "d\\u", "prefix_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "current", " ", "line", " ", "starts", " ", "with", " ", "a", " ", "comment", ",", " ", "only", " ", "select", " ", "lines", " ", "tha", "t", " ", "are", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commente", "d_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "line", "\\u", "comments_", ",_", "block", "\\u", "comments_", ")_", "=_", "comment_", "._", "build", "\\u", "comment", "\\u", "data_", "(_", "view_", ",_", "tp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Start_", "=_", "comment_", "._", "advance", "\\u", "to", "\\u", "first", "\\u", "non", "\\u", "white", "\\u", "space", "\\u", "on", "\\u", "line_", "(_", "view_", ",_", "sr_", "._", "begin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "line", "\\u", "comments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "start_", ",_", "disable", "\\u", "indent_", ")_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comment", "\\u", "region_", "=_", "sublime_", "._", "Region_", "(_", "data", "Start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data", "Start_", "+_", "len_", "(_", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view_", "._", "substr_", "(_", "comment", "\\u", "region_", ")_", "==_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "require", "d\\u", "prefix_", "=_", "view_", "._", "substr_", "(_", "sublime_", "._", "Region_", "(_", "sr_", "._", "begin_", "(_", ")_", ",_", "comment", "\\u", "region_", "._", "end_", "(_", ")_", ")_", ")_", "\\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_", "first_", "=_", "sr_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev_", "=_", "previ", "ous", "\\u", "line_", "(_", "view_", ",_", "prev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "prev_", "==_", "None_", "or_", "is", "\\u", "paragraph", "\\u", "separa", "ting", "\\u", "line_", "(_", "view_", ",_", "prev_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "has", "\\u", "prefix_", "(_", "view_", ",_", "prev_", ",_", "require", "d\\u", "prefix_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first_", "=_", "prev_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last_", "=_", "sr_", "._", "end_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next_", "=_", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "=_", "next", "\\u", "line_", "(_", "view_", ",_", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "next_", "==_", "None_", "or_", "is", "\\u", "paragraph", "\\u", "separa", "ting", "\\u", "line_", "(_", "view_", ",_", "next_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "has", "\\u", "prefix_", "(_", "view_", ",_", "next_", ",_", "require", "d\\u", "prefix_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last_", "=_", "next_", "._", "end_", "(_", ")_", "\\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_", "sublime_", "._", "Region_", "(_", "first_", ",_", "last_", ")_", "\\u\\u\\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_", "all", "\\u", "paragraph", "s", "\\u", "intersect", "ing", "\\u", "selection_", "(_", "view_", ",_", "sr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paragraphs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "para_", "=_", "expand", "\\u", "to", "\\u", "paragraph_", "(_", "view_", ",_", "sr_", "._", "begin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "para_", "._", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paragraphs_", "._", "append_", "(_", "para_", ")_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "next", "\\u", "line_", "(_", "view_", ",_", "para_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "==_", "None_", "or_", "line_", "._", "begin_", "(_", ")_", ">=_", "sr_", "._", "end_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "paragraph", "\\u", "separa", "ting", "\\u", "line_", "(_", "view_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "para_", "=_", "expand", "\\u", "to", "\\u", "paragraph_", "(_", "view_", ",_", "line_", "._", "begin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paragraphs_", "._", "append_", "(_", "para_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "para_", "=_", "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_", "return_", "paragraphs_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
adamhadani/logtools/logtools/parsers.py
[ { "content": "#!/usr/bin/env python\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\"\"\"\nlogtools.parsers\nParsers for some common log formats, e.g Common Log Format (CLF).\nThese parsers can be used both programmaticaly as well as by the \nlogtools command-line tools to meaningfully parse log fields \nfrom standard formats.\n\"\"\"\nimport os\nimport re\nimport sys\nimport logging\nfrom functools import partial\nfrom datetime import datetime\nfrom abc import ABCMeta, abstractmethod\nimport json\n\nfrom _config import AttrDict\n\n__all__ = ['multikey_getter_gen', 'unescape_json', 'LogParser', 'JSONParser', 'LogLine',\n 'AccessLog', 'CommonLogFormat', 'uWSGIParser']\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 multikey_getter_gen(parser, keys, is_indices=False, delimiter=\"\\t\"):\n \"\"\"Generator meta-function to return a function\n parsing a logline and returning multiple keys (tab-delimited)\"\"\"\n if is_indices:\n keys = map(int, keys)\n \n def multikey_getter(line, parser, keyset):\n data = parser(line.strip())\n return delimiter.join((unicode(data[k]) for k in keyset))\n \n def multiindex_getter(line, parser, keyset):\n data = parser(line.strip())\n return delimiter.join((unicode(data.by_index(idx-1, raw=True)) for idx in keys))\n\n if is_indices is True:\n # Field indices\n return partial(multiindex_getter, parser=parser, keyset=keys)\n else:\n # Field names\n return partial(multikey_getter, parser=parser, keyset=keys)", "metadata": "root.multikey_getter_gen", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def unescape_json(s):\n \"\"\"Unescape a string that was previously encoded into JSON.\n This unescapes forward slashes (optional in JSON standard),\n backslashes and double quotes\"\"\"\n return s.replace(\"\\\\/\", '/').replace('\\\\\"', '\"').decode('string_escape')", "metadata": "root.unescape_json", "header": "['module', '___EOS___']", "index": 57 }, { "content": "class LogParser(object):\n \"\"\"Base class for all our parsers\"\"\"\n __metaclass__ = ABCMeta\n\n\n ", "metadata": "root.LogParser", "header": "['module', '___EOS___']", "index": 64 }, { "content": " def __call__(self, line):\n \"\"\"Callable interface\"\"\"\n return self.parse(line)", "metadata": "root.LogParser.__call__", "header": "['class', 'LogParser', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " @abstractmethod\n def parse(self, line):\n \"\"\"Parse a logline\"\"\"", "metadata": "root.LogParser.parse", "header": "['class', 'LogParser', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": " def set_format(self, format):\n \"\"\"Set a format specifier for parser.\n Some parsers can use this to specify\n a format string\"\"\"", "metadata": "root.LogParser.set_format", "header": "['class', 'LogParser', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": "class LogLine(dict):\n \"\"\"Instrumented dictionary that allows\n convenient access to a parsed log lines,\n using key-based lookup / index-based / raw / parsed\"\"\"\n \n \n \n \n ", "metadata": "root.LogLine", "header": "['module', '___EOS___']", "index": 82 }, { "content": " def __init__(self, fieldnames=None):\n \"\"\"Initialize logline. This class can be reused\n across multiple input lines by using the clear()\n method after each invocation\"\"\"\n \n self._fieldnames = None\n \n if fieldnames:\n self.fieldnames = fieldnames", "metadata": "root.LogLine.__init__", "header": "['class', 'LogLine', '(', 'dict', ')', ':', '___EOS___']", "index": 87 }, { "content": " @property\n def fieldnames(self):\n \"\"\"Getter method for the field names\"\"\"\n return self._fieldnames", "metadata": "root.LogLine.fieldnames", "header": "['class', 'LogLine', '(', 'dict', ')', ':', '___EOS___']", "index": 97 }, { "content": " @fieldnames.setter\n def fieldnames(self, fieldnames):\n \"\"\"Set the log format field names\"\"\"\n self._fieldnames = dict(enumerate(fieldnames))", "metadata": "root.LogLine.fieldnames", "header": "['class', 'LogLine', '(', 'dict', ')', ':', '___EOS___']", "index": 102 }, { "content": " def by_index(self, i, raw=False):\n return self.by_key(self._fieldnames[i], raw=raw)", "metadata": "root.LogLine.by_index", "header": "['class', 'LogLine', '(', 'dict', ')', ':', '___EOS___']", "index": 107 }, { "content": " def by_key(self, key, raw=False):\n \"\"\"Return the i-th field parsed\"\"\"\n val = None\n \n if raw is True:\n return self[key]\n \n if key == '%t':\n val = datetime.strptime(self[key][1:-7], '%d/%b/%Y:%H:%M:%S')\n else:\n val = self[key]\n return val", "metadata": "root.LogLine.by_key", "header": "['class', 'LogLine', '(', 'dict', ')', ':', '___EOS___']", "index": 110 }, { "content": "class JSONParser(LogParser):\n \"\"\"Parser implementation for JSON format logs\"\"\"\n \n ", "metadata": "root.JSONParser", "header": "['module', '___EOS___']", "index": 124 }, { "content": " def __init__(self):\n LogParser.__init__(self)\n self._logline_wrapper = LogLine()", "metadata": "root.JSONParser.__init__", "header": "['class', 'JSONParser', '(', 'LogParser', ')', ':', '___EOS___']", "index": 127 }, { "content": " def parse(self, line):\n \"\"\"Parse JSON line\"\"\"\n parsed_row = json.loads(line)\n \n data = self._logline_wrapper\n\n # This is called for every log line - This is because\n # JSON logs are generally schema-less and so fields\n # can change between lines.\n self._logline_wrapper.fieldnames = parsed_row.keys()\n \n data.clear()\n for k, v in parsed_row.iteritems():\n data[k] = v\n\n return data", "metadata": "root.JSONParser.parse", "header": "['class', 'JSONParser', '(', 'LogParser', ')', ':', '___EOS___']", "index": 131 }, { "content": "class AccessLog(LogParser):\n \"\"\"Apache access_log logfile parser. This can\n consume arbitrary Apache log field directives. see\n http://httpd.apache.org/docs/1.3/logs.html#accesslog\"\"\"\n\n\n \n", "metadata": "root.AccessLog", "header": "['module', '___EOS___']", "index": 149 }, { "content": " def __init__(self, format=None):\n LogParser.__init__(self)\n \n self.fieldnames = None\n self.fieldselector = None\n self._logline_wrapper = None\n \n if format:\n self.fieldselector = self._parse_log_format(format)\n self._logline_wrapper = LogLine(self.fieldnames) ", "metadata": "root.AccessLog.__init__", "header": "['class', 'AccessLog', '(', 'LogParser', ')', ':', '___EOS___']", "index": 154 }, { "content": " def set_format(self, format):\n \"\"\"Set the access_log format\"\"\"\n self.fieldselector = self._parse_log_format(format)\n self._logline_wrapper = LogLine(self.fieldnames) ", "metadata": "root.AccessLog.set_format", "header": "['class', 'AccessLog', '(', 'LogParser', ')', ':', '___EOS___']", "index": 165 }, { "content": " def parse(self, logline):\n \"\"\"\n Parse log line into structured row.\n Will raise ParseError Exception when\n parsing failed.\n \"\"\"\n try:\n match = self.fieldselector.match(logline)\n except AttributeError, exc:\n raise AttributeError(\"%s needs a valid format string (--format)\" % \\\n self.__class__.__name__ )\n\n if match:\n data = self._logline_wrapper\n data.clear()\n for k, v in zip(self.fieldnames, match.groups()):\n data[k] = v\n return data \n else:\n raise ValueError(\"Could not parse log line: '%s'\" % logline)", "metadata": "root.AccessLog.parse", "header": "['class', 'AccessLog', '(', 'LogParser', ')', ':', '___EOS___']", "index": 170 }, { "content": " def _parse_log_format(self, format):\n \"\"\"This code piece is based on the apachelogs \n python/perl projects. Raises an exception if \n it couldn't compile the generated regex\"\"\"\n format = format.strip()\n format = re.sub('[ \\t]+',' ',format)\n\n subpatterns = []\n\n findquotes = re.compile(r'^\"')\n findreferreragent = re.compile('Referer|User-Agent')\n findpercent = re.compile(r'^%.*t$')\n lstripquotes = re.compile(r'^\"')\n rstripquotes = re.compile(r'\"$')\n self.fieldnames = []\n\n for element in format.split(' '):\n hasquotes = 0\n if findquotes.match(element): \n hasquotes = 1\n\n if hasquotes:\n element = lstripquotes.sub('', element)\n element = rstripquotes.sub('', element)\n\n self.fieldnames.append(element)\n\n subpattern = '(\\S*)'\n\n if hasquotes:\n if element == '%r' or findreferreragent.search(element):\n subpattern = r'\\\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\\\"'\n else:\n subpattern = r'\\\"([^\\\"]*)\\\"'\n\n elif findpercent.search(element):\n subpattern = r'(\\[[^\\]]+\\])'\n\n elif element == '%U':\n subpattern = '(.+?)'\n\n subpatterns.append(subpattern)\n\n _pattern = '^' + ' '.join(subpatterns) + '$'\n _regex = re.compile(_pattern)\n\n return _regex", "metadata": "root.AccessLog._parse_log_format", "header": "['class', 'AccessLog', '(', 'LogParser', ')', ':', '___EOS___']", "index": 191 }, { "content": "class CommonLogFormat(AccessLog):\n \"\"\"\n Parse the CLF Format, defined as:\n %h %l %u %t \\\"%r\\\" %>s %b\n See http://httpd.apache.org/docs/1.3/logs.html#accesslog\n \"\"\"\n", "metadata": "root.CommonLogFormat", "header": "['module', '___EOS___']", "index": 240 }, { "content": " def __init__(self):\n AccessLog.__init__(self, format='%h %l %u %t \"%r\" %>s %b')", "metadata": "root.CommonLogFormat.__init__", "header": "['class', 'CommonLogFormat', '(', 'AccessLog', ')', ':', '___EOS___']", "index": 247 }, { "content": "class uWSGIParser(LogParser):\n \"\"\"Parser for the uWSGI log format\"\"\"\n\n", "metadata": "root.uWSGIParser", "header": "['module', '___EOS___']", "index": 251 }, { "content": " def __init__(self):\n LogParser.__init__(self)\n self._re = re.compile(r'.* ((?:[0-9]+\\.){3}[0-9]+) .* \\[(.*?)\\] (GET|POST) (\\S+) .* generated (\\d+) bytes in (\\d+) msecs .*')\n self.fieldnames = ('ip', 'timestamp', 'method', 'path', 'bytes', 'processing_time')\n self._logline_wrapper = LogLine(self.fieldnames)", "metadata": "root.uWSGIParser.__init__", "header": "['class', 'uWSGIParser', '(', 'LogParser', ')', ':', '___EOS___']", "index": 254 }, { "content": " def parse(self, logline):\n \"\"\"Parse log line\"\"\"\n match = self._re.match(logline)\n if match:\n data = self._logline_wrapper\n data.clear()\n for k, v in zip(self.fieldnames, match.groups()):\n data[k] = v\n return data\n else:\n raise ValueError(\"Could not parse log line: '%s'\" % logline)", "metadata": "root.uWSGIParser.parse", "header": "['class', 'uWSGIParser', '(', 'LogParser', ')', ':', '___EOS___']", "index": 260 } ]
[ { "span": "import os", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 9 }, { "span": "import sys", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 10 }, { "span": "import logging", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 14 }, { "span": "from _config import AttrDict", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 28 } ]
[]
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_", "#", " ", " ", "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_", "\"\"\"", "\\", "10", ";", "logt", "ool", "s", ".", "parser", "s", "\\", "10", ";", "Parser", "s", " ", "for", " ", "some", " ", "common", " ", "log", " ", "formats", ",", " ", "e", ".", "g", " ", "Common", " ", "Log", " ", "Format", " ", "(", "CL", "F", ").", "\\", "10", ";", "The", "se", " ", "parser", "s", " ", "can", " ", "be", " ", "used", " ", "bot", "h", " ", "program", "matical", "y", " ", "as", " ", "well", " ", "as", " ", "by", " ", "the", " ", "\\", "10", ";", "logt", "ool", "s", " ", "command", "-", "line", " ", "tool", "s", " ", "to", " ", "meaning", "full", "y", " ", "parse", " ", "log", " ", "fields", " ", "\\", "10", ";", "from", " ", "standard", " ", "formats", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "abc_", "import_", "ABC", "Meta_", ",_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u", "config_", "import_", "Attr", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "multi", "key", "\\u", "getter", "\\u", "gen", "'_", ",_", "'", "unescape", "\\u", "json", "'_", ",_", "'", "Log", "Parser", "'_", ",_", "'", "JSO", "NP", "arser", "'_", ",_", "'", "Log", "Line", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Access", "Log", "'_", ",_", "'", "Common", "Log", "Format", "'_", ",_", "'", "u", "WS", "GI", "Parser", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "multi", "key", "\\u", "getter", "\\u", "gen_", "(_", "parser_", ",_", "keys_", ",_", "is", "\\u", "indices_", "=_", "False_", ",_", "delimiter_", "=_", "\"\\\\", "t", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generat", "or", " ", "meta", "-", "function", " ", "to", " ", "return", " ", "a", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "pars", "ing", " ", "a", " ", "logl", "ine", " ", "and", " ", "return", "ing", " ", "multiple", " ", "keys", " ", "(", "tab", "-", "delim", "ited", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "map_", "(_", "int_", ",_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "multi", "key", "\\u", "getter_", "(_", "line_", ",_", "parser_", ",_", "keyse", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "parser_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "delimiter_", "._", "join_", "(_", "(_", "unicode_", "(_", "data_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "keyse", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "multi", "index", "\\u", "getter_", "(_", "line_", ",_", "parser_", ",_", "keyse", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "parser_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "delimiter_", "._", "join_", "(_", "(_", "unicode_", "(_", "data_", "._", "by", "\\u", "index_", "(_", "idx_", "-_", "1_", ",_", "raw_", "=_", "True_", ")_", ")_", "for_", "idx_", "in_", "keys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "indices_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "indices_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "partial_", "(_", "multi", "index", "\\u", "getter_", ",_", "parser_", "=_", "parser_", ",_", "keyse", "t_", "=_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Field", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "partial_", "(_", "multi", "key", "\\u", "getter_", ",_", "parser_", "=_", "parser_", ",_", "keyse", "t_", "=_", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unescape", "\\u", "json_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Une", "scap", "e", " ", "a", " ", "string", " ", "tha", "t", " ", "was", " ", "previ", "ously", " ", "encode", "d", " ", "int", "o", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "unescape", "s", " ", "forward", " ", "slash", "es", " ", "(", "option", "al", " ", "in", " ", "JSO", "N", " ", "standard", "),", "\\", "10", ";", " ", " ", " ", " ", "backslash", "es", " ", "and", " ", "double", " ", "quote", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "._", "replace_", "(_", "\"\\\\\\\\", "/\"_", ",_", "'/'_", ")_", "._", "replace_", "(_", "'\\\\\\\\", "\"'_", ",_", "'\"'_", ")_", "._", "decode_", "(_", "'", "string", "\\u", "escape", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Log", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "all", " ", "our", " ", "parser", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "ABC", "Meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Log", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "able", " ", "interface", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "parse_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "logl", "ine", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "format_", "(_", "self_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "a", " ", "format", " ", "specifier", " ", "for", " ", "parser", ".", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "parser", "s", " ", "can", " ", "use", " ", "this", " ", "to", " ", "speci", "fy", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "format", " ", "string", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Log", "Line_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Instrum", "ente", "d", " ", "dictionar", "y", " ", "tha", "t", " ", "allow", "s", "\\", "10", ";", " ", " ", " ", " ", "convenien", "t", " ", "access", " ", "to", " ", "a", " ", "parsed", " ", "log", " ", "lines", ",", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "key", "-", "based", " ", "look", "up", " ", "/", " ", "index", "-", "based", " ", "/", " ", "raw", " ", "/", " ", "parsed", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Log", "Line_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fieldnames_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "logl", "ine", ".", " ", "Thi", "s", " ", "class", " ", "can", " ", "be", " ", "reus", "ed", "\\", "10", ";", " ", " ", " ", " ", "acro", "ss", " ", "multiple", " ", "input", " ", "lines", " ", "by", " ", "usi", "ng", " ", "the", " ", "clear", "()", "\\", "10", ";", " ", " ", " ", " ", "method", " ", "after", " ", "each", " ", "invocation", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fieldnames_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fieldnames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fieldnames_", "=_", "fieldnames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Line_", "(_", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fieldnames_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Getter", " ", "method", " ", "for", " ", "the", " ", "field", " ", "names", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "fieldnames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Line_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "fieldnames_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fieldnames_", "(_", "self_", ",_", "fieldnames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "log", " ", "format", " ", "field", " ", "names", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fieldnames_", "=_", "dict_", "(_", "enumerate_", "(_", "fieldnames_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Line_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "by", "\\u", "index_", "(_", "self_", ",_", "i_", ",_", "raw_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "by", "\\u", "key_", "(_", "self_", "._", "\\u", "fieldnames_", "[_", "i_", "]_", ",_", "raw_", "=_", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Line_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "by", "\\u", "key_", "(_", "self_", ",_", "key_", ",_", "raw_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "i", "-", "th", " ", "field", " ", "parsed", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "raw_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "==_", "'%", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "datetime_", "._", "strptime_", "(_", "self_", "[_", "key_", "]_", "[_", "1_", ":_", "-_", "7_", "]_", ",_", "'%", "d", "/", "%", "b", "/", "%", "Y", ":", "%", "H", ":", "%", "M", ":", "%", "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 ", " _", "val_", "=_", "self_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "JSO", "NP", "arser", "_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Parser", " ", "implementation", " ", "for", " ", "JSO", "N", " ", "format", " ", "logs", "\"\"\"_", "\\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_", "JSO", "NP", "arser", "_", "(_", "Log", "Parser_", ")_", ":_", "\\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 ", " _", "Log", "Parser_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "=_", "Log", "Line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSO", "NP", "arser", "_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "JSO", "N", " ", "line", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed", "\\u", "row_", "=_", "json_", "._", "loads_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "call", "ed", " ", "for", " ", "every", " ", "log", " ", "line", " ", "-", " ", "Thi", "s", " ", "is", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "JSO", "N", " ", "logs", " ", "are", " ", "genera", "ll", "y", " ", "schema", "-", "less", " ", "and", " ", "so", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "change", " ", "bet", "ween", " ", "lines", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "._", "fieldnames_", "=_", "parsed", "\\u", "row_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "parsed", "\\u", "row_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Access", "Log_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ap", "ache", " ", "access", "\\u", "log", " ", "logfile", " ", "parser", ".", " ", "Thi", "s", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "consume", " ", "arbitra", "ry", " ", "Ap", "ache", " ", "log", " ", "field", " ", "directive", "s", ".", " ", "see", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "http", "d", ".", "apa", "che", ".", "org", "/", "docs", "/", "1.3", "/", "logs", ".", "html", "#", "access", "log", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Access", "Log_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "format_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Log", "Parser_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fieldnames_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields", "elect", "or_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields", "elect", "or_", "=_", "self_", "._", "\\u", "parse", "\\u", "log", "\\u", "format_", "(_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "=_", "Log", "Line_", "(_", "self_", "._", "fieldnames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Log_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\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", "format_", "(_", "self_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "access", "\\u", "log", " ", "format", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields", "elect", "or_", "=_", "self_", "._", "\\u", "parse", "\\u", "log", "\\u", "format_", "(_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "=_", "Log", "Line_", "(_", "self_", "._", "fieldnames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Log_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "logl", "ine_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "log", " ", "line", " ", "int", "o", " ", "structure", "d", " ", "row", ".", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "raise", " ", "Pars", "e", "Error", " ", "Except", "ion", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "pars", "ing", " ", "fail", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "self_", "._", "fields", "elect", "or_", "._", "match_", "(_", "logl", "ine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ",_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"%", "s", " ", "need", "s", " ", "a", " ", "valid", " ", "format", " ", "string", " ", "(-", "-", "format", ")\"_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "zip_", "(_", "self_", "._", "fieldnames_", ",_", "match_", "._", "groups_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "parse", " ", "log", " ", "line", ":", " ", "'%", "s", "'\"_", "%_", "logl", "ine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Access", "Log_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\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", "parse", "\\u", "log", "\\u", "format_", "(_", "self_", ",_", "format_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "code", " ", "piece", " ", "is", " ", "based", " ", "on", " ", "the", " ", "apa", "che", "logs", " ", "\\", "10", ";", " ", " ", " ", " ", "python", "/", "perl", " ", "project", "s", ".", " ", "Rai", "ses", " ", "an", " ", "exception", " ", "if", " ", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "coul", "dn", "'", "t", " ", "compile", " ", "the", " ", "generat", "ed", " ", "regex", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "=_", "format_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "=_", "re_", "._", "sub_", "(_", "'[", " ", "\\\\", "t", "]+'_", ",_", "'", " ", "'_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subpa", "tter", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "find", "quotes_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "referrer", "agent_", "=_", "re_", "._", "compile_", "(_", "'", "Refer", "er", "|", "User", "-", "Agent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find", "percent_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "%", ".*", "t", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lst", "rip", "quotes_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rstr", "ip", "quotes_", "=_", "re_", "._", "compile_", "(_", "r", "'\"", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fieldnames_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "element_", "in_", "format_", "._", "split_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "quotes_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "find", "quotes_", "._", "match_", "(_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "quotes_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "quotes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "element_", "=_", "lst", "rip", "quotes_", "._", "sub_", "(_", "''_", ",_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "element_", "=_", "rstr", "ip", "quotes_", "._", "sub_", "(_", "''_", ",_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fieldnames_", "._", "append_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subpa", "tter", "n_", "=_", "'(\\\\", "S", "*)'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "has", "quotes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "==_", "'%", "r", "'_", "or_", "find", "referrer", "agent_", "._", "search_", "(_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subpa", "tter", "n_", "=_", "r", "'\\\\\"", "([", "^", "\"\\\\\\\\", "]*(", "?:\\\\", "\\\\.", "[", "^", "\"\\\\\\\\", "]*)", "*)\\\\", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subpa", "tter", "n_", "=_", "r", "'\\\\\"", "([", "^", "\\\\\"]", "*)\\\\", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "find", "percent_", "._", "search_", "(_", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subpa", "tter", "n_", "=_", "r", "'(\\\\", "[[", "^", "\\\\]", "]+\\\\", "])'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "element_", "==_", "'%", "U", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subpa", "tter", "n_", "=_", "'(", ".+?)", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subpa", "tter", "ns_", "._", "append_", "(_", "subpa", "tter", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "pattern_", "=_", "'", "^", "'_", "+_", "'", " ", "'_", "._", "join_", "(_", "subpa", "tter", "ns_", ")_", "+_", "'$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "\\u", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\\u", "regex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Common", "Log", "Format_", "(_", "Access", "Log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "the", " ", "CL", "F", " ", "Format", ",", " ", "defin", "ed", " ", "as", ":", "\\", "10", ";", " ", " ", " ", " ", "%", "h", " ", "%", "l", " ", "%", "u", " ", "%", "t", " ", "\\\\\"", "%", "r", "\\\\\"", " ", "%", ">", "s", " ", "%", "b", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "http", "d", ".", "apa", "che", ".", "org", "/", "docs", "/", "1.3", "/", "logs", ".", "html", "#", "access", "log", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Common", "Log", "Format_", "(_", "Access", "Log_", ")_", ":_", "\\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 ", " _", "Access", "Log_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "format_", "=_", "'%", "h", " ", "%", "l", " ", "%", "u", " ", "%", "t", " ", "\"%", "r", "\"", " ", "%", ">", "s", " ", "%", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "u", "WS", "GI", "Parser_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Parser", " ", "for", " ", "the", " ", "u", "WS", "GI", " ", "log", " ", "format", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "u", "WS", "GI", "Parser_", "(_", "Log", "Parser_", ")_", ":_", "\\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 ", " _", "Log", "Parser_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'.*", " ", "((", "?:[", "0", "-", "9", "]+\\\\", ".)", "{", "3", "}[", "0", "-", "9", "]+)", " ", ".*", " ", "\\\\[", "(.*?)", "\\\\]", " ", "(", "GET", "|", "POST", ")", " ", "(\\\\", "S", "+)", " ", ".*", " ", "generat", "ed", " ", "(\\\\", "d", "+)", " ", "bytes", " ", "in", " ", "(\\\\", "d", "+)", " ", "msec", "s", " ", ".*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fieldnames_", "=_", "(_", "'", "ip", "'_", ",_", "'", "timestamp", "'_", ",_", "'", "method", "'_", ",_", "'", "path", "'_", ",_", "'", "bytes", "'_", ",_", "'", "process", "ing", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "=_", "Log", "Line_", "(_", "self_", "._", "fieldnames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "u", "WS", "GI", "Parser_", "(_", "Log", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "logl", "ine_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "log", " ", "line", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "self_", "._", "\\u", "re_", "._", "match_", "(_", "logl", "ine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "\\u", "logl", "ine", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "zip_", "(_", "self_", "._", "fieldnames_", ",_", "match_", "._", "groups_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cou", "ld", " ", "not", " ", "parse", " ", "log", " ", "line", ":", " ", "'%", "s", "'\"_", "%_", "logl", "ine_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
Arelle/Arelle/arelle/ValidateFormula.py
[ { "content": "'''\nCreated on Dec 9, 2010\n\n@author: Mark V Systems Limited\n(c) Copyright 2010 Mark V Systems Limited, All rights reserved.\n'''\nimport os, sys, time, logging\nfrom collections import defaultdict\nfrom threading import Timer\n\nfrom arelle.ModelFormulaObject import (ModelParameter, ModelInstance, ModelVariableSet,\n ModelFormula, ModelTuple, ModelVariable, ModelFactVariable, \n ModelVariableSetAssertion, ModelConsistencyAssertion,\n ModelExistenceAssertion, ModelValueAssertion, ModelAssertionSeverity,\n ModelPrecondition, ModelConceptName, Trace,\n Aspect, aspectModels, ModelAspectCover,\n ModelMessage)\nfrom arelle.ModelRenderingObject import (ModelRuleDefinitionNode, ModelRelationshipDefinitionNode, ModelFilterDefinitionNode)\nfrom arelle.ModelObject import (ModelObject)\nfrom arelle.ModelValue import (qname,QName)\nfrom arelle import (XbrlConst, XmlUtil, ModelXbrl, ModelDocument, XPathParser, XPathContext, FunctionXs,\n ValidateXbrlDimensions) \n\narcroleChecks = {\n XbrlConst.equalityDefinition: (None, \n XbrlConst.qnEqualityDefinition, \n \"xbrlve:info\"),\n XbrlConst.assertionSet: (XbrlConst.qnAssertionSet,\n (XbrlConst.qnAssertion, XbrlConst.qnVariableSetAssertion),\n \"xbrlvalide:info\"),\n XbrlConst.assertionUnsatisfiedSeverity:\n ((XbrlConst.qnAssertion,XbrlConst.qnVariableSetAssertion),\n (XbrlConst.qnAssertionSeverityError, XbrlConst.qnAssertionSeverityWarning, XbrlConst.qnAssertionSeverityOk),\n \"seve:assertionSeveritySourceError\",\n \"seve:assertionSeverityTargetError\"),\n XbrlConst.variableSet: (XbrlConst.qnVariableSet,\n (XbrlConst.qnVariableVariable, XbrlConst.qnParameter),\n \"xbrlve:info\"),\n XbrlConst.variableSetFilter: (XbrlConst.qnVariableSet, \n XbrlConst.qnVariableFilter, \n \"xbrlve:info\"),\n XbrlConst.variableFilter: (XbrlConst.qnFactVariable, \n XbrlConst.qnVariableFilter, \n \"xbrlve:info\"),\n XbrlConst.booleanFilter: (XbrlConst.qnVariableFilter, \n XbrlConst.qnVariableFilter, \n \"xbrlbfe:info\"),\n XbrlConst.consistencyAssertionFormula: (XbrlConst.qnConsistencyAssertion, \n None, \n \"xbrlca:info\"),\n XbrlConst.functionImplementation: (XbrlConst.qnCustomFunctionSignature,\n XbrlConst.qnCustomFunctionImplementation,\n \"xbrlcfie:info\"),\n XbrlConst.tableBreakdown: (XbrlConst.qnTableTable,\n XbrlConst.qnTableBreakdown,\n \"xbrlte:tableBreakdownSourceError\",\n \"xbrlte:tableBreakdownTargetError\"),\n XbrlConst.tableBreakdownTree: (XbrlConst.qnTableBreakdown,\n (XbrlConst.qnTableClosedDefinitionNode,\n XbrlConst.qnTableAspectNode),\n \"xbrlte:breakdownTreeSourceError\",\n \"xbrlte:breakdownTreeTargetError\"),\n XbrlConst.tableDefinitionNodeSubtree: (XbrlConst.qnTableDefinitionNode, \n XbrlConst.qnTableDefinitionNode,\n \"xbrlte:definitionNodeSubtreeSourceError\",\n \"xbrlte:definitionNodeSubtreeTargetError\",\n (XbrlConst.qnTableConceptRelationshipNode,\n XbrlConst.qnTableDimensionRelationshipNode),\n None,\n \"xbrlte:prohibitedDefinitionNodeSubtreeSourceError\",\n None),\n XbrlConst.tableFilter: (XbrlConst.qnTableTable, \n XbrlConst.qnVariableFilter,\n \"xbrlte:tableFilterSourceError\",\n \"xbrlte:tableFilterTargetError\"),\n XbrlConst.tableParameter: (XbrlConst.qnTableTable, \n XbrlConst.qnParameter,\n \"xbrlte:tableParameterSourceError\",\n \"xbrlte:tableParameterTargetError\"),\n XbrlConst.tableAspectNodeFilter:(XbrlConst.qnTableAspectNode,\n XbrlConst.qnVariableFilter, \n \"xbrlte:aspectNodeFilterSourceError\",\n \"xbrlte:aspectNodeFilterTargetError\"),\n XbrlConst.tableBreakdownMMDD: (XbrlConst.qnTableTableMMDD,\n XbrlConst.qnTableBreakdownMMDD,\n \"xbrlte:tableBreakdownSourceError\",\n \"xbrlte:tableBreakdownTargetError\"),\n XbrlConst.tableBreakdownTreeMMDD:(XbrlConst.qnTableBreakdownMMDD,\n (XbrlConst.qnTableClosedDefinitionNodeMMDD,\n XbrlConst.qnTableAspectNodeMMDD),\n \"xbrlte:breakdownTreeSourceError\",\n \"xbrlte:breakdownTreeTargetError\"),\n XbrlConst.tableDefinitionNodeSubtreeMMDD: (XbrlConst.qnTableDefinitionNodeMMDD, \n XbrlConst.qnTableDefinitionNodeMMDD,\n \"xbrlte:definitionNodeSubtreeSourceError\",\n \"xbrlte:definitionNodeSubtreeTargetError\",\n (XbrlConst.qnTableConceptRelationshipNodeMMDD,\n XbrlConst.qnTableDimensionRelationshipNodeMMDD),\n None,\n \"xbrlte:prohibitedDefinitionNodeSubtreeSourceError\",\n None),\n XbrlConst.tableFilterMMDD: (XbrlConst.qnTableTableMMDD, \n XbrlConst.qnVariableFilter,\n \"xbrlte:tableFilterSourceError\",\n \"xbrlte:tableFilterTargetError\"),\n XbrlConst.tableParameterMMDD: (XbrlConst.qnTableTableMMDD, \n XbrlConst.qnParameter,\n \"xbrlte:tableParameterSourceError\",\n \"xbrlte:tableParameterTargetError\"),\n XbrlConst.tableAspectNodeFilterMMDD:(XbrlConst.qnTableAspectNodeMMDD,\n XbrlConst.qnVariableFilter, \n \"xbrlte:aspectNodeFilterSourceError\",\n \"xbrlte:aspectNodeFilterTargetError\"),\n XbrlConst.tableBreakdown201305: (XbrlConst.qnTableTable201305,\n XbrlConst.qnTableBreakdown201305, \n \"xbrlte:info\"),\n XbrlConst.tableBreakdownTree201305:(XbrlConst.qnTableBreakdown201305,\n (XbrlConst.qnTableClosedDefinitionNode201305,\n XbrlConst.qnTableAspectNode201305),\n \"xbrlte:info\"),\n XbrlConst.tableDefinitionNodeSubtree201305: (XbrlConst.qnTableClosedDefinitionNode201305, \n XbrlConst.qnTableClosedDefinitionNode201305, \n \"xbrlte:info\"),\n XbrlConst.tableFilter201305: (XbrlConst.qnTableTable201305, \n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableAspectNodeFilter201305:(XbrlConst.qnTableAspectNode201305,\n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableBreakdown201301: (XbrlConst.qnTableTable201301,\n (XbrlConst.qnTableClosedDefinitionNode201301, \n XbrlConst.qnTableFilterNode201301, \n XbrlConst.qnTableSelectionNode201301, \n XbrlConst.qnTableTupleNode201301),\n \"xbrlte:info\"),\n XbrlConst.tableAxis2011: (XbrlConst.qnTableTable2011,\n (XbrlConst.qnTablePredefinedAxis2011, \n XbrlConst.qnTableFilterAxis2011,\n XbrlConst.qnTableSelectionAxis2011, \n XbrlConst.qnTableTupleAxis2011),\n \"xbrlte:info\"),\n XbrlConst.tableFilter201301: (XbrlConst.qnTableTable201301, \n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableFilter2011: (XbrlConst.qnTableTable2011, \n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableDefinitionNodeSubtree201301: (XbrlConst.qnTableClosedDefinitionNode201301, \n XbrlConst.qnTableClosedDefinitionNode201301, \n \"xbrlte:info\"),\n XbrlConst.tableAxisSubtree2011: (XbrlConst.qnTablePredefinedAxis2011, \n XbrlConst.qnTablePredefinedAxis2011, \n \"xbrlte:info\"),\n XbrlConst.tableFilterNodeFilter2011:(XbrlConst.qnTableFilterNode201301,\n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableAxisFilter2011: (XbrlConst.qnTableFilterAxis2011,\n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableAxisFilter201205:(XbrlConst.qnTableFilterAxis2011,\n XbrlConst.qnVariableFilter, \n \"xbrlte:info\"),\n XbrlConst.tableTupleContent201301: ((XbrlConst.qnTableTupleNode201301,\n XbrlConst.qnTableTupleAxis2011), \n (XbrlConst.qnTableRuleNode201301,\n XbrlConst.qnTableRuleAxis2011), \n \"xbrlte:info\"),\n }\n \n \n\n\n \n \n \n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def checkBaseSet(val, arcrole, ELR, relsSet):\n # check hypercube-dimension relationships\n \n if arcrole in arcroleChecks:\n arcroleCheck = arcroleChecks[arcrole]\n notFromQname = notToQname = notFromErrCode = notToErrCode = None\n if len(arcroleCheck) == 3:\n fromQname, toQname, fromErrCode = arcroleCheck\n toErrCode = fromErrCode\n elif len(arcroleCheck) == 4: \n fromQname, toQname, fromErrCode, toErrCode = arcroleCheck\n elif len(arcroleCheck) == 8:\n fromQname, toQname, fromErrCode, toErrCode, notFromQname, notToQname, notFromErrCode, notToErrCode = arcroleCheck\n else:\n raise Exception(\"Invalid arcroleCheck \" + str(arcroleCheck))\n level = \"INFO\" if fromErrCode.endswith(\":info\") else \"ERROR\"\n for modelRel in relsSet.modelRelationships:\n fromMdlObj = modelRel.fromModelObject\n toMdlObj = modelRel.toModelObject\n if fromQname:\n if (fromMdlObj is None or \n # if not in subs group, only warn if the namespace has a loaded schema, otherwise no complaint\n (not val.modelXbrl.isInSubstitutionGroup(fromMdlObj.elementQname, fromQname) and\n fromMdlObj.elementQname.namespaceURI in val.modelXbrl.namespaceDocs)):\n val.modelXbrl.log(level, fromErrCode,\n _(\"Relationship from %(xlinkFrom)s to %(xlinkTo)s should have an %(element)s source\"),\n modelObject=modelRel, xlinkFrom=modelRel.fromLabel, xlinkTo=modelRel.toLabel, element=fromQname)\n elif notFromQname and val.modelXbrl.isInSubstitutionGroup(fromMdlObj.elementQname, notFromQname):\n val.modelXbrl.log(level, notFromErrCode,\n _(\"Relationship from %(xlinkFrom)s to %(xlinkTo)s should not have an %(element)s source\"),\n modelObject=modelRel, xlinkFrom=modelRel.fromLabel, xlinkTo=modelRel.toLabel, element=fromQname)\n if toQname:\n if (toMdlObj is None or \n (not val.modelXbrl.isInSubstitutionGroup(toMdlObj.elementQname, toQname) and\n toMdlObj.elementQname.namespaceURI in val.modelXbrl.namespaceDocs)):\n val.modelXbrl.log(level, toErrCode,\n _(\"Relationship from %(xlinkFrom)s to %(xlinkTo)s should have an %(element)s target\"),\n modelObject=modelRel, xlinkFrom=modelRel.fromLabel, xlinkTo=modelRel.toLabel, element=toQname)\n elif notToQname and val.modelXbrl.isInSubstitutionGroup(fromMdlObj.elementQname, notToQname):\n val.modelXbrl.log(level, notFromErrCode,\n _(\"Relationship from %(xlinkFrom)s to %(xlinkTo)s should not have an %(element)s target\"),\n modelObject=modelRel, xlinkFrom=modelRel.fromLabel, xlinkTo=modelRel.toLabel, element=fromQname)\n if arcrole == XbrlConst.functionImplementation:\n for relFrom, rels in relsSet.fromModelObjects().items():\n if len(rels) > 1:\n val.modelXbrl.error(\"xbrlcfie:tooManyCFIRelationships\",\n _(\"Function-implementation relationship from signature %(name)s has more than one implementation target\"),\n modelObject=[relFrom] + rels, name=relFrom.name)\n for relTo, rels in relsSet.toModelObjects().items():\n if len(rels) > 1:\n val.modelXbrl.error(\"xbrlcfie:tooManyCFIRelationships\",\n _(\"Function implementation %(xlinkLabel)s must be the target of only one function-implementation relationship\"),\n modelObject=[relTo] + rels, xlinkLabel=relTo.xlinkLabel)\n elif arcrole == XbrlConst.assertionUnsatisfiedSeverity:\n for relFrom, rels in relsSet.fromModelObjects().items():\n if len(rels) > 1:\n val.modelXbrl.error(\"seve:multipleSeveritiesForAssertionError\",\n _(\"Assertion-unsatisfied-severity relationship from %(xlinkLabel)s has more than one severity target\"),\n modelObject=[relFrom] + rels, xlinkLabel=relFrom.xlinkLabel)", "metadata": "root.checkBaseSet", "header": "['module', '___EOS___']", "index": 168 }, { "content": "def executeCallTest(val, name, callTuple, testTuple):\n if callTuple:\n XPathParser.initializeParser(val.modelXbrl.modelManager)\n \n try: \n val.modelXbrl.modelManager.showStatus(_(\"Executing call\"))\n callExprStack = XPathParser.parse(val, callTuple[0], callTuple[1], name + \" call\", Trace.CALL)\n xpathContext = XPathContext.create(val.modelXbrl, sourceElement=callTuple[1])\n result = xpathContext.evaluate(callExprStack)\n xpathContext.inScopeVars[qname('result',noPrefixIsNoNamespace=True)] = result \n val.modelXbrl.info(\"formula:trace\", \n _(\"%(name)s result %(result)s\"), \n modelObject=callTuple[1], name=name, result=str(result))\n \n if testTuple:\n val.modelXbrl.modelManager.showStatus(_(\"Executing test\"))\n testExprStack = XPathParser.parse(val, testTuple[0], testTuple[1], name + \" test\", Trace.CALL)\n testResult = xpathContext.effectiveBooleanValue( None, xpathContext.evaluate(testExprStack) )\n \n if testResult:\n val.modelXbrl.info(\"cfcn:testPass\",\n _(\"Test %(name)s result %(result)s\"), \n modelObject=testTuple[1], name=name, result=str(testResult))\n else:\n val.modelXbrl.error(\"cfcn:testFail\",\n _(\"Test %(name)s result %(result)s\"), \n modelObject=testTuple[1], name=name, result=str(testResult))\n \n xpathContext.close() # dereference\n\n except XPathContext.XPathException as err:\n val.modelXbrl.error(err.code,\n _(\"%(name)s evaluation error: %(error)s \\n%(errorSource)s\"),\n modelObject=callTuple[1], name=name, error=err.message, errorSource=err.sourceErrorIndication)\n\n val.modelXbrl.modelManager.showStatus(_(\"ready\"), 2000)", "metadata": "root.executeCallTest", "header": "['module', '___EOS___']", "index": 228 }, { "content": "def validate(val, xpathContext=None, parametersOnly=False, statusMsg='', compileOnly=False):\n for e in (\"xbrl.5.1.4.3:cycles\", \"xbrlgene:violatedCyclesConstraint\"):\n if e in val.modelXbrl.errors:\n val.modelXbrl.info(\"info\", _(\"Formula validation skipped due to %(error)s error\"),\n modelObject=val.modelXbrl, error=e)\n return\n \n val.modelXbrl.profileStat()\n formulaOptions = val.modelXbrl.modelManager.formulaOptions\n if XPathParser.initializeParser(val.modelXbrl.modelManager):\n val.modelXbrl.profileStat(_(\"initializeXPath2Grammar\")) # only provide stat when not yet initialized\n val.modelXbrl.modelManager.showStatus(statusMsg)\n val.modelXbrl.profileActivity()\n initialErrorCount = val.modelXbrl.logCount.get(logging._checkLevel('ERROR'), 0)\n \n # global parameter names\n parameterQnames = set()\n instanceQnames = set()\n parameterDependencies = {}\n instanceDependencies = defaultdict(set) # None-key entries are non-formula dependencies\n dependencyResolvedParameters = set()\n orderedParameters = []\n orderedInstances = []\n for paramQname, modelParameter in val.modelXbrl.qnameParameters.items():\n if isinstance(modelParameter, ModelParameter):\n modelParameter.compile()\n parameterDependencies[paramQname] = modelParameter.variableRefs()\n parameterQnames.add(paramQname)\n if isinstance(modelParameter, ModelInstance):\n instanceQnames.add(paramQname)\n # duplicates checked on loading modelDocument\n \n #resolve dependencies\n resolvedAParameter = True\n while (resolvedAParameter):\n resolvedAParameter = False\n for paramQname in parameterQnames:\n if paramQname not in dependencyResolvedParameters and \\\n len(parameterDependencies[paramQname] - dependencyResolvedParameters) == 0:\n dependencyResolvedParameters.add(paramQname)\n orderedParameters.append(paramQname)\n resolvedAParameter = True\n # anything unresolved?\n for paramQname in parameterQnames:\n if paramQname not in dependencyResolvedParameters:\n circularOrUndefDependencies = parameterDependencies[paramQname] - dependencyResolvedParameters\n undefinedVars = circularOrUndefDependencies - parameterQnames \n paramsCircularDep = circularOrUndefDependencies - undefinedVars\n if len(undefinedVars) > 0:\n val.modelXbrl.error(\"xbrlve:unresolvedDependency\",\n _(\"Undefined dependencies in parameter %(name)s, to names %(dependencies)s\"),\n modelObject=val.modelXbrl.qnameParameters[paramQname],\n name=paramQname, dependencies=\", \".join((str(v) for v in undefinedVars)))\n if len(paramsCircularDep) > 0:\n val.modelXbrl.error(\"xbrlve:parameterCyclicDependencies\",\n _(\"Cyclic dependencies in parameter %(name)s, to names %(dependencies)s\"),\n modelObject=val.modelXbrl.qnameParameters[paramQname],\n name=paramQname, dependencies=\", \".join((str(d) for d in paramsCircularDep)) )\n val.modelXbrl.profileActivity(\"... formula parameter checks\", minTimeToShow=1.0)\n \n for custFnSig in val.modelXbrl.modelCustomFunctionSignatures.values():\n # entries indexed by qname, arity are signature, by qname are just for parser (value=None)\n if custFnSig is not None:\n custFnQname = custFnSig.functionQname\n if custFnQname.namespaceURI == XbrlConst.xfi:\n val.modelXbrl.error(\"xbrlve:noProhibitedNamespaceForCustomFunction\",\n _(\"Custom function %(name)s has namespace reserved for functions in the function registry %(namespace)s\"),\n modelObject=custFnSig, name=custFnQname, namespace=custFnQname.namespaceURI )\n # check types\n _outputType = custFnSig.outputType\n if _outputType and _outputType.namespaceURI == XbrlConst.xsd and not FunctionXs.isXsType(_outputType.localName):\n val.modelXbrl.error(\"xbrlve:invalidDatatypeInCustomFunctionSignature\",\n _(\"Custom Function Signature %(name)s output type %(type)s is not valid\"), \n modelObject=custFnSig, name=custFnQname, type=_outputType)\n for _inputType in custFnSig.inputTypes:\n if _inputType and _inputType.namespaceURI == XbrlConst.xsd and not FunctionXs.isXsType(_inputType.localName):\n val.modelXbrl.error(\"xbrlve:invalidDatatypeInCustomFunctionSignature\",\n _(\"Custom Function Signature %(name)s input type %(type)s is not valid\"), \n modelObject=custFnSig, name=custFnQname, type=_inputType)\n # any custom function implementations?\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.functionImplementation).fromModelObject(custFnSig):\n custFnImpl = modelRel.toModelObject\n custFnSig.customFunctionImplementation = custFnImpl\n if len(custFnImpl.inputNames) != len(custFnSig.inputTypes):\n val.modelXbrl.error(\"xbrlcfie:inputMismatch\",\n _(\"Custom function %(name)s signature has %(parameterCountSignature)s parameters but implementation has %(parameterCountImplementation)s, must be matching\"),\n modelObject=custFnSig, name=custFnQname, \n parameterCountSignature=len(custFnSig.inputTypes), parameterCountImplementation=len(custFnImpl.inputNames) )\n \n for custFnImpl in val.modelXbrl.modelCustomFunctionImplementations:\n if not val.modelXbrl.relationshipSet(XbrlConst.functionImplementation).toModelObject(custFnImpl):\n val.modelXbrl.error(\"xbrlcfie:missingCFIRelationship\",\n _(\"Custom function implementation %(xlinkLabel)s has no relationship from any custom function signature\"),\n modelObject=custFnSig, xlinkLabel=custFnImpl.xlinkLabel)\n custFnImpl.compile()\n val.modelXbrl.profileActivity(\"... custom function checks and compilation\", minTimeToShow=1.0)\n \n # xpathContext is needed for filter setup for expressions such as aspect cover filter\n # determine parameter values\n \n if xpathContext is None:\n xpathContext = XPathContext.create(val.modelXbrl) \n xpathContext.parameterQnames = parameterQnames # needed for formula filters to determine variable dependencies\n for paramQname in orderedParameters:\n modelParameter = val.modelXbrl.qnameParameters[paramQname]\n if not isinstance(modelParameter, ModelInstance):\n asType = modelParameter.asType\n if asType and asType.namespaceURI == XbrlConst.xsd and not FunctionXs.isXsType(asType.localName):\n val.modelXbrl.error(\"xbrlve:parameterTypeMismatch\",\n _(\"Parameter %(name)s type %(type)s is not valid\"), \n modelObject=modelParameter, name=paramQname, type=asType)\n asLocalName = asType.localName if asType else \"string\"\n try:\n if val.parameters and paramQname in val.parameters:\n paramDataType, paramValue = val.parameters[paramQname]\n typeLocalName = paramDataType.localName if paramDataType else \"string\"\n value = FunctionXs.call(xpathContext, None, typeLocalName, [paramValue])\n result = FunctionXs.call(xpathContext, None, asLocalName, [value])\n if formulaOptions.traceParameterInputValue:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Parameter %(name)s input value %(input)s\"), \n modelObject=modelParameter, name=paramQname, input=result)\n xpathContext.inScopeVars[paramQname] = result # make visible to subsequent parameter expression \n elif modelParameter.isRequired:\n val.modelXbrl.error(\"xbrlve:missingParameterValue\",\n _(\"Parameter %(name)s is required but not input\"), \n modelObject=modelParameter, name=paramQname)\n elif not modelParameter.selectProg:\n val.modelXbrl.error(\"xbrlve:missingParameterValue\",\n _(\"Parameter %(name)s does not have a select attribute\"), \n modelObject=modelParameter, name=paramQname)\n else:\n result = modelParameter.evaluate(xpathContext, asType)\n if formulaOptions.traceParameterExpressionResult:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Parameter %(name)s select result %(result)s\"), \n modelObject=modelParameter, name=paramQname, result=result)\n xpathContext.inScopeVars[paramQname] = result # make visible to subsequent parameter expression \n except XPathContext.XPathException as err:\n val.modelXbrl.error(\"xbrlve:parameterTypeMismatch\" if err.code == \"err:FORG0001\" else err.code,\n _(\"Parameter \\n%(name)s \\nException: \\n%(error)s\"), \n modelObject=modelParameter, name=paramQname, error=err.message,\n messageCodes=(\"xbrlve:parameterTypeMismatch\", \"err:FORG0001\"))\n ''' Removed as per WG discussion 2012-12-20. This duplication checking unfairly presupposes URI based\n implementation and exceeds the scope of linkbase validation\n elif not parametersOnly: # is a modelInstance\n if val.parameters and paramQname in val.parameters:\n instanceModelXbrls = val.parameters[paramQname][1]\n instanceUris = set()\n for instanceModelXbrl in instanceModelXbrls:\n if instanceModelXbrl.uri in instanceUris:\n val.modelXbrl.error(\"xbrlvarinste:inputInstanceDuplication\",\n _(\"Input instance resource %(instName)s has multiple XBRL instances %(uri)s\"), \n modelObject=modelParameter, instName=paramQname, uri=instanceModelXbrl.uri)\n instanceUris.add(instanceModelXbrl.uri)\n if val.parameters and XbrlConst.qnStandardInputInstance in val.parameters: # standard input instance has\n if len(val.parameters[XbrlConst.qnStandardInputInstance][1]) != 1:\n val.modelXbrl.error(\"xbrlvarinste:standardInputInstanceNotUnique\",\n _(\"Standard input instance resource parameter has multiple XBRL instances\"), \n modelObject=modelParameter)\n '''\n val.modelXbrl.profileActivity(\"... parameter checks and select evaluation\", minTimeToShow=1.0)\n \n val.modelXbrl.profileStat(_(\"parametersProcessing\"))\n\n # check typed dimension equality test\n val.modelXbrl.modelFormulaEqualityDefinitions = {}\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.equalityDefinition).modelRelationships:\n typedDomainElt = modelRel.fromModelObject\n modelEqualityDefinition = modelRel.toModelObject\n if typedDomainElt in val.modelXbrl.modelFormulaEqualityDefinitions:\n val.modelXbrl.error(\"xbrlve:multipleTypedDimensionEqualityDefinitions\",\n _(\"Multiple typed domain definitions from %(typedDomain)s to %(equalityDefinition1)s and %(equalityDefinition2)s\"),\n modelObject=modelRel.arcElement, typedDomain=typedDomainElt.qname,\n equalityDefinition1=modelEqualityDefinition.xlinkLabel,\n equalityDefinition2=val.modelXbrl.modelFormulaEqualityDefinitions[typedDomainElt].xlinkLabel)\n else:\n modelEqualityDefinition.compile()\n val.modelXbrl.modelFormulaEqualityDefinitions[typedDomainElt] = modelEqualityDefinition\n \n if parametersOnly:\n return\n\n for modelVariableSet in val.modelXbrl.modelVariableSets:\n modelVariableSet.compile()\n val.modelXbrl.profileStat(_(\"formulaCompilation\"))\n\n produceOutputXbrlInstance = False\n instanceProducingVariableSets = defaultdict(list)\n \n for modelVariableSet in val.modelXbrl.modelVariableSets:\n varSetInstanceDependencies = set()\n if isinstance(modelVariableSet, ModelFormula):\n instanceQname = None\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.formulaInstance).fromModelObject(modelVariableSet):\n instance = modelRel.toModelObject\n if isinstance(instance, ModelInstance):\n if instanceQname is None:\n instanceQname = instance.instanceQname\n modelVariableSet.fromInstanceQnames = {instanceQname} # required if referred to by variables scope chaining\n else:\n val.modelXbrl.info(\"arelle:multipleOutputInstances\",\n _(\"Multiple output instances for formula %(xlinkLabel)s, to names %(instanceTo)s, %(instanceTo2)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, \n instanceTo=instanceQname, instanceTo2=instance.instanceQname)\n if instanceQname is None: \n instanceQname = XbrlConst.qnStandardOutputInstance\n instanceQnames.add(instanceQname)\n modelVariableSet.fromInstanceQnames = None # required if referred to by variables scope chaining\n modelVariableSet.outputInstanceQname = instanceQname\n if getattr(val, \"validateSBRNL\", False): # may not exist on some val objects\n val.modelXbrl.error(\"SBR.NL.2.3.9.03\",\n _(\"Formula:formula %(xlinkLabel)s is not allowed\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel)\n else:\n instanceQname = None\n modelVariableSet.countSatisfied = 0\n modelVariableSet.countNotSatisfied = 0\n checkValidationMessages(val, modelVariableSet)\n instanceProducingVariableSets[instanceQname].append(modelVariableSet)\n modelVariableSet.outputInstanceQname = instanceQname\n if modelVariableSet.aspectModel not in (\"non-dimensional\", \"dimensional\"):\n val.modelXbrl.error(\"xbrlve:unknownAspectModel\",\n _(\"Variable set %(xlinkLabel)s, aspect model %(aspectModel)s not recognized\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, aspectModel=modelVariableSet.aspectModel)\n modelVariableSet.hasConsistencyAssertion = False\n \n #determine dependencies within variable sets\n nameVariables = {}\n qnameRels = {}\n definedNamesSet = set()\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.variableSet).fromModelObject(modelVariableSet):\n varqname = modelRel.variableQname\n if varqname:\n qnameRels[varqname] = modelRel\n toVariable = modelRel.toModelObject\n if varqname not in definedNamesSet:\n definedNamesSet.add(varqname)\n if varqname not in nameVariables:\n nameVariables[varqname] = toVariable\n elif nameVariables[varqname] != toVariable:\n val.modelXbrl.error(\"xbrlve:duplicateVariableNames\",\n _(\"Multiple variables named %(xlinkLabel)s in variable set %(name)s\"),\n modelObject=toVariable, xlinkLabel=modelVariableSet.xlinkLabel, name=varqname )\n fromInstanceQnames = None\n for instRel in val.modelXbrl.relationshipSet(XbrlConst.instanceVariable).toModelObject(toVariable):\n fromInstance = instRel.fromModelObject\n if isinstance(fromInstance, ModelInstance):\n fromInstanceQname = fromInstance.instanceQname\n varSetInstanceDependencies.add(fromInstanceQname)\n instanceDependencies[instanceQname].add(fromInstanceQname)\n if fromInstanceQnames is None: fromInstanceQnames = set()\n fromInstanceQnames.add(fromInstanceQname)\n if fromInstanceQnames is None:\n varSetInstanceDependencies.add(XbrlConst.qnStandardInputInstance)\n if instanceQname: instanceDependencies[instanceQname].add(XbrlConst.qnStandardInputInstance)\n toVariable.fromInstanceQnames = fromInstanceQnames\n else:\n val.modelXbrl.error(\"xbrlve:variableNameResolutionFailure\",\n _(\"Variables name %(name)s cannot be determined on arc from %(xlinkLabel)s\"),\n modelObject=modelRel, xlinkLabel=modelVariableSet.xlinkLabel, name=modelRel.variablename )\n checkVariablesScopeVisibleQnames(val, nameVariables, definedNamesSet, modelVariableSet)\n definedNamesSet |= parameterQnames\n \n variableDependencies = {}\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.variableSet).fromModelObject(modelVariableSet):\n variable = modelRel.toModelObject\n if isinstance(variable, (ModelParameter,ModelVariable)): # ignore anything not parameter or variable\n varqname = modelRel.variableQname\n depVars = variable.variableRefs()\n variableDependencies[varqname] = depVars\n if len(depVars) > 0 and formulaOptions.traceVariablesDependencies:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Variable set %(xlinkLabel)s, variable %(name)s, dependences %(dependencies)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, \n name=varqname, dependencies=depVars)\n definedNamesSet.add(varqname)\n # check for fallback value variable references\n if isinstance(variable, ModelFactVariable):\n variable.hasNoVariableDependencies = len(depVars - parameterQnames) == 0\n for depVar in XPathParser.variableReferencesSet(variable.fallbackValueProg, variable):\n if depVar in qnameRels and isinstance(qnameRels[depVar].toModelObject,ModelVariable):\n val.modelXbrl.error(\"xbrlve:fallbackValueVariableReferenceNotAllowed\",\n _(\"Variable set %(xlinkLabel)s fallbackValue '%(fallbackValue)s' cannot refer to variable %(dependency)s\"),\n modelObject=variable, xlinkLabel=modelVariableSet.xlinkLabel, \n fallbackValue=variable.fallbackValue, dependency=depVar)\n # check for covering aspect not in variable set aspect model\n checkFilterAspectModel(val, modelVariableSet, variable.filterRelationships, xpathContext)\n\n orderedNameSet = set()\n orderedNameList = []\n orderedAVariable = True\n while (orderedAVariable):\n orderedAVariable = False\n for varqname, depVars in variableDependencies.items():\n if varqname not in orderedNameSet and len(depVars - parameterQnames - orderedNameSet) == 0:\n orderedNameList.append(varqname)\n orderedNameSet.add(varqname)\n orderedAVariable = True\n if varqname in instanceQnames:\n varSetInstanceDependencies.add(varqname)\n instanceDependencies[instanceQname].add(varqname)\n elif isinstance(nameVariables.get(varqname), ModelInstance):\n instqname = nameVariables[varqname].instanceQname\n varSetInstanceDependencies.add(instqname)\n instanceDependencies[instanceQname].add(instqname)\n \n # anything unresolved?\n for varqname, depVars in variableDependencies.items():\n if varqname not in orderedNameSet:\n circularOrUndefVars = depVars - parameterQnames - orderedNameSet\n undefinedVars = circularOrUndefVars - definedNamesSet \n varsCircularDep = circularOrUndefVars - undefinedVars\n if len(undefinedVars) > 0:\n val.modelXbrl.error(\"xbrlve:unresolvedDependency\",\n _(\"Undefined variable dependencies in variable set %(xlinkLabel)s, from variable %(nameFrom)s to %(nameTo)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, \n nameFrom=varqname, nameTo=undefinedVars)\n if len(varsCircularDep) > 0:\n val.modelXbrl.error(\"xbrlve:cyclicDependencies\",\n _(\"Cyclic dependencies in variable set %(xlinkLabel)s, from variable %(nameFrom)s to %(nameTo)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, \n nameFrom=varqname, nameTo=varsCircularDep )\n \n # check unresolved variable set dependencies\n for varSetDepVarQname in modelVariableSet.variableRefs():\n if varSetDepVarQname not in definedNamesSet and varSetDepVarQname not in parameterQnames:\n val.modelXbrl.error(\"xbrlve:unresolvedDependency\",\n _(\"Undefined variable dependency in variable set %(xlinkLabel)s, %(name)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel,\n name=varSetDepVarQname)\n if varSetDepVarQname in instanceQnames:\n varSetInstanceDependencies.add(varSetDepVarQname)\n instanceDependencies[instanceQname].add(varSetDepVarQname)\n elif isinstance(nameVariables.get(varSetDepVarQname), ModelInstance):\n instqname = nameVariables[varSetDepVarQname].instanceQname\n varSetInstanceDependencies.add(instqname)\n instanceDependencies[instanceQname].add(instqname)\n \n if formulaOptions.traceVariablesOrder:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Variable set %(xlinkLabel)s, variables order: %(dependencies)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, dependencies=orderedNameList)\n \n if (formulaOptions.traceVariablesDependencies and len(varSetInstanceDependencies) > 0 and\n varSetInstanceDependencies != {XbrlConst.qnStandardInputInstance}):\n val.modelXbrl.info(\"formula:trace\",\n _(\"Variable set %(xlinkLabel)s, instance dependences %(dependencies)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, dependencies=varSetInstanceDependencies)\n \n modelVariableSet.orderedVariableRelationships = []\n for varqname in orderedNameList:\n if varqname in qnameRels:\n modelVariableSet.orderedVariableRelationships.append(qnameRels[varqname])\n \n orderedNameSet.clear() \n del orderedNameList[:] # dereference \n \n # check existence assertion @test variable dependencies (not including precondition references)\n if isinstance(modelVariableSet, ModelExistenceAssertion):\n for depVar in XPathParser.variableReferencesSet(modelVariableSet.testProg, modelVariableSet):\n if depVar in qnameRels and isinstance(qnameRels[depVar].toModelObject,ModelVariable):\n val.modelXbrl.error(\"xbrleae:variableReferenceNotAllowed\",\n _(\"Existence Assertion %(xlinkLabel)s, cannot refer to variable %(name)s\"),\n modelObject=modelVariableSet, xlinkLabel=modelVariableSet.xlinkLabel, name=depVar)\n \n # check messages variable dependencies\n checkValidationMessageVariables(val, modelVariableSet, qnameRels, xpathContext.parameterQnames)\n\n if isinstance(modelVariableSet, ModelFormula): # check consistency assertion message variables and its messages variables\n for consisAsserRel in val.modelXbrl.relationshipSet(XbrlConst.consistencyAssertionFormula).toModelObject(modelVariableSet):\n consisAsser = consisAsserRel.fromModelObject\n if isinstance(consisAsser, ModelConsistencyAssertion):\n checkValidationMessages(val, consisAsser)\n checkValidationMessageVariables(val, consisAsser, qnameRels, xpathContext.parameterQnames)\n \n # check preconditions\n modelVariableSet.preconditions = []\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.variableSetPrecondition).fromModelObject(modelVariableSet):\n precondition = modelRel.toModelObject\n if isinstance(precondition, ModelPrecondition):\n modelVariableSet.preconditions.append(precondition)\n \n # check for variable sets referencing fact or general variables\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.variableSetFilter).fromModelObject(modelVariableSet):\n varSetFilter = modelRel.toModelObject\n if modelRel.isCovered:\n val.modelXbrl.warning(\"arelle:variableSetFilterCovered\",\n _(\"Variable set %(xlinkLabel)s, filter %(filterLabel)s, cannot be covered\"),\n modelObject=varSetFilter, xlinkLabel=modelVariableSet.xlinkLabel, filterLabel=varSetFilter.xlinkLabel)\n modelRel._isCovered = False # block group filter from being able to covered\n \n for depVar in varSetFilter.variableRefs():\n if depVar in qnameRels and isinstance(qnameRels[depVar].toModelObject,ModelVariable):\n val.modelXbrl.error(\"xbrlve:factVariableReferenceNotAllowed\",\n _(\"Variable set %(xlinkLabel)s, filter %(filterLabel)s, cannot refer to variable %(name)s\"),\n modelObject=varSetFilter, xlinkLabel=modelVariableSet.xlinkLabel, filterLabel=varSetFilter.xlinkLabel, name=depVar)\n \n # check aspects of formula\n if isinstance(modelVariableSet, ModelFormula):\n checkFormulaRules(val, modelVariableSet, nameVariables)\n\n nameVariables.clear() # dereference\n qnameRels.clear()\n definedNamesSet.clear()\n variableDependencies.clear()\n varSetInstanceDependencies.clear()\n\n val.modelXbrl.profileActivity(\"... assertion and formula checks and compilation\", minTimeToShow=1.0)\n \n for modelTable in val.modelXbrl.modelRenderingTables:\n modelTable.fromInstanceQnames = None # required if referred to by variables scope chaining\n if modelTable.aspectModel not in (\"non-dimensional\", \"dimensional\"):\n val.modelXbrl.error(\"xbrlte:unknownAspectModel\",\n _(\"Table %(xlinkLabel)s, aspect model %(aspectModel)s not recognized\"),\n modelObject=modelTable, xlinkLabel=modelTable.xlinkLabel, aspectModel=modelTable.aspectModel)\n modelTable.compile()\n checkTableRules(val, xpathContext, modelTable)\n\n val.modelXbrl.profileActivity(\"... rendering tables and axes checks and compilation\", minTimeToShow=1.0)\n \n # determine instance dependency order\n orderedInstancesSet = set()\n stdInpInst = {XbrlConst.qnStandardInputInstance}\n orderedInstancesList = []\n orderedAnInstance = True\n while (orderedAnInstance):\n orderedAnInstance = False\n for instqname, depInsts in instanceDependencies.items():\n if instqname and instqname not in orderedInstancesSet and len(depInsts - stdInpInst - orderedInstancesSet) == 0:\n orderedInstancesList.append(instqname)\n orderedInstancesSet.add(instqname)\n orderedAnInstance = True\n # add instances with variable sets with no variables or other dependencies\n for independentInstance in _DICT_SET(instanceProducingVariableSets.keys()) - _DICT_SET(orderedInstancesList): # must be set for 2.7 compatibility\n orderedInstancesList.append(independentInstance)\n orderedInstancesSet.add(independentInstance)\n if None not in orderedInstancesList:\n orderedInstancesList.append(None) # assertions come after all formulas that produce outputs\n\n # anything unresolved?\n for instqname, depInsts in instanceDependencies.items():\n if instqname not in orderedInstancesSet:\n # can also be satisfied from an input DTS\n missingDependentInstances = depInsts - stdInpInst\n if val.parameters: missingDependentInstances -= _DICT_SET(val.parameters.keys()) \n if instqname:\n if missingDependentInstances:\n val.modelXbrl.error(\"xbrlvarinste:instanceVariableRecursionCycle\",\n _(\"Cyclic dependencies of instance %(name)s produced by a formula, with variables consuming instances %(dependencies)s\"),\n modelObject=val.modelXbrl,\n name=instqname, dependencies=missingDependentInstances )\n elif instqname == XbrlConst.qnStandardOutputInstance:\n orderedInstancesSet.add(instqname)\n orderedInstancesList.append(instqname) # standard output formula, all input dependencies in parameters\n ''' future check? if instance has no external input or producing formula\n else:\n val.modelXbrl.error(\"xbrlvarinste:instanceVariableRecursionCycle\",\n _(\"Unresolved dependencies of an assertion's variables on instances %(dependencies)s\"),\n dependencies=str(_DICT_SET(depInsts) - stdInpInst) )\n '''\n elif instqname in depInsts: # check for direct cycle\n val.modelXbrl.error(\"xbrlvarinste:instanceVariableRecursionCycle\",\n _(\"Cyclic dependencies of instance %(name)s produced by its own variables\"),\n modelObject=val.modelXbrl, name=instqname )\n\n if formulaOptions.traceVariablesOrder and len(orderedInstancesList) > 1:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Variable instances processing order: %(dependencies)s\"),\n modelObject=val.modelXbrl, dependencies=orderedInstancesList)\n\n # linked consistency assertions\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.consistencyAssertionFormula).modelRelationships:\n if (modelRel.fromModelObject is not None and modelRel.toModelObject is not None and \n isinstance(modelRel.toModelObject,ModelFormula)):\n consisAsser = modelRel.fromModelObject\n consisAsser.countSatisfied = 0\n consisAsser.countNotSatisfied = 0\n if consisAsser.hasProportionalAcceptanceRadius and consisAsser.hasAbsoluteAcceptanceRadius:\n val.modelXbrl.error(\"xbrlcae:acceptanceRadiusConflict\",\n _(\"Consistency assertion %(xlinkLabel)s has both absolute and proportional acceptance radii\"), \n modelObject=consisAsser, xlinkLabel=consisAsser.xlinkLabel)\n consisAsser.orderedVariableRelationships = []\n for consisParamRel in val.modelXbrl.relationshipSet(XbrlConst.consistencyAssertionParameter).fromModelObject(consisAsser):\n if isinstance(consisParamRel.toModelObject, ModelVariable):\n val.modelXbrl.error(\"xbrlcae:variablesNotAllowed\",\n _(\"Consistency assertion %(xlinkLabel)s has relationship to a %(elementTo)s %(xlinkLabelTo)s\"),\n modelObject=consisAsser, xlinkLabel=consisAsser.xlinkLabel, \n elementTo=consisParamRel.toModelObject.localName, xlinkLabelTo=consisParamRel.toModelObject.xlinkLabel)\n elif isinstance(consisParamRel.toModelObject, ModelParameter):\n consisAsser.orderedVariableRelationships.append(consisParamRel)\n consisAsser.compile()\n modelRel.toModelObject.hasConsistencyAssertion = True\n val.modelXbrl.profileActivity(\"... consistency assertion setup\", minTimeToShow=1.0)\n\n # validate default dimensions in instances and accumulate multi-instance-default dimension aspects\n xpathContext.defaultDimensionAspects = set(val.modelXbrl.qnameDimensionDefaults.keys())\n xpathContext.dimensionsAspectUniverse = xpathContext.defaultDimensionAspects\n for cntx in val.modelXbrl.contexts.values(): # note that this maybe should not include unreferenced contexts\n xpathContext.dimensionsAspectUniverse |= _DICT_SET(cntx.qnameDims.keys())\n \n #xpathContext.reportedDimensionAspects = set()\n #_evaluatedContexts = set()\n for instanceQname in instanceQnames:\n if (instanceQname not in (XbrlConst.qnStandardInputInstance,XbrlConst.qnStandardOutputInstance) and\n val.parameters and instanceQname in val.parameters):\n for namedInstance in val.parameters[instanceQname][1]:\n ValidateXbrlDimensions.loadDimensionDefaults(namedInstance)\n xpathContext.defaultDimensionAspects |= _DICT_SET(namedInstance.qnameDimensionDefaults.keys())\n xpathContext.dimensionsAspectUniverse |= _DICT_SET(namedInstance.qnameDimensionDefaults.keys())\n for cntx in namedInstance.contexts.values():\n xpathContext.dimensionsAspectUniverse |= _DICT_SET(cntx.qnameDims.keys())\n #for fact in namedInstance.factsInInstance: \n # _cntx = fact.context\n # if fact.isItem and _cntx is not None and _cntx not in _evaluatedContexts:\n # xpathContext.reportedDimensionAspects |= _DICT_SET(_cntx.qnameDims.keys())\n #del _evaluatedContexts # dereference\n #xpathContext.reportedDefaultDimensionAspects = xpathContext.defaultDimensionAspects & xpathContext.reportedDimensionAspects\n\n\n # determine reportedDimensionAspects (for which facts report any value of the dimension)\n \n # check for variable set dependencies across output instances produced\n for instanceQname, modelVariableSets in instanceProducingVariableSets.items():\n for modelVariableSet in modelVariableSets:\n for varScopeRel in val.modelXbrl.relationshipSet(XbrlConst.variablesScope).toModelObject(modelVariableSet):\n if varScopeRel.fromModelObject is not None:\n sourceVariableSet = varScopeRel.fromModelObject\n if sourceVariableSet.outputInstanceQname != instanceQname:\n val.modelXbrl.error(\"xbrlvarscopee:differentInstances\",\n _(\"Variable set %(xlinkLabel1)s in instance %(instance1)s has variables scope relationship to varaible set %(xlinkLabel2)s in instance %(instance2)s\"),\n modelObject=modelVariableSet, \n xlinkLabel1=sourceVariableSet.xlinkLabel, instance1=sourceVariableSet.outputInstanceQname,\n xlinkLabel2=modelVariableSet.xlinkLabel, instance2=modelVariableSet.outputInstanceQname)\n if sourceVariableSet.aspectModel != modelVariableSet.aspectModel:\n val.modelXbrl.error(\"xbrlvarscopee:conflictingAspectModels\",\n _(\"Variable set %(xlinkLabel1)s aspectModel (%(aspectModel1)s) differs from varaible set %(xlinkLabel2)s aspectModel (%(aspectModel2)s)\"),\n modelObject=modelVariableSet, \n xlinkLabel1=sourceVariableSet.xlinkLabel, aspectModel1=sourceVariableSet.aspectModel,\n xlinkLabel2=modelVariableSet.xlinkLabel, aspectModel2=modelVariableSet.aspectModel)\n val.modelXbrl.profileActivity(\"... instances scopes and setup\", minTimeToShow=1.0)\n\n val.modelXbrl.profileStat(_(\"formulaValidation\"))\n if (initialErrorCount < val.modelXbrl.logCount.get(logging._checkLevel('ERROR'), 0) or\n compileOnly or \n getattr(val, \"validateFormulaCompileOnly\", False)):\n return # don't try to execute\n \n\n # formula output instances \n if instanceQnames: \n val.modelXbrl.modelManager.showStatus(_(\"initializing formula output instances\"))\n schemaRefs = [val.modelXbrl.modelDocument.relativeUri(referencedDoc.uri)\n for referencedDoc in val.modelXbrl.modelDocument.referencesDocument.keys()\n if referencedDoc.type == ModelDocument.Type.SCHEMA]\n \n outputXbrlInstance = None\n for instanceQname in instanceQnames:\n if instanceQname == XbrlConst.qnStandardInputInstance:\n continue # always present the standard way\n if val.parameters and instanceQname in val.parameters:\n namedInstance = val.parameters[instanceQname][1] # this is a sequence\n else: # empty intermediate instance \n uri = val.modelXbrl.modelDocument.filepath[:-4] + \"-output-XBRL-instance\"\n if instanceQname != XbrlConst.qnStandardOutputInstance:\n uri = uri + \"-\" + instanceQname.localName\n uri = uri + \".xml\"\n namedInstance = ModelXbrl.create(val.modelXbrl.modelManager, \n newDocumentType=ModelDocument.Type.INSTANCE,\n url=uri,\n schemaRefs=schemaRefs,\n isEntry=True)\n ValidateXbrlDimensions.loadDimensionDefaults(namedInstance) # need dimension defaults \n xpathContext.inScopeVars[instanceQname] = namedInstance\n if instanceQname == XbrlConst.qnStandardOutputInstance:\n outputXbrlInstance = namedInstance\n val.modelXbrl.profileActivity(\"... output instances setup\", minTimeToShow=1.0)\n val.modelXbrl.profileStat(_(\"formulaInstancesSetup\"))\n timeFormulasStarted = time.time()\n \n val.modelXbrl.modelManager.showStatus(_(\"running formulae\"))\n \n # IDs may be \"|\" or whitespace separated\n runIDs = (formulaOptions.runIDs or '').replace('|',' ').split()\n if runIDs:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Formua/assertion IDs restriction: %(ids)s\"), \n modelXbrl=val.modelXbrl, ids=', '.join(runIDs))\n \n # evaluate consistency assertions\n try:\n if hasattr(val, \"maxFormulaRunTime\") and val.maxFormulaRunTime > 0:\n maxFormulaRunTimeTimer = Timer(val.maxFormulaRunTime * 60.0, xpathContext.runTimeExceededCallback)\n maxFormulaRunTimeTimer.start()\n else:\n maxFormulaRunTimeTimer = None\n # evaluate variable sets not in consistency assertions\n from arelle.FormulaEvaluator import init as formulaEvaluatorInit, evaluate\n formulaEvaluatorInit() # one-time module initialization\n val.modelXbrl.profileActivity(\"... evaluations\", minTimeToShow=1.0)\n for instanceQname in orderedInstancesList:\n for modelVariableSet in instanceProducingVariableSets[instanceQname]:\n # produce variable evaluations if no dependent variables-scope relationships\n if not val.modelXbrl.relationshipSet(XbrlConst.variablesScope).toModelObject(modelVariableSet):\n if (not runIDs or \n modelVariableSet.id in runIDs or\n (modelVariableSet.hasConsistencyAssertion and \n any(modelRel.fromModelObject.id in runIDs\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.consistencyAssertionFormula).toModelObject(modelVariableSet)\n if isinstance(modelRel.fromModelObject, ModelConsistencyAssertion)))):\n try:\n varSetId = (modelVariableSet.id or modelVariableSet.xlinkLabel)\n val.modelXbrl.profileActivity(\"... evaluating \" + varSetId, minTimeToShow=10.0)\n val.modelXbrl.modelManager.showStatus(_(\"evaluating {0}\").format(varSetId))\n val.modelXbrl.profileActivity(\"... evaluating \" + varSetId, minTimeToShow=1.0)\n evaluate(xpathContext, modelVariableSet)\n val.modelXbrl.profileStat(modelVariableSet.localName + \"_\" + varSetId)\n except XPathContext.XPathException as err:\n val.modelXbrl.error(err.code,\n _(\"Variable set \\n%(variableSet)s \\nException: \\n%(error)s\"), \n modelObject=modelVariableSet, variableSet=str(modelVariableSet), error=err.message)\n if maxFormulaRunTimeTimer:\n maxFormulaRunTimeTimer.cancel()\n except XPathContext.RunTimeExceededException:\n val.modelXbrl.info(\"formula:maxRunTime\",\n _(\"Formula execution ended after %(mins)s minutes\"), \n modelObject=val.modelXbrl, mins=val.maxFormulaRunTime)\n \n # log assertion result counts\n asserTests = {}\n for exisValAsser in val.modelXbrl.modelVariableSets:\n if isinstance(exisValAsser, ModelVariableSetAssertion) and \\\n (not runIDs or exisValAsser.id in runIDs):\n asserTests[exisValAsser.id] = (exisValAsser.countSatisfied, exisValAsser.countNotSatisfied)\n if formulaOptions.traceAssertionResultCounts:\n val.modelXbrl.info(\"formula:trace\",\n _(\"%(assertionType)s Assertion %(id)s evaluations : %(satisfiedCount)s satisfied, %(notSatisfiedCount)s not satisfied\"),\n modelObject=exisValAsser,\n assertionType=\"Existence\" if isinstance(exisValAsser, ModelExistenceAssertion) else \"Value\", \n id=exisValAsser.id, satisfiedCount=exisValAsser.countSatisfied, notSatisfiedCount=exisValAsser.countNotSatisfied)\n\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.consistencyAssertionFormula).modelRelationships:\n if modelRel.fromModelObject is not None and modelRel.toModelObject is not None and \\\n isinstance(modelRel.toModelObject,ModelFormula) and \\\n (not runIDs or modelRel.fromModelObject.id in runIDs):\n consisAsser = modelRel.fromModelObject\n asserTests[consisAsser.id] = (consisAsser.countSatisfied, consisAsser.countNotSatisfied)\n if formulaOptions.traceAssertionResultCounts:\n val.modelXbrl.info(\"formula:trace\",\n _(\"Consistency Assertion %(id)s evaluations : %(satisfiedCount)s satisfied, %(notSatisfiedCount)s not satisfied\"),\n modelObject=consisAsser, id=consisAsser.id, \n satisfiedCount=consisAsser.countSatisfied, notSatisfiedCount=consisAsser.countNotSatisfied)\n \n if asserTests: # pass assertion results to validation if appropriate\n val.modelXbrl.log(None, \"asrtNoLog\", None, assertionResults=asserTests);\n\n # display output instance\n if outputXbrlInstance:\n if val.modelXbrl.formulaOutputInstance:\n # close prior instance, usually closed by caller to validate as it may affect UI on different thread\n val.modelXbrl.formulaOutputInstance.close()\n val.modelXbrl.formulaOutputInstance = outputXbrlInstance\n \n val.modelXbrl.modelManager.showStatus(_(\"formulae finished\"), 2000)\n \n instanceProducingVariableSets.clear() # dereference\n parameterQnames.clear()\n instanceQnames.clear()\n parameterDependencies.clear()\n instanceDependencies.clear()\n dependencyResolvedParameters.clear()\n orderedInstancesSet.clear()\n del orderedParameters, orderedInstances, orderedInstancesList\n xpathContext.close() # dereference everything\n val.modelXbrl.profileStat(_(\"formulaExecutionTotal\"), time.time() - timeFormulasStarted)", "metadata": "root.validate", "header": "['module', '___EOS___']", "index": 265 }, { "content": "def checkVariablesScopeVisibleQnames(val, nameVariables, definedNamesSet, modelVariableSet):\n for visibleVarSetRel in val.modelXbrl.relationshipSet(XbrlConst.variablesScope).toModelObject(modelVariableSet):\n varqname = visibleVarSetRel.variableQname # name (if any) of the formula result\n if varqname:\n if varqname not in nameVariables:\n nameVariables[varqname] = visibleVarSetRel.fromModelObject\n if varqname not in definedNamesSet:\n definedNamesSet.add(varqname)\n visibleVarSet = visibleVarSetRel.fromModelObject\n for modelRel in val.modelXbrl.relationshipSet(XbrlConst.variableSet).fromModelObject(visibleVarSet):\n varqname = modelRel.variableQname\n if varqname:\n if varqname not in nameVariables:\n nameVariables[varqname] = modelRel.toModelObject\n if varqname not in definedNamesSet:\n definedNamesSet.add(varqname)\n checkVariablesScopeVisibleQnames(val, nameVariables, definedNamesSet, visibleVarSet)", "metadata": "root.checkVariablesScopeVisibleQnames", "header": "['module', '___EOS___']", "index": 941 }, { "content": "def checkFilterAspectModel(val, variableSet, filterRelationships, xpathContext, uncoverableAspects=None):\n result = set() # all of the aspects found to be covered\n if uncoverableAspects is None:\n # protect 2.7 conversion\n oppositeAspectModel = (_DICT_SET({'dimensional','non-dimensional'}) - _DICT_SET({variableSet.aspectModel})).pop()\n try:\n uncoverableAspects = aspectModels[oppositeAspectModel] - aspectModels[variableSet.aspectModel]\n except KeyError: # bad aspect model, not an issue for this test\n return result\n acfAspectsCovering = {}\n for varFilterRel in filterRelationships:\n _filter = varFilterRel.toModelObject # use _filter instead of filter to prevent 2to3 confusion\n isAllAspectCoverFilter = False\n if isinstance(_filter, ModelAspectCover):\n for aspect in _filter.aspectsCovered(None, xpathContext):\n if aspect in acfAspectsCovering:\n otherFilterCover, otherFilterLabel = acfAspectsCovering[aspect]\n if otherFilterCover != varFilterRel.isCovered:\n val.modelXbrl.error(\"xbrlacfe:inconsistentAspectCoverFilters\",\n _(\"Variable set %(xlinkLabel)s, aspect cover filter %(filterLabel)s, aspect %(aspect)s, conflicts with %(filterLabel2)s with inconsistent cover attribute\"),\n modelObject=variableSet, xlinkLabel=variableSet.xlinkLabel, filterLabel=_filter.xlinkLabel, \n aspect=str(aspect) if isinstance(aspect,QName) else Aspect.label[aspect],\n filterLabel2=otherFilterLabel)\n else:\n acfAspectsCovering[aspect] = (varFilterRel.isCovered, _filter.xlinkLabel)\n isAllAspectCoverFilter = _filter.isAll\n if True: # changed for test case 50210 v03 varFilterRel.isCovered:\n try:\n aspectsCovered = _filter.aspectsCovered(None)\n if (not isAllAspectCoverFilter and \n (any(isinstance(aspect,QName) for aspect in aspectsCovered) and Aspect.DIMENSIONS in uncoverableAspects\n or (aspectsCovered & uncoverableAspects))):\n val.modelXbrl.error(\"xbrlve:filterAspectModelMismatch\",\n _(\"Variable set %(xlinkLabel)s, aspect model %(aspectModel)s filter %(filterName)s %(filterLabel)s can cover aspect not in aspect model\"),\n modelObject=variableSet, xlinkLabel=variableSet.xlinkLabel, aspectModel=variableSet.aspectModel, \n filterName=_filter.localName, filterLabel=_filter.xlinkLabel)\n result |= aspectsCovered \n except Exception:\n pass\n if hasattr(_filter, \"filterRelationships\"): # check and & or filters\n result |= checkFilterAspectModel(val, variableSet, _filter.filterRelationships, xpathContext, uncoverableAspects)\n return result", "metadata": "root.checkFilterAspectModel", "header": "['module', '___EOS___']", "index": 959 }, { "content": "def checkFormulaRules(val, formula, nameVariables):\n if not (formula.hasRule(Aspect.CONCEPT) or formula.source(Aspect.CONCEPT)):\n if XmlUtil.hasDescendant(formula, XbrlConst.formula, \"concept\"):\n val.modelXbrl.error(\"xbrlfe:incompleteConceptRule\",\n _(\"Formula %(xlinkLabel)s concept rule does not have a nearest source and does not have a child element\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n else:\n val.modelXbrl.error(\"xbrlfe:missingConceptRule\",\n _(\"Formula %(xlinkLabel)s omits a rule for the concept aspect\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n if not isinstance(formula, ModelTuple):\n if (not (formula.hasRule(Aspect.SCHEME) or formula.source(Aspect.SCHEME)) or\n not (formula.hasRule(Aspect.VALUE) or formula.source(Aspect.VALUE))):\n if XmlUtil.hasDescendant(formula, XbrlConst.formula, \"entityIdentifier\"):\n val.modelXbrl.error(\"xbrlfe:incompleteEntityIdentifierRule\",\n _(\"Formula %(xlinkLabel)s entity identifier rule does not have a nearest source and does not have either a @scheme or a @value attribute\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n else:\n val.modelXbrl.error(\"xbrlfe:missingEntityIdentifierRule\",\n _(\"Formula %(xlinkLabel)s omits a rule for the entity identifier aspect\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n if not (formula.hasRule(Aspect.PERIOD_TYPE) or formula.source(Aspect.PERIOD_TYPE)):\n if XmlUtil.hasDescendant(formula, XbrlConst.formula, \"period\"):\n val.modelXbrl.error(\"xbrlfe:incompletePeriodRule\",\n _(\"Formula %(xlinkLabel)s period rule does not have a nearest source and does not have a child element\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n else:\n val.modelXbrl.error(\"xbrlfe:missingPeriodRule\",\n _(\"Formula %(xlinkLabel)s omits a rule for the period aspect\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n # for unit need to see if the qname is statically determinable to determine if numeric\n concept = val.modelXbrl.qnameConcepts.get(formula.evaluateRule(None, Aspect.CONCEPT))\n if concept is None: # is there a source with a static QName filter\n sourceFactVar = nameVariables.get(formula.source(Aspect.CONCEPT))\n if isinstance(sourceFactVar, ModelFactVariable):\n for varFilterRels in (formula.groupFilterRelationships, sourceFactVar.filterRelationships):\n for varFilterRel in varFilterRels:\n _filter = varFilterRel.toModelObject\n if isinstance(_filter,ModelConceptName): # relationship not constrained to real filters\n for conceptQname in _filter.conceptQnames:\n concept = val.modelXbrl.qnameConcepts.get(conceptQname)\n if concept is not None and concept.isNumeric:\n break\n if concept is not None: # from concept aspect rule or from source factVariable concept Qname filter\n if concept.isNumeric:\n if not (formula.hasRule(Aspect.MULTIPLY_BY) or formula.hasRule(Aspect.DIVIDE_BY) or formula.source(Aspect.UNIT)):\n if XmlUtil.hasDescendant(formula, XbrlConst.formula, \"unit\"):\n val.modelXbrl.error(\"xbrlfe:missingSAVForUnitRule\",\n _(\"Formula %(xlinkLabel)s unit rule does not have a source and does not have a child element\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n else:\n val.modelXbrl.error(\"xbrlfe:missingUnitRule\",\n _(\"Formula %(xlinkLabel)s omits a rule for the unit aspect\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel)\n elif (formula.hasRule(Aspect.MULTIPLY_BY) or formula.hasRule(Aspect.DIVIDE_BY) or \n formula.source(Aspect.UNIT, acceptFormulaSource=False)):\n val.modelXbrl.error(\"xbrlfe:conflictingAspectRules\",\n _(\"Formula %(xlinkLabel)s has a rule for the unit aspect of a non-numeric concept %(concept)s\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, concept=concept.qname)\n aspectPeriodType = formula.evaluateRule(None, Aspect.PERIOD_TYPE)\n if ((concept.periodType == \"duration\" and aspectPeriodType == \"instant\") or\n (concept.periodType == \"instant\" and aspectPeriodType in (\"duration\",\"forever\"))):\n val.modelXbrl.error(\"xbrlfe:conflictingAspectRules\",\n _(\"Formula %(xlinkLabel)s has a rule for the %(aspectPeriodType)s period aspect of a %(conceptPeriodType)s concept %(concept)s\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, concept=concept.qname, aspectPeriodType=aspectPeriodType, conceptPeriodType=concept.periodType)\n \n # check dimension elements\n for eltName, dim, badUsageErr, missingSavErr in ((\"explicitDimension\", \"explicit\", \"xbrlfe:badUsageOfExplicitDimensionRule\", \"xbrlfe:missingSAVForExplicitDimensionRule\"),\n (\"typedDimension\", \"typed\", \"xbrlfe:badUsageOfTypedDimensionRule\", \"xbrlfe:missingSAVForTypedDimensionRule\")):\n for dimElt in XmlUtil.descendants(formula, XbrlConst.formula, eltName):\n dimQname = qname(dimElt, dimElt.get(\"dimension\"))\n dimConcept = val.modelXbrl.qnameConcepts.get(dimQname)\n if dimQname and (dimConcept is None or (not dimConcept.isExplicitDimension if dim == \"explicit\" else not dimConcept.isTypedDimension)):\n val.modelXbrl.error(badUsageErr,\n _(\"Formula %(xlinkLabel)s dimension attribute %(dimension)s on the %(dimensionType)s dimension rule contains a QName that does not identify an (dimensionType)s dimension.\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, dimensionType=dim, dimension=dimQname,\n messageCodes=(\"xbrlfe:badUsageOfExplicitDimensionRule\", \"xbrlfe:badUsageOfTypedDimensionRule\"))\n elif not XmlUtil.hasChild(dimElt, XbrlConst.formula, \"*\") and not formula.source(Aspect.DIMENSIONS, dimElt):\n val.modelXbrl.error(missingSavErr,\n _(\"Formula %(xlinkLabel)s %(dimension)s dimension rule does not have any child elements and does not have a SAV for the %(dimensionType)s dimension that is identified by its dimension attribute.\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, dimensionType=dim, dimension=dimQname,\n messageCodes=(\"xbrlfe:missingSAVForExplicitDimensionRule\", \"xbrlfe:missingSAVForTypedDimensionRule\"))\n \n # check aspect model expectations\n if formula.aspectModel == \"non-dimensional\":\n unexpectedElts = XmlUtil.descendants(formula, XbrlConst.formula, (\"explicitDimension\", \"typedDimension\"))\n if unexpectedElts:\n val.modelXbrl.error(\"xbrlfe:unrecognisedAspectRule\",\n _(\"Formula %(xlinkLabel)s aspect model, %(aspectModel)s, includes an rule for aspect not defined in this aspect model: %(undefinedAspects)s\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, aspectModel=formula.aspectModel, undefinedAspects=\", \".join([elt.localName for elt in unexpectedElts]))\n\n # check source qnames\n for sourceElt in ([formula] + \n XmlUtil.descendants(formula, XbrlConst.formula, \"*\", \"source\",\"*\")):\n if sourceElt.get(\"source\") is not None:\n qnSource = qname(sourceElt, sourceElt.get(\"source\"), noPrefixIsNoNamespace=True)\n if qnSource == XbrlConst.qnFormulaUncovered:\n if formula.implicitFiltering != \"true\":\n val.modelXbrl.error(\"xbrlfe:illegalUseOfUncoveredQName\",\n _(\"Formula %(xlinkLabel)s, not implicit filtering element has formulaUncovered source: %(name)s\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, name=sourceElt.localName) \n elif qnSource not in nameVariables:\n val.modelXbrl.error(\"xbrlfe:nonexistentSourceVariable\",\n _(\"Variable set %(xlinkLabel)s, source %(name)s is not in the variable set\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, name=qnSource)\n else:\n factVariable = nameVariables.get(qnSource)\n if isinstance(factVariable, ModelVariableSet):\n pass\n elif not isinstance(factVariable, ModelFactVariable):\n val.modelXbrl.error(\"xbrlfe:nonexistentSourceVariable\",\n _(\"Variable set %(xlinkLabel)s, source %(name)s not a factVariable but is a %(element)s\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, name=qnSource, element=factVariable.localName)\n elif factVariable.fallbackValue is not None:\n val.modelXbrl.error(\"xbrlfe:bindEmptySourceVariable\",\n _(\"Formula %(xlinkLabel)s: source %(name)s is a fact variable that has a fallback value\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, name=qnSource)\n elif sourceElt.localName == \"formula\" and factVariable.bindAsSequence == \"true\":\n val.modelXbrl.error(\"xbrlfe:defaultAspectValueConflicts\",\n _(\"Formula %(xlinkLabel)s: formula source %(name)s is a fact variable that binds as a sequence\"),\n modelObject=formula, xlinkLabel=formula.xlinkLabel, name=qnSource)", "metadata": "root.checkFormulaRules", "header": "['module', '___EOS___']", "index": 1002 }, { "content": "def checkTableRules(val, xpathContext, table):\n # check for covering aspect not in variable set aspect model\n checkFilterAspectModel(val, table, table.filterRelationships, xpathContext)\n\n checkDefinitionNodeRules(val, table, table, (XbrlConst.tableBreakdown, XbrlConst.tableBreakdownMMDD, XbrlConst.tableBreakdown201305, XbrlConst.tableAxis2011), xpathContext)", "metadata": "root.checkTableRules", "header": "['module', '___EOS___']", "index": 1124 }, { "content": "def checkDefinitionNodeRules(val, table, parent, arcrole, xpathContext):\n for rel in val.modelXbrl.relationshipSet(arcrole).fromModelObject(parent):\n axis = rel.toModelObject\n if axis is not None:\n if isinstance(axis, ModelFilterDefinitionNode):\n checkFilterAspectModel(val, table, axis.filterRelationships, xpathContext)\n #if not checkFilterAspectModel(val, table, axis.filterRelationships, xpathContext):\n # this removed after 2013-01-06 PWD\n #val.modelXbrl.error(\"xbrlte:axisFilterCoversNoAspects\",\n # _(\"FilterAxis %(xlinkLabel)s does not cover any aspects.\"),\n # modelObject=axis, xlinkLabel=axis.xlinkLabel)\n else:\n if isinstance(axis, ModelRuleDefinitionNode):\n # check dimension elements\n for eltName, dim, badUsageErr in ((\"explicitDimension\", \"explicit\", \"xbrlfe:badUsageOfExplicitDimensionRule\"),\n (\"typedDimension\", \"typed\", \"xbrlfe:badUsageOfTypedDimensionRule\")):\n for dimElt in XmlUtil.descendants(axis, XbrlConst.formula, eltName):\n dimQname = qname(dimElt, dimElt.get(\"dimension\"))\n dimConcept = val.modelXbrl.qnameConcepts.get(dimQname)\n if dimQname and (dimConcept is None or (not dimConcept.isExplicitDimension if dim == \"explicit\" else not dimConcept.isTypedDimension)):\n val.modelXbrl.error(badUsageErr,\n _(\"RuleAxis %(xlinkLabel)s dimension attribute %(dimension)s on the %(dimensionType)s dimension rule contains a QName that does not identify an (dimensionType)s dimension.\"),\n modelObject=axis, xlinkLabel=axis.xlinkLabel, dimensionType=dim, dimension=dimQname,\n messageCodes=(\"xbrlfe:badUsageOfExplicitDimensionRule\", \"xbrlfe:badUsageOfTypedDimensionRule\"))\n memQname = axis.evaluateRule(None, dimQname)\n if dimConcept.isExplicitDimension and memQname is not None and memQname not in val.modelXbrl.qnameConcepts: \n val.modelXbrl.info(\"table:info\",\n _(\"RuleAxis rule %(xlinkLabel)s contains a member QName %(memQname)s which is not in the DTS.\"),\n modelObject=axis, xlinkLabel=axis.xlinkLabel, memQname=memQname)\n \n # check aspect model expectations\n if table.aspectModel == \"non-dimensional\":\n unexpectedElts = XmlUtil.descendants(axis, XbrlConst.formula, (\"explicitDimension\", \"typedDimension\"))\n if unexpectedElts:\n val.modelXbrl.error(\"xbrlte:axisAspectModelMismatch\",\n _(\"RuleAxis %(xlinkLabel)s aspect model, %(aspectModel)s, includes an rule for aspect not defined in this aspect model: %(undefinedAspects)s\"),\n modelObject=axis, xlinkLabel=axis.xlinkLabel, aspectModel=table.aspectModel, undefinedAspects=\", \".join([elt.localName for elt in unexpectedElts]))\n \n # check source qnames\n for sourceElt in ([axis] + \n XmlUtil.descendants(axis, XbrlConst.formula, \"*\", \"source\",\"*\")):\n if sourceElt.get(\"source\") is not None:\n qnSource = qname(sourceElt, sourceElt.get(\"source\"), noPrefixIsNoNamespace=True)\n val.modelXbrl.info(\"table:info\",\n _(\"RuleAxis rule %(xlinkLabel)s contains a @source attribute %(qnSource)s which is not applicable to table rule axes.\"),\n modelObject=axis, xlinkLabel=axis.xlinkLabel, qnSource=qnSource)\n conceptQname = axis.evaluateRule(None, Aspect.CONCEPT)\n if conceptQname and conceptQname not in val.modelXbrl.qnameConcepts: \n val.modelXbrl.info(\"table:info\",\n _(\"RuleAxis rule %(xlinkLabel)s contains a concept QName %(conceptQname)s which is not in the DTS.\"),\n modelObject=axis, xlinkLabel=axis.xlinkLabel, conceptQname=conceptQname)\n \n elif isinstance(axis, ModelRelationshipDefinitionNode):\n for qnameAttr in (\"relationshipSourceQname\", \"arcQname\", \"linkQname\", \"dimensionQname\"):\n eltQname = axis.get(qnameAttr)\n if eltQname and eltQname not in val.modelXbrl.qnameConcepts: \n val.modelXbrl.info(\"table:info\",\n _(\"%(axis)s rule %(xlinkLabel)s contains a %(qnameAttr)s QName %(qname)s which is not in the DTS.\"),\n modelObject=axis, axis=axis.localName.title(), xlinkLabel=axis.xlinkLabel, \n qnameAttr=qnameAttr, qname=eltQname)\n checkDefinitionNodeRules(val, table, axis, (XbrlConst.tableBreakdownTree, XbrlConst.tableBreakdownTreeMMDD, XbrlConst.tableBreakdownTree201305, XbrlConst.tableDefinitionNodeSubtree201301, XbrlConst.tableAxisSubtree2011), xpathContext) ", "metadata": "root.checkDefinitionNodeRules", "header": "['module', '___EOS___']", "index": 1130 }, { "content": "def checkValidationMessages(val, modelVariableSet):\n for msgRelationship in (XbrlConst.assertionSatisfiedMessage, XbrlConst.assertionUnsatisfiedMessage):\n for modelRel in val.modelXbrl.relationshipSet(msgRelationship).fromModelObject(modelVariableSet):\n checkMessageExpressions(val, modelRel.toModelObject)", "metadata": "root.checkValidationMessages", "header": "['module', '___EOS___']", "index": 1192 }, { "content": "def checkMessageExpressions(val, message):\n if isinstance(message, ModelMessage) and not hasattr(message,\"expressions\"):\n formatString = []\n expressions = []\n bracketNesting = 0\n skipTo = None\n expressionIndex = 0\n expression = None\n lastC = None\n for c in message.text:\n if skipTo:\n if c == skipTo:\n skipTo = None\n if expression is not None and c in ('\\'', '\"'):\n skipTo = c\n elif lastC == c and c in ('{','}'):\n lastC = None\n elif lastC == '{': \n bracketNesting += 1\n expression = []\n lastC = None\n elif c == '}' and expression is not None: \n expressions.append( ''.join(expression).strip() )\n expression = None\n formatString.append( \"0[{0}]\".format(expressionIndex) )\n expressionIndex += 1\n lastC = c\n elif lastC == '}':\n bracketNesting -= 1\n lastC = None\n else:\n lastC = c\n \n if expression is not None: expression.append(c)\n else: formatString.append(c)\n \n if lastC == '}':\n bracketNesting -= 1\n if bracketNesting:\n val.modelXbrl.error(\"xbrlmsge:missingLeftCurlyBracketInMessage\" if bracketNesting < 0 else \"xbrlmsge:missingRightCurlyBracketInMessage\",\n _(\"Message %(xlinkLabel)s: unbalanced %(character)s character(s) in: %(text)s\"),\n modelObject=message, xlinkLabel=message.xlinkLabel, \n character='{' if bracketNesting < 0 else '}', \n text=message.text,\n messageCodes=(\"xbrlmsge:missingLeftCurlyBracketInMessage\", \"xbrlmsge:missingRightCurlyBracketInMessage\"))\n else:\n message.expressions = expressions\n message.formatString = ''.join( formatString )\n if not message.xmlLang:\n val.modelXbrl.error(\"xbrlmsge:xbrlmsge:missingMessageLanguage\",\n _(\"Message %(xlinkLabel)s is missing an effective value for xml:lang: %(text)s.\"),\n modelObject=message, xlinkLabel=message.xlinkLabel, text=message.text)", "metadata": "root.checkMessageExpressions", "header": "['module', '___EOS___']", "index": 1197 }, { "content": "def checkValidationMessageVariables(val, modelVariableSet, varNames, paramNames):\n if isinstance(modelVariableSet, ModelConsistencyAssertion):\n varSetVars = (qname(XbrlConst.ca,'aspect-matched-facts'),\n qname(XbrlConst.ca,'acceptance-radius'),\n qname(XbrlConst.ca,'absolute-acceptance-radius-expression'),\n qname(XbrlConst.ca,'proportional-acceptance-radius-expression'))\n elif isinstance(modelVariableSet, ModelExistenceAssertion):\n varSetVars = (XbrlConst.qnEaTestExpression,)\n elif isinstance(modelVariableSet, ModelValueAssertion):\n varSetVars = (XbrlConst.qnVaTestExpression,)\n for msgRelationship in (XbrlConst.assertionSatisfiedMessage, XbrlConst.assertionUnsatisfiedMessage):\n for modelRel in val.modelXbrl.relationshipSet(msgRelationship).fromModelObject(modelVariableSet):\n message = modelRel.toModelObject\n message.compile()\n for msgVarQname in message.variableRefs():\n if msgVarQname not in varNames and msgVarQname not in varSetVars and msgVarQname not in paramNames:\n val.modelXbrl.error(\"err:XPST0008\",\n _(\"Undefined variable dependency in message %(xlinkLabel)s, %(name)s\"),\n modelObject=message, xlinkLabel=message.xlinkLabel, name=msgVarQname)\n elif (msgVarQname in varNames and \n isinstance(modelVariableSet, ModelExistenceAssertion) and\n isinstance(varNames[msgVarQname].toModelObject,ModelVariable)):\n val.modelXbrl.error(\"err:XPST0008\",\n _(\"Existence Assertion depends on evaluation variable in message %(xlinkLabel)s, %(name)s\"),\n modelObject=message, xlinkLabel=message.xlinkLabel, name=msgVarQname)", "metadata": "root.checkValidationMessageVariables", "header": "['module', '___EOS___']", "index": 1250 } ]
[ { "span": "import os, sys, time, logging", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 29 }, { "span": "from arelle.ModelFormulaObject import (ModelParameter, ModelInstance, ModelVariableSet,\n ModelFormula, ModelTuple, ModelVariable, ModelFactVariable, \n ModelVariableSetAssertion, ModelConsistencyAssertion,\n ModelExistenceAssertion, ModelValueAssertion, ModelAssertionSeverity,\n ModelPrecondition, ModelConceptName, Trace,\n Aspect, aspectModels, ModelAspectCover,\n ModelMessage)", "start_line": 10, "start_column": 0, "end_line": 16, "end_column": 52 }, { "span": "from arelle.ModelObject import (ModelObject)", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "De", "c", " ", "9", ",", " ", "2010", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", "\\", "10", ";", "(", "c", ")", " ", "Copy", "right", " ", "2010", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "time_", ",_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Form", "ula", "Object_", "import_", "(_", "Model", "Parameter_", ",_", "Model", "Instance_", ",_", "Model", "Varia", "ble", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Formula_", ",_", "Model", "Tuple_", ",_", "Model", "Variable_", ",_", "Model", "Fact", "Variable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Varia", "ble", "Set", "Assert", "ion_", ",_", "Model", "Cons", "iste", "nc", "y", "Assert", "ion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Exist", "ence", "Assert", "ion_", ",_", "Model", "Value", "Assert", "ion_", ",_", "Model", "Assert", "ion", "Severity", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Precon", "dition", "_", ",_", "Model", "Concept", "Name_", ",_", "Trace_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Asp", "ect_", ",_", "aspect", "Models_", ",_", "Model", "Asp", "ect", "Cover", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Rendering", "Object_", "import_", "(_", "Model", "Rule", "Definit", "ion", "Node_", ",_", "Model", "Relationship", "Definit", "ion", "Node_", ",_", "Model", "Filter", "Definit", "ion", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Object_", "import_", "(_", "Model", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Value_", "import_", "(_", "qname_", ",_", "QN", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "(_", "Xbrl", "Const_", ",_", "Xm", "l", "Util_", ",_", "Model", "Xbrl", "_", ",_", "Model", "Document_", ",_", "XP", "ath", "Parser_", ",_", "XP", "ath", "Context_", ",_", "Function", "Xs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Validate", "Xbrl", "Dimensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arc", "role", "Check", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "equality", "Definition_", ":_", "(_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Equali", "ty", "Definition_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lve", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "assertion", "Set_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Assert", "ion", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Assert", "ion_", ",_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Set", "Assert", "ion_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lval", "ide", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "assertion", "Uns", "ati", "sfi", "ed", "Severity", "_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "Xbrl", "Const_", "._", "qn", "Assert", "ion_", ",_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Set", "Assert", "ion_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Assert", "ion", "Severity", "Error_", ",_", "Xbrl", "Const_", "._", "qn", "Assert", "ion", "Severity", "Warning_", ",_", "Xbrl", "Const_", "._", "qn", "Assert", "ion", "Severity", "Ok_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "se", "ve", ":", "assertion", "Severity", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "se", "ve", ":", "assertion", "Severity", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "variab", "le", "Set_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Variable_", ",_", "Xbrl", "Const_", "._", "qn", "Parameter_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lve", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "variab", "le", "Set", "Filter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lve", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "variab", "le", "Filter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Fact", "Variable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lve", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "boolean", "Filter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lb", "fe", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Formula_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Cons", "iste", "nc", "y", "Assert", "ion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lca", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "function", "Implementation", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Custom", "Function", "Signature_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Custom", "Function", "Implementation", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lc", "fie", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Break", "down", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Break", "down", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "breakdown", "Tree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "breakdown", "Tree", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Definit", "ion", "Node", "Subt", "ree_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Definit", "ion", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Definit", "ion", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "definit", "ion", "Node", "Subt", "ree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "definit", "ion", "Node", "Subt", "ree", "Target", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Concept", "Relationship", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Dimen", "sion", "Relationship", "Node_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "pro", "hibit", "ed", "Definit", "ion", "Node", "Subt", "ree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Filter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Filter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Parameter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Parameter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Parameter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Parameter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Asp", "ect", "Node", "Filter_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "aspect", "Node", "Filter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "aspect", "Node", "Filter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Break", "down", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Break", "down", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node", "MM", "DD", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "breakdown", "Tree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "breakdown", "Tree", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Definit", "ion", "Node", "Subt", "ree", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Definit", "ion", "Node", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Definit", "ion", "Node", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "definit", "ion", "Node", "Subt", "ree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "definit", "ion", "Node", "Subt", "ree", "Target", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Concept", "Relationship", "Node", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Dimen", "sion", "Relationship", "Node", "MM", "DD", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "pro", "hibit", "ed", "Definit", "ion", "Node", "Subt", "ree", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Filter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Filter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Parameter", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Parameter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Parameter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "table", "Parameter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Asp", "ect", "Node", "Filter", "MM", "DD", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node", "MM", "DD", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "aspect", "Node", "Filter", "Sou", "rce", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "aspect", "Node", "Filter", "Target", "Error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "20130", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree", "20130", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Break", "down", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node", "20130", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Definit", "ion", "Node", "Subt", "ree", "20130", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter", "20130", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Asp", "ect", "Node", "Filter", "20130", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Asp", "ect", "Node", "20130", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Break", "down", "20130", "1_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Filter", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Selecti", "on", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Tup", "le", "Node", "20130", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Axi", "s2", "011", "_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "2011_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Pred", "efin", "ed", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Filter", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Selecti", "on", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Tup", "le", "Axi", "s2", "011", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter", "20130", "1_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter", "2011_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Table", "2011_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Definit", "ion", "Node", "Subt", "ree", "20130", "1_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Clos", "ed", "Definit", "ion", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Axi", "s", "Subt", "ree", "2011_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Pred", "efin", "ed", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Pred", "efin", "ed", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Filter", "Node", "Filter", "2011_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Filter", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Axi", "s", "Filter", "2011_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Filter", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Axi", "s", "Filter", "20120", "5_", ":_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Filter", "Axi", "s2", "011", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Varia", "ble", "Filter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "table", "Tup", "le", "Conten", "t2", "013", "01_", ":_", "(_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Tup", "le", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Tup", "le", "Axi", "s2", "011", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Xbrl", "Const_", "._", "qn", "Table", "Rule", "Node", "20130", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Xbrl", "Const_", "._", "qn", "Table", "Rule", "Axi", "s2", "011", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xbr", "lte", ":", "info", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "Base", "Set_", "(_", "val_", ",_", "arc", "role_", ",_", "EL", "R_", ",_", "rel", "s", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "hyper", "cube", "-", "dimension", " ", "relationships_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arc", "role_", "in_", "arc", "role", "Check", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arc", "role", "Check_", "=_", "arc", "role", "Check", "s_", "[_", "arc", "role_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "Fro", "m", "Qn", "ame_", "=_", "not", "To", "Qn", "ame_", "=_", "not", "Fro", "m", "Err", "Code_", "=_", "not", "To", "Err", "Code_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "arc", "role", "Check_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "Qn", "ame_", ",_", "to", "Qn", "ame_", ",_", "from", "Err", "Code_", "=_", "arc", "role", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "Err", "Code_", "=_", "from", "Err", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "arc", "role", "Check_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "Qn", "ame_", ",_", "to", "Qn", "ame_", ",_", "from", "Err", "Code_", ",_", "to", "Err", "Code_", "=_", "arc", "role", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "arc", "role", "Check_", ")_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "Qn", "ame_", ",_", "to", "Qn", "ame_", ",_", "from", "Err", "Code_", ",_", "to", "Err", "Code_", ",_", "not", "Fro", "m", "Qn", "ame_", ",_", "not", "To", "Qn", "ame_", ",_", "not", "Fro", "m", "Err", "Code_", ",_", "not", "To", "Err", "Code_", "=_", "arc", "role", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Inva", "lid", " ", "arc", "role", "Check", " ", "\"_", "+_", "str_", "(_", "arc", "role", "Check_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level_", "=_", "\"", "INFO", "\"_", "if_", "from", "Err", "Code_", "._", "endswith_", "(_", "\":", "info", "\"_", ")_", "else_", "\"", "ERROR", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "rel", "s", "Set_", "._", "model", "Relationship", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "Md", "l", "Obj_", "=_", "model", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "Md", "l", "Obj_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "Qn", "ame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "from", "Md", "l", "Obj_", "is_", "None_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "in", " ", "subs", " ", "group", ",", " ", "only", " ", "warn", " ", "if", " ", "the", " ", "namespace", " ", "has", " ", "a", " ", "load", "ed", " ", "schema", ",", " ", "other", "wis", "e", " ", "no", " ", "complaint", "_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "val_", "._", "model", "Xbrl", "_", "._", "is", "In", "Substituti", "on", "Group_", "(_", "from", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", ",_", "from", "Qn", "ame_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "from", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", "._", "namespace", "URI_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "namespace", "Docs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "log_", "(_", "level_", ",_", "from", "Err", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Relationship", " ", "from", " ", "%", "(", "xli", "nk", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "xli", "nk", "To", ")", "s", " ", "shou", "ld", " ", "have", " ", "an", " ", "%", "(", "element", ")", "s", " ", "source", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", ",_", "xli", "nk", "From_", "=_", "model", "Rel", "_", "._", "from", "Label_", ",_", "xli", "nk", "To_", "=_", "model", "Rel", "_", "._", "to", "Label_", ",_", "element_", "=_", "from", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not", "Fro", "m", "Qn", "ame_", "and_", "val_", "._", "model", "Xbrl", "_", "._", "is", "In", "Substituti", "on", "Group_", "(_", "from", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", ",_", "not", "Fro", "m", "Qn", "ame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "log_", "(_", "level_", ",_", "not", "Fro", "m", "Err", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Relationship", " ", "from", " ", "%", "(", "xli", "nk", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "xli", "nk", "To", ")", "s", " ", "shou", "ld", " ", "not", " ", "have", " ", "an", " ", "%", "(", "element", ")", "s", " ", "source", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", ",_", "xli", "nk", "From_", "=_", "model", "Rel", "_", "._", "from", "Label_", ",_", "xli", "nk", "To_", "=_", "model", "Rel", "_", "._", "to", "Label_", ",_", "element_", "=_", "from", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "Qn", "ame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "to", "Md", "l", "Obj_", "is_", "None_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "not_", "val_", "._", "model", "Xbrl", "_", "._", "is", "In", "Substituti", "on", "Group_", "(_", "to", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", ",_", "to", "Qn", "ame_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "to", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", "._", "namespace", "URI_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "namespace", "Docs", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "log_", "(_", "level_", ",_", "to", "Err", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Relationship", " ", "from", " ", "%", "(", "xli", "nk", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "xli", "nk", "To", ")", "s", " ", "shou", "ld", " ", "have", " ", "an", " ", "%", "(", "element", ")", "s", " ", "target", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", ",_", "xli", "nk", "From_", "=_", "model", "Rel", "_", "._", "from", "Label_", ",_", "xli", "nk", "To_", "=_", "model", "Rel", "_", "._", "to", "Label_", ",_", "element_", "=_", "to", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not", "To", "Qn", "ame_", "and_", "val_", "._", "model", "Xbrl", "_", "._", "is", "In", "Substituti", "on", "Group_", "(_", "from", "Md", "l", "Obj_", "._", "element", "Qn", "ame_", ",_", "not", "To", "Qn", "ame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "log_", "(_", "level_", ",_", "not", "Fro", "m", "Err", "Code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Relationship", " ", "from", " ", "%", "(", "xli", "nk", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "xli", "nk", "To", ")", "s", " ", "shou", "ld", " ", "not", " ", "have", " ", "an", " ", "%", "(", "element", ")", "s", " ", "target", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", ",_", "xli", "nk", "From_", "=_", "model", "Rel", "_", "._", "from", "Label_", ",_", "xli", "nk", "To_", "=_", "model", "Rel", "_", "._", "to", "Label_", ",_", "element_", "=_", "from", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arc", "role_", "==_", "Xbrl", "Const_", "._", "function", "Implementation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel", "From_", ",_", "rels_", "in_", "rel", "s", "Set_", "._", "from", "Model", "Objects_", "(_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "rels_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lc", "fie", ":", "too", "Many", "CF", "IR", "ela", "tion", "ships", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Function", "-", "implementation", " ", "relation", "ship", " ", "from", " ", "signa", "ture", " ", "%", "(", "name", ")", "s", " ", "has", " ", "more", " ", "than", " ", "one", " ", "implementation", " ", "target", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "[_", "rel", "From_", "]_", "+_", "rels_", ",_", "name_", "=_", "rel", "From_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "rel", "To_", ",_", "rels_", "in_", "rel", "s", "Set_", "._", "to", "Model", "Objects_", "(_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "rels_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lc", "fie", ":", "too", "Many", "CF", "IR", "ela", "tion", "ships", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Function", " ", "implementation", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "must", " ", "be", " ", "the", " ", "target", " ", "of", " ", "only", " ", "one", " ", "function", "-", "implementation", " ", "relation", "ship", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "[_", "rel", "To_", "]_", "+_", "rels_", ",_", "xli", "nk", "Label_", "=_", "rel", "To_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arc", "role_", "==_", "Xbrl", "Const_", "._", "assertion", "Uns", "ati", "sfi", "ed", "Severity", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel", "From_", ",_", "rels_", "in_", "rel", "s", "Set_", "._", "from", "Model", "Objects_", "(_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "rels_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "se", "ve", ":", "multiple", "Seve", "riti", "es", "For", "Assert", "ion", "Error", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Assert", "ion", "-", "unsa", "tis", "fied", "-", "sever", "it", "y", " ", "relation", "ship", " ", "from", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "more", " ", "than", " ", "one", " ", "sever", "it", "y", " ", "target", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "[_", "rel", "From_", "]_", "+_", "rels_", ",_", "xli", "nk", "Label_", "=_", "rel", "From_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "execute", "Call", "Test_", "(_", "val_", ",_", "name_", ",_", "call", "Tuple_", ",_", "test", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "call", "Tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XP", "ath", "Parser_", "._", "initialize", "Parser_", "(_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", ")_", "\\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 ", " _", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "Execut", "ing", " ", "call", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "Exp", "r", "Stack_", "=_", "XP", "ath", "Parser_", "._", "parse_", "(_", "val_", ",_", "call", "Tuple_", "[_", "0_", "]_", ",_", "call", "Tuple_", "[_", "1_", "]_", ",_", "name_", "+_", "\"", " ", "call", "\"_", ",_", "Trace_", "._", "CALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "=_", "XP", "ath", "Context_", "._", "create_", "(_", "val_", "._", "model", "Xbrl", "_", ",_", "source", "Element_", "=_", "call", "Tuple_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "xpa", "th", "Context_", "._", "evaluate_", "(_", "call", "Exp", "r", "Stack_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "._", "in", "Sco", "pe", "Vars_", "[_", "qname_", "(_", "'", "result", "'_", ",_", "no", "Pref", "ix", "Is", "No", "Namespace_", "=_", "True_", ")_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"%", "(", "name", ")", "s", " ", "result", " ", "%", "(", "result", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "call", "Tuple_", "[_", "1_", "]_", ",_", "name_", "=_", "name_", ",_", "result_", "=_", "str_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "test", "Tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "Execut", "ing", " ", "test", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Exp", "r", "Stack_", "=_", "XP", "ath", "Parser_", "._", "parse_", "(_", "val_", ",_", "test", "Tuple_", "[_", "0_", "]_", ",_", "test", "Tuple_", "[_", "1_", "]_", ",_", "name_", "+_", "\"", " ", "test", "\"_", ",_", "Trace_", "._", "CALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Result_", "=_", "xpa", "th", "Context_", "._", "effective", "Boo", "lean", "Value_", "(_", "None_", ",_", "xpa", "th", "Context_", "._", "evaluate_", "(_", "test", "Exp", "r", "Stack_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "test", "Result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "cfc", "n", ":", "test", "Pass", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Test", " ", "%", "(", "name", ")", "s", " ", "result", " ", "%", "(", "result", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "test", "Tuple_", "[_", "1_", "]_", ",_", "name_", "=_", "name_", ",_", "result_", "=_", "str_", "(_", "test", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "cfc", "n", ":", "test", "Fail", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Test", " ", "%", "(", "name", ")", "s", " ", "result", " ", "%", "(", "result", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "test", "Tuple_", "[_", "1_", "]_", ",_", "name_", "=_", "name_", ",_", "result_", "=_", "str_", "(_", "test", "Result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xpa", "th", "Context_", "._", "close_", "(_", ")_", "#", " ", "dereferenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XP", "ath", "Context_", "._", "XP", "ath", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "err_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"%", "(", "name", ")", "s", " ", "evaluat", "ion", " ", "error", ":", " ", "%", "(", "error", ")", "s", " ", "\\\\", "n", "%", "(", "error", "Sou", "rce", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "call", "Tuple_", "[_", "1_", "]_", ",_", "name_", "=_", "name_", ",_", "error_", "=_", "err_", "._", "message_", ",_", "error", "Source_", "=_", "err_", "._", "source", "Error", "Indicat", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "read", "y", "\"_", ")_", ",_", "2000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "val_", ",_", "xpa", "th", "Context_", "=_", "None_", ",_", "parameter", "s", "Only_", "=_", "False_", ",_", "status", "Msg_", "=_", "''_", ",_", "compile", "Only_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "(_", "\"", "xbr", "l", ".5", ".1", ".4", ".3", ":", "cycle", "s", "\"_", ",_", "\"", "xbr", "lg", "ene", ":", "viola", "ted", "Cycle", "s", "Constr", "aint", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "info", "\"_", ",_", "\\u_", "(_", "\"", "Form", "ula", " ", "validation", " ", "skip", "ped", " ", "due", " ", "to", " ", "%", "(", "error", ")", "s", " ", "error", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "error_", "=_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formula", "Options_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "formula", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "XP", "ath", "Parser_", "._", "initialize", "Parser_", "(_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "initialize", "XP", "ath", "2", "Gram", "mar", "\"_", ")_", ")_", "#", " ", "only", " ", "provide", " ", "stat", " ", "whe", "n", " ", "not", " ", "ye", "t", " ", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "status", "Msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial", "Error", "Count_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "log", "Count_", "._", "get_", "(_", "logging_", "._", "\\u", "check", "Level_", "(_", "'", "ERROR", "'_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "global", " ", "parameter", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "Qn", "ames_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Qn", "ames_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter", "Dependenc", "ies_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "=_", "defaultdict_", "(_", "set_", ")_", "#", " ", "Non", "e-", "key", " ", "entri", "es", " ", "are", " ", "non", "-", "formula", " ", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependen", "cy", "Resolved", "Parameters_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Parameters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Instances_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param", "Qn", "ame_", ",_", "model", "Parameter_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Parameters_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "model", "Parameter_", ",_", "Model", "Parameter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Parameter_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter", "Dependenc", "ies_", "[_", "param", "Qn", "ame_", "]_", "=_", "model", "Parameter_", "._", "variab", "le", "Refs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter", "Qn", "ames_", "._", "add_", "(_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Parameter_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "Qn", "ames_", "._", "add_", "(_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "duplicat", "es", " ", "checke", "d", " ", "on", " ", "load", "ing", " ", "model", "Document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "resolve", " ", "dependencies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resolve", "d", "AP", "aram", "eter", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "resolve", "d", "AP", "aram", "eter", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolve", "d", "AP", "aram", "eter", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param", "Qn", "ame_", "in_", "parameter", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "param", "Qn", "ame_", "not_", "in_", "dependen", "cy", "Resolved", "Parameters_", "and_", "len_", "(_", "parameter", "Dependenc", "ies_", "[_", "param", "Qn", "ame_", "]_", "-_", "dependen", "cy", "Resolved", "Parameters_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependen", "cy", "Resolved", "Parameters_", "._", "add_", "(_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Parameters_", "._", "append_", "(_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolve", "d", "AP", "aram", "eter", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "unresolv", "ed", "?", "_", "\\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_", "param", "Qn", "ame_", "in_", "parameter", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "param", "Qn", "ame_", "not_", "in_", "dependen", "cy", "Resolved", "Parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circular", "Or", "Unde", "f", "Dependenc", "ies_", "=_", "parameter", "Dependenc", "ies_", "[_", "param", "Qn", "ame_", "]_", "-_", "dependen", "cy", "Resolved", "Parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undefined", "Vars_", "=_", "circular", "Or", "Unde", "f", "Dependenc", "ies_", "-_", "parameter", "Qn", "ames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params", "Circular", "Dep", "_", "=_", "circular", "Or", "Unde", "f", "Dependenc", "ies_", "-_", "undefined", "Vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "undefined", "Vars_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "unresolv", "ed", "Dependenc", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Unde", "fined", " ", "dependen", "cies", " ", "in", " ", "parameter", " ", "%", "(", "name", ")", "s", ",", " ", "to", " ", "names", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Parameters_", "[_", "param", "Qn", "ame_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "param", "Qn", "ame_", ",_", "dependencies_", "=_", "\",", " ", "\"_", "._", "join_", "(_", "(_", "str_", "(_", "v_", ")_", "for_", "v_", "in_", "undefined", "Vars_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "params", "Circular", "Dep", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "parameter", "Cyc", "lic", "Dependenc", "ies", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cyc", "lic", " ", "dependen", "cies", " ", "in", " ", "parameter", " ", "%", "(", "name", ")", "s", ",", " ", "to", " ", "names", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Parameters_", "[_", "param", "Qn", "ame_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "param", "Qn", "ame_", ",_", "dependencies_", "=_", "\",", " ", "\"_", "._", "join_", "(_", "(_", "str_", "(_", "d_", ")_", "for_", "d_", "in_", "params", "Circular", "Dep", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "formula", " ", "parameter", " ", "checks", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cust", "Fn", "Sig_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Custom", "Function", "Sign", "ature", "s_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "entri", "es", " ", "indexe", "d", " ", "by", " ", "qna", "me", ",", " ", "arit", "y", " ", "are", " ", "signa", "ture", ",", " ", "by", " ", "qna", "me", " ", "are", " ", "just", " ", "for", " ", "parser", " ", "(", "value", "=", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cust", "Fn", "Sig_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cust", "Fn", "Qn", "ame_", "=_", "cust", "Fn", "Sig_", "._", "function", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cust", "Fn", "Qn", "ame_", "._", "namespace", "URI_", "==_", "Xbrl", "Const_", "._", "xfi", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "no", "Pro", "hibit", "ed", "Names", "pace", "For", "Custom", "Function", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Custom", " ", "function", " ", "%", "(", "name", ")", "s", " ", "has", " ", "namespace", " ", "reserve", "d", " ", "for", " ", "function", "s", " ", "in", " ", "the", " ", "function", " ", "registr", "y", " ", "%", "(", "namespace", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "cust", "Fn", "Sig_", ",_", "name_", "=_", "cust", "Fn", "Qn", "ame_", ",_", "namespace_", "=_", "cust", "Fn", "Qn", "ame_", "._", "namespace", "URI_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "output", "Type_", "=_", "cust", "Fn", "Sig_", "._", "output", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "output", "Type_", "and_", "\\u", "output", "Type_", "._", "namespace", "URI_", "==_", "Xbrl", "Const_", "._", "xsd", "_", "and_", "not_", "Function", "Xs_", "._", "is", "Xs", "Type_", "(_", "\\u", "output", "Type_", "._", "local", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "invalid", "Datat", "ype", "In", "Custom", "Function", "Sign", "ature", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Custom", " ", "Function", " ", "Sign", "ature", " ", "%", "(", "name", ")", "s", " ", "output", " ", "type", " ", "%", "(", "type", ")", "s", " ", "is", " ", "not", " ", "valid", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "cust", "Fn", "Sig_", ",_", "name_", "=_", "cust", "Fn", "Qn", "ame_", ",_", "type_", "=_", "\\u", "output", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "input", "Type_", "in_", "cust", "Fn", "Sig_", "._", "input", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "input", "Type_", "and_", "\\u", "input", "Type_", "._", "namespace", "URI_", "==_", "Xbrl", "Const_", "._", "xsd", "_", "and_", "not_", "Function", "Xs_", "._", "is", "Xs", "Type_", "(_", "\\u", "input", "Type_", "._", "local", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "invalid", "Datat", "ype", "In", "Custom", "Function", "Sign", "ature", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Custom", " ", "Function", " ", "Sign", "ature", " ", "%", "(", "name", ")", "s", " ", "input", " ", "type", " ", "%", "(", "type", ")", "s", " ", "is", " ", "not", " ", "valid", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "cust", "Fn", "Sig_", ",_", "name_", "=_", "cust", "Fn", "Qn", "ame_", ",_", "type_", "=_", "\\u", "input", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "any", " ", "custom", " ", "function", " ", "implementation", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "function", "Implementation", "_", ")_", "._", "from", "Model", "Object_", "(_", "cust", "Fn", "Sig_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cust", "Fn", "Impl_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cust", "Fn", "Sig_", "._", "custom", "Function", "Implementation", "_", "=_", "cust", "Fn", "Impl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "cust", "Fn", "Impl_", "._", "input", "Names_", ")_", "!=_", "len_", "(_", "cust", "Fn", "Sig_", "._", "input", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lc", "fie", ":", "input", "Mismatch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Custom", " ", "function", " ", "%", "(", "name", ")", "s", " ", "signa", "ture", " ", "has", " ", "%", "(", "parameter", "Count", "Sign", "ature", ")", "s", " ", "parameter", "s", " ", "but", " ", "implementation", " ", "has", " ", "%", "(", "parameter", "Count", "Implementation", ")", "s", ",", " ", "must", " ", "be", " ", "matchi", "ng", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "cust", "Fn", "Sig_", ",_", "name_", "=_", "cust", "Fn", "Qn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "Count", "Signature_", "=_", "len_", "(_", "cust", "Fn", "Sig_", "._", "input", "Types_", ")_", ",_", "parameter", "Count", "Implementation", "_", "=_", "len_", "(_", "cust", "Fn", "Impl_", "._", "input", "Names_", ")_", ")_", "\\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_", "for_", "cust", "Fn", "Impl_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Custom", "Function", "Implementation", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "function", "Implementation", "_", ")_", "._", "to", "Model", "Object_", "(_", "cust", "Fn", "Impl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lc", "fie", ":", "missi", "ng", "CF", "IR", "ela", "tion", "ship", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Custom", " ", "function", " ", "implementation", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "no", " ", "relation", "ship", " ", "from", " ", "any", " ", "custom", " ", "function", " ", "signa", "ture", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "cust", "Fn", "Sig_", ",_", "xli", "nk", "Label_", "=_", "cust", "Fn", "Impl_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cust", "Fn", "Impl_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "custom", " ", "function", " ", "checks", " ", "and", " ", "compilation", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xpa", "th", "Context", " ", "is", " ", "need", "ed", " ", "for", " ", "filter", " ", "setup", " ", "for", " ", "express", "ion", "s", " ", "suc", "h", " ", "as", " ", "aspect", " ", "cover", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "parameter", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xpa", "th", "Context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpa", "th", "Context_", "=_", "XP", "ath", "Context_", "._", "create_", "(_", "val_", "._", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xpa", "th", "Context_", "._", "parameter", "Qn", "ames_", "=_", "parameter", "Qn", "ames_", "#", " ", "need", "ed", " ", "for", " ", "formula", " ", "filter", "s", " ", "to", " ", "dete", "rmin", "e", " ", "variab", "le", " ", "dependencies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "param", "Qn", "ame_", "in_", "order", "ed", "Parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Parameter_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Parameters_", "[_", "param", "Qn", "ame_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "model", "Parameter_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "as", "Type_", "=_", "model", "Parameter_", "._", "as", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "as", "Type_", "and_", "as", "Type_", "._", "namespace", "URI_", "==_", "Xbrl", "Const_", "._", "xsd", "_", "and_", "not_", "Function", "Xs_", "._", "is", "Xs", "Type_", "(_", "as", "Type_", "._", "local", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "parameter", "Type", "Mismatch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "%", "(", "name", ")", "s", " ", "type", " ", "%", "(", "type", ")", "s", " ", "is", " ", "not", " ", "valid", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ",_", "type_", "=_", "as", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "as", "Local", "Name_", "=_", "as", "Type_", "._", "local", "Name_", "if_", "as", "Type_", "else_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "._", "parameters_", "and_", "param", "Qn", "ame_", "in_", "val_", "._", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "param", "Data", "Type_", ",_", "param", "Value_", "=_", "val_", "._", "parameters_", "[_", "param", "Qn", "ame_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "Local", "Name_", "=_", "param", "Data", "Type_", "._", "local", "Name_", "if_", "param", "Data", "Type_", "else_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "Function", "Xs_", "._", "call_", "(_", "xpa", "th", "Context_", ",_", "None_", ",_", "type", "Local", "Name_", ",_", "[_", "param", "Value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "Function", "Xs_", "._", "call_", "(_", "xpa", "th", "Context_", ",_", "None_", ",_", "as", "Local", "Name_", ",_", "[_", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula", "Options_", "._", "trace", "Parameter", "Inp", "ut", "Value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "%", "(", "name", ")", "s", " ", "input", " ", "value", " ", "%", "(", "input", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ",_", "input_", "=_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xpa", "th", "Context_", "._", "in", "Sco", "pe", "Vars_", "[_", "param", "Qn", "ame_", "]_", "=_", "result_", "#", " ", "make", " ", "visi", "ble", " ", "to", " ", "subsequen", "t", " ", "parameter", " ", "express", "ion", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "model", "Parameter_", "._", "is", "Required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "missi", "ng", "Parameter", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "%", "(", "name", ")", "s", " ", "is", " ", "require", "d", " ", "but", " ", "not", " ", "input", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "model", "Parameter_", "._", "select", "Prog", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "missi", "ng", "Parameter", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "%", "(", "name", ")", "s", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "select", " ", "attribute", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "model", "Parameter_", "._", "evaluate_", "(_", "xpa", "th", "Context_", ",_", "as", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula", "Options_", "._", "trace", "Parameter", "Expression", "Result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "%", "(", "name", ")", "s", " ", "select", " ", "result", " ", "%", "(", "result", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ",_", "result_", "=_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xpa", "th", "Context_", "._", "in", "Sco", "pe", "Vars_", "[_", "param", "Qn", "ame_", "]_", "=_", "result_", "#", " ", "make", " ", "visi", "ble", " ", "to", " ", "subsequen", "t", " ", "parameter", " ", "express", "ion", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XP", "ath", "Context_", "._", "XP", "ath", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "parameter", "Type", "Mismatch", "\"_", "if_", "err_", "._", "code_", "==_", "\"", "err", ":", "FOR", "G", "0001", "\"_", "else_", "err_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Parameter", " ", "\\\\", "n", "%", "(", "name", ")", "s", " ", "\\\\", "n", "Except", "ion", ":", " ", "\\\\", "n", "%", "(", "error", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Parameter_", ",_", "name_", "=_", "param", "Qn", "ame_", ",_", "error_", "=_", "err_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "Codes_", "=_", "(_", "\"", "xbr", "lve", ":", "parameter", "Type", "Mismatch", "\"_", ",_", "\"", "err", ":", "FOR", "G", "0001", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", " ", "Remove", "d", " ", "as", " ", "per", " ", "WG", " ", "discuss", "ion", " ", "2012", "-1", "2", "-", "20.", " ", "Thi", "s", " ", "duplicat", "ion", " ", "checking", " ", "unf", "air", "ly", " ", "presu", "ppo", "ses", " ", "URI", " ", "based", "\\", "10", ";", " ", " ", " ", "implementation", " ", "and", " ", "exceed", "s", " ", "the", " ", "scope", " ", "of", " ", "link", "base", " ", "validation", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "not", " ", "parameter", "s", "On", "ly", ":", " ", "#", " ", "is", " ", "a", " ", "model", "Insta", "nce", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "val", ".", "parameter", "s", " ", "and", " ", "param", "Qn", "ame", " ", "in", " ", "val", ".", "parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "instance", "Model", "Xbrl", "s", " ", "=", " ", "val", ".", "parameter", "s", "[", "param", "Qn", "ame", "][", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "instance", "Ur", "is", " ", "=", " ", "set", "()", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "instance", "Model", "Xbrl", " ", "in", " ", "instance", "Model", "Xbrl", "s", ":", "\\", "10", ";", " ", " ", "if", " ", "instance", "Model", "Xbrl", ".", "uri", " ", "in", " ", "instance", "Ur", "is", ":", "\\", "10", ";", " ", " ", "val", ".", "model", "Xbrl", ".", "error", "(\"", "xbr", "lv", "ari", "nst", "e", ":", "input", "Insta", "nce", "Dup", "licat", "ion", "\",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "\\u(", "\"", "Inp", "ut", " ", "instance", " ", "resource", " ", "%", "(", "inst", "Name", ")", "s", " ", "has", " ", "multiple", " ", "XB", "RL", " ", "instance", "s", " ", "%", "(", "uri", ")", "s", "\")", ",", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "model", "Object", "=", "model", "Parameter", ",", " ", "inst", "Name", "=", "param", "Qn", "ame", ",", " ", "uri", "=", "instance", "Model", "Xbrl", ".", "uri", ")", "\\", "10", ";", " ", " ", "instance", "Ur", "is", ".", "add", "(", "instance", "Model", "Xbrl", ".", "uri", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "val", ".", "parameter", "s", " ", "and", " ", "Xbrl", "Const", ".", "qn", "Standard", "Inp", "ut", "Insta", "nce", " ", "in", " ", "val", ".", "parameter", "s", ":", " ", "#", " ", "standard", " ", "input", " ", "instance", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "len", "(", "val", ".", "parameter", "s", "[", "Xbrl", "Const", ".", "qn", "Standard", "Inp", "ut", "Insta", "nce", "][", "1", "])", " ", "!=", " ", "1", ":", "\\", "10", ";", " ", " ", " ", " ", "val", ".", "model", "Xbrl", ".", "error", "(\"", "xbr", "lv", "ari", "nst", "e", ":", "standard", "Inp", "ut", "Insta", "nce", "Not", "Unique", "\",", "\\", "10", ";", " ", " ", "\\u(", "\"", "Standard", " ", "input", " ", "instance", " ", "resource", " ", "parameter", " ", "has", " ", "multiple", " ", "XB", "RL", " ", "instance", "s", "\")", ",", " ", "\\", "10", ";", " ", " ", "model", "Object", "=", "model", "Parameter", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "parameter", " ", "checks", " ", "and", " ", "select", " ", "evaluat", "ion", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "parameter", "s", "Process", "ing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "typed", " ", "dimension", " ", "equality", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Form", "ula", "Equali", "ty", "Definit", "ions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "equality", "Definition_", ")_", "._", "model", "Relationship", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typed", "Doma", "in", "El", "t_", "=_", "model", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Equali", "ty", "Definition_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typed", "Doma", "in", "El", "t_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Form", "ula", "Equali", "ty", "Definit", "ions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "multiple", "Type", "d", "Dimen", "sion", "Equali", "ty", "Definit", "ion", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Multipl", "e", " ", "typed", " ", "domain", " ", "definit", "ion", "s", " ", "from", " ", "%", "(", "typed", "Doma", "in", ")", "s", " ", "to", " ", "%", "(", "equality", "Definit", "ion", "1", ")", "s", " ", "and", " ", "%", "(", "equality", "Definit", "ion", "2", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", "._", "arc", "Element_", ",_", "typed", "Domain_", "=_", "typed", "Doma", "in", "El", "t_", "._", "qname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "equality", "Definit", "ion", "1_", "=_", "model", "Equali", "ty", "Definition_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "equality", "Definit", "ion", "2_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Form", "ula", "Equali", "ty", "Definit", "ions_", "[_", "typed", "Doma", "in", "El", "t_", "]_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Equali", "ty", "Definition_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Form", "ula", "Equali", "ty", "Definit", "ions_", "[_", "typed", "Doma", "in", "El", "t_", "]_", "=_", "model", "Equali", "ty", "Definition_", "\\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_", "parameter", "s", "Only_", ":_", "\\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_", "model", "Varia", "ble", "Set_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Varia", "ble", "Sets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Varia", "ble", "Set_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "formula", "Compil", "ation", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "produce", "Output", "Xbrl", "Instance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "Varia", "ble", "Set_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Varia", "ble", "Sets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "Qn", "ame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "formula", "Instance_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "instance_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "instance", "Qn", "ame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "instance", "Qn", "ame_", "=_", "instance_", "._", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "from", "Insta", "nce", "Qn", "ames_", "=_", "{_", "instance", "Qn", "ame_", "}_", "#", " ", "require", "d", " ", "if", " ", "referred", " ", "to", " ", "by", " ", "variab", "les", " ", "scope", " ", "chain", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "are", "lle", ":", "multiple", "Output", "Insta", "nce", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Multipl", "e", " ", "output", " ", "instance", "s", " ", "for", " ", "formula", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "to", " ", "names", " ", "%", "(", "instance", "To", ")", "s", ",", " ", "%", "(", "instance", "To", "2", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "To_", "=_", "instance", "Qn", "ame_", ",_", "instance", "To", "2_", "=_", "instance_", "._", "instance", "Qn", "ame_", ")_", "\\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_", "instance", "Qn", "ame_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "Qn", "ame_", "=_", "Xbrl", "Const_", "._", "qn", "Standard", "Output", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Qn", "ames_", "._", "add_", "(_", "instance", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "from", "Insta", "nce", "Qn", "ames_", "=_", "None_", "#", " ", "require", "d", " ", "if", " ", "referred", " ", "to", " ", "by", " ", "variab", "les", " ", "scope", " ", "chain", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "output", "Insta", "nce", "Qn", "ame_", "=_", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "getattr_", "(_", "val_", ",_", "\"", "validat", "e", "SB", "RN", "L", "\"_", ",_", "False_", ")_", ":_", "#", " ", "may", " ", "not", " ", "exist", " ", "on", " ", "some", " ", "val", " ", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "SB", "R", ".", "NL", ".2", ".3", ".9", ".03", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", ":", "formula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "is", " ", "not", " ", "allow", "ed", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ")_", "\\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 ", " _", "instance", "Qn", "ame_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "count", "Sat", "isfi", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "count", "Not", "Sat", "isfi", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "Validat", "ion", "Messages_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "[_", "instance", "Qn", "ame_", "]_", "._", "append_", "(_", "model", "Varia", "ble", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "output", "Insta", "nce", "Qn", "ame_", "=_", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Varia", "ble", "Set_", "._", "aspect", "Model_", "not_", "in_", "(_", "\"", "non", "-", "dimension", "al", "\"_", ",_", "\"", "dimension", "al", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "unknown", "Asp", "ect", "Model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "aspect", " ", "model", " ", "%", "(", "aspect", "Model", ")", "s", " ", "not", " ", "recognize", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model_", "=_", "model", "Varia", "ble", "Set_", "._", "aspect", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "has", "Cons", "iste", "nc", "y", "Assert", "ion_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dete", "rmin", "e", " ", "dependen", "cies", " ", "within", " ", "variab", "le", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "name", "Variables_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qna", "me", "Rel", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "ed", "Names", "Set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "le", "Set_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "qname_", "=_", "model", "Rel", "_", "._", "variab", "le", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qna", "me", "Rel", "s_", "[_", "var", "qname_", "]_", "=_", "model", "Rel", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "Variable_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var", "qname_", "not_", "in_", "defin", "ed", "Names", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "defin", "ed", "Names", "Set_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "var", "qname_", "not_", "in_", "name", "Variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name", "Variables_", "[_", "var", "qname_", "]_", "=_", "to", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name", "Variables_", "[_", "var", "qname_", "]_", "!=_", "to", "Variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "duplicat", "e", "Varia", "ble", "Names", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Multipl", "e", " ", "variab", "les", " ", "named", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "in", " ", "variab", "le", " ", "set", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "to", "Variable_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "Insta", "nce", "Qn", "ames_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "inst", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "instance", "Variable_", ")_", "._", "to", "Model", "Object_", "(_", "to", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from", "Instance_", "=_", "inst", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "from", "Instance_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "from", "Insta", "nce", "Qn", "ame_", "=_", "from", "Instance_", "._", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "from", "Insta", "nce", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "from", "Insta", "nce", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "Insta", "nce", "Qn", "ames_", "is_", "None_", ":_", "from", "Insta", "nce", "Qn", "ames_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "Insta", "nce", "Qn", "ames_", "._", "add_", "(_", "from", "Insta", "nce", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "from", "Insta", "nce", "Qn", "ames_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "Qn", "ame_", ":_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to", "Variable_", "._", "from", "Insta", "nce", "Qn", "ames_", "=_", "from", "Insta", "nce", "Qn", "ames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "variab", "le", "Name", "Reso", "luti", "on", "Fail", "ure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "bles", " ", "name", " ", "%", "(", "name", ")", "s", " ", "cann", "ot", " ", "be", " ", "dete", "rmin", "ed", " ", "on", " ", "arc", " ", "from", " ", "%", "(", "xli", "nk", "Label", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Rel", "_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "model", "Rel", "_", "._", "variab", "lename", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Varia", "bles", "Sco", "pe", "Vis", "ibl", "e", "Qn", "ames_", "(_", "val_", ",_", "name", "Variables_", ",_", "defin", "ed", "Names", "Set_", ",_", "model", "Varia", "ble", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "ed", "Names", "Set_", "|=_", "parameter", "Qn", "ames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "variab", "le", "Dependenc", "ies_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "le", "Set_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variable_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "variable_", ",_", "(_", "Model", "Parameter_", ",_", "Model", "Variable_", ")_", ")_", ":_", "#", " ", "ignore", " ", "anyt", "hing", " ", "not", " ", "parameter", " ", "or", " ", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "qname_", "=_", "model", "Rel", "_", "._", "variab", "le", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dep", "Vars_", "=_", "variable_", "._", "variab", "le", "Refs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "Dependenc", "ies_", "[_", "var", "qname_", "]_", "=_", "dep", "Vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "dep", "Vars_", ")_", ">_", "0_", "and_", "formula", "Options_", "._", "trace", "Varia", "bles", "Dependenc", "ies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "variab", "le", " ", "%", "(", "name", ")", "s", ",", " ", "dependen", "ces", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "var", "qname_", ",_", "dependencies_", "=_", "dep", "Vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "defin", "ed", "Names", "Set_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "fall", "back", " ", "value", " ", "variab", "le", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "variable_", ",_", "Model", "Fact", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "variable_", "._", "has", "No", "Varia", "ble", "Dependenc", "ies_", "=_", "len_", "(_", "dep", "Vars_", "-_", "parameter", "Qn", "ames_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dep", "Var_", "in_", "XP", "ath", "Parser_", "._", "variab", "le", "Reference", "s", "Set_", "(_", "variable_", "._", "fall", "back", "Value", "Prog", "_", ",_", "variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dep", "Var_", "in_", "qna", "me", "Rel", "s_", "and_", "isinstance_", "(_", "qna", "me", "Rel", "s_", "[_", "dep", "Var_", "]_", "._", "to", "Model", "Object_", ",_", "Model", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "fall", "back", "Value", "Varia", "ble", "Reference", "Not", "All", "owe", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "fall", "back", "Value", " ", "'%", "(", "fall", "back", "Value", ")", "s", "'", " ", "cann", "ot", " ", "refer", " ", "to", " ", "variab", "le", " ", "%", "(", "dependen", "cy", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "variable_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fall", "back", "Value_", "=_", "variable_", "._", "fall", "back", "Value_", ",_", "dependency_", "=_", "dep", "Var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "cover", "ing", " ", "aspect", " ", "not", " ", "in", " ", "variab", "le", " ", "set", " ", "aspect", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Filter", "Asp", "ect", "Model_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ",_", "variable_", "._", "filter", "Relationship", "s_", ",_", "xpa", "th", "Context_", ")_", "\\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_", "order", "ed", "Name", "Set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Name", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "AV", "aria", "ble_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "order", "ed", "AV", "aria", "ble_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "ed", "AV", "aria", "ble_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "var", "qname_", ",_", "dep", "Vars_", "in_", "variab", "le", "Dependenc", "ies_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "qname_", "not_", "in_", "order", "ed", "Name", "Set_", "and_", "len_", "(_", "dep", "Vars_", "-_", "parameter", "Qn", "ames_", "-_", "order", "ed", "Name", "Set_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "order", "ed", "Name", "List_", "._", "append_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Name", "Set_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "AV", "aria", "ble_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "var", "qname_", "in_", "instance", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "name", "Variables_", "._", "get_", "(_", "var", "qname_", ")_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "inst", "qname_", "=_", "name", "Variables_", "[_", "var", "qname_", "]_", "._", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "unresolv", "ed", "?", "_", "\\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_", "var", "qname_", ",_", "dep", "Vars_", "in_", "variab", "le", "Dependenc", "ies_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "qname_", "not_", "in_", "order", "ed", "Name", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "circular", "Or", "Unde", "f", "Vars_", "=_", "dep", "Vars_", "-_", "parameter", "Qn", "ames_", "-_", "order", "ed", "Name", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undefined", "Vars_", "=_", "circular", "Or", "Unde", "f", "Vars_", "-_", "defin", "ed", "Names", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vars", "Circular", "Dep", "_", "=_", "circular", "Or", "Unde", "f", "Vars_", "-_", "undefined", "Vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "undefined", "Vars_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "unresolv", "ed", "Dependenc", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Unde", "fined", " ", "variab", "le", " ", "dependen", "cies", " ", "in", " ", "variab", "le", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "from", " ", "variab", "le", " ", "%", "(", "name", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "name", "To", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "From_", "=_", "var", "qname_", ",_", "name", "To_", "=_", "undefined", "Vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "vars", "Circular", "Dep", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "cyclic", "Dependenc", "ies", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cyc", "lic", " ", "dependen", "cies", " ", "in", " ", "variab", "le", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "from", " ", "variab", "le", " ", "%", "(", "name", "Fro", "m", ")", "s", " ", "to", " ", "%", "(", "name", "To", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "From_", "=_", "var", "qname_", ",_", "name", "To_", "=_", "vars", "Circular", "Dep", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "unresolv", "ed", " ", "variab", "le", " ", "set", " ", "dependencies_", "\\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_", "var", "Set", "Dep", "Var", "Qn", "ame_", "in_", "model", "Varia", "ble", "Set_", "._", "variab", "le", "Refs", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "Set", "Dep", "Var", "Qn", "ame_", "not_", "in_", "defin", "ed", "Names", "Set_", "and_", "var", "Set", "Dep", "Var", "Qn", "ame_", "not_", "in_", "parameter", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "unresolv", "ed", "Dependenc", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Unde", "fined", " ", "variab", "le", " ", "dependen", "cy", " ", "in", " ", "variab", "le", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "var", "Set", "Dep", "Var", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "var", "Set", "Dep", "Var", "Qn", "ame_", "in_", "instance", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "var", "Set", "Dep", "Var", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "var", "Set", "Dep", "Var", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "name", "Variables_", "._", "get_", "(_", "var", "Set", "Dep", "Var", "Qn", "ame_", ")_", ",_", "Model", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst", "qname_", "=_", "name", "Variables_", "[_", "var", "Set", "Dep", "Var", "Qn", "ame_", "]_", "._", "instance", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "add_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "[_", "instance", "Qn", "ame_", "]_", "._", "add_", "(_", "inst", "qname_", ")_", "\\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_", "formula", "Options_", "._", "trace", "Varia", "bles", "Order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "variab", "les", " ", "order", ":", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "dependencies_", "=_", "order", "ed", "Name", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "formula", "Options_", "._", "trace", "Varia", "bles", "Dependenc", "ies_", "and_", "len_", "(_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", ")_", ">_", "0_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "!=_", "{_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "instance", " ", "dependen", "ces", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "dependencies_", "=_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "order", "ed", "Varia", "ble", "Relationship", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "var", "qname_", "in_", "order", "ed", "Name", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "qname_", "in_", "qna", "me", "Rel", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Varia", "ble", "Set_", "._", "order", "ed", "Varia", "ble", "Relationship", "s_", "._", "append_", "(_", "qna", "me", "Rel", "s_", "[_", "var", "qname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "order", "ed", "Name", "Set_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "order", "ed", "Name", "List_", "[_", ":_", "]_", "#", " ", "dereferenc", "e", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "existence", " ", "assertion", " ", "@", "test", " ", "variab", "le", " ", "dependen", "cies", " ", "(", "not", " ", "inclu", "ding", " ", "precondition", " ", "reference", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Exist", "ence", "Assert", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dep", "Var_", "in_", "XP", "ath", "Parser_", "._", "variab", "le", "Reference", "s", "Set_", "(_", "model", "Varia", "ble", "Set_", "._", "test", "Prog", "_", ",_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dep", "Var_", "in_", "qna", "me", "Rel", "s_", "and_", "isinstance_", "(_", "qna", "me", "Rel", "s_", "[_", "dep", "Var_", "]_", "._", "to", "Model", "Object_", ",_", "Model", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lea", "e", ":", "variab", "le", "Reference", "Not", "All", "owe", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Exist", "ence", " ", "Assert", "ion", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "cann", "ot", " ", "refer", " ", "to", " ", "variab", "le", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "dep", "Var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "message", "s", " ", "variab", "le", " ", "dependencies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Validat", "ion", "Messag", "e", "Variables_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ",_", "qna", "me", "Rel", "s_", ",_", "xpa", "th", "Context_", "._", "parameter", "Qn", "ames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Formula_", ")_", ":_", "#", " ", "check", " ", "consiste", "nc", "y", " ", "assertion", " ", "message", " ", "variab", "les", " ", "and", " ", "its", " ", "message", "s", " ", "variables_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "consi", "s", "Asse", "r", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Formula_", ")_", "._", "to", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consi", "s", "Asse", "r_", "=_", "consi", "s", "Asse", "r", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "consi", "s", "Asse", "r_", ",_", "Model", "Cons", "iste", "nc", "y", "Assert", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "check", "Validat", "ion", "Messages_", "(_", "val_", ",_", "consi", "s", "Asse", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "Validat", "ion", "Messag", "e", "Variables_", "(_", "val_", ",_", "consi", "s", "Asse", "r_", ",_", "qna", "me", "Rel", "s_", ",_", "xpa", "th", "Context_", "._", "parameter", "Qn", "ames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "precondition", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "precondition", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "le", "Set", "Precon", "dition", "_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "precondition", "_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "precondition", "_", ",_", "Model", "Precon", "dition", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Varia", "ble", "Set_", "._", "precondition", "s_", "._", "append_", "(_", "precondition", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "variab", "le", " ", "sets", " ", "referenci", "ng", " ", "fact", " ", "or", " ", "genera", "l", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "le", "Set", "Filter_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Filter_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Rel", "_", "._", "is", "Cover", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "warning_", "(_", "\"", "are", "lle", ":", "variab", "le", "Set", "Filter", "Cover", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "filter", " ", "%", "(", "filter", "Label", ")", "s", ",", " ", "cann", "ot", " ", "be", " ", "covered", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "var", "Set", "Filter_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "filter", "Label_", "=_", "var", "Set", "Filter_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Rel", "_", "._", "\\u", "is", "Cover", "ed_", "=_", "False_", "#", " ", "block", " ", "group", " ", "filter", " ", "from", " ", "bei", "ng", " ", "able", " ", "to", " ", "covered", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dep", "Var_", "in_", "var", "Set", "Filter_", "._", "variab", "le", "Refs", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dep", "Var_", "in_", "qna", "me", "Rel", "s_", "and_", "isinstance_", "(_", "qna", "me", "Rel", "s_", "[_", "dep", "Var_", "]_", "._", "to", "Model", "Object_", ",_", "Model", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "fact", "Varia", "ble", "Reference", "Not", "All", "owe", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "filter", " ", "%", "(", "filter", "Label", ")", "s", ",", " ", "cann", "ot", " ", "refer", " ", "to", " ", "variab", "le", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "var", "Set", "Filter_", ",_", "xli", "nk", "Label_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "filter", "Label_", "=_", "var", "Set", "Filter_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "dep", "Var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "aspect", "s", " ", "of", " ", "formula_", "\\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_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Form", "ula", "Rules_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ",_", "name", "Variables_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name", "Variables_", "._", "clear_", "(_", ")_", "#", " ", "dereferenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qna", "me", "Rel", "s_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "ed", "Names", "Set_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "Dependenc", "ies_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "Set", "Insta", "nce", "Dependenc", "ies_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "assertion", " ", "and", " ", "formula", " ", "checks", " ", "and", " ", "compilation", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "Table_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Rendering", "Tables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "Table_", "._", "from", "Insta", "nce", "Qn", "ames_", "=_", "None_", "#", " ", "require", "d", " ", "if", " ", "referred", " ", "to", " ", "by", " ", "variab", "les", " ", "scope", " ", "chain", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model", "Table_", "._", "aspect", "Model_", "not_", "in_", "(_", "\"", "non", "-", "dimension", "al", "\"_", ",_", "\"", "dimension", "al", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lte", ":", "unknown", "Asp", "ect", "Model", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Table", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "aspect", " ", "model", " ", "%", "(", "aspect", "Model", ")", "s", " ", "not", " ", "recognize", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Table_", ",_", "xli", "nk", "Label_", "=_", "model", "Table_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model_", "=_", "model", "Table_", "._", "aspect", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model", "Table_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "Table", "Rules_", "(_", "val_", ",_", "xpa", "th", "Context_", ",_", "model", "Table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "render", "ing", " ", "tables", " ", "and", " ", "axes", " ", "checks", " ", "and", " ", "compilation", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "instance", " ", "dependen", "cy", " ", "order_", "\\u\\u\\uNL\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "Set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "std", "Inp", "Inst_", "=_", "{_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "An", "Instance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "order", "ed", "An", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "ed", "An", "Instance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "inst", "qname_", ",_", "dep", "Ins", "ts_", "in_", "instance", "Dependenc", "ies_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inst", "qname_", "and_", "inst", "qname_", "not_", "in_", "order", "ed", "Insta", "nce", "s", "Set_", "and_", "len_", "(_", "dep", "Ins", "ts_", "-_", "std", "Inp", "Inst_", "-_", "order", "ed", "Insta", "nce", "s", "Set_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "ed", "Insta", "nce", "s", "List_", "._", "append_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "Set_", "._", "add_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "An", "Instance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "instance", "s", " ", "with", " ", "variab", "le", " ", "sets", " ", "with", " ", "no", " ", "variab", "les", " ", "or", " ", "other", " ", "dependencies_", "\\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_", "independent", "Instance_", "in_", "\\u", "DICT", "\\u", "SET_", "(_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "._", "keys_", "(_", ")_", ")_", "-_", "\\u", "DICT", "\\u", "SET_", "(_", "order", "ed", "Insta", "nce", "s", "List_", ")_", ":_", "#", " ", "must", " ", "be", " ", "set", " ", "for", " ", "2.7", " ", "compatibility", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "ed", "Insta", "nce", "s", "List_", "._", "append_", "(_", "independent", "Instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "Set_", "._", "add_", "(_", "independent", "Instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "None_", "not_", "in_", "order", "ed", "Insta", "nce", "s", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "ed", "Insta", "nce", "s", "List_", "._", "append_", "(_", "None_", ")_", "#", " ", "assertion", "s", " ", "come", " ", "after", " ", "all", " ", "formulas", " ", "tha", "t", " ", "produce", " ", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "unresolv", "ed", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "inst", "qname_", ",_", "dep", "Ins", "ts_", "in_", "instance", "Dependenc", "ies_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inst", "qname_", "not_", "in_", "order", "ed", "Insta", "nce", "s", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "als", "o", " ", "be", " ", "satisfied", " ", "from", " ", "an", " ", "input", " ", "DT", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "Dependent", "Instances_", "=_", "dep", "Ins", "ts_", "-_", "std", "Inp", "Inst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "._", "parameters_", ":_", "missi", "ng", "Dependent", "Instances_", "-=_", "\\u", "DICT", "\\u", "SET_", "(_", "val_", "._", "parameters_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inst", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "missi", "ng", "Dependent", "Instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lv", "ari", "nst", "e", ":", "instance", "Varia", "ble", "Recurs", "ion", "Cycle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cyc", "lic", " ", "dependen", "cies", " ", "of", " ", "instance", " ", "%", "(", "name", ")", "s", " ", "produce", "d", " ", "by", " ", "a", " ", "formula", ",", " ", "with", " ", "variab", "les", " ", "consum", "ing", " ", "instance", "s", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "inst", "qname_", ",_", "dependencies_", "=_", "missi", "ng", "Dependent", "Instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "inst", "qname_", "==_", "Xbrl", "Const_", "._", "qn", "Standard", "Output", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "order", "ed", "Insta", "nce", "s", "Set_", "._", "add_", "(_", "inst", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "List_", "._", "append_", "(_", "inst", "qname_", ")_", "#", " ", "standard", " ", "output", " ", "formula", ",", " ", "all", " ", "input", " ", "dependen", "cies", " ", "in", " ", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", " ", "future", " ", "check", "?", " ", " ", "if", " ", "instance", " ", "has", " ", "no", " ", "external", " ", "input", " ", "or", " ", "produc", "ing", " ", "formula", "\\", "10", ";", " ", " ", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "val", ".", "model", "Xbrl", ".", "error", "(\"", "xbr", "lv", "ari", "nst", "e", ":", "instance", "Varia", "ble", "Recurs", "ion", "Cycle", "\",", "\\", "10", ";", " ", " ", "\\u(", "\"", "Unre", "solved", " ", "dependen", "cies", " ", "of", " ", "an", " ", "assertion", "'", "s", " ", "variab", "les", " ", "on", " ", "instance", "s", " ", "%", "(", "dependen", "cies", ")", "s", "\")", ",", "\\", "10", ";", " ", " ", "dependen", "cies", "=", "str", "(\\u", "DICT", "\\u", "SET", "(", "dep", "Ins", "ts", ")", " ", "-", " ", "std", "Inp", "Ins", "t", ")", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "inst", "qname_", "in_", "dep", "Ins", "ts_", ":_", "#", " ", "check", " ", "for", " ", "direct", " ", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lv", "ari", "nst", "e", ":", "instance", "Varia", "ble", "Recurs", "ion", "Cycle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cyc", "lic", " ", "dependen", "cies", " ", "of", " ", "instance", " ", "%", "(", "name", ")", "s", " ", "produce", "d", " ", "by", " ", "its", " ", "own", " ", "variab", "les", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "name_", "=_", "inst", "qname_", ")_", "\\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_", "formula", "Options_", "._", "trace", "Varia", "bles", "Order_", "and_", "len_", "(_", "order", "ed", "Insta", "nce", "s", "List_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "instance", "s", " ", "process", "ing", " ", "order", ":", " ", "%", "(", "dependen", "cies", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "dependencies_", "=_", "order", "ed", "Insta", "nce", "s", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "linked", " ", "consiste", "nc", "y", " ", "assertions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Formula_", ")_", "._", "model", "Relationship", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "model", "Rel", "_", "._", "from", "Model", "Object_", "is_", "not_", "None_", "and_", "model", "Rel", "_", "._", "to", "Model", "Object_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "model", "Rel", "_", "._", "to", "Model", "Object_", ",_", "Model", "Formula_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consi", "s", "Asse", "r_", "=_", "model", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consi", "s", "Asse", "r_", "._", "count", "Sat", "isfi", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "consi", "s", "Asse", "r_", "._", "count", "Not", "Sat", "isfi", "ed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "consi", "s", "Asse", "r_", "._", "has", "Prop", "ortion", "al", "Accepta", "nce", "Radius_", "and_", "consi", "s", "Asse", "r_", "._", "has", "Abs", "olute", "Accepta", "nce", "Radius_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lca", "e", ":", "acceptance", "Rad", "ius", "Confl", "ict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cons", "iste", "nc", "y", " ", "assertion", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "bot", "h", " ", "abs", "olute", " ", "and", " ", "proportional", " ", "acceptance", " ", "radi", "i", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "consi", "s", "Asse", "r_", ",_", "xli", "nk", "Label_", "=_", "consi", "s", "Asse", "r_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consi", "s", "Asse", "r_", "._", "order", "ed", "Varia", "ble", "Relationship", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "consi", "s", "Param", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Parameter_", ")_", "._", "from", "Model", "Object_", "(_", "consi", "s", "Asse", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "consi", "s", "Param", "Rel", "_", "._", "to", "Model", "Object_", ",_", "Model", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lca", "e", ":", "variab", "les", "Not", "All", "owe", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cons", "iste", "nc", "y", " ", "assertion", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "relation", "ship", " ", "to", " ", "a", " ", "%", "(", "element", "To", ")", "s", " ", "%", "(", "xli", "nk", "Label", "To", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "consi", "s", "Asse", "r_", ",_", "xli", "nk", "Label_", "=_", "consi", "s", "Asse", "r_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "element", "To_", "=_", "consi", "s", "Param", "Rel", "_", "._", "to", "Model", "Object_", "._", "local", "Name_", ",_", "xli", "nk", "Label", "To_", "=_", "consi", "s", "Param", "Rel", "_", "._", "to", "Model", "Object_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "consi", "s", "Param", "Rel", "_", "._", "to", "Model", "Object_", ",_", "Model", "Parameter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "consi", "s", "Asse", "r_", "._", "order", "ed", "Varia", "ble", "Relationship", "s_", "._", "append_", "(_", "consi", "s", "Param", "Rel", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "consi", "s", "Asse", "r_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Rel", "_", "._", "to", "Model", "Object_", "._", "has", "Cons", "iste", "nc", "y", "Assert", "ion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "consiste", "nc", "y", " ", "assertion", " ", "setup", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "validat", "e", " ", "default", " ", "dimension", "s", " ", "in", " ", "instance", "s", " ", "and", " ", "accumulate", " ", "multi", "-", "instance", "-", "default", " ", "dimension", " ", "aspect", "s_", "\\u\\u\\uNL\\u\\u\\u_", "xpa", "th", "Context_", "._", "default", "Dimen", "sion", "Asp", "ects_", "=_", "set_", "(_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Dimen", "sion", "Defaults_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "._", "dimension", "s", "Asp", "ect", "Univers", "e_", "=_", "xpa", "th", "Context_", "._", "default", "Dimen", "sion", "Asp", "ects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cnt", "x_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "contexts_", "._", "values_", "(_", ")_", ":_", "#", " ", "note", " ", "tha", "t", " ", "this", " ", "may", "be", " ", "shou", "ld", " ", "not", " ", "include", " ", "unre", "ference", "d", " ", "contexts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xpa", "th", "Context_", "._", "dimension", "s", "Asp", "ect", "Univers", "e_", "|=_", "\\u", "DICT", "\\u", "SET_", "(_", "cnt", "x_", "._", "qna", "me", "Dims", "_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xpa", "th", "Context", ".", "reporte", "d", "Dimen", "sion", "Asp", "ect", "s", " ", "=", " ", "set", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\\u", "evaluate", "d", "Context", "s", " ", "=", " ", "set", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "instance", "Qn", "ame_", "in_", "instance", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "instance", "Qn", "ame_", "not_", "in_", "(_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", ",_", "Xbrl", "Const_", "._", "qn", "Standard", "Output", "Instance_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "._", "parameters_", "and_", "instance", "Qn", "ame_", "in_", "val_", "._", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "named", "Instance_", "in_", "val_", "._", "parameters_", "[_", "instance", "Qn", "ame_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Validate", "Xbrl", "Dimensions_", "._", "load", "Dimen", "sion", "Defaults_", "(_", "named", "Instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "._", "default", "Dimen", "sion", "Asp", "ects_", "|=_", "\\u", "DICT", "\\u", "SET_", "(_", "named", "Instance_", "._", "qna", "me", "Dimen", "sion", "Defaults_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "._", "dimension", "s", "Asp", "ect", "Univers", "e_", "|=_", "\\u", "DICT", "\\u", "SET_", "(_", "named", "Instance_", "._", "qna", "me", "Dimen", "sion", "Defaults_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cnt", "x_", "in_", "named", "Instance_", "._", "contexts_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "xpa", "th", "Context_", "._", "dimension", "s", "Asp", "ect", "Univers", "e_", "|=_", "\\u", "DICT", "\\u", "SET_", "(_", "cnt", "x_", "._", "qna", "me", "Dims", "_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "fact", " ", "in", " ", "named", "Insta", "nce", ".", "fact", "s", "In", "Insta", "nce", ":", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "cnt", "x", " ", "=", " ", "fact", ".", "context_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "fact", ".", "is", "Item", " ", "and", " ", "\\u", "cnt", "x", " ", "is", " ", "not", " ", "Non", "e", " ", "and", " ", "\\u", "cnt", "x", " ", "not", " ", "in", " ", "\\u", "evaluate", "d", "Context", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "xpa", "th", "Context", ".", "reporte", "d", "Dimen", "sion", "Asp", "ect", "s", " ", "|", "=", " ", "\\u", "DICT", "\\u", "SET", "(\\u", "cnt", "x", ".", "qna", "me", "Dims", ".", "keys", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "del", " ", "\\u", "evaluate", "d", "Context", "s", " ", "#", " ", "dereferenc", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xpa", "th", "Context", ".", "reporte", "d", "Default", "Dimen", "sion", "Asp", "ect", "s", " ", "=", " ", "xpa", "th", "Context", ".", "default", "Dimen", "sion", "Asp", "ect", "s", " ", "&", " ", "xpa", "th", "Context", ".", "reporte", "d", "Dimen", "sion", "Asp", "ects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "reporte", "d", "Dimen", "sion", "Asp", "ect", "s", " ", "(", "for", " ", "whi", "ch", " ", "fact", "s", " ", "report", " ", "any", " ", "value", " ", "of", " ", "the", " ", "dimension", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "variab", "le", " ", "set", " ", "dependen", "cies", " ", "acro", "ss", " ", "output", " ", "instance", "s", " ", "produce", "d_", "\\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_", "for_", "instance", "Qn", "ame_", ",_", "model", "Varia", "ble", "Sets_", "in_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Varia", "ble", "Set_", "in_", "model", "Varia", "ble", "Sets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "var", "Sco", "pe", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "les", "Scope_", ")_", "._", "to", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "Sco", "pe", "Rel", "_", "._", "from", "Model", "Object_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "source", "Varia", "ble", "Set_", "=_", "var", "Sco", "pe", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "source", "Varia", "ble", "Set_", "._", "output", "Insta", "nce", "Qn", "ame_", "!=_", "instance", "Qn", "ame_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lv", "ars", "cope", "e", ":", "different", "Insta", "nce", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", "1", ")", "s", " ", "in", " ", "instance", " ", "%", "(", "instance", "1", ")", "s", " ", "has", " ", "variab", "les", " ", "scope", " ", "relation", "ship", " ", "to", " ", "vara", "ibl", "e", " ", "set", " ", "%", "(", "xli", "nk", "Label", "2", ")", "s", " ", "in", " ", "instance", " ", "%", "(", "instance", "2", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "nk", "Label", "1_", "=_", "source", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "instance", "1_", "=_", "source", "Varia", "ble", "Set_", "._", "output", "Insta", "nce", "Qn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "nk", "Label", "2_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "instance", "2_", "=_", "model", "Varia", "ble", "Set_", "._", "output", "Insta", "nce", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "source", "Varia", "ble", "Set_", "._", "aspect", "Model_", "!=_", "model", "Varia", "ble", "Set_", "._", "aspect", "Model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lv", "ars", "cope", "e", ":", "conflicting", "Asp", "ect", "Model", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", "1", ")", "s", " ", "aspect", "Model", " ", "(%", "(", "aspect", "Model", "1", ")", "s", ")", " ", "differs", " ", "from", " ", "vara", "ibl", "e", " ", "set", " ", "%", "(", "xli", "nk", "Label", "2", ")", "s", " ", "aspect", "Model", " ", "(%", "(", "aspect", "Model", "2", ")", "s", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "nk", "Label", "1_", "=_", "source", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model", "1_", "=_", "source", "Varia", "ble", "Set_", "._", "aspect", "Model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "nk", "Label", "2_", "=_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model", "2_", "=_", "model", "Varia", "ble", "Set_", "._", "aspect", "Model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "instance", "s", " ", "scope", "s", " ", "and", " ", "setup", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "formula", "Validat", "ion", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "initial", "Error", "Count_", "<_", "val_", "._", "model", "Xbrl", "_", "._", "log", "Count_", "._", "get_", "(_", "logging_", "._", "\\u", "check", "Level_", "(_", "'", "ERROR", "'_", ")_", ",_", "0_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "compile", "Only_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "val_", ",_", "\"", "validat", "e", "Form", "ula", "Compil", "e", "On", "ly", "\"_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", "don", "'", "t", " ", "try", " ", "to", " ", "execute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "formula", " ", "output", " ", "instance", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "instance", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "initiali", "zin", "g", " ", "formula", " ", "output", " ", "instance", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema", "Refs", "_", "=_", "[_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "relative", "Uri_", "(_", "referenced", "Doc_", "._", "uri_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "referenced", "Doc_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "reference", "s", "Document_", "._", "keys_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "referenced", "Doc_", "._", "type_", "==_", "Model", "Document_", "._", "Type_", "._", "SCHEMA_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "Xbrl", "Instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance", "Qn", "ame_", "in_", "instance", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance", "Qn", "ame_", "==_", "Xbrl", "Const_", "._", "qn", "Standard", "Inp", "ut", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "alw", "ay", "s", " ", "presen", "t", " ", "the", " ", "standard", " ", "way_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "val_", "._", "parameters_", "and_", "instance", "Qn", "ame_", "in_", "val_", "._", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "named", "Instance_", "=_", "val_", "._", "parameters_", "[_", "instance", "Qn", "ame_", "]_", "[_", "1_", "]_", "#", " ", "this", " ", "is", " ", "a", " ", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "empty", " ", "intermediate", " ", "instance", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Document_", "._", "filepath_", "[_", ":_", "-_", "4_", "]_", "+_", "\"-", "output", "-", "XB", "RL", "-", "instance", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "Qn", "ame_", "!=_", "Xbrl", "Const_", "._", "qn", "Standard", "Output", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "uri_", "+_", "\"-\"_", "+_", "instance", "Qn", "ame_", "._", "local", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uri_", "=_", "uri_", "+_", "\".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "named", "Instance_", "=_", "Model", "Xbrl", "_", "._", "create_", "(_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Document", "Type_", "=_", "Model", "Document_", "._", "Type_", "._", "INSTANCE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema", "Refs", "_", "=_", "schema", "Refs", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Entry_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Validate", "Xbrl", "Dimensions_", "._", "load", "Dimen", "sion", "Defaults_", "(_", "named", "Instance_", ")_", "#", " ", "need", " ", "dimension", " ", "default", "s", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xpa", "th", "Context_", "._", "in", "Sco", "pe", "Vars_", "[_", "instance", "Qn", "ame_", "]_", "=_", "named", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "Qn", "ame_", "==_", "Xbrl", "Const_", "._", "qn", "Standard", "Output", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "Xbrl", "Instance_", "=_", "named", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "output", " ", "instance", "s", " ", "setup", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "formula", "Insta", "nce", "s", "Set", "up", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "Form", "ulas", "Started_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "runn", "ing", " ", "formula", "e", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ID", "s", " ", "may", " ", "be", " ", "\"|", "\"", " ", "or", " ", "whitespace", " ", "separate", "d_", "\\u\\u\\uNL\\u\\u\\u_", "run", "ID", "s_", "=_", "(_", "formula", "Options_", "._", "run", "ID", "s_", "or_", "''_", ")_", "._", "replace_", "(_", "'|'_", ",_", "'", " ", "'_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "ID", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ua", "/", "assertion", " ", "ID", "s", " ", "restriction", ":", " ", "%", "(", "ids", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Xbrl", "_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "ids_", "=_", "',", " ", "'_", "._", "join_", "(_", "run", "ID", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "evaluate", " ", "consiste", "nc", "y", " ", "assertions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "val_", ",_", "\"", "max", "Form", "ula", "Run", "Time", "\"_", ")_", "and_", "val_", "._", "max", "Form", "ula", "Run", "Time_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Form", "ula", "Run", "Time", "Timer_", "=_", "Timer_", "(_", "val_", "._", "max", "Form", "ula", "Run", "Time_", "*_", "60.0_", ",_", "xpa", "th", "Context_", "._", "run", "Time", "Exce", "eded", "Callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "Form", "ula", "Run", "Time", "Timer_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Form", "ula", "Run", "Time", "Timer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "evaluate", " ", "variab", "le", " ", "sets", " ", "not", " ", "in", " ", "consiste", "nc", "y", " ", "assertions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Form", "ula", "Evaluator_", "import_", "init_", "as_", "formula", "Eval", "uator", "Init_", ",_", "evaluate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formula", "Eval", "uator", "Init_", "(_", ")_", "#", " ", "one", "-", "time", " ", "module", " ", "initialization", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "evaluations", "\"_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance", "Qn", "ame_", "in_", "order", "ed", "Insta", "nce", "s", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Varia", "ble", "Set_", "in_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "[_", "instance", "Qn", "ame_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "produce", " ", "variab", "le", " ", "evaluations", " ", "if", " ", "no", " ", "dependent", " ", "variab", "les", "-", "scope", " ", "relationships_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "les", "Scope_", ")_", "._", "to", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "not_", "run", "ID", "s_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Varia", "ble", "Set_", "._", "id_", "in_", "run", "ID", "s_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "model", "Varia", "ble", "Set_", "._", "has", "Cons", "iste", "nc", "y", "Assert", "ion_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "model", "Rel", "_", "._", "from", "Model", "Object_", "._", "id_", "in_", "run", "ID", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Formula_", ")_", "._", "to", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "model", "Rel", "_", "._", "from", "Model", "Object_", ",_", "Model", "Cons", "iste", "nc", "y", "Assert", "ion_", ")_", ")_", ")_", ")_", ":_", "\\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 ", " ", " _", "var", "Set", "Id_", "=_", "(_", "model", "Varia", "ble", "Set_", "._", "id_", "or_", "model", "Varia", "ble", "Set_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "evaluat", "ing", " ", "\"_", "+_", "var", "Set", "Id_", ",_", "min", "Time", "To", "Show_", "=_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "evaluat", "ing", " ", "{", "0", "}\"_", ")_", "._", "format_", "(_", "var", "Set", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Activity_", "(_", "\"...", " ", "evaluat", "ing", " ", "\"_", "+_", "var", "Set", "Id_", ",_", "min", "Time", "To", "Show_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "evaluate_", "(_", "xpa", "th", "Context_", ",_", "model", "Varia", "ble", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "model", "Varia", "ble", "Set_", "._", "local", "Name_", "+_", "\"\\u\"_", "+_", "var", "Set", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XP", "ath", "Context_", "._", "XP", "ath", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "err_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "\\\\", "n", "%", "(", "variab", "le", "Set", ")", "s", " ", "\\\\", "n", "Except", "ion", ":", " ", "\\\\", "n", "%", "(", "error", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Varia", "ble", "Set_", ",_", "variab", "le", "Set_", "=_", "str_", "(_", "model", "Varia", "ble", "Set_", ")_", ",_", "error_", "=_", "err_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "max", "Form", "ula", "Run", "Time", "Timer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "Form", "ula", "Run", "Time", "Timer_", "._", "cancel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XP", "ath", "Context_", "._", "Run", "Time", "Exce", "eded", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "max", "Run", "Time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "executi", "on", " ", "ende", "d", " ", "after", " ", "%", "(", "mins", ")", "s", " ", "minute", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "val_", "._", "model", "Xbrl", "_", ",_", "mins_", "=_", "val_", "._", "max", "Form", "ula", "Run", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", " ", "assertion", " ", "result", " ", "counts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ass", "er", "Tests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exi", "s", "Val", "Asse", "r_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Varia", "ble", "Sets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "exi", "s", "Val", "Asse", "r_", ",_", "Model", "Varia", "ble", "Set", "Assert", "ion_", ")_", "and_", "(_", "not_", "run", "ID", "s_", "or_", "exi", "s", "Val", "Asse", "r_", "._", "id_", "in_", "run", "ID", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ass", "er", "Tests_", "[_", "exi", "s", "Val", "Asse", "r_", "._", "id_", "]_", "=_", "(_", "exi", "s", "Val", "Asse", "r_", "._", "count", "Sat", "isfi", "ed_", ",_", "exi", "s", "Val", "Asse", "r_", "._", "count", "Not", "Sat", "isfi", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula", "Options_", "._", "trace", "Assert", "ion", "Result", "Counts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"%", "(", "assertion", "Type", ")", "s", " ", "Assert", "ion", " ", "%", "(", "id", ")", "s", " ", "evaluations", " ", ":", " ", "%", "(", "satisfied", "Count", ")", "s", " ", "satisfied", ",", " ", "%", "(", "not", "Sat", "isfi", "ed", "Count", ")", "s", " ", "not", " ", "satisfied", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "exi", "s", "Val", "Asse", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assertion", "Type_", "=_", "\"", "Exist", "ence", "\"_", "if_", "isinstance_", "(_", "exi", "s", "Val", "Asse", "r_", ",_", "Model", "Exist", "ence", "Assert", "ion_", ")_", "else_", "\"", "Value", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "exi", "s", "Val", "Asse", "r_", "._", "id_", ",_", "satisfied", "Count_", "=_", "exi", "s", "Val", "Asse", "r_", "._", "count", "Sat", "isfi", "ed_", ",_", "not", "Sat", "isfi", "ed", "Count_", "=_", "exi", "s", "Val", "Asse", "r_", "._", "count", "Not", "Sat", "isfi", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "consiste", "nc", "y", "Assert", "ion", "Formula_", ")_", "._", "model", "Relationship", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "model", "Rel", "_", "._", "from", "Model", "Object_", "is_", "not_", "None_", "and_", "model", "Rel", "_", "._", "to", "Model", "Object_", "is_", "not_", "None_", "and_", "isinstance_", "(_", "model", "Rel", "_", "._", "to", "Model", "Object_", ",_", "Model", "Formula_", ")_", "and_", "(_", "not_", "run", "ID", "s_", "or_", "model", "Rel", "_", "._", "from", "Model", "Object_", "._", "id_", "in_", "run", "ID", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "consi", "s", "Asse", "r_", "=_", "model", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ass", "er", "Tests_", "[_", "consi", "s", "Asse", "r_", "._", "id_", "]_", "=_", "(_", "consi", "s", "Asse", "r_", "._", "count", "Sat", "isfi", "ed_", ",_", "consi", "s", "Asse", "r_", "._", "count", "Not", "Sat", "isfi", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formula", "Options_", "._", "trace", "Assert", "ion", "Result", "Counts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "formula", ":", "trace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cons", "iste", "nc", "y", " ", "Assert", "ion", " ", "%", "(", "id", ")", "s", " ", "evaluations", " ", ":", " ", "%", "(", "satisfied", "Count", ")", "s", " ", "satisfied", ",", " ", "%", "(", "not", "Sat", "isfi", "ed", "Count", ")", "s", " ", "not", " ", "satisfied", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "consi", "s", "Asse", "r_", ",_", "id_", "=_", "consi", "s", "Asse", "r_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "satisfied", "Count_", "=_", "consi", "s", "Asse", "r_", "._", "count", "Sat", "isfi", "ed_", ",_", "not", "Sat", "isfi", "ed", "Count_", "=_", "consi", "s", "Asse", "r_", "._", "count", "Not", "Sat", "isfi", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ass", "er", "Tests_", ":_", "#", " ", "pass", " ", "assertion", " ", "results", " ", "to", " ", "validation", " ", "if", " ", "appropr", "iate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "log_", "(_", "None_", ",_", "\"", "as", "rt", "No", "Log", "\"_", ",_", "None_", ",_", "assertion", "Results_", "=_", "ass", "er", "Tests_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "display", " ", "output", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output", "Xbrl", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "val_", "._", "model", "Xbrl", "_", "._", "formula", "Output", "Instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "close", " ", "prior", " ", "instance", ",", " ", "usual", "ly", " ", "close", "d", " ", "by", " ", "caller", " ", "to", " ", "validat", "e", " ", "as", " ", "it", " ", "may", " ", "affect", " ", "UI", " ", "on", " ", "different", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "formula", "Output", "Instance_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "formula", "Output", "Instance_", "=_", "output", "Xbrl", "Instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "show", "Status_", "(_", "\\u_", "(_", "\"", "formula", "e", " ", "finish", "ed", "\"_", ")_", ",_", "2000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "Produ", "cing", "Varia", "ble", "Sets_", "._", "clear_", "(_", ")_", "#", " ", "dereferenc", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter", "Qn", "ames_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Qn", "ames_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter", "Dependenc", "ies_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "Dependenc", "ies_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependen", "cy", "Resolved", "Parameters_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "ed", "Insta", "nce", "s", "Set_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "order", "ed", "Parameters_", ",_", "order", "ed", "Instances_", ",_", "order", "ed", "Insta", "nce", "s", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "Context_", "._", "close_", "(_", ")_", "#", " ", "dereferenc", "e", " ", "every", "thing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "profile", "Stat_", "(_", "\\u_", "(_", "\"", "formula", "Execut", "ion", "Total", "\"_", ")_", ",_", "time_", "._", "time_", "(_", ")_", "-_", "time", "Form", "ulas", "Started_", ")_", "\\u\\u\\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_", "check", "Varia", "bles", "Sco", "pe", "Vis", "ibl", "e", "Qn", "ames_", "(_", "val_", ",_", "name", "Variables_", ",_", "defin", "ed", "Names", "Set_", ",_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "visi", "ble", "Var", "Set", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "les", "Scope_", ")_", "._", "to", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "qname_", "=_", "visi", "ble", "Var", "Set", "Rel", "_", "._", "variab", "le", "Qn", "ame_", "#", " ", "name", " ", "(", "if", " ", "any", ")", " ", "of", " ", "the", " ", "formula", " ", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "qname_", "not_", "in_", "name", "Variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "Variables_", "[_", "var", "qname_", "]_", "=_", "visi", "ble", "Var", "Set", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "var", "qname_", "not_", "in_", "defin", "ed", "Names", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defin", "ed", "Names", "Set_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "visi", "ble", "Var", "Set_", "=_", "visi", "ble", "Var", "Set", "Rel", "_", "._", "from", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "Xbrl", "Const_", "._", "variab", "le", "Set_", ")_", "._", "from", "Model", "Object_", "(_", "visi", "ble", "Var", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "qname_", "=_", "model", "Rel", "_", "._", "variab", "le", "Qn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "var", "qname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var", "qname_", "not_", "in_", "name", "Variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name", "Variables_", "[_", "var", "qname_", "]_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "var", "qname_", "not_", "in_", "defin", "ed", "Names", "Set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "defin", "ed", "Names", "Set_", "._", "add_", "(_", "var", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Varia", "bles", "Sco", "pe", "Vis", "ibl", "e", "Qn", "ames_", "(_", "val_", ",_", "name", "Variables_", ",_", "defin", "ed", "Names", "Set_", ",_", "visi", "ble", "Var", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Filter", "Asp", "ect", "Model_", "(_", "val_", ",_", "variab", "le", "Set_", ",_", "filter", "Relationship", "s_", ",_", "xpa", "th", "Context_", ",_", "unco", "vera", "ble", "Asp", "ects_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "set_", "(_", ")_", "#", " ", "all", " ", "of", " ", "the", " ", "aspect", "s", " ", "found", " ", "to", " ", "be", " ", "covered", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unco", "vera", "ble", "Asp", "ects_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "protect", " ", "2.7", " ", "conversion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opposite", "Asp", "ect", "Model_", "=_", "(_", "\\u", "DICT", "\\u", "SET_", "(_", "{_", "'", "dimension", "al", "'_", ",_", "'", "non", "-", "dimension", "al", "'_", "}_", ")_", "-_", "\\u", "DICT", "\\u", "SET_", "(_", "{_", "variab", "le", "Set_", "._", "aspect", "Model_", "}_", ")_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unco", "vera", "ble", "Asp", "ects_", "=_", "aspect", "Models_", "[_", "opposite", "Asp", "ect", "Model_", "]_", "-_", "aspect", "Models_", "[_", "variab", "le", "Set_", "._", "aspect", "Model_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "#", " ", "bad", " ", "aspect", " ", "model", ",", " ", "not", " ", "an", " ", "issue", " ", "for", " ", "this", " ", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "acf", "Asp", "ect", "s", "Cover", "ing_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "var", "Filter", "Rel", "_", "in_", "filter", "Relationship", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "filter_", "=_", "var", "Filter", "Rel", "_", "._", "to", "Model", "Object_", "#", " ", "use", " ", "\\u", "filter", " ", "inst", "ead", " ", "of", " ", "filter", " ", "to", " ", "prevent", " ", "2t", "o3", " ", "confusion", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "All", "Asp", "ect", "Cover", "Filter_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "filter_", ",_", "Model", "Asp", "ect", "Cover", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "aspect_", "in_", "\\u", "filter_", "._", "aspect", "s", "Cover", "ed_", "(_", "None_", ",_", "xpa", "th", "Context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "aspect_", "in_", "acf", "Asp", "ect", "s", "Cover", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "other", "Filter", "Cover", "_", ",_", "other", "Filter", "Label_", "=_", "acf", "Asp", "ect", "s", "Cover", "ing_", "[_", "aspect_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "other", "Filter", "Cover", "_", "!=_", "var", "Filter", "Rel", "_", "._", "is", "Cover", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lac", "fe", ":", "inconsistent", "Asp", "ect", "Cover", "Filter", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "aspect", " ", "cover", " ", "filter", " ", "%", "(", "filter", "Label", ")", "s", ",", " ", "aspect", " ", "%", "(", "aspect", ")", "s", ",", " ", "confl", "icts", " ", "with", " ", "%", "(", "filter", "Label", "2", ")", "s", " ", "with", " ", "inconsistent", " ", "cover", " ", "attribute", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "variab", "le", "Set_", ",_", "xli", "nk", "Label_", "=_", "variab", "le", "Set_", "._", "xli", "nk", "Label_", ",_", "filter", "Label_", "=_", "\\u", "filter_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect_", "=_", "str_", "(_", "aspect_", ")_", "if_", "isinstance_", "(_", "aspect_", ",_", "QN", "ame_", ")_", "else_", "Asp", "ect_", "._", "label_", "[_", "aspect_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "Label", "2_", "=_", "other", "Filter", "Label_", ")_", "\\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 ", " ", "_", "acf", "Asp", "ect", "s", "Cover", "ing_", "[_", "aspect_", "]_", "=_", "(_", "var", "Filter", "Rel", "_", "._", "is", "Cover", "ed_", ",_", "\\u", "filter_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "All", "Asp", "ect", "Cover", "Filter_", "=_", "\\u", "filter_", "._", "is", "All_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "True_", ":_", "#", " ", "change", "d", " ", "for", " ", "test", " ", "case", " ", "502", "10", " ", "v", "03", " ", "var", "Filter", "Rel", ".", "is", "Cover", "ed", ":_", "\\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 ", " _", "aspect", "s", "Cover", "ed_", "=_", "\\u", "filter_", "._", "aspect", "s", "Cover", "ed_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "is", "All", "Asp", "ect", "Cover", "Filter_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "any_", "(_", "isinstance_", "(_", "aspect_", ",_", "QN", "ame_", ")_", "for_", "aspect_", "in_", "aspect", "s", "Cover", "ed_", ")_", "and_", "Asp", "ect_", "._", "DIMENSION", "S_", "in_", "unco", "vera", "ble", "Asp", "ects_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "aspect", "s", "Cover", "ed_", "&_", "unco", "vera", "ble", "Asp", "ects_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lve", ":", "filter", "Asp", "ect", "Model", "Mismatch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "aspect", " ", "model", " ", "%", "(", "aspect", "Model", ")", "s", " ", "filter", " ", "%", "(", "filter", "Name", ")", "s", " ", "%", "(", "filter", "Label", ")", "s", " ", "can", " ", "cover", " ", "aspect", " ", "not", " ", "in", " ", "aspect", " ", "model", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "variab", "le", "Set_", ",_", "xli", "nk", "Label_", "=_", "variab", "le", "Set_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model_", "=_", "variab", "le", "Set_", "._", "aspect", "Model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "Name_", "=_", "\\u", "filter_", "._", "local", "Name_", ",_", "filter", "Label_", "=_", "\\u", "filter_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "|=_", "aspect", "s", "Cover", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "\\u", "filter_", ",_", "\"", "filter", "Relationship", "s", "\"_", ")_", ":_", "#", " ", "check", " ", "and", " ", "&", " ", "or", " ", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "|=_", "check", "Filter", "Asp", "ect", "Model_", "(_", "val_", ",_", "variab", "le", "Set_", ",_", "\\u", "filter_", "._", "filter", "Relationship", "s_", ",_", "xpa", "th", "Context_", ",_", "unco", "vera", "ble", "Asp", "ects_", ")_", "\\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_", "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_", "check", "Form", "ula", "Rules_", "(_", "val_", ",_", "formula_", ",_", "name", "Variables_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "CONC", "EP", "T_", ")_", "or_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "CONC", "EP", "T_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Xm", "l", "Util_", "._", "has", "Descen", "dant", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"", "concept", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "incomplete", "Concept", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "concept", " ", "rule", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "near", "est", " ", "source", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "child", " ", "element", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "Concept", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "omit", "s", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "concept", " ", "aspect", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "formula_", ",_", "Model", "Tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "SCHEME", "_", ")_", "or_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "SCHEME", "_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "VALUE_", ")_", "or_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "VALUE_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Xm", "l", "Util_", "._", "has", "Descen", "dant", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"", "entity", "Identifie", "r", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "incomplete", "Entit", "y", "Identifie", "r", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "entity", " ", "identifi", "er", " ", "rule", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "near", "est", " ", "source", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "eit", "her", " ", "a", " ", "@", "sche", "me", " ", "or", " ", "a", " ", "@", "value", " ", "attribute", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "Entit", "y", "Identifie", "r", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "omit", "s", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "entity", " ", "identifi", "er", " ", "aspect", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "PERIOD", "\\u", "TYPE_", ")_", "or_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "PERIOD", "\\u", "TYPE_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Xm", "l", "Util_", "._", "has", "Descen", "dant", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"", "period", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "incomplete", "Period", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "period", " ", "rule", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "near", "est", " ", "source", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "child", " ", "element", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "Period", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "omit", "s", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "period", " ", "aspect", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "unit", " ", "need", " ", "to", " ", "see", " ", "if", " ", "the", " ", "qna", "me", " ", "is", " ", "static", "ally", " ", "determina", "ble", " ", "to", " ", "dete", "rmin", "e", " ", "if", " ", "numeric_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "concept_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "._", "get_", "(_", "formula_", "._", "evaluate", "Rule_", "(_", "None_", ",_", "Asp", "ect_", "._", "CONC", "EP", "T_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "concept_", "is_", "None_", ":_", "#", " ", "is", " ", "there", " ", "a", " ", "source", " ", "with", " ", "a", " ", "static", " ", "QN", "ame", " ", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "Fact", "Var_", "=_", "name", "Variables_", "._", "get_", "(_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "CONC", "EP", "T_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "source", "Fact", "Var_", ",_", "Model", "Fact", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "var", "Filter", "Rel", "s_", "in_", "(_", "formula_", "._", "group", "Filter", "Relationship", "s_", ",_", "source", "Fact", "Var_", "._", "filter", "Relationship", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "var", "Filter", "Rel", "_", "in_", "var", "Filter", "Rel", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "filter_", "=_", "var", "Filter", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "filter_", ",_", "Model", "Concept", "Name_", ")_", ":_", "#", " ", "relation", "ship", " ", "not", " ", "constrained", " ", "to", " ", "real", " ", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "concept", "Qn", "ame_", "in_", "\\u", "filter_", "._", "concept", "Qn", "ames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "concept_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "._", "get_", "(_", "concept", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "concept_", "is_", "not_", "None_", "and_", "concept_", "._", "is", "Numeric_", ":_", "\\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_", "\\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_", "concept_", "is_", "not_", "None_", ":_", "#", " ", "from", " ", "concept", " ", "aspect", " ", "rule", " ", "or", " ", "from", " ", "source", " ", "fact", "Varia", "ble", " ", "concept", " ", "Qn", "ame", " ", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "concept_", "._", "is", "Numeric_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "MULTIP", "LY", "\\u", "BY", "_", ")_", "or_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "DIVI", "DE", "\\u", "BY", "_", ")_", "or_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "UNIT", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "Xm", "l", "Util_", "._", "has", "Descen", "dant", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"", "unit", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "SA", "VF", "or", "Unit", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "unit", " ", "rule", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "source", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "child", " ", "element", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "Unit", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "omit", "s", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "unit", " ", "aspect", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "MULTIP", "LY", "\\u", "BY", "_", ")_", "or_", "formula_", "._", "has", "Rule_", "(_", "Asp", "ect_", "._", "DIVI", "DE", "\\u", "BY", "_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "UNIT", "_", ",_", "accept", "Form", "ula", "Source_", "=_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "conflicting", "Asp", "ect", "Rule", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "unit", " ", "aspect", " ", "of", " ", "a", " ", "non", "-", "numeri", "c", " ", "concept", " ", "%", "(", "concept", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "concept_", "=_", "concept_", "._", "qname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aspect", "Period", "Type_", "=_", "formula_", "._", "evaluate", "Rule_", "(_", "None_", ",_", "Asp", "ect_", "._", "PERIOD", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "concept_", "._", "period", "Type_", "==_", "\"", "duration", "\"_", "and_", "aspect", "Period", "Type_", "==_", "\"", "instant", "\"_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "concept_", "._", "period", "Type_", "==_", "\"", "instant", "\"_", "and_", "aspect", "Period", "Type_", "in_", "(_", "\"", "duration", "\"_", ",_", "\"", "forever", "\"_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "conflicting", "Asp", "ect", "Rule", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "has", " ", "a", " ", "rule", " ", "for", " ", "the", " ", "%", "(", "aspect", "Period", "Type", ")", "s", " ", "period", " ", "aspect", " ", "of", " ", "a", " ", "%", "(", "concept", "Period", "Type", ")", "s", " ", "concept", " ", "%", "(", "concept", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "concept_", "=_", "concept_", "._", "qname_", ",_", "aspect", "Period", "Type_", "=_", "aspect", "Period", "Type_", ",_", "concept", "Period", "Type_", "=_", "concept_", "._", "period", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "dimension", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elt", "Name_", ",_", "dim_", ",_", "bad", "Us", "age", "Err_", ",_", "missi", "ng", "Sav", "Err_", "in_", "(_", "(_", "\"", "explicit", "Dimen", "sion", "\"_", ",_", "\"", "explicit", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "SA", "VF", "or", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "typed", "Dimen", "sion", "\"_", ",_", "\"", "typed", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Type", "d", "Dimen", "sion", "Rule", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "SA", "VF", "or", "Type", "d", "Dimen", "sion", "Rule", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dim", "El", "t_", "in_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "elt", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim", "Qn", "ame_", "=_", "qname_", "(_", "dim", "El", "t_", ",_", "dim", "El", "t_", "._", "get_", "(_", "\"", "dimension", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "Concept", "_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "._", "get_", "(_", "dim", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "Qn", "ame_", "and_", "(_", "dim", "Concept", "_", "is_", "None_", "or_", "(_", "not_", "dim", "Concept", "_", "._", "is", "Exp", "licit", "Dimension_", "if_", "dim_", "==_", "\"", "explicit", "\"_", "else_", "not_", "dim", "Concept", "_", "._", "is", "Type", "d", "Dimension_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "bad", "Us", "age", "Err_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "dimension", " ", "attribute", " ", "%", "(", "dimension", ")", "s", " ", "on", " ", "the", " ", "%", "(", "dimension", "Type", ")", "s", " ", "dimension", " ", "rule", " ", "contain", "s", " ", "a", " ", "QN", "ame", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "identify", " ", "an", " ", "(", "dimension", "Type", ")", "s", " ", "dimension", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "dimension", "Type_", "=_", "dim_", ",_", "dimension_", "=_", "dim", "Qn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "Codes_", "=_", "(_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Type", "d", "Dimen", "sion", "Rule", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "Xm", "l", "Util_", "._", "has", "Child_", "(_", "dim", "El", "t_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"*\"_", ")_", "and_", "not_", "formula_", "._", "source_", "(_", "Asp", "ect_", "._", "DIMENSION", "S_", ",_", "dim", "El", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "missi", "ng", "Sav", "Err_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "%", "(", "dimension", ")", "s", " ", "dimension", " ", "rule", " ", "doe", "s", " ", "not", " ", "have", " ", "any", " ", "child", " ", "element", "s", " ", "and", " ", "doe", "s", " ", "not", " ", "have", " ", "a", " ", "SA", "V", " ", "for", " ", "the", " ", "%", "(", "dimension", "Type", ")", "s", " ", "dimension", " ", "tha", "t", " ", "is", " ", "identifi", "ed", " ", "by", " ", "its", " ", "dimension", " ", "attribute", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "dimension", "Type_", "=_", "dim_", ",_", "dimension_", "=_", "dim", "Qn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "Codes_", "=_", "(_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "SA", "VF", "or", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "missi", "ng", "SA", "VF", "or", "Type", "d", "Dimen", "sion", "Rule", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "aspect", " ", "model", " ", "expectations", "_", "\\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_", "formula_", "._", "aspect", "Model_", "==_", "\"", "non", "-", "dimension", "al", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unexpected", "El", "ts_", "=_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "(_", "\"", "explicit", "Dimen", "sion", "\"_", ",_", "\"", "typed", "Dimen", "sion", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unexpected", "El", "ts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "unre", "cogni", "sed", "Asp", "ect", "Rule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "aspect", " ", "model", ",", " ", "%", "(", "aspect", "Model", ")", "s", ",", " ", "include", "s", " ", "an", " ", "rule", " ", "for", " ", "aspect", " ", "not", " ", "defin", "ed", " ", "in", " ", "this", " ", "aspect", " ", "model", ":", " ", "%", "(", "undefined", "Asp", "ect", "s", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model_", "=_", "formula_", "._", "aspect", "Model_", ",_", "undefined", "Asp", "ects_", "=_", "\",", " ", "\"_", "._", "join_", "(_", "[_", "elt_", "._", "local", "Name_", "for_", "elt_", "in_", "unexpected", "El", "ts_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "source", " ", "qna", "mes_", "\\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_", "source", "El", "t_", "in_", "(_", "[_", "formula_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "formula_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"*\"_", ",_", "\"", "source", "\"_", ",_", "\"*\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "source", "El", "t_", "._", "get_", "(_", "\"", "source", "\"_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qn", "Source_", "=_", "qname_", "(_", "source", "El", "t_", ",_", "source", "El", "t_", "._", "get_", "(_", "\"", "source", "\"_", ")_", ",_", "no", "Pref", "ix", "Is", "No", "Namespace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qn", "Source_", "==_", "Xbrl", "Const_", "._", "qn", "Form", "ula", "Unco", "vere", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "formula_", "._", "implicit", "Filtering", "_", "!=_", "\"", "true", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "ille", "gal", "Us", "e", "Of", "Unco", "vere", "d", "QN", "ame", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "not", " ", "implicit", " ", "filtering", " ", "element", " ", "has", " ", "formula", "Unco", "vere", "d", " ", "source", ":", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "source", "El", "t_", "._", "local", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "qn", "Source_", "not_", "in_", "name", "Variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "nonexist", "ent", "Sou", "rce", "Varia", "ble", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "source", " ", "%", "(", "name", ")", "s", " ", "is", " ", "not", " ", "in", " ", "the", " ", "variab", "le", " ", "set", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "qn", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fact", "Variable_", "=_", "name", "Variables_", "._", "get_", "(_", "qn", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "fact", "Variable_", ",_", "Model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "fact", "Variable_", ",_", "Model", "Fact", "Variable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "nonexist", "ent", "Sou", "rce", "Varia", "ble", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Varia", "ble", " ", "set", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "source", " ", "%", "(", "name", ")", "s", " ", "not", " ", "a", " ", "fact", "Varia", "ble", " ", "but", " ", "is", " ", "a", " ", "%", "(", "element", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "qn", "Source_", ",_", "element_", "=_", "fact", "Variable_", "._", "local", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fact", "Variable_", "._", "fall", "back", "Value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "bind", "Emp", "ty", "Sou", "rce", "Varia", "ble", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", ":", " ", "source", " ", "%", "(", "name", ")", "s", " ", "is", " ", "a", " ", "fact", " ", "variab", "le", " ", "tha", "t", " ", "has", " ", "a", " ", "fall", "back", " ", "value", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "qn", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "source", "El", "t_", "._", "local", "Name_", "==_", "\"", "formula", "\"_", "and_", "fact", "Variable_", "._", "bind", "As", "Sequence_", "==_", "\"", "true", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lf", "e", ":", "default", "Asp", "ect", "Value", "Confl", "icts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Form", "ula", " ", "%", "(", "xli", "nk", "Label", ")", "s", ":", " ", "formula", " ", "source", " ", "%", "(", "name", ")", "s", " ", "is", " ", "a", " ", "fact", " ", "variab", "le", " ", "tha", "t", " ", "bind", "s", " ", "as", " ", "a", " ", "sequence", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "formula_", ",_", "xli", "nk", "Label_", "=_", "formula_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "qn", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Table", "Rules_", "(_", "val_", ",_", "xpa", "th", "Context_", ",_", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "cover", "ing", " ", "aspect", " ", "not", " ", "in", " ", "variab", "le", " ", "set", " ", "aspect", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Filter", "Asp", "ect", "Model_", "(_", "val_", ",_", "table_", ",_", "table_", "._", "filter", "Relationship", "s_", ",_", "xpa", "th", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check", "Definit", "ion", "Node", "Rules_", "(_", "val_", ",_", "table_", ",_", "table_", ",_", "(_", "Xbrl", "Const_", "._", "table", "Break", "down_", ",_", "Xbrl", "Const_", "._", "table", "Break", "down", "MM", "DD", "_", ",_", "Xbrl", "Const_", "._", "table", "Break", "down", "20130", "5_", ",_", "Xbrl", "Const_", "._", "table", "Axi", "s2", "011", "_", ")_", ",_", "xpa", "th", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Definit", "ion", "Node", "Rules_", "(_", "val_", ",_", "table_", ",_", "parent_", ",_", "arc", "role_", ",_", "xpa", "th", "Context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rel_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "arc", "role_", ")_", "._", "from", "Model", "Object_", "(_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axis_", "=_", "rel_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "axis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "axis_", ",_", "Model", "Filter", "Definit", "ion", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Filter", "Asp", "ect", "Model_", "(_", "val_", ",_", "table_", ",_", "axis_", "._", "filter", "Relationship", "s_", ",_", "xpa", "th", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "not", " ", "check", "Filter", "Asp", "ect", "Model", "(", "val", ",", " ", "table", ",", " ", "axis", ".", "filter", "Relationship", "s", ",", " ", "xpa", "th", "Context", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "remove", "d", " ", "after", " ", "2013", "-0", "1", "-0", "6", " ", "PWD", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "val", ".", "model", "Xbrl", ".", "error", "(\"", "xbr", "lte", ":", "axis", "Filter", "Cover", "s", "No", "Asp", "ect", "s", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u(", "\"", "Filter", "Axi", "s", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "doe", "s", " ", "not", " ", "cover", " ", "any", " ", "aspect", "s", ".\"", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "model", "Object", "=", "axis", ",", " ", "xli", "nk", "Label", "=", "axis", ".", "xli", "nk", "Label", ")_", "\\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_", "isinstance_", "(_", "axis_", ",_", "Model", "Rule", "Definit", "ion", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "dimension", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "elt", "Name_", ",_", "dim_", ",_", "bad", "Us", "age", "Err_", "in_", "(_", "(_", "\"", "explicit", "Dimen", "sion", "\"_", ",_", "\"", "explicit", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "typed", "Dimen", "sion", "\"_", ",_", "\"", "typed", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Type", "d", "Dimen", "sion", "Rule", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "dim", "El", "t_", "in_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "axis_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "elt", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dim", "Qn", "ame_", "=_", "qname_", "(_", "dim", "El", "t_", ",_", "dim", "El", "t_", "._", "get_", "(_", "\"", "dimension", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dim", "Concept", "_", "=_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", "._", "get_", "(_", "dim", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "Qn", "ame_", "and_", "(_", "dim", "Concept", "_", "is_", "None_", "or_", "(_", "not_", "dim", "Concept", "_", "._", "is", "Exp", "licit", "Dimension_", "if_", "dim_", "==_", "\"", "explicit", "\"_", "else_", "not_", "dim", "Concept", "_", "._", "is", "Type", "d", "Dimension_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "bad", "Us", "age", "Err_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Rule", "Axi", "s", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "dimension", " ", "attribute", " ", "%", "(", "dimension", ")", "s", " ", "on", " ", "the", " ", "%", "(", "dimension", "Type", ")", "s", " ", "dimension", " ", "rule", " ", "contain", "s", " ", "a", " ", "QN", "ame", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "identify", " ", "an", " ", "(", "dimension", "Type", ")", "s", " ", "dimension", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "dimension", "Type_", "=_", "dim_", ",_", "dimension_", "=_", "dim", "Qn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "Codes_", "=_", "(_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Exp", "licit", "Dimen", "sion", "Rule", "\"_", ",_", "\"", "xbr", "lf", "e", ":", "bad", "Us", "age", "Of", "Type", "d", "Dimen", "sion", "Rule", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mem", "Qn", "ame_", "=_", "axis_", "._", "evaluate", "Rule_", "(_", "None_", ",_", "dim", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dim", "Concept", "_", "._", "is", "Exp", "licit", "Dimension_", "and_", "mem", "Qn", "ame_", "is_", "not_", "None_", "and_", "mem", "Qn", "ame_", "not_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "table", ":", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Rule", "Axi", "s", " ", "rule", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "contain", "s", " ", "a", " ", "member", " ", "QN", "ame", " ", "%", "(", "mem", "Qn", "ame", ")", "s", " ", "whi", "ch", " ", "is", " ", "not", " ", "in", " ", "the", " ", "DT", "S", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "mem", "Qn", "ame_", "=_", "mem", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "aspect", " ", "model", " ", "expectations", "_", "\\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_", "table_", "._", "aspect", "Model_", "==_", "\"", "non", "-", "dimension", "al", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unexpected", "El", "ts_", "=_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "axis_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "(_", "\"", "explicit", "Dimen", "sion", "\"_", ",_", "\"", "typed", "Dimen", "sion", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unexpected", "El", "ts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lte", ":", "axis", "Asp", "ect", "Model", "Mismatch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Rule", "Axi", "s", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "aspect", " ", "model", ",", " ", "%", "(", "aspect", "Model", ")", "s", ",", " ", "include", "s", " ", "an", " ", "rule", " ", "for", " ", "aspect", " ", "not", " ", "defin", "ed", " ", "in", " ", "this", " ", "aspect", " ", "model", ":", " ", "%", "(", "undefined", "Asp", "ect", "s", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "aspect", "Model_", "=_", "table_", "._", "aspect", "Model_", ",_", "undefined", "Asp", "ects_", "=_", "\",", " ", "\"_", "._", "join_", "(_", "[_", "elt_", "._", "local", "Name_", "for_", "elt_", "in_", "unexpected", "El", "ts_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "source", " ", "qna", "mes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "source", "El", "t_", "in_", "(_", "[_", "axis_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "Xm", "l", "Util_", "._", "descendants", "_", "(_", "axis_", ",_", "Xbrl", "Const_", "._", "formula_", ",_", "\"*\"_", ",_", "\"", "source", "\"_", ",_", "\"*\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "source", "El", "t_", "._", "get_", "(_", "\"", "source", "\"_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "qn", "Source_", "=_", "qname_", "(_", "source", "El", "t_", ",_", "source", "El", "t_", "._", "get_", "(_", "\"", "source", "\"_", ")_", ",_", "no", "Pref", "ix", "Is", "No", "Namespace_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "table", ":", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Rule", "Axi", "s", " ", "rule", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "contain", "s", " ", "a", " ", "@", "source", " ", "attribute", " ", "%", "(", "qn", "Sou", "rce", ")", "s", " ", "whi", "ch", " ", "is", " ", "not", " ", "applica", "ble", " ", "to", " ", "table", " ", "rule", " ", "axes", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "qn", "Source_", "=_", "qn", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "concept", "Qn", "ame_", "=_", "axis_", "._", "evaluate", "Rule_", "(_", "None_", ",_", "Asp", "ect_", "._", "CONC", "EP", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "concept", "Qn", "ame_", "and_", "concept", "Qn", "ame_", "not_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "table", ":", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Rule", "Axi", "s", " ", "rule", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "contain", "s", " ", "a", " ", "concept", " ", "QN", "ame", " ", "%", "(", "concept", "Qn", "ame", ")", "s", " ", "whi", "ch", " ", "is", " ", "not", " ", "in", " ", "the", " ", "DT", "S", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "concept", "Qn", "ame_", "=_", "concept", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "axis_", ",_", "Model", "Relationship", "Definit", "ion", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "qna", "me", "Attr_", "in_", "(_", "\"", "relation", "ship", "Sou", "rce", "Qn", "ame", "\"_", ",_", "\"", "arc", "Qn", "ame", "\"_", ",_", "\"", "link", "Qn", "ame", "\"_", ",_", "\"", "dimension", "Qn", "ame", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "elt", "Qn", "ame_", "=_", "axis_", "._", "get_", "(_", "qna", "me", "Attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "elt", "Qn", "ame_", "and_", "elt", "Qn", "ame_", "not_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "qna", "me", "Concept", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "val_", "._", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "table", ":", "info", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"%", "(", "axis", ")", "s", " ", "rule", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "contain", "s", " ", "a", " ", "%", "(", "qna", "me", "Attr", ")", "s", " ", "QN", "ame", " ", "%", "(", "qna", "me", ")", "s", " ", "whi", "ch", " ", "is", " ", "not", " ", "in", " ", "the", " ", "DT", "S", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "axis_", ",_", "axis_", "=_", "axis_", "._", "local", "Name_", "._", "title_", "(_", ")_", ",_", "xli", "nk", "Label_", "=_", "axis_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qna", "me", "Attr_", "=_", "qna", "me", "Attr_", ",_", "qname_", "=_", "elt", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "Definit", "ion", "Node", "Rules_", "(_", "val_", ",_", "table_", ",_", "axis_", ",_", "(_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree_", ",_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree", "MM", "DD", "_", ",_", "Xbrl", "Const_", "._", "table", "Break", "down", "Tree", "20130", "5_", ",_", "Xbrl", "Const_", "._", "table", "Definit", "ion", "Node", "Subt", "ree", "20130", "1_", ",_", "Xbrl", "Const_", "._", "table", "Axi", "s", "Subt", "ree", "2011_", ")_", ",_", "xpa", "th", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Validat", "ion", "Messages_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "msg", "Relationship", "_", "in_", "(_", "Xbrl", "Const_", "._", "assertion", "Sat", "isfi", "ed", "Message_", ",_", "Xbrl", "Const_", "._", "assertion", "Uns", "ati", "sfi", "ed", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "msg", "Relationship", "_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "Messag", "e", "Expression", "s_", "(_", "val_", ",_", "model", "Rel", "_", "._", "to", "Model", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Messag", "e", "Expression", "s_", "(_", "val_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "message_", ",_", "Model", "Message_", ")_", "and_", "not_", "hasattr_", "(_", "message_", ",_", "\"", "express", "ion", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format", "String_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expressions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bracket", "Nest", "ing_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "To_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "express", "ion", "Index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expression_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "C_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "message_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "skip", "To_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "==_", "skip", "To_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "skip", "To_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "expression_", "is_", "not_", "None_", "and_", "c_", "in_", "(_", "'\\\\''_", ",_", "'\"'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "To_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "last", "C_", "==_", "c_", "and_", "c_", "in_", "(_", "'{'_", ",_", "'}'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "C_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "last", "C_", "==_", "'{'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bracket", "Nest", "ing_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expression_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "C_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "c_", "==_", "'}'_", "and_", "expression_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expressions_", "._", "append_", "(_", "''_", "._", "join_", "(_", "expression_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expression_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format", "String_", "._", "append_", "(_", "\"", "0", "[{", "0", "}]\"_", "._", "format_", "(_", "express", "ion", "Index_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "express", "ion", "Index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "C_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "last", "C_", "==_", "'}'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bracket", "Nest", "ing_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "C_", "=_", "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 ", " _", "last", "C_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "expression_", "is_", "not_", "None_", ":_", "expression_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "format", "String_", "._", "append_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "last", "C_", "==_", "'}'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bracket", "Nest", "ing_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bracket", "Nest", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lm", "sge", ":", "missi", "ng", "Le", "ft", "Curl", "y", "Bracket", "In", "Messag", "e", "\"_", "if_", "bracket", "Nest", "ing_", "<_", "0_", "else_", "\"", "xbr", "lm", "sge", ":", "missi", "ng", "Rig", "ht", "Curl", "y", "Bracket", "In", "Messag", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Messag", "e", " ", "%", "(", "xli", "nk", "Label", ")", "s", ":", " ", "unb", "alance", "d", " ", "%", "(", "character", ")", "s", " ", "character", "(", "s", ")", " ", "in", ":", " ", "%", "(", "text", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "message_", ",_", "xli", "nk", "Label_", "=_", "message_", "._", "xli", "nk", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "character_", "=_", "'{'_", "if_", "bracket", "Nest", "ing_", "<_", "0_", "else_", "'}'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "message_", "._", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "Codes_", "=_", "(_", "\"", "xbr", "lm", "sge", ":", "missi", "ng", "Le", "ft", "Curl", "y", "Bracket", "In", "Messag", "e", "\"_", ",_", "\"", "xbr", "lm", "sge", ":", "missi", "ng", "Rig", "ht", "Curl", "y", "Bracket", "In", "Messag", "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 ", " _", "message_", "._", "expressions_", "=_", "expressions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "format", "String_", "=_", "''_", "._", "join_", "(_", "format", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "message_", "._", "xml", "Lang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "xbr", "lm", "sge", ":", "xbr", "lm", "sge", ":", "missi", "ng", "Messag", "e", "Lang", "ua", "ge", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Messag", "e", " ", "%", "(", "xli", "nk", "Label", ")", "s", " ", "is", " ", "missi", "ng", " ", "an", " ", "effective", " ", "value", " ", "for", " ", "xml", ":", "lang", ":", " ", "%", "(", "text", ")", "s", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "message_", ",_", "xli", "nk", "Label_", "=_", "message_", "._", "xli", "nk", "Label_", ",_", "text_", "=_", "message_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Validat", "ion", "Messag", "e", "Variables_", "(_", "val_", ",_", "model", "Varia", "ble", "Set_", ",_", "var", "Names_", ",_", "param", "Names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Cons", "iste", "nc", "y", "Assert", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Vars_", "=_", "(_", "qname_", "(_", "Xbrl", "Const_", "._", "ca_", ",_", "'", "aspect", "-", "matche", "d", "-", "fact", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qname_", "(_", "Xbrl", "Const_", "._", "ca_", ",_", "'", "acceptance", "-", "radi", "us", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qname_", "(_", "Xbrl", "Const_", "._", "ca_", ",_", "'", "abs", "olute", "-", "acceptance", "-", "radi", "us", "-", "express", "ion", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qname_", "(_", "Xbrl", "Const_", "._", "ca_", ",_", "'", "proportional", "-", "acceptance", "-", "radi", "us", "-", "express", "ion", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Exist", "ence", "Assert", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Vars_", "=_", "(_", "Xbrl", "Const_", "._", "qn", "Ea", "Test", "Expression_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Value", "Assert", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var", "Set", "Vars_", "=_", "(_", "Xbrl", "Const_", "._", "qn", "Va", "Test", "Expression_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "msg", "Relationship", "_", "in_", "(_", "Xbrl", "Const_", "._", "assertion", "Sat", "isfi", "ed", "Message_", ",_", "Xbrl", "Const_", "._", "assertion", "Uns", "ati", "sfi", "ed", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "model", "Rel", "_", "in_", "val_", "._", "model", "Xbrl", "_", "._", "relation", "ship", "Set_", "(_", "msg", "Relationship", "_", ")_", "._", "from", "Model", "Object_", "(_", "model", "Varia", "ble", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "model", "Rel", "_", "._", "to", "Model", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "._", "compile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "msg", "Var", "Qn", "ame_", "in_", "message_", "._", "variab", "le", "Refs", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg", "Var", "Qn", "ame_", "not_", "in_", "var", "Names_", "and_", "msg", "Var", "Qn", "ame_", "not_", "in_", "var", "Set", "Vars_", "and_", "msg", "Var", "Qn", "ame_", "not_", "in_", "param", "Names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "err", ":", "XP", "ST", "0008", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Unde", "fined", " ", "variab", "le", " ", "dependen", "cy", " ", "in", " ", "message", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "message_", ",_", "xli", "nk", "Label_", "=_", "message_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "msg", "Var", "Qn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "msg", "Var", "Qn", "ame_", "in_", "var", "Names_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "model", "Varia", "ble", "Set_", ",_", "Model", "Exist", "ence", "Assert", "ion_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "var", "Names_", "[_", "msg", "Var", "Qn", "ame_", "]_", "._", "to", "Model", "Object_", ",_", "Model", "Variable_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "._", "model", "Xbrl", "_", "._", "error_", "(_", "\"", "err", ":", "XP", "ST", "0008", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Exist", "ence", " ", "Assert", "ion", " ", "depend", "s", " ", "on", " ", "evaluat", "ion", " ", "variab", "le", " ", "in", " ", "message", " ", "%", "(", "xli", "nk", "Label", ")", "s", ",", " ", "%", "(", "name", ")", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "message_", ",_", "xli", "nk", "Label_", "=_", "message_", "._", "xli", "nk", "Label_", ",_", "name_", "=_", "msg", "Var", "Qn", "ame_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jmoiron/johnny-cache/settings.py
[ { "content": "# Django settings for proj project.\n\nimport os\nimport warnings\nimport django\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = ()\n\nMANAGERS = ADMINS\n\ndb_engine = os.environ.get('DB_ENGINE', 'django.db.backends.sqlite3')\nDATABASES = {\n 'default': {\n 'ENGINE': db_engine,\n 'NAME': 'johnny_db',\n 'TEST_NAME': 'test_johnny_db',\n 'OPTIONS': {},\n },\n 'second': {\n 'ENGINE': db_engine,\n 'NAME': 'johnny2_db',\n 'TEST_NAME': 'test_johnny2_db',\n 'OPTIONS': {},\n },\n}\nif db_engine == 'django.db.backends.postgresql_psycopg2':\n DATABASES['default']['OPTIONS'] = {'autocommit': True}\n DATABASES['second']['OPTIONS'] = {'autocommit': True}\nif db_engine in ('django.db.backends.mysql', 'mysql.connector.django'):\n DATABASES['default']['USER'] = 'root'\n DATABASES['second']['USER'] = 'root'\nif db_engine == 'mysql.connector.django':\n # Disable raising exception on database warnings (turned on by default\n # when settings.DEBUG is True), otherwise causes test failures when trying\n # to test for transaction support via use of a DROP TABLE IF EXISTS query.\n DATABASES['default']['OPTIONS']['raise_on_warnings'] = False\n DATABASES['second']['OPTIONS']['raise_on_warnings'] = False\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# If running in a Windows environment this must be set to the same as your\n# system time zone.\nTIME_ZONE = 'America/Chicago'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\nSITE_ID = 1\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# Absolute path to the directory that holds media.\n# Example: \"/home/media/media.lawrence.com/\"\nMEDIA_ROOT = ''\n\n# URL that handles the media served from MEDIA_ROOT. Make sure to use a\n# trailing slash if there is a path component (optional in other cases).\n# Examples: \"http://media.lawrence.com\", \"http://example.com/media/\"\nMEDIA_URL = ''\n\n# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a\n# trailing slash.\n# Examples: \"http://foo.com/media/\", \"/media/\".\nADMIN_MEDIA_PREFIX = '/media/'\n\ncache_backend = os.environ.get('CACHE_BACKEND', 'memcached')\nif cache_backend == 'memcached':\n CACHES = {\n 'default': {\n 'BACKEND': 'johnny.backends.memcached.MemcachedCache',\n 'LOCATION': ['localhost:11211'],\n 'JOHNNY_CACHE': True,\n }\n }\nelif cache_backend == 'redis':\n CACHES = {\n 'default': {\n 'BACKEND': 'johnny.backends.redis.RedisCache',\n 'LOCATION': 'localhost:6379:0',\n 'JOHNNY_CACHE': True,\n }\n }\nelif cache_backend == 'locmem':\n CACHES = {\n 'default': {\n 'BACKEND': 'johnny.backends.locmem.LocMemCache',\n }\n }\n warnings.warn('Some tests may fail with the locmem cache backend!')\nelif cache_backend == 'filebased':\n CACHES = {\n 'default': {\n 'BACKEND': 'johnny.backends.filebased.FileBasedCache',\n 'LOCATION': '_cache',\n }\n }\n warnings.warn('Some tests may fail with the file-based cache backend!')\nelse:\n raise ValueError('The CACHE_BACKEND environment variable is invalid.')\n\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = '_vpn1a^j(6&+3qip2me4f#&8#m#*#icc!%=x=)rha4k=!4m8s4'\n\n# List of callables that know how to import templates from various sources.\nTEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.Loader',\n# 'django.template.loaders.app_directories.Loader',\n# 'django.template.loaders.eggs.Loader',\n)\n\nMIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n)\n\nROOT_URLCONF = 'proj.urls'\n\nTEMPLATE_DIRS = (\n # Put strings here, like \"/home/html/django_templates\" or \"C:/www/django/templates\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)\n\nINSTALLED_APPS = (\n #'django.contrib.auth',\n #'django.contrib.sessions',\n #'django.contrib.sites',\n 'johnny',\n)\n\ntry:\n from local_settings import *\nexcept ImportError:\n pass\n\n# set up a multi-db router if there are multiple databases set\nlcls = locals()\nif 'DATABASES' in lcls and len(lcls['DATABASES']) > 1:\n DATABASE_ROUTERS = ['routers.MultiSyncedRouter']\n\nTEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import django", "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_", "#", " ", "Dj", "ang", "o", " ", "settings", " ", "for", " ", "proj", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DEBUG_", "=_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ADMINS_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MANAGER", "S_", "=_", "ADMINS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "engine_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "DB", "\\u", "ENGINE", "'_", ",_", "'", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATABASES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "db", "\\u", "engine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "john", "ny", "\\u", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TEST", "\\u", "NAME", "'_", ":_", "'", "test\\u", "john", "ny", "\\u", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "OPTION", "S", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "second", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "db", "\\u", "engine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "john", "ny", "2", "\\u", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "TEST", "\\u", "NAME", "'_", ":_", "'", "test\\u", "john", "ny", "2", "\\u", "db", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "OPTION", "S", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "db", "\\u", "engine_", "==_", "'", "django", ".", "db", ".", "back", "ends", ".", "postgres", "ql", "\\u", "psy", "cop", "g2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DATABASES_", "[_", "'", "default", "'_", "]_", "[_", "'", "OPTION", "S", "'_", "]_", "=_", "{_", "'", "autoc", "ommit", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATABASES_", "[_", "'", "second", "'_", "]_", "[_", "'", "OPTION", "S", "'_", "]_", "=_", "{_", "'", "autoc", "ommit", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "engine_", "in_", "(_", "'", "django", ".", "db", ".", "back", "ends", ".", "mysql", "'_", ",_", "'", "mysql", ".", "connect", "or", ".", "django", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DATABASES_", "[_", "'", "default", "'_", "]_", "[_", "'", "USER", "'_", "]_", "=_", "'", "root", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATABASES_", "[_", "'", "second", "'_", "]_", "[_", "'", "USER", "'_", "]_", "=_", "'", "root", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "db", "\\u", "engine_", "==_", "'", "mysql", ".", "connect", "or", ".", "django", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Disa", "ble", " ", "rais", "ing", " ", "exception", " ", "on", " ", "databa", "se", " ", "warn", "ings", " ", "(", "turn", "ed", " ", "on", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "settings", ".", "DEBU", "G", " ", "is", " ", "Tru", "e", "),", " ", "other", "wis", "e", " ", "caus", "es", " ", "test", " ", "fail", "ure", "s", " ", "whe", "n", " ", "try", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "test", " ", "for", " ", "transaction", " ", "support", " ", "via", " ", "use", " ", "of", " ", "a", " ", "DROP", " ", "TAB", "LE", " ", "IF", " ", "EXIST", "S", " ", "query", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DATABASES_", "[_", "'", "default", "'_", "]_", "[_", "'", "OPTION", "S", "'_", "]_", "[_", "'", "raise", "\\u", "on", "\\u", "warn", "ings", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATABASES_", "[_", "'", "second", "'_", "]_", "[_", "'", "OPTION", "S", "'_", "]_", "[_", "'", "raise", "\\u", "on", "\\u", "warn", "ings", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "time", " ", "zone", " ", "for", " ", "this", " ", "installation", ".", " ", "Choi", "ces", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "List", "\\u", "of", "\\u", "tz", "\\u", "zone", "s", "\\u", "by", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alth", "ou", "gh", " ", "not", " ", "all", " ", "choice", "s", " ", "may", " ", "be", " ", "avail", "able", " ", "on", " ", "all", " ", "operati", "ng", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "runn", "ing", " ", "in", " ", "a", " ", "Window", "s", " ", "environ", "ment", " ", "this", " ", "must", " ", "be", " ", "set", " ", "to", " ", "the", " ", "same", " ", "as", " ", "your", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", " ", "time", " ", "zone", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "TIME", "\\u", "ZONE_", "=_", "'", "Ame", "rica", "/", "Chi", "cag", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "code", " ", "for", " ", "this", " ", "installation", ".", " ", "All", " ", "choice", "s", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "i18n", "guy", ".", "com", "/", "unicode", "/", "language", "-", "identifi", "ers", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "LANGUAGE", "\\u", "CODE_", "=_", "'", "en", "-", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SITE", "\\u", "ID_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "make", " ", "some", " ", "optimization", "s", " ", "so", " ", "as", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "load", " ", "the", " ", "international", "izatio", "n", " ", "machine", "ry", "._", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "I1", "8", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abs", "olute", " ", "path", " ", "to", " ", "the", " ", "director", "y", " ", "tha", "t", " ", "hold", "s", " ", "media", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "\"/", "home", "/", "media", "/", "media", ".", "law", "ren", "ce", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "ROOT_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "tha", "t", " ", "handle", "s", " ", "the", " ", "media", " ", "serve", "d", " ", "from", " ", "MEDIA", "\\u", "ROO", "T", ".", " ", "Make", " ", "sure", " ", "to", " ", "use", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trail", "ing", " ", "slash", " ", "if", " ", "there", " ", "is", " ", "a", " ", "path", " ", "component", " ", "(", "option", "al", " ", "in", " ", "other", " ", "case", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":", " ", "\"", "http", "://", "media", ".", "law", "ren", "ce", ".", "com", "\",", " ", "\"", "http", "://", "example", ".", "com", "/", "media", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "URL_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "prefix", " ", "for", " ", "admin", " ", "media", " ", "--", " ", "CS", "S", ",", " ", "Ja", "va", "Script", " ", "and", " ", "images", ".", " ", "Make", " ", "sure", " ", "to", " ", "use", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trail", "ing", " ", "slash", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":", " ", "\"", "http", "://", "foo", ".", "com", "/", "media", "/\"", ",", " ", "\"/", "media", "/\"", "._", "\\u\\u\\uNL\\u\\u\\u_", "ADM", "IN", "\\u", "MEDIA", "\\u", "PREFIX_", "=_", "'/", "media", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "backend_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "CACHE", "\\u", "BACK", "END", "'_", ",_", "'", "memcached", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache", "\\u", "backend_", "==_", "'", "memcached", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CACHE", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BACK", "END", "'_", ":_", "'", "john", "ny", ".", "back", "ends", ".", "memcached", ".", "Memcache", "d", "Cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOCATION", "'_", ":_", "[_", "'", "local", "host", ":", "1121", "1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "JO", "HN", "NY", "\\u", "CACHE", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cache", "\\u", "backend_", "==_", "'", "redis", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CACHE", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BACK", "END", "'_", ":_", "'", "john", "ny", ".", "back", "ends", ".", "redis", ".", "Red", "is", "Cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOCATION", "'_", ":_", "'", "local", "host", ":", "6379", ":", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "JO", "HN", "NY", "\\u", "CACHE", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cache", "\\u", "backend_", "==_", "'", "loc", "mem", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CACHE", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BACK", "END", "'_", ":_", "'", "john", "ny", ".", "back", "ends", ".", "loc", "mem", ".", "Loc", "Mem", "Cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "'", "Some", " ", "tests", " ", "may", " ", "fail", " ", "with", " ", "the", " ", "loc", "mem", " ", "cache", " ", "back", "end", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cache", "\\u", "backend_", "==_", "'", "fileb", "ase", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CACHE", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BACK", "END", "'_", ":_", "'", "john", "ny", ".", "back", "ends", ".", "fileb", "ase", "d", ".", "File", "Base", "d", "Cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOCATION", "'_", ":_", "'\\u", "cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "'", "Some", " ", "tests", " ", "may", " ", "fail", " ", "with", " ", "the", " ", "file", "-", "based", " ", "cache", " ", "back", "end", "!'_", ")_", "\\u\\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_", "(_", "'", "The", " ", "CACHE", "\\u", "BACK", "END", " ", "environ", "ment", " ", "variab", "le", " ", "is", " ", "invalid", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "unique", ",", " ", "and", " ", "don", "'", "t", " ", "share", " ", "it", " ", "with", " ", "any", "body", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "'\\u", "vpn", "1a", "^", "j", "(", "6", "&", "+", "3", "qi", "p2", "me", "4f", "#", "&", "8", "#", "m", "#", "*#", "icc", "!%", "=", "x", "=", ")", "rh", "a4", "k", "=", "!", "4", "m", "8s", "4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "calla", "bles", " ", "tha", "t", " ", "know", " ", "how", " ", "to", " ", "import", " ", "template", "s", " ", "from", " ", "vari", "ous", " ", "source", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "LOADER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "filesystem", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "django", ".", "template", ".", "load", "ers", ".", "app", "\\u", "director", "ies", ".", "Load", "er", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "'", "django", ".", "template", ".", "load", "ers", ".", "egg", "s", ".", "Load", "er", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "common", ".", "Common", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", ".", "middle", "ware", ".", "Sess", "ion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "middle", "ware", ".", "Auth", "entica", "tion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "proj", ".", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "string", "s", " ", "here", ",", " ", "like", " ", "\"/", "home", "/", "html", "/", "django", "\\u", "template", "s", "\"", " ", "or", " ", "\"", "C", ":/", "www", "/", "django", "/", "template", "s", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "use", " ", "forward", " ", "slash", "es", ",", " ", "even", " ", "on", " ", "Window", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "forget", " ", "to", " ", "use", " ", "abs", "olute", " ", "path", "s", ",", " ", "not", " ", "relative", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "APPS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "django", ".", "contrib", ".", "auth", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "django", ".", "contrib", ".", "session", "s", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "django", ".", "contrib", ".", "sites", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "john", "ny", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "local", "\\u", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "up", " ", "a", " ", "multi", "-", "db", " ", "router", " ", "if", " ", "there", " ", "are", " ", "multiple", " ", "databa", "ses", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lc", "ls_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "DATA", "BASE", "S", "'_", "in_", "lc", "ls_", "and_", "len_", "(_", "lc", "ls_", "[_", "'", "DATA", "BASE", "S", "'_", "]_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DATA", "BASE", "\\u", "ROUTER", "S_", "=_", "[_",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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 ]
Unused local variable
sightmachine/SimpleCV/SimpleCV/Tracking/MFTracker.py
[ { "content": "def fbtrack(imgI, imgJ, bb, numM=10, numN=10,margin=5,winsize_ncc=10, winsize_lk=4):\n \"\"\"\n **SUMMARY**\n (Dev Zone)\n Forward-Backward tracking using Lucas-Kanade Tracker\n \n **PARAMETERS**\n \n imgI - Image contain Object with known BoundingBox (Numpy array)\n imgJ - Following image (Numpy array)\n bb - Bounding box represented through 2 points (x1,y1,x2,y2)\n numM - Number of points in height direction.\n numN - Number of points in width direction.\n margin - margin (in pixel)\n winsize_ncc - Size of quadratic area around the point which is compared.\n \n **RETURNS**\n \n newbb - Bounding box of object in track in imgJ\n scaleshift - relative scale change of bb\n \n \"\"\"\n\n nPoints = numM*numN\n sizePointsArray = nPoints*2\n #print bb, \"passed in fbtrack\"\n pt = getFilledBBPoints(bb, numM, numN, margin)\n fb, ncc, status, ptTracked = lktrack(imgI, imgJ, pt, nPoints, winsize_ncc, winsize_lk)\n\n nlkPoints = sum(status)[0]\n \n startPoints = []\n targetPoints = []\n fbLKCleaned = [0.0]*nlkPoints\n nccLKCleaned = [0.0]*nlkPoints\n M = 2\n nRealPoints = 0\n \n for i in range(nPoints):\n if ptTracked[M*i] is not -1:\n startPoints.append((pt[2 * i],pt[2*i+1]))\n targetPoints.append((ptTracked[2 * i], ptTracked[2 * i + 1]))\n fbLKCleaned[nRealPoints]=fb[i]\n nccLKCleaned[nRealPoints]=ncc[i]\n nRealPoints+=1\n \n medFb = getMedian(fbLKCleaned)\n medNcc = getMedian(nccLKCleaned)\n \n nAfterFbUsage = 0\n for i in range(nlkPoints):\n if fbLKCleaned[i] <= medFb and nccLKCleaned[i] >= medNcc:\n startPoints[nAfterFbUsage] = startPoints[i]\n targetPoints[nAfterFbUsage] = targetPoints[i]\n nAfterFbUsage+=1\n\n newBB, scaleshift = predictBB(bb, startPoints, targetPoints, nAfterFbUsage)\n #print newBB, \"fbtrack passing newBB\"\n return (newBB, scaleshift)", "metadata": "root.fbtrack", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def getFilledBBPoints(bb, numM, numN, margin):\n \"\"\"\n \n **SUMMARY**\n (Dev Zone)\n Creates numM x numN points grid on Bounding Box\n \n **PARAMETERS**\n \n bb - Bounding Box represented through 2 points (x1,y1,x2,y2)\n numM - Number of points in height direction.\n numN - Number of points in width direction.\n margin - margin (in pixel)\n \n **RETURNS**\n \n pt - A list of points (pt[0] - x1, pt[1] - y1, pt[2] - x2, ..)\n \n \"\"\"\n pointDim = 2\n bb_local = (bb[0] + margin, bb[1] + margin, bb[2] - margin, bb[3] - margin)\n if numM == 1 and numN == 1 :\n pts = calculateBBCenter(bb_local)\n return pts\n \n elif numM > 1 and numN == 1:\n divM = numM - 1\n divN = 2\n spaceM = (bb_local[3]-bb_local[1])/divM\n center = calculateBBCenter(bb_local)\n pt = [0.0]*(2*numM*numN)\n for i in range(numN):\n for j in range(numM):\n pt[i * numM * pointDim + j * pointDim + 0] = center[0]\n pt[i * numM * pointDim + j * pointDim + 1] = bb_local[1] + j * spaceM\n \n return pt\n \n elif numM == 1 and numN > 1:\n divM = 2\n divN = numN - 1\n spaceN = (bb_local[2] - bb_local[0]) / divN\n center = calculateBBCenter(bb_local)\n pt = [0.0]*((numN-1)*numM*pointDim+numN*pointDim)\n for i in range(numN):\n for j in range(numN):\n pt[i * numM * pointDim + j * pointDim + 0] = bb_local[0] + i * spaceN\n pt[i * numM * pointDim + j * pointDim + 1] = center[1]\n return pt\n \n elif numM > 1 and numN > 1:\n divM = numM - 1\n divN = numN - 1\n \n spaceN = (bb_local[2] - bb_local[0]) / divN\n spaceM = (bb_local[3] - bb_local[1]) / divM\n\n pt = [0.0]*((numN-1)*numM*pointDim+numM*pointDim)\n \n for i in range(numN):\n for j in range(numM):\n pt[i * numM * pointDim + j * pointDim + 0] = float(bb_local[0] + i * spaceN)\n pt[i * numM * pointDim + j * pointDim + 1] = float(bb_local[1] + j * spaceM)\n return pt", "metadata": "root.getFilledBBPoints", "header": "['module', '___EOS___']", "index": 256 }, { "content": "def predictBB(bb0, pt0, pt1, nPts):\n \"\"\"\n \n **SUMMARY**\n (Dev Zone)\n Calculates the new (moved and resized) Bounding box.\n Calculation based on all relative distance changes of all points\n to every point. Then the Median of the relative Values is used.\n \n **PARAMETERS**\n \n bb0 - Bounding Box represented through 2 points (x1,y1,x2,y2)\n pt0 - Starting Points\n pt1 - Target Points\n nPts - Total number of points (eg. len(pt0))\n \n **RETURNS**\n \n bb1 - new bounding box\n shift - relative scale change of bb0\n \n \"\"\"\n ofx = []\n ofy = []\n for i in range(nPts):\n ofx.append(pt1[i][0]-pt0[i][0])\n ofy.append(pt1[i][1]-pt0[i][1])\n \n dx = getMedianUnmanaged(ofx)\n dy = getMedianUnmanaged(ofy)\n ofx=ofy=0\n \n lenPdist = nPts * (nPts - 1) / 2\n dist0=[]\n for i in range(nPts):\n for j in range(i+1,nPts):\n temp0 = ((pt0[i][0] - pt0[j][0])**2 + (pt0[i][1] - pt0[j][1])**2)**0.5\n temp1 = ((pt1[i][0] - pt1[j][0])**2 + (pt1[i][1] - pt1[j][1])**2)**0.5\n if temp0 != 0:\n dist0.append(float(temp1)/temp0)\n else:\n dist0.append(1.0)\n \n shift = getMedianUnmanaged(dist0)\n if shift is None:\n return(bb0, 1.0)\n\n # too much variation in shift is due to some errors\n if shift > 1.1 or shift < 0.9:\n shift = 1\n s0 = 0.5 * (shift - 1) * getBBWidth(bb0)\n s1 = 0.5 * (shift - 1) * getBBHeight(bb0)\n \n \n x1 = bb0[0] - s0 + dx\n y1 = bb0[1] - s1 + dy\n x2 = bb0[2] + s0 + dx\n y2 = bb0[3] + s1 + dy\n w = x2-x1\n h = y2-y1\n #print x1,x2,y1,y2,w,h\n if x1 <= 0 or x2 <=0 or y1<=0 or y2 <=0 or w <=20 or h <=20:\n x1 = bb0[0]\n y1 = bb0[1]\n x2 = bb0[2]\n y2 = bb0[3]\n \n bb1 = (int(x1),int(y1),int(x2),int(y2))\n \n return (bb1, shift)", "metadata": "root.predictBB", "header": "['module', '___EOS___']", "index": 356 } ]
[ { "span": "sizePointsArray ", "start_line": 122, "start_column": 4, "end_line": 122, "end_column": 19 }, { "span": "divN ", "start_line": 283, "start_column": 8, "end_line": 283, "end_column": 12 }, { "span": "divM ", "start_line": 295, "start_column": 8, "end_line": 295, "end_column": 12 }, { "span": "ofx=", "start_line": 386, "start_column": 4, "end_line": 386, "end_column": 7 }, { "span": "ofy=", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 11 }, { "span": "lenPdist ", "start_line": 388, "start_column": 4, "end_line": 388, "end_column": 12 } ]
[]
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_", "def_", "fb", "track_", "(_", "img", "I_", ",_", "img", "J_", ",_", "bb_", ",_", "num", "M_", "=_", "10_", ",_", "num", "N_", "=_", "10_", ",_", "margin_", "=_", "5_", ",_", "wins", "ize", "\\u", "ncc", "_", "=_", "10_", ",_", "wins", "ize", "\\u", "lk_", "=_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "**", "SUMMARY", "**", "\\", "10", ";", " ", " ", " ", " ", "(", "Dev", " ", "Zon", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Forward", "-", "Backward", " ", "track", "ing", " ", "usi", "ng", " ", "Luc", "as", "-", "Kan", "ade", " ", "Track", "er", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "PARAMETERS", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "img", "I", " ", "-", " ", "Image", " ", "contain", " ", "Object", " ", "with", " ", "know", "n", " ", "Bound", "ing", "Box", " ", "(", "Num", "py", " ", "array", ")", "\\", "10", ";", " ", " ", " ", " ", "img", "J", " ", "-", " ", "Follow", "ing", " ", "image", " ", "(", "Num", "py", " ", "array", ")", "\\", "10", ";", " ", " ", " ", " ", "bb", " ", "-", " ", "Bound", "ing", " ", "box", " ", "represent", "ed", " ", "through", " ", "2", " ", "points", " ", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", "\\", "10", ";", " ", " ", " ", " ", "num", "M", " ", "-", " ", "Number", " ", "of", " ", "points", " ", "in", " ", "height", " ", "direction", ".", "\\", "10", ";", " ", " ", " ", " ", "num", "N", " ", "-", " ", "Number", " ", "of", " ", "points", " ", "in", " ", "widt", "h", " ", "direction", ".", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", " ", "-", " ", "marg", "in", " ", "(", "in", " ", "pixel", ")", "\\", "10", ";", " ", " ", " ", " ", "wins", "ize", "\\u", "ncc", " ", "-", " ", "Size", " ", "of", " ", "quadratic", " ", "area", " ", "aro", "und", " ", "the", " ", "point", " ", "whi", "ch", " ", "is", " ", "compare", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "RETURN", "S", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "newb", "b", " ", "-", " ", "Bound", "ing", " ", "box", " ", "of", " ", "object", " ", "in", " ", "track", " ", "in", " ", "img", "J", "\\", "10", ";", " ", " ", " ", " ", "scale", "shift", " ", "-", " ", "relative", " ", "scale", " ", "change", " ", "of", " ", "bb", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Points_", "=_", "num", "M_", "*_", "num", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size", "Point", "s", "Array_", "=_", "n", "Points_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "bb", ",", " ", "\"", "pass", "ed", " ", "in", " ", "fb", "track", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "=_", "get", "Fille", "d", "BB", "Points_", "(_", "bb_", ",_", "num", "M_", ",_", "num", "N_", ",_", "margin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb_", ",_", "ncc", "_", ",_", "status_", ",_", "pt", "Track", "ed_", "=_", "lk", "track_", "(_", "img", "I_", ",_", "img", "J_", ",_", "pt_", ",_", "n", "Points_", ",_", "wins", "ize", "\\u", "ncc", "_", ",_", "wins", "ize", "\\u", "lk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nl", "k", "Points_", "=_", "sum_", "(_", "status_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb", "LK", "Cleane", "d_", "=_", "[_", "0.0_", "]_", "*_", "nl", "k", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ncc", "LK", "Cleane", "d_", "=_", "[_", "0.0_", "]_", "*_", "nl", "k", "Points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Real", "Points_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n", "Points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pt", "Track", "ed_", "[_", "M_", "*_", "i_", "]_", "is_", "not_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Points_", "._", "append_", "(_", "(_", "pt_", "[_", "2_", "*_", "i_", "]_", ",_", "pt_", "[_", "2_", "*_", "i_", "+_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Points_", "._", "append_", "(_", "(_", "pt", "Track", "ed_", "[_", "2_", "*_", "i_", "]_", ",_", "pt", "Track", "ed_", "[_", "2_", "*_", "i_", "+_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fb", "LK", "Cleane", "d_", "[_", "n", "Real", "Points_", "]_", "=_", "fb_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ncc", "LK", "Cleane", "d_", "[_", "n", "Real", "Points_", "]_", "=_", "ncc", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Real", "Points_", "+=_", "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_", "med", "Fb", "_", "=_", "get", "Media", "n_", "(_", "fb", "LK", "Cleane", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "med", "Nc", "c_", "=_", "get", "Media", "n_", "(_", "ncc", "LK", "Cleane", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n", "Af", "ter", "Fb", "Usage_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "nl", "k", "Points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fb", "LK", "Cleane", "d_", "[_", "i_", "]_", "<=_", "med", "Fb", "_", "and_", "ncc", "LK", "Cleane", "d_", "[_", "i_", "]_", ">=_", "med", "Nc", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "Points_", "[_", "n", "Af", "ter", "Fb", "Usage_", "]_", "=_", "start", "Points_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Points_", "[_", "n", "Af", "ter", "Fb", "Usage_", "]_", "=_", "target", "Points_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "Af", "ter", "Fb", "Usage_", "+=_", "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_", "new", "BB_", ",_", "scale", "shift_", "=_", "predi", "ct", "BB_", "(_", "bb_", ",_", "start", "Points_", ",_", "target", "Points_", ",_", "n", "Af", "ter", "Fb", "Usage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "new", "BB", ",", " ", "\"", "fb", "track", " ", "passi", "ng", " ", "new", "BB", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "new", "BB_", ",_", "scale", "shift_", ")_", "\\u\\u\\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", "Fille", "d", "BB", "Points_", "(_", "bb_", ",_", "num", "M_", ",_", "num", "N_", ",_", "margin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "SUMMARY", "**", "\\", "10", ";", " ", " ", " ", " ", "(", "Dev", " ", "Zon", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "num", "M", " ", "x", " ", "num", "N", " ", "points", " ", "grid", " ", "on", " ", "Bound", "ing", " ", "Box", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "PARAMETERS", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "bb", " ", "-", " ", "Bound", "ing", " ", "Box", " ", "represent", "ed", " ", "through", " ", "2", " ", "points", " ", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", "\\", "10", ";", " ", " ", " ", " ", "num", "M", " ", "-", " ", "Number", " ", "of", " ", "points", " ", "in", " ", "height", " ", "direction", ".", "\\", "10", ";", " ", " ", " ", " ", "num", "N", " ", "-", " ", "Number", " ", "of", " ", "points", " ", "in", " ", "widt", "h", " ", "direction", ".", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", " ", "-", " ", "marg", "in", " ", "(", "in", " ", "pixel", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "RETURN", "S", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "pt", " ", "-", " ", "A", " ", "list", " ", "of", " ", "points", " ", "(", "pt", "[", "0", "]", " ", "-", " ", "x1", ",", " ", "pt", "[", "1", "]", " ", "-", " ", "y1", ",", " ", "pt", "[", "2", "]", " ", "-", " ", "x2", ",", " ", "..", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point", "Dim_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "\\u", "local_", "=_", "(_", "bb_", "[_", "0_", "]_", "+_", "margin_", ",_", "bb_", "[_", "1_", "]_", "+_", "margin_", ",_", "bb_", "[_", "2_", "]_", "-_", "margin_", ",_", "bb_", "[_", "3_", "]_", "-_", "margin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "M_", "==_", "1_", "and_", "num", "N_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pts_", "=_", "calcul", "ate", "BB", "Center_", "(_", "bb", "\\u", "local_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "num", "M_", ">_", "1_", "and_", "num", "N_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "div", "M_", "=_", "num", "M_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div", "N_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space", "M_", "=_", "(_", "bb", "\\u", "local_", "[_", "3_", "]_", "-_", "bb", "\\u", "local_", "[_", "1_", "]_", ")_", "/_", "div", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center_", "=_", "calcul", "ate", "BB", "Center_", "(_", "bb", "\\u", "local_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "=_", "[_", "0.0_", "]_", "*_", "(_", "2_", "*_", "num", "M_", "*_", "num", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "0_", "]_", "=_", "center_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "1_", "]_", "=_", "bb", "\\u", "local_", "[_", "1_", "]_", "+_", "j_", "*_", "space", "M_", "\\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_", "pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "num", "M_", "==_", "1_", "and_", "num", "N_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "div", "M_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div", "N_", "=_", "num", "N_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space", "N_", "=_", "(_", "bb", "\\u", "local_", "[_", "2_", "]_", "-_", "bb", "\\u", "local_", "[_", "0_", "]_", ")_", "/_", "div", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center_", "=_", "calcul", "ate", "BB", "Center_", "(_", "bb", "\\u", "local_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "=_", "[_", "0.0_", "]_", "*_", "(_", "(_", "num", "N_", "-_", "1_", ")_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "num", "N_", "*_", "point", "Dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "0_", "]_", "=_", "bb", "\\u", "local_", "[_", "0_", "]_", "+_", "i_", "*_", "space", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "1_", "]_", "=_", "center_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "num", "M_", ">_", "1_", "and_", "num", "N_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "div", "M_", "=_", "num", "M_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div", "N_", "=_", "num", "N_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "space", "N_", "=_", "(_", "bb", "\\u", "local_", "[_", "2_", "]_", "-_", "bb", "\\u", "local_", "[_", "0_", "]_", ")_", "/_", "div", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space", "M_", "=_", "(_", "bb", "\\u", "local_", "[_", "3_", "]_", "-_", "bb", "\\u", "local_", "[_", "1_", "]_", ")_", "/_", "div", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pt_", "=_", "[_", "0.0_", "]_", "*_", "(_", "(_", "num", "N_", "-_", "1_", ")_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "num", "M_", "*_", "point", "Dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "num", "M_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "0_", "]_", "=_", "float_", "(_", "bb", "\\u", "local_", "[_", "0_", "]_", "+_", "i_", "*_", "space", "N_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pt_", "[_", "i_", "*_", "num", "M_", "*_", "point", "Dim_", "+_", "j_", "*_", "point", "Dim_", "+_", "1_", "]_", "=_", "float_", "(_", "bb", "\\u", "local_", "[_", "1_", "]_", "+_", "j_", "*_", "space", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pt_", "\\u\\u\\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_", "predi", "ct", "BB_", "(_", "bb", "0_", ",_", "pt", "0_", ",_", "pt1_", ",_", "n", "Pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "SUMMARY", "**", "\\", "10", ";", " ", " ", " ", " ", "(", "Dev", " ", "Zon", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "es", " ", "the", " ", "new", " ", "(", "moved", " ", "and", " ", "resized", ")", " ", "Bound", "ing", " ", "box", ".", "\\", "10", ";", " ", " ", " ", " ", "Calculat", "ion", " ", "based", " ", "on", " ", "all", " ", "relative", " ", "distance", " ", "change", "s", " ", "of", " ", "all", " ", "points", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "every", " ", "point", ".", " ", "The", "n", " ", "the", " ", "Media", "n", " ", "of", " ", "the", " ", "relative", " ", "Value", "s", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "PARAMETERS", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "bb", "0", " ", "-", " ", "Bound", "ing", " ", "Box", " ", "represent", "ed", " ", "through", " ", "2", " ", "points", " ", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", "\\", "10", ";", " ", " ", " ", " ", "pt", "0", " ", "-", " ", "Start", "ing", " ", "Point", "s", "\\", "10", ";", " ", " ", " ", " ", "pt", "1", " ", "-", " ", "Target", " ", "Point", "s", "\\", "10", ";", " ", " ", " ", " ", "n", "Pt", "s", " ", "-", " ", "Total", " ", "number", " ", "of", " ", "points", " ", "(", "eg", ".", " ", "len", "(", "pt", "0", "))\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "RETURN", "S", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "bb", "1", " ", "-", " ", "new", " ", "bound", "ing", " ", "box", "\\", "10", ";", " ", " ", " ", " ", "shift", " ", "-", " ", "relative", " ", "scale", " ", "change", " ", "of", " ", "bb", "0", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n", "Pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "of", "x_", "._", "append_", "(_", "pt1_", "[_", "i_", "]_", "[_", "0_", "]_", "-_", "pt", "0_", "[_", "i_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of", "y_", "._", "append_", "(_", "pt1_", "[_", "i_", "]_", "[_", "1_", "]_", "-_", "pt", "0_", "[_", "i_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dx_", "=_", "get", "Media", "n", "Unma", "nage", "d_", "(_", "of", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "get", "Media", "n", "Unma", "nage", "d_", "(_", "of", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "of", "x_", "=_", "of", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "len", "Pd", "ist_", "=_", "n", "Pts_", "*_", "(_", "n", "Pts_", "-_", "1_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist", "0_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "n", "Pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "i_", "+_", "1_", ",_", "n", "Pts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "0_", "=_", "(_", "(_", "pt", "0_", "[_", "i_", "]_", "[_", "0_", "]_", "-_", "pt", "0_", "[_", "j_", "]_", "[_", "0_", "]_", ")_", "**_", "2_", "+_", "(_", "pt", "0_", "[_", "i_", "]_", "[_", "1_", "]_", "-_", "pt", "0_", "[_", "j_", "]_", "[_", "1_", "]_", ")_", "**_", "2_", ")_", "**_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "1_", "=_", "(_", "(_", "pt1_", "[_", "i_", "]_", "[_", "0_", "]_", "-_", "pt1_", "[_", "j_", "]_", "[_", "0_", "]_", ")_", "**_", "2_", "+_", "(_", "pt1_", "[_", "i_", "]_", "[_", "1_", "]_", "-_", "pt1_", "[_", "j_", "]_", "[_", "1_", "]_", ")_", "**_", "2_", ")_", "**_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "temp", "0_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dist", "0_", "._", "append_", "(_", "float_", "(_", "temp", "1_", ")_", "/_", "temp", "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 ", " _", "dist", "0_", "._", "append_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shift_", "=_", "get", "Media", "n", "Unma", "nage", "d_", "(_", "dist", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shift_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "bb", "0_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "too", " ", "muc", "h", " ", "variatio", "n", " ", "in", " ", "shift", " ", "is", " ", "due", " ", "to", " ", "some", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shift_", ">_", "1.1_", "or_", "shift_", "<_", "0.9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shift_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s0_", "=_", "0.5_", "*_", "(_", "shift_", "-_", "1_", ")_", "*_", "get", "BB", "Width_", "(_", "bb", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s1_", "=_", "0.5_", "*_", "(_", "shift_", "-_", "1_", ")_", "*_", "get", "BB", "Height_", "(_", "bb", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x1_", "=_", "bb", "0_", "[_", "0_", "]_", "-_", "s0_", "+_", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", "=_", "bb", "0_", "[_", "1_", "]_", "-_", "s1_", "+_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "bb", "0_", "[_", "2_", "]_", "+_", "s0_", "+_", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "=_", "bb", "0_", "[_", "3_", "]_", "+_", "s1_", "+_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "x2_", "-_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "y2_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "x1", ",", "x2", ",", "y1", ",", "y2", ",", "w", ",", "h_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "x1_", "<=_", "0_", "or_", "x2_", "<=_", "0_", "or_", "y1_", "<=_", "0_", "or_", "y2_", "<=_", "0_", "or_", "w_", "<=_", "20_", "or_", "h_", "<=_", "20_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x1_", "=_", "bb", "0_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y1_", "=_", "bb", "0_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "bb", "0_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y2_", "=_", "bb", "0_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bb", "1_", "=_", "(_", "int_", "(_", "x1_", ")_", ",_", "int_", "(_", "y1_", ")_", ",_", "int_", "(_", "x2_", ")_", ",_", "int_", "(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, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_function_module.py
[ { "content": " def test_empty(self):\n fn = function([], []) # ok\n self.assertTrue(fn() == [])", "metadata": "root.T_function.test_empty", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 }, { "content": " def test_input_anon_singleton(self):\n x, s = T.scalars('xs')\n fn = function([s, x], [x+s])\n self.assertTrue(fn(2, 3) == [5])\n # no state\n self.assertTrue(fn(2, 3) == [5])", "metadata": "root.T_function.test_input_anon_singleton", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_input_anon_unpack(self):\n x, s = T.scalars('xs')\n fn = function([s, x], x+s)\n self.assertTrue(fn(2, 3) == 5)", "metadata": "root.T_function.test_input_anon_unpack", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 114 }, { "content": " def test_naming_rule0(self):\n x, s = T.scalars('xs')\n f = function([x, s], x/s)\n self.assertTrue(f(1, 2) == 0.5)\n self.assertTrue(f(2, 1) == 2.0)\n self.assertTrue(f(s=2, x=1) == 0.5)\n self.assertTrue(f(x=2, s=1) == 2.0)\n self.assertTrue(f(2, s=1) == 2.0)\n checkfor(self, lambda : f(2, x=2.0), TypeError) # got multiple values for keyword argument 'x'\n checkfor(self, lambda : f(x=1), TypeError) # takes exactly 2 non-keyword arguments (1 given)\n checkfor(self, lambda : f(s=1), TypeError) # takes exactly 2 non-keyword arguments (0 given)", "metadata": "root.T_function.test_naming_rule0", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 119 }, { "content": " def test_naming_rule1(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n f = function([a, s], a/s)\n self.assertTrue(f(1, 2) == 0.5)\n self.assertTrue(f(2, 1) == 2.0)\n self.assertTrue(f(2, s=1) == 2.0)\n checkfor(self, lambda: f(q=2, s=1), TypeError) # got unexpected keyword argument 'q'\n checkfor(self, lambda: f(a=2, s=1), TypeError) # got unexpected keyword argument 'a'", "metadata": "root.T_function.test_naming_rule1", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 131 }, { "content": " def test_naming_rule2(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n # x's name is ignored because it is followed by anonymous parameter a.\n # Ignore unused input x, as it hides the other error\n f = function([x, a, s], a/s, on_unused_input='ignore')\n self.assertTrue(f(9, 1, 2) == 0.5)\n self.assertTrue(f(9, 2, 1) == 2.0)\n self.assertTrue(f(9, 2, s=1) == 2.0)\n checkfor(self, lambda: f(x=9, a=2, s=1), TypeError) # got unexpected keyword argument 'x'\n checkfor(self, lambda: f(5.0, x=9), TypeError) # got unexpected keyword argument 'x'", "metadata": "root.T_function.test_naming_rule2", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def test_naming_rule3(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n # x's name is not ignored (as in test_naming_rule2) because a has a default value.\n f = function([x, In(a, value=1.0), s], a/s+x)\n self.assertTrue(f(9, 2, 4) == 9.5) # can specify all args in order\n self.assertTrue(f(9, 2, s=4) == 9.5) # can give s as kwarg\n self.assertTrue(f(9, s=4) == 9.25) # can give s as kwarg, get default a\n self.assertTrue(f(x=9, s=4) == 9.25) # can give s as kwarg, omit a, x as kw\n checkfor(self, lambda: f(x=9, a=2, s=4), TypeError) # got unexpected keyword argument 'a'\n checkfor(self, lambda: f(), TypeError) # takes exactly 3 non-keyword arguments (0 given)\n checkfor(self, lambda: f(x=9), TypeError) # takes exactly 3 non-keyword arguments (1 given)", "metadata": "root.T_function.test_naming_rule3", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 154 }, { "content": " def test_naming_rule4(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), s], a/s+x)\n\n self.assertTrue(f(9, 2, 4) == 9.5) # can specify all args in order\n self.assertTrue(f(9, 2, s=4) == 9.5) # can give s as kwarg\n self.assertTrue(f(9, s=4) == 9.25) # can give s as kwarg, get default a\n self.assertTrue(f(9, a=2, s=4) == 9.5) # can give s as kwarg, a as kwarg\n self.assertTrue(f(x=9, a=2, s=4) == 9.5) # can give all kwargs\n self.assertTrue(f(x=9, s=4) == 9.25) # can give all kwargs\n checkfor(self, lambda: f(), TypeError) # takes exactly 3 non-keyword arguments (0 given)\n checkfor(self, lambda: f(5.0, x=9), TypeError) # got multiple values for keyword argument 'x'", "metadata": "root.T_function.test_naming_rule4", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_state_access(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x)], s+a*x)\n\n self.assertTrue(f[a] == 1.0)\n self.assertTrue(f[s] == 0.0)\n\n self.assertTrue(f(3.0) == 3.0)\n self.assertTrue(f(3.0, a=2.0) == 9.0) # 3.0 + 2*3.0\n\n self.assertTrue(f[a] == 1.0) # state hasn't changed permanently, we just overrode it last line\n self.assertTrue(f[s] == 9.0)\n\n f[a] = 5.0\n self.assertTrue(f[a] == 5.0)\n self.assertTrue(f(3.0) == 24.0) # 9 + 3*5\n self.assertTrue(f[s] == 24.0)", "metadata": "root.T_function.test_state_access", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 183 }, { "content": " def test_same_names(self):\n a, x, s = T.scalars('xxx')\n # implicit names would cause error. What do we do?\n f = function([a, x, s], a+x+s)\n self.assertTrue(f(1, 2, 3) == 6)\n checkfor(self, lambda: f(1, 2, x=3), TypeError)", "metadata": "root.T_function.test_same_names", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 203 }, { "content": " def test_copy(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x, mutable=True)], s+a*x)\n\n g = copy.copy(f)\n # if they both return, assume that they return equivalent things.\n\n self.assertFalse(g.container[x].storage is f.container[x].storage)\n self.assertFalse(g.container[a].storage is f.container[a].storage)\n self.assertFalse(g.container[s].storage is f.container[s].storage)\n\n self.assertFalse(g.value[a] is not f.value[a]) # should not have been copied\n self.assertFalse(g.value[s] is f.value[s]) # should have been copied because it is mutable.\n self.assertFalse((g.value[s] != f.value[s]).any()) # its contents should be identical\n\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n f(1, 2) # put them out of sync\n self.assertFalse(f(1, 2) == g(1, 2)) # they should not be equal anymore.", "metadata": "root.T_function.test_copy", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def test_copy_share_memory(self):\n x = T.fscalar('x')\n # SharedVariable for tests, one of them has update\n y = theano.shared(value=1)\n z = theano.shared(value=2)\n out = T.tanh((x+y+2)/(x+z-0.2)**2)\n\n # Test for different linkers\n for mode in [\"FAST_RUN\",\"FAST_COMPILE\"]:\n ori = theano.function([x], [out], mode=mode,updates={z:z+1})\n cpy = ori.copy(share_memory=True)\n\n # Test if memories shared\n storage_map_ori = ori.fn.storage_map\n storage_map_cpy = cpy.fn.storage_map\n fgraph_ori = ori.maker.fgraph\n fgraph_cpy = cpy.maker.fgraph\n\n # Assert intermediate and Constants storages are shared.\n # and output stoarges are not shared\n i_o_variables = fgraph_cpy.inputs + fgraph_cpy.outputs\n ori_storages = storage_map_ori.values()\n for key in storage_map_cpy.keys():\n storage = storage_map_cpy[key]\n if key not in i_o_variables or isinstance(key, theano.tensor.Constant):\n self.assertTrue(any([ storage is s for s in ori_storages]))\n\n # Assert storages of SharedVariable without updates are shared\n for (input, _1, _2), here, there in zip(ori.indices,\n ori.input_storage,\n cpy.input_storage):\n self.assertTrue(here.data is there.data)", "metadata": "root.T_function.test_copy_share_memory", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 243 }, { "content": " def test_shared_state0(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x, mutable=True)], s+a*x)\n g = function([x, In(a, value=1.0, name='a'), In(s, value=f.container[s], update=s-a*x, mutable=True)], s+a*x)\n\n f(1, 2)\n self.assertTrue(f[s] == 2)\n self.assertTrue(g[s] == 2)\n g(1, 2)\n self.assertTrue(f[s] == 0)\n self.assertTrue(g[s] == 0)", "metadata": "root.T_function.test_shared_state0", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 380 }, { "content": " def test_shared_state1(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x, mutable=True)], s+a*x)\n g = function([x, In(a, value=1.0, name='a'), In(s, value=f.container[s])], s+a*x)\n\n f(1, 2)\n self.assertTrue(f[s] == 2)\n self.assertTrue(g[s] == 2)\n f(1, 2)\n g(1, 2)\n self.assertTrue(f[s] == 4)\n self.assertTrue(g[s] == 4)", "metadata": "root.T_function.test_shared_state1", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 394 }, { "content": " def test_shared_state2(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x,\n mutable=False)], s+a*x)\n g = function([x, In(a, value=1.0, name='a'), In(s, value=f.container[s])], s+a*x)\n\n f(1, 2)\n self.assertTrue(f[s] == 2)\n self.assertTrue(g[s] == 2)\n f(1, 2)\n self.assertTrue(f[s] == 4)\n self.assertTrue(g[s] == 4)\n g(1, 2) # has no effect on state\n self.assertTrue(f[s] == 4)\n self.assertTrue(g[s] == 4)", "metadata": "root.T_function.test_shared_state2", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 409 }, { "content": " def test_shared_state_not_implicit(self):\n # This test is taken from the documentation in\n # doc/topics/function.txt. If it does not pass anymore and yet the\n # behavior is still intended the doc and the test should both be\n # updated accordingly.\n x, s = T.scalars('xs')\n inc = function([x, In(s, update=(s+x), value=10.0)], [])\n dec = function([x, In(s, update=(s-x), value=inc.container[s],\n implicit=False)], [])\n self.assertTrue(dec[s] is inc[s])\n inc[s] = 2\n self.assertTrue(dec[s] == 2)\n dec(1)\n self.assertTrue(inc[s] == 1)\n dec(1, 0)\n self.assertTrue(inc[s] == -1)\n self.assertTrue(dec[s] == -1)", "metadata": "root.T_function.test_shared_state_not_implicit", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 427 }, { "content": " def test_deepcopy(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x, mutable=True)], s+a*x)\n\n try:\n g = copy.deepcopy(f)\n except NotImplementedError as e:\n if e[0].startswith('DebugMode is not picklable'):\n return\n else:\n raise\n # if they both return, assume that they return equivalent things.\n # print [(k,id(k)) for k in f.finder.keys()]\n # print [(k,id(k)) for k in g.finder.keys()]\n\n self.assertFalse(g.container[0].storage is f.container[0].storage)\n self.assertFalse(g.container[1].storage is f.container[1].storage)\n self.assertFalse(g.container[2].storage is f.container[2].storage)\n self.assertFalse(x in g.container)\n self.assertFalse(x in g.value)\n self.assertTrue(len(f.defaults) == len(g.defaults))\n # print 'f.defaults = %s' % (f.defaults, )\n # print 'g.defaults = %s' % (g.defaults, )\n self.assertTrue(all([f_req == g_req and f_feed == g_feed and\n f_val == g_val\n for ((f_req, f_feed, f_val), (g_req, g_feed, g_val)) in zip(\n f.defaults, g.defaults)]))\n\n self.assertFalse(g.value[1] is f.value[1]) # should not have been copied\n self.assertFalse(g.value[2] is f.value[2]) # should have been copied because it is mutable.\n self.assertFalse((g.value[2] != f.value[2]).any()) # its contents should be identical\n\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n f(1, 2) # put them out of sync\n self.assertFalse(f(1, 2) == g(1, 2)) # they should not be equal anymore.\n g(1, 2) # put them back in sync\n self.assertTrue(f(3) == g(3)) # They should be in sync again.", "metadata": "root.T_picklefunction.test_deepcopy", "header": "['class', 'T_picklefunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 563 }, { "content": " def test_deepcopy_shared_container(self):\n # Ensure that shared containers remain shared after a deep copy.\n a, x = T.scalars('ax')\n\n h = function([In(a, value=0.0)], a)\n f = function([x, In(a, value=h.container[a], implicit=True)], x + a)\n\n try:\n memo = {}\n ac = copy.deepcopy(a)\n memo.update({id(a): ac})\n hc = copy.deepcopy(h, memo=memo)\n memo.update({id(h): hc})\n fc = copy.deepcopy(f, memo=memo)\n except NotImplementedError as e:\n if e[0].startswith('DebugMode is not picklable'):\n return\n else:\n raise\n h[a] = 1\n hc[ac] = 2\n self.assertTrue(f[a] == 1)\n self.assertTrue(fc[ac] == 2)", "metadata": "root.T_picklefunction.test_deepcopy_shared_container", "header": "['class', 'T_picklefunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 604 }, { "content": " def test_pickle(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x, mutable=True)], s+a*x)\n\n try:\n # Note that here we also test protocol 0 on purpose, since it\n # should work (even though one should not use it).\n g = pickle.loads(pickle.dumps(f, protocol=0))\n g = pickle.loads(pickle.dumps(f, protocol=-1))\n except NotImplementedError as e:\n if e[0].startswith('DebugMode is not picklable'):\n return\n else:\n raise\n # if they both return, assume that they return equivalent things.\n # print [(k,id(k)) for k in f.finder.keys()]\n # print [(k,id(k)) for k in g.finder.keys()]\n\n self.assertFalse(g.container[0].storage is f.container[0].storage)\n self.assertFalse(g.container[1].storage is f.container[1].storage)\n self.assertFalse(g.container[2].storage is f.container[2].storage)\n self.assertFalse(x in g.container)\n self.assertFalse(x in g.value)\n\n self.assertFalse(g.value[1] is f.value[1]) # should not have been copied\n self.assertFalse(g.value[2] is f.value[2]) # should have been copied because it is mutable.\n self.assertFalse((g.value[2] != f.value[2]).any()) # its contents should be identical\n\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n self.assertTrue(f(2, 1) == g(2)) # they should be in sync, default value should be copied.\n f(1, 2) # put them out of sync\n self.assertFalse(f(1, 2) == g(1, 2)) # they should not be equal anymore.", "metadata": "root.T_picklefunction.test_pickle", "header": "['class', 'T_picklefunction', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 628 } ]
[ { "span": "self.assertTrue(fn() == [])", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 35 }, { "span": "self.assertTrue(fn(2, 3) == [5])", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 40 }, { "span": "self.assertTrue(fn(2, 3) == [5])", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 40 }, { "span": "self.assertTrue(fn(2, 3) == 5)", "start_line": 117, "start_column": 8, "end_line": 117, "end_column": 38 }, { "span": "self.assertTrue(f(1, 2) == 0.5)", "start_line": 122, "start_column": 8, "end_line": 122, "end_column": 39 }, { "span": "self.assertTrue(f(2, 1) == 2.0)", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 39 }, { "span": "self.assertTrue(f(s=2, x=1) == 0.5)", "start_line": 124, "start_column": 8, "end_line": 124, "end_column": 43 }, { "span": "self.assertTrue(f(x=2, s=1) == 2.0)", "start_line": 125, "start_column": 8, "end_line": 125, "end_column": 43 }, { "span": "self.assertTrue(f(2, s=1) == 2.0)", "start_line": 126, "start_column": 8, "end_line": 126, "end_column": 41 }, { "span": "self.assertTrue(f(1, 2) == 0.5)", "start_line": 135, "start_column": 8, "end_line": 135, "end_column": 39 }, { "span": "self.assertTrue(f(2, 1) == 2.0)", "start_line": 136, "start_column": 8, "end_line": 136, "end_column": 39 }, { "span": "self.assertTrue(f(2, s=1) == 2.0)", "start_line": 137, "start_column": 8, "end_line": 137, "end_column": 41 }, { "span": "self.assertTrue(f(9, 1, 2) == 0.5)", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 42 }, { "span": "self.assertTrue(f(9, 2, 1) == 2.0)", "start_line": 149, "start_column": 8, "end_line": 149, "end_column": 42 }, { "span": "self.assertTrue(f(9, 2, s=1) == 2.0)", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 44 }, { "span": "self.assertTrue(f(9, 2, 4) == 9.5) ", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 42 }, { "span": "self.assertTrue(f(9, 2, s=4) == 9.5) ", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 44 }, { "span": "self.assertTrue(f(9, s=4) == 9.25) ", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 42 }, { "span": "self.assertTrue(f(x=9, s=4) == 9.25) ", "start_line": 163, "start_column": 8, "end_line": 163, "end_column": 44 }, { "span": "self.assertTrue(f(9, 2, 4) == 9.5) ", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 42 }, { "span": "self.assertTrue(f(9, 2, s=4) == 9.5) ", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 44 }, { "span": "self.assertTrue(f(9, s=4) == 9.25) ", "start_line": 176, "start_column": 8, "end_line": 176, "end_column": 42 }, { "span": "self.assertTrue(f(9, a=2, s=4) == 9.5) ", "start_line": 177, "start_column": 8, "end_line": 177, "end_column": 46 }, { "span": "self.assertTrue(f(x=9, a=2, s=4) == 9.5) ", "start_line": 178, "start_column": 8, "end_line": 178, "end_column": 48 }, { "span": "self.assertTrue(f(x=9, s=4) == 9.25) ", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 44 }, { "span": "self.assertTrue(f[a] == 1.0)", "start_line": 189, "start_column": 8, "end_line": 189, "end_column": 36 }, { "span": "self.assertTrue(f[s] == 0.0)", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 36 }, { "span": "self.assertTrue(f(3.0) == 3.0)", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 38 }, { "span": "self.assertTrue(f(3.0, a=2.0) == 9.0) ", "start_line": 193, "start_column": 8, "end_line": 193, "end_column": 45 }, { "span": "self.assertTrue(f[a] == 1.0) ", "start_line": 195, "start_column": 8, "end_line": 195, "end_column": 36 }, { "span": "self.assertTrue(f[s] == 9.0)", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 36 }, { "span": "self.assertTrue(f[a] == 5.0)", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 36 }, { "span": "self.assertTrue(f(3.0) == 24.0) ", "start_line": 200, "start_column": 8, "end_line": 200, "end_column": 39 }, { "span": "self.assertTrue(f[s] == 24.0)", "start_line": 201, "start_column": 8, "end_line": 201, "end_column": 37 }, { "span": "self.assertTrue(f(1, 2, 3) == 6)", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 40 }, { "span": "self.assertFalse(g.container[x].storage is f.container[x].storage)", "start_line": 230, "start_column": 8, "end_line": 230, "end_column": 74 }, { "span": "self.assertFalse(g.container[a].storage is f.container[a].storage)", "start_line": 231, "start_column": 8, "end_line": 231, "end_column": 74 }, { "span": "self.assertFalse(g.container[s].storage is f.container[s].storage)", "start_line": 232, "start_column": 8, "end_line": 232, "end_column": 74 }, { "span": "self.assertFalse(g.value[a] is not f.value[a]) ", "start_line": 234, "start_column": 8, "end_line": 234, "end_column": 54 }, { "span": "self.assertFalse(g.value[s] is f.value[s]) ", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 50 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 238, "start_column": 8, "end_line": 238, "end_column": 40 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 239, "start_column": 8, "end_line": 239, "end_column": 40 }, { "span": "self.assertFalse(f(1, 2) == g(1, 2)) ", "start_line": 241, "start_column": 8, "end_line": 241, "end_column": 44 }, { "span": "self.assertTrue(here.data is there.data)", "start_line": 274, "start_column": 16, "end_line": 274, "end_column": 56 }, { "span": "self.assertTrue(f[s] == 2)", "start_line": 388, "start_column": 8, "end_line": 388, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 2)", "start_line": 389, "start_column": 8, "end_line": 389, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 0)", "start_line": 391, "start_column": 8, "end_line": 391, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 0)", "start_line": 392, "start_column": 8, "end_line": 392, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 2)", "start_line": 402, "start_column": 8, "end_line": 402, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 2)", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 4)", "start_line": 406, "start_column": 8, "end_line": 406, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 4)", "start_line": 407, "start_column": 8, "end_line": 407, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 2)", "start_line": 418, "start_column": 8, "end_line": 418, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 2)", "start_line": 419, "start_column": 8, "end_line": 419, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 4)", "start_line": 421, "start_column": 8, "end_line": 421, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 4)", "start_line": 422, "start_column": 8, "end_line": 422, "end_column": 34 }, { "span": "self.assertTrue(f[s] == 4)", "start_line": 424, "start_column": 8, "end_line": 424, "end_column": 34 }, { "span": "self.assertTrue(g[s] == 4)", "start_line": 425, "start_column": 8, "end_line": 425, "end_column": 34 }, { "span": "self.assertTrue(dec[s] is inc[s])", "start_line": 436, "start_column": 8, "end_line": 436, "end_column": 41 }, { "span": "self.assertTrue(dec[s] == 2)", "start_line": 438, "start_column": 8, "end_line": 438, "end_column": 36 }, { "span": "self.assertTrue(inc[s] == 1)", "start_line": 440, "start_column": 8, "end_line": 440, "end_column": 36 }, { "span": "self.assertTrue(inc[s] == -1)", "start_line": 442, "start_column": 8, "end_line": 442, "end_column": 37 }, { "span": "self.assertTrue(dec[s] == -1)", "start_line": 443, "start_column": 8, "end_line": 443, "end_column": 37 }, { "span": "self.assertFalse(g.container[0].storage is f.container[0].storage)", "start_line": 580, "start_column": 8, "end_line": 580, "end_column": 74 }, { "span": "self.assertFalse(g.container[1].storage is f.container[1].storage)", "start_line": 581, "start_column": 8, "end_line": 581, "end_column": 74 }, { "span": "self.assertFalse(g.container[2].storage is f.container[2].storage)", "start_line": 582, "start_column": 8, "end_line": 582, "end_column": 74 }, { "span": "self.assertFalse(x in g.container)", "start_line": 583, "start_column": 8, "end_line": 583, "end_column": 42 }, { "span": "self.assertFalse(x in g.value)", "start_line": 584, "start_column": 8, "end_line": 584, "end_column": 38 }, { "span": "self.assertTrue(len(f.defaults) == len(g.defaults))", "start_line": 585, "start_column": 8, "end_line": 585, "end_column": 59 }, { "span": "self.assertFalse(g.value[1] is f.value[1]) ", "start_line": 593, "start_column": 8, "end_line": 593, "end_column": 50 }, { "span": "self.assertFalse(g.value[2] is f.value[2]) ", "start_line": 594, "start_column": 8, "end_line": 594, "end_column": 50 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 597, "start_column": 8, "end_line": 597, "end_column": 40 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 598, "start_column": 8, "end_line": 598, "end_column": 40 }, { "span": "self.assertFalse(f(1, 2) == g(1, 2)) ", "start_line": 600, "start_column": 8, "end_line": 600, "end_column": 44 }, { "span": "self.assertTrue(f(3) == g(3)) ", "start_line": 602, "start_column": 8, "end_line": 602, "end_column": 37 }, { "span": "self.assertTrue(f[a] == 1)", "start_line": 625, "start_column": 8, "end_line": 625, "end_column": 34 }, { "span": "self.assertTrue(fc[ac] == 2)", "start_line": 626, "start_column": 8, "end_line": 626, "end_column": 36 }, { "span": "self.assertFalse(g.container[0].storage is f.container[0].storage)", "start_line": 648, "start_column": 8, "end_line": 648, "end_column": 74 }, { "span": "self.assertFalse(g.container[1].storage is f.container[1].storage)", "start_line": 649, "start_column": 8, "end_line": 649, "end_column": 74 }, { "span": "self.assertFalse(g.container[2].storage is f.container[2].storage)", "start_line": 650, "start_column": 8, "end_line": 650, "end_column": 74 }, { "span": "self.assertFalse(x in g.container)", "start_line": 651, "start_column": 8, "end_line": 651, "end_column": 42 }, { "span": "self.assertFalse(x in g.value)", "start_line": 652, "start_column": 8, "end_line": 652, "end_column": 38 }, { "span": "self.assertFalse(g.value[1] is f.value[1]) ", "start_line": 654, "start_column": 8, "end_line": 654, "end_column": 50 }, { "span": "self.assertFalse(g.value[2] is f.value[2]) ", "start_line": 655, "start_column": 8, "end_line": 655, "end_column": 50 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 658, "start_column": 8, "end_line": 658, "end_column": 40 }, { "span": "self.assertTrue(f(2, 1) == g(2)) ", "start_line": 659, "start_column": 8, "end_line": 659, "end_column": 40 }, { "span": "self.assertFalse(f(1, 2) == g(1, 2)) ", "start_line": 661, "start_column": 8, "end_line": 661, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "function_", "(_", "[_", "]_", ",_", "[_", "]_", ")_", "#", " ", "ok_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fn_", "(_", ")_", "==_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "input", "\\u", "anon", "\\u", "singleton_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", ",_", "x_", "]_", ",_", "[_", "x_", "+_", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fn_", "(_", "2_", ",_", "3_", ")_", "==_", "[_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fn_", "(_", "2_", ",_", "3_", ")_", "==_", "[_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "input", "\\u", "anon", "\\u", "unpack_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fn_", "=_", "function_", "(_", "[_", "s_", ",_", "x_", "]_", ",_", "x_", "+_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fn_", "(_", "2_", ",_", "3_", ")_", "==_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nami", "ng", "\\u", "rule", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "s_", "]_", ",_", "x_", "/_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", "==_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "s_", "=_", "2_", ",_", "x_", "=_", "1_", ")_", "==_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "x_", "=_", "2_", ",_", "s_", "=_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "s_", "=_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "2_", ",_", "x_", "=_", "2.0_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "multiple", " ", "values", " ", "for", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "x_", "=_", "1_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "take", "s", " ", "exact", "ly", " ", "2", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "(", "1", " ", "give", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "s_", "=_", "1_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "take", "s", " ", "exact", "ly", " ", "2", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "(", "0", " ", "give", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nami", "ng", "\\u", "rule", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "a_", ",_", "s_", "]_", ",_", "a_", "/_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", "==_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "s_", "=_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "q_", "=_", "2_", ",_", "s_", "=_", "1_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "unexpected", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "q", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "a_", "=_", "2_", ",_", "s_", "=_", "1_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "unexpected", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nami", "ng", "\\u", "rule", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", "'", "s", " ", "name", " ", "is", " ", "ignore", "d", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "followe", "d", " ", "by", " ", "anonym", "ous", " ", "parameter", " ", "a", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "unu", "sed", " ", "input", " ", "x", ",", " ", "as", " ", "it", " ", "hide", "s", " ", "the", " ", "other", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "a_", ",_", "s_", "]_", ",_", "a_", "/_", "s_", ",_", "on", "\\u", "unu", "sed", "\\u", "input_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "1_", ",_", "2_", ")_", "==_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "s_", "=_", "1_", ")_", "==_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "x_", "=_", "9_", ",_", "a_", "=_", "2_", ",_", "s_", "=_", "1_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "unexpected", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "5.0_", ",_", "x_", "=_", "9_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "unexpected", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nami", "ng", "\\u", "rule", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "x", "'", "s", " ", "name", " ", "is", " ", "not", " ", "ignore", "d", " ", "(", "as", " ", "in", " ", "test\\u", "nami", "ng", "\\u", "rule", "2", ")", " ", "bec", "aus", "e", " ", "a", " ", "has", " ", "a", " ", "default", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ")_", ",_", "s_", "]_", ",_", "a_", "/_", "s_", "+_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "speci", "fy", " ", "all", " ", "args", " ", "in", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "s_", "=_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "s_", "=_", "4_", ")_", "==_", "9.2", "5_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg", ",", " ", "get", " ", "default", " ", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "x_", "=_", "9_", ",_", "s_", "=_", "4_", ")_", "==_", "9.2", "5_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg", ",", " ", "omit", " ", "a", ",", " ", "x", " ", "as", " ", "kw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "x_", "=_", "9_", ",_", "a_", "=_", "2_", ",_", "s_", "=_", "4_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "unexpected", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "take", "s", " ", "exact", "ly", " ", "3", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "(", "0", " ", "give", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "x_", "=_", "9_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "take", "s", " ", "exact", "ly", " ", "3", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "(", "1", " ", "give", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nami", "ng", "\\u", "rule", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "s_", "]_", ",_", "a_", "/_", "s_", "+_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "speci", "fy", " ", "all", " ", "args", " ", "in", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "2_", ",_", "s_", "=_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "s_", "=_", "4_", ")_", "==_", "9.2", "5_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg", ",", " ", "get", " ", "default", " ", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "9_", ",_", "a_", "=_", "2_", ",_", "s_", "=_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "give", " ", "s", " ", "as", " ", "kwarg", ",", " ", "a", " ", "as", " ", "kwarg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "x_", "=_", "9_", ",_", "a_", "=_", "2_", ",_", "s_", "=_", "4_", ")_", "==_", "9.5", "_", ")_", "#", " ", "can", " ", "give", " ", "all", " ", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "x_", "=_", "9_", ",_", "s_", "=_", "4_", ")_", "==_", "9.2", "5_", ")_", "#", " ", "can", " ", "give", " ", "all", " ", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "take", "s", " ", "exact", "ly", " ", "3", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "(", "0", " ", "give", "n", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "5.0_", ",_", "x_", "=_", "9_", ")_", ",_", "Type", "Error_", ")_", "#", " ", "got", " ", "multiple", " ", "values", " ", "for", " ", "keyw", "ord", " ", "argu", "ment", " ", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "state", "\\u", "access_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "a_", "]_", "==_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "3.0_", ")_", "==_", "3.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "3.0_", ",_", "a_", "=_", "2.0_", ")_", "==_", "9.0_", ")_", "#", " ", "3.0", " ", "+", " ", "2", "*", "3.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "a_", "]_", "==_", "1.0_", ")_", "#", " ", "state", " ", "hasn", "'", "t", " ", "change", "d", " ", "permanent", "ly", ",", " ", "we", " ", "just", " ", "over", "rod", "e", " ", "it", " ", "last", " ", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "9.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "[_", "a_", "]_", "=_", "5.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "a_", "]_", "==_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "3.0_", ")_", "==_", "24.0", "_", ")_", "#", " ", "9", " ", "+", " ", "3", "*", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "24.0", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "same", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xxx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "implicit", " ", "names", " ", "wou", "ld", " ", "caus", "e", " ", "error", ".", " ", " ", "What", " ", "do", " ", "we", " ", "do", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "a_", ",_", "x_", ",_", "s_", "]_", ",_", "a_", "+_", "x_", "+_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", "==_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "for_", "(_", "self_", ",_", "lambda_", ":_", "f_", "(_", "1_", ",_", "2_", ",_", "x_", "=_", "3_", ")_", ",_", "Type", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "copy_", "._", "copy_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", "y", " ", "bot", "h", " ", "return", ",", " ", "assume", " ", " ", "tha", "t", " ", "the", "y", " ", "return", " ", "equivalent", " ", "thing", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "x_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "x_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "a_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "a_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "s_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "s_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "a_", "]_", "is_", "not_", "f_", "._", "value_", "[_", "a_", "]_", ")_", "#", " ", "shou", "ld", " ", "not", " ", "have", " ", "bee", "n", " ", "copied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "s_", "]_", "is_", "f_", "._", "value_", "[_", "s_", "]_", ")_", "#", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "copie", "d", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "mutable", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "(_", "g_", "._", "value_", "[_", "s_", "]_", "!=_", "f_", "._", "value_", "[_", "s_", "]_", ")_", "._", "any_", "(_", ")_", ")_", "#", " ", "its", " ", "content", "s", " ", "shou", "ld", " ", "be", " ", "identical_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "#", " ", "put", " ", "them", " ", "out", " ", "of", " ", "sync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", "==_", "g_", "(_", "1_", ",_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "not", " ", "be", " ", "equal", " ", "any", "more", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "copy", "\\u", "share", "\\u", "memory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "T_", "._", "fsc", "ala", "r_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Share", "d", "Varia", "ble", " ", "for", " ", "tests", ",", " ", "one", " ", "of", " ", "them", " ", "has", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "T_", "._", "tanh_", "(_", "(_", "x_", "+_", "y_", "+_", "2_", ")_", "/_", "(_", "x_", "+_", "z_", "-_", "0.2_", ")_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "different", " ", "linker", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mode_", "in_", "[_", "\"", "FAST", "\\u", "RUN", "\"_", ",_", "\"", "FAST", "\\u", "COMPIL", "E", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ori_", "=_", "theano_", "._", "function_", "(_", "[_", "x_", "]_", ",_", "[_", "out_", "]_", ",_", "mode_", "=_", "mode_", ",_", "updates_", "=_", "{_", "z_", ":_", "z_", "+_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "_", "=_", "ori_", "._", "copy_", "(_", "share", "\\u", "memory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "if", " ", "memori", "es", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "storage", "\\u", "map", "\\u", "ori_", "=_", "ori_", "._", "fn_", "._", "storage", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "\\u", "map", "\\u", "cpy", "_", "=_", "cpy", "_", "._", "fn_", "._", "storage", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fg", "raph", "\\u", "ori_", "=_", "ori_", "._", "maker_", "._", "fg", "raph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fg", "raph", "\\u", "cpy", "_", "=_", "cpy", "_", "._", "maker_", "._", "fg", "raph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert", " ", "intermediate", " ", "and", " ", "Const", "ant", "s", " ", "storage", "s", " ", "are", " ", "shared", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "output", " ", "sto", "arge", "s", " ", "are", " ", "not", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "o", "\\u", "variables_", "=_", "fg", "raph", "\\u", "cpy", "_", "._", "inputs_", "+_", "fg", "raph", "\\u", "cpy", "_", "._", "outputs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ori", "\\u", "storage", "s_", "=_", "storage", "\\u", "map", "\\u", "ori_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "storage", "\\u", "map", "\\u", "cpy", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", "=_", "storage", "\\u", "map", "\\u", "cpy", "_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "i", "\\u", "o", "\\u", "variables_", "or_", "isinstance_", "(_", "key_", ",_", "theano_", "._", "tensor_", "._", "Constant_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "assert", "True_", "(_", "any_", "(_", "[_", "storage_", "is_", "s_", "for_", "s_", "in_", "ori", "\\u", "storage", "s_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert", " ", "storage", "s", " ", "of", " ", "Share", "d", "Varia", "ble", " ", "with", "out", " ", "update", "s", " ", "are", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "input_", ",_", "\\u", "1_", ",_", "\\u", "2_", ")_", ",_", "here_", ",_", "there", "_", "in_", "zip_", "(_", "ori_", "._", "indices_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ori_", "._", "input", "\\u", "storage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpy", "_", "._", "input", "\\u", "storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "here_", "._", "data_", "is_", "there", "_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shared", "\\u", "state", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "f_", "._", "container_", "[_", "s_", "]_", ",_", "update_", "=_", "s_", "-_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shared", "\\u", "state", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "f_", "._", "container_", "[_", "s_", "]_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shared", "\\u", "state", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mutable", "_", "=_", "False_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "f_", "._", "container_", "[_", "s_", "]_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "(_", "1_", ",_", "2_", ")_", "#", " ", "has", " ", "no", " ", "effect", " ", "on", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shared", "\\u", "state", "\\u", "not", "\\u", "implicit", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "test", " ", "is", " ", "take", "n", " ", "from", " ", "the", " ", "documentation", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "doc", "/", "topic", "s", "/", "function", ".", "txt", ".", " ", "If", " ", "it", " ", "doe", "s", " ", "not", " ", "pass", " ", "any", "more", " ", "and", " ", "ye", "t", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "behavior", " ", "is", " ", "still", " ", "inten", "ded", " ", "the", " ", "doc", " ", "and", " ", "the", " ", "test", " ", "shou", "ld", " ", "bot", "h", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", " ", "according", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "s_", ",_", "update_", "=_", "(_", "s_", "+_", "x_", ")_", ",_", "value_", "=_", "10.0_", ")_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "s_", ",_", "update_", "=_", "(_", "s_", "-_", "x_", ")_", ",_", "value_", "=_", "inc_", "._", "container_", "[_", "s_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "implicit", "_", "=_", "False_", ")_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dec_", "[_", "s_", "]_", "is_", "inc_", "[_", "s_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inc_", "[_", "s_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dec_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inc_", "[_", "s_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec_", "(_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inc_", "[_", "s_", "]_", "==_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "dec_", "[_", "s_", "]_", "==_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "pickle", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "deepcopy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "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 ", " _", "g_", "=_", "copy_", "._", "deepcopy_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "[_", "0_", "]_", "._", "startswith_", "(_", "'", "Deb", "ug", "Mode", " ", "is", " ", "not", " ", "pick", "lable", "'_", ")_", ":_", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", "y", " ", "bot", "h", " ", "return", ",", " ", "assume", " ", " ", "tha", "t", " ", "the", "y", " ", "return", " ", "equivalent", " ", "thing", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "[(", "k", ",", "id", "(", "k", "))", " ", "for", " ", "k", " ", "in", " ", "f", ".", "finde", "r", ".", "keys", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "[(", "k", ",", "id", "(", "k", "))", " ", "for", " ", "k", " ", "in", " ", "g", ".", "finde", "r", ".", "keys", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "0_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "0_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "1_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "1_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "2_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "2_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "x_", "in_", "g_", "._", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "x_", "in_", "g_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "f_", "._", "defaults_", ")_", "==_", "len_", "(_", "g_", "._", "defaults_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "'", "f", ".", "default", "s", " ", "=", " ", "%", "s", "'", " ", "%", " ", "(", "f", ".", "default", "s", ",", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", "g", ".", "default", "s", " ", "=", " ", "%", "s", "'", " ", "%", " ", "(", "g", ".", "default", "s", ",", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "all_", "(_", "[_", "f", "\\u", "req_", "==_", "g", "\\u", "req_", "and_", "f", "\\u", "feed_", "==_", "g", "\\u", "feed_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "f", "\\u", "val_", "==_", "g", "\\u", "val_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "(_", "f", "\\u", "req_", ",_", "f", "\\u", "feed_", ",_", "f", "\\u", "val_", ")_", ",_", "(_", "g", "\\u", "req_", ",_", "g", "\\u", "feed_", ",_", "g", "\\u", "val_", ")_", ")_", "in_", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "defaults_", ",_", "g_", "._", "defaults_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "1_", "]_", "is_", "f_", "._", "value_", "[_", "1_", "]_", ")_", "#", " ", "shou", "ld", " ", "not", " ", "have", " ", "bee", "n", " ", "copied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "2_", "]_", "is_", "f_", "._", "value_", "[_", "2_", "]_", ")_", "#", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "copie", "d", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "mutable", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "(_", "g_", "._", "value_", "[_", "2_", "]_", "!=_", "f_", "._", "value_", "[_", "2_", "]_", ")_", "._", "any_", "(_", ")_", ")_", "#", " ", "its", " ", "content", "s", " ", "shou", "ld", " ", "be", " ", "identical_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "#", " ", "put", " ", "them", " ", "out", " ", "of", " ", "sync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", "==_", "g_", "(_", "1_", ",_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "not", " ", "be", " ", "equal", " ", "any", "more", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "(_", "1_", ",_", "2_", ")_", "#", " ", "put", " ", "them", " ", "back", " ", "in", " ", "sync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "3_", ")_", "==_", "g_", "(_", "3_", ")_", ")_", "#", " ", "The", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", " ", "again", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "pickle", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "deepc", "opy", "\\u", "shared", "\\u", "container_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "shared", " ", "container", "s", " ", "rema", "in", " ", "shared", " ", "after", " ", "a", " ", "deep", " ", "copy", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "x_", "=_", "T_", "._", "scalars", "_", "(_", "'", "ax", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h_", "=_", "function_", "(_", "[_", "In_", "(_", "a_", ",_", "value_", "=_", "0.0_", ")_", "]_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "h_", "._", "container_", "[_", "a_", "]_", ",_", "implicit", "_", "=_", "True_", ")_", "]_", ",_", "x_", "+_", "a_", ")_", "\\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 ", " _", "memo_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac_", "=_", "copy_", "._", "deepcopy_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memo_", "._", "update_", "(_", "{_", "id_", "(_", "a_", ")_", ":_", "ac_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hc_", "=_", "copy_", "._", "deepcopy_", "(_", "h_", ",_", "memo_", "=_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memo_", "._", "update_", "(_", "{_", "id_", "(_", "h_", ")_", ":_", "hc_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fc_", "=_", "copy_", "._", "deepcopy_", "(_", "f_", ",_", "memo_", "=_", "memo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "[_", "0_", "]_", "._", "startswith_", "(_", "'", "Deb", "ug", "Mode", " ", "is", " ", "not", " ", "pick", "lable", "'_", ")_", ":_", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h_", "[_", "a_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hc_", "[_", "ac_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "a_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "fc_", "[_", "ac_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "pickle", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pickle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "mutable", "_", "=_", "True_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "here", " ", "we", " ", "als", "o", " ", "test", " ", "protoc", "ol", " ", "0", " ", "on", " ", "purpose", ",", " ", "sinc", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "work", " ", "(", "even", " ", "tho", "ugh", " ", "one", " ", "shou", "ld", " ", "not", " ", "use", " ", "it", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "f_", ",_", "protocol_", "=_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "f_", ",_", "protocol_", "=_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "[_", "0_", "]_", "._", "startswith_", "(_", "'", "Deb", "ug", "Mode", " ", "is", " ", "not", " ", "pick", "lable", "'_", ")_", ":_", "\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", "y", " ", "bot", "h", " ", "return", ",", " ", "assume", " ", " ", "tha", "t", " ", "the", "y", " ", "return", " ", "equivalent", " ", "thing", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "[(", "k", ",", "id", "(", "k", "))", " ", "for", " ", "k", " ", "in", " ", "f", ".", "finde", "r", ".", "keys", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "[(", "k", ",", "id", "(", "k", "))", " ", "for", " ", "k", " ", "in", " ", "g", ".", "finde", "r", ".", "keys", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "0_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "0_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "1_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "1_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "container_", "[_", "2_", "]_", "._", "storage_", "is_", "f_", "._", "container_", "[_", "2_", "]_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "x_", "in_", "g_", "._", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "x_", "in_", "g_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "1_", "]_", "is_", "f_", "._", "value_", "[_", "1_", "]_", ")_", "#", " ", "shou", "ld", " ", "not", " ", "have", " ", "bee", "n", " ", "copied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "g_", "._", "value_", "[_", "2_", "]_", "is_", "f_", "._", "value_", "[_", "2_", "]_", ")_", "#", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "copie", "d", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "mutable", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "(_", "g_", "._", "value_", "[_", "2_", "]_", "!=_", "f_", "._", "value_", "[_", "2_", "]_", ")_", "._", "any_", "(_", ")_", ")_", "#", " ", "its", " ", "content", "s", " ", "shou", "ld", " ", "be", " ", "identical_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "2_", ",_", "1_", ")_", "==_", "g_", "(_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "be", " ", "in", " ", "sync", ",", " ", "default", " ", "value", " ", "shou", "ld", " ", "be", " ", "copie", "d", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "#", " ", "put", " ", "them", " ", "out", " ", "of", " ", "sync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "f_", "(_", "1_", ",_", "2_", ")_", "==_", "g_", "(_", "1_", ",_", "2_", ")_", ")_", "#", " ", "the", "y", " ", "shou", "ld", " ", "not", " ", "be", " ", "equal", " ", "any", "more", "._", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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 ]
Imprecise assert
ericholscher/django-test-utils/test_project/test_app/tests/testmaker_tests.py
[ { "content": " def test_basic_testmaker(self):\n self.client.get('/')\n logs = open('test_file')\n output = logs.read()\n self.assertTrue(output.find('[<Poll: What\\'s up?>, <Poll: Test poll>]') != -1)", "metadata": "root.TestMakerTests.test_basic_testmaker", "header": "['class', 'TestMakerTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_twill_processor(self):\n settings.TESTMAKER_PROCESSOR = 'twill'\n self.client.get('/')\n self.client.get('/1/')\n logs = open('test_file')\n output = logs.read()\n self.assertTrue(output.find('code 200') != -1)", "metadata": "root.TestMakerTests.test_twill_processor", "header": "['class', 'TestMakerTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "self.assertTrue(output.find('[<Poll: What\\'s up?>, <Poll: Test poll>]') != -1)", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 86 }, { "span": "self.assertTrue(output.find('code 200') != -1)", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Make", "r", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "\\u", "testm", "ake", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client_", "._", "get_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logs_", "=_", "open_", "(_", "'", "test\\u", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "logs_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "output_", "._", "find_", "(_", "'[", "<", "Poll", ":", " ", "What", "\\\\'", "s", " ", "up", "?>", ",", " ", "<", "Poll", ":", " ", "Test", " ", "poll", ">]", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Make", "r", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "twi", "ll", "\\u", "processor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "TEST", "MAKE", "R", "\\u", "PROCESSOR", "_", "=_", "'", "twi", "ll", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "get_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "._", "get_", "(_", "'/", "1", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logs_", "=_", "open_", "(_", "'", "test\\u", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "logs_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "output_", "._", "find_", "(_", "'", "code", " ", "200", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
mblayman/markwiki/markwiki/wiki.py
[ { "content": " def store(self, content):\n '''Write the content. Assumes valid path. Returns success status.'''\n # Determine if the directories are already in place.\n directory = os.path.dirname(self.wiki_path)\n if not os.path.exists(directory):\n # This could be nested deeply so make all intermediate directories.\n try:\n os.makedirs(directory)\n except:\n return False\n\n try:\n with open(self.wiki_path, 'wb') as wiki:\n # get rid of any Windows-like ending\n wiki.write(content.encode('utf-8').replace('\\r\\n', '\\n'))\n except IOError:\n # Something bad happened while writing so report failure.\n return False\n if app.config['GIT_ENABLED']:\n app.gitint.update_file(self.rel_path)\n\n return True", "metadata": "root.WikiPage.store", "header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']", "index": 66 }, { "content": " def delete(self):\n try:\n os.remove(self.wiki_path)\n except:\n return False\n\n return True", "metadata": "root.WikiPage.delete", "header": "['class', 'WikiPage', '(', 'object', ')', ':', '___EOS___']", "index": 89 } ]
[ { "span": "except:", "start_line": 74, "start_column": 12, "end_line": 74, "end_column": 19 }, { "span": "except:", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Wiki", "Page_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "store_", "(_", "self_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Write", " ", "the", " ", "content", ".", " ", "Assume", "s", " ", "valid", " ", "path", ".", " ", "Return", "s", " ", "success", " ", "status", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "director", "ies", " ", "are", " ", "alr", "ead", "y", " ", "in", " ", "place", "._", "\\u\\u\\uNL\\u\\u\\u_", "directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "wiki", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "coul", "d", " ", "be", " ", "nest", "ed", " ", "deep", "ly", " ", "so", " ", "make", " ", "all", " ", "intermediate", " ", "director", "ies", "._", "\\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 ", " _", "os_", "._", "makedirs_", "(_", "directory_", ")_", "\\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_", "\\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_", "(_", "self_", "._", "wiki", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "as_", "wiki_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "rid", " ", "of", " ", "any", " ", "Window", "s", "-", "like", " ", "ending_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wiki_", "._", "write_", "(_", "content_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "replace_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ",_", "'\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", "thing", " ", "bad", " ", "happ", "ened", " ", "whi", "le", " ", "writ", "ing", " ", "so", " ", "report", " ", "fail", "ure", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app_", "._", "config_", "[_", "'", "GIT", "\\u", "ENABLE", "D", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "giti", "nt_", "._", "update", "\\u", "file_", "(_", "self_", "._", "rel", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wiki", "Page_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "wiki", "\\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 ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/utils/__init__.py
[ { "content": " def exec_(code, globs=None, locs=None):\n \"\"\"Execute code in a namespace.\"\"\"\n if globs is None:\n frame = sys._getframe(1)\n globs = frame.f_globals\n if locs is None:\n locs = frame.f_locals\n del frame\n elif locs is None:\n locs = globs\n exec(\"\"\"exec code in globs, locs\"\"\")", "metadata": "root.exec_", "header": "['module', '___EOS___']", "index": 623 } ]
[ { "span": "globs ", "start_line": 627, "start_column": 12, "end_line": 627, "end_column": 17 }, { "span": "locs ", "start_line": 629, "start_column": 16, "end_line": 629, "end_column": 20 }, { "span": "locs ", "start_line": 632, "start_column": 12, "end_line": 632, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "exec\\u_", "(_", "code_", ",_", "globs_", "=_", "None_", ",_", "locs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "e", " ", "code", " ", "in", " ", "a", " ", "namespace", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "globs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "sys_", "._", "\\u", "getframe_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "globs_", "=_", "frame_", "._", "f", "\\u", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "locs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locs_", "=_", "frame_", "._", "f", "\\u", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "locs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "locs_", "=_", "globs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "(_", "\"\"\"", "exec", " ", "code", " ", "in", " ", "glob", "s", ",", " ", "locs", "\"\"\"_", ")_", "\\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, 0, 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, 0, 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'
zunzun/pyeq2/Models_3D/RomanSurfaces.py
[ { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n XSQMINUSYSQ = inDataCacheDictionary['XSQMINUSYSQ'] # only need to perform this dictionary look-up once\n YSQMINUSXSQ = inDataCacheDictionary['YSQMINUSXSQ'] # only need to perform this dictionary look-up once\n XSQPLUSYSQ = inDataCacheDictionary['XSQPLUSYSQ'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n\n try:\n temp = (k * YSQMINUSXSQ - XSQMINUSYSQ * numpy.sqrt(k * k - XSQMINUSYSQ)) / (2.0 * XSQPLUSYSQ)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfaceMinus.CalculateModelPredictions", "header": "['class', 'RomanSurfaceMinus', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 59 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n a = inCoeffs[1]\n b = inCoeffs[2]\n\n try:\n temp_x_sq = (x_in + a) * (x_in + a)\n temp_y_sq = (y_in + b) * (y_in + b)\n temp = (k * (temp_y_sq - temp_x_sq) - (temp_x_sq - temp_y_sq) * numpy.sqrt(k * k - temp_x_sq - temp_y_sq)) / (2.0 * (temp_x_sq + temp_y_sq))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfaceMinus_OffsetXY.CalculateModelPredictions", "header": "['class', 'RomanSurfaceMinus_OffsetXY', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 110 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n a = inCoeffs[1]\n b = inCoeffs[2]\n c = inCoeffs[3]\n d = inCoeffs[4]\n\n try:\n temp_x_sq = (a * x_in + b) * (a * x_in + b)\n temp_y_sq = (c * y_in + d) * (c * y_in + d)\n temp = (k * (temp_y_sq - temp_x_sq) - (temp_x_sq - temp_y_sq) * numpy.power(k * k - temp_x_sq - temp_y_sq)) / (2.0 * (temp_x_sq + temp_y_sq))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfaceMinus_ScaledAndOffsetXY.CalculateModelPredictions", "header": "['class', 'RomanSurfaceMinus_ScaledAndOffsetXY', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 166 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n XSQMINUSYSQ = inDataCacheDictionary['XSQMINUSYSQ'] # only need to perform this dictionary look-up once\n YSQMINUSXSQ = inDataCacheDictionary['YSQMINUSXSQ'] # only need to perform this dictionary look-up once\n XSQPLUSYSQ = inDataCacheDictionary['XSQPLUSYSQ'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n\n try:\n temp = (k * YSQMINUSXSQ + XSQMINUSYSQ * numpy.sqrt(k * k - XSQMINUSYSQ)) / (2.0 * XSQPLUSYSQ)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfacePlus.CalculateModelPredictions", "header": "['class', 'RomanSurfacePlus', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 225 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n XSQMINUSYSQ = inDataCacheDictionary['XSQMINUSYSQ'] # only need to perform this dictionary look-up once\n YSQMINUSXSQ = inDataCacheDictionary['YSQMINUSXSQ'] # only need to perform this dictionary look-up once\n XSQPLUSYSQ = inDataCacheDictionary['XSQPLUSYSQ'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n scale = inCoeffs[1]\n\n try:\n temp = scale * (k * YSQMINUSXSQ + XSQMINUSYSQ * numpy.sqrt(k * k - XSQMINUSYSQ)) / (2.0 * XSQPLUSYSQ)\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfacePlus_scaled.CalculateModelPredictions", "header": "['class', 'RomanSurfacePlus_scaled', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 277 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n a = inCoeffs[1]\n b = inCoeffs[2]\n\n try:\n temp_x_sq = (x_in + a) * (x_in + a)\n temp_y_sq = (y_in + b) * (y_in + b)\n temp = (k * (temp_y_sq - temp_x_sq) + (temp_x_sq - temp_y_sq) * numpy.sqrt(k * k - temp_x_sq - temp_y_sq)) / (2.0 * (temp_x_sq + temp_y_sq))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfacePlus_OffsetXY.CalculateModelPredictions", "header": "['class', 'RomanSurfacePlus_OffsetXY', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 329 }, { "content": " def CalculateModelPredictions(self, inCoeffs, inDataCacheDictionary):\n x_in = inDataCacheDictionary['X'] # only need to perform this dictionary look-up once\n y_in = inDataCacheDictionary['Y'] # only need to perform this dictionary look-up once\n \n k = inCoeffs[0]\n a = inCoeffs[1]\n b = inCoeffs[2]\n c = inCoeffs[3]\n d = inCoeffs[4]\n\n try:\n temp_x_sq = (a * x_in + b) * (a * x_in + b)\n temp_y_sq = (c * y_in + d) * (c * y_in + d)\n temp = (k * (temp_y_sq - temp_x_sq) + (temp_x_sq - temp_y_sq) * numpy.sqrt(k * k - temp_x_sq - temp_y_sq)) / (2.0 * (temp_x_sq + temp_y_sq))\n return self.extendedVersionHandler.GetAdditionalModelPredictions(temp, inCoeffs, inDataCacheDictionary, self)\n except:\n return numpy.ones(len(inDataCacheDictionary['DependentData'])) * 1.0E300", "metadata": "root.RomanSurfacePlus_ScaledAndOffsetXY.CalculateModelPredictions", "header": "['class', 'RomanSurfacePlus_ScaledAndOffsetXY', '(', 'pyeq2', '.', 'Model_3D_BaseClass', '.', 'Model_3D_BaseClass', ')', ':', '___EOS___']", "index": 385 } ]
[ { "span": "except:", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 15 }, { "span": "except:", "start_line": 123, "start_column": 8, "end_line": 123, "end_column": 15 }, { "span": "except:", "start_line": 181, "start_column": 8, "end_line": 181, "end_column": 15 }, { "span": "except:", "start_line": 235, "start_column": 8, "end_line": 235, "end_column": 15 }, { "span": "except:", "start_line": 288, "start_column": 8, "end_line": 288, "end_column": 15 }, { "span": "except:", "start_line": 342, "start_column": 8, "end_line": 342, "end_column": 15 }, { "span": "except:", "start_line": 400, "start_column": 8, "end_line": 400, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Minus", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XS", "QM", "IN", "US", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QM", "IN", "US", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YS", "QM", "IN", "US", "XS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "YS", "QM", "IN", "US", "XS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XS", "QP", "LUS", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QP", "LUS", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "(_", "k_", "*_", "YS", "QM", "IN", "US", "XS", "Q_", "-_", "XS", "QM", "IN", "US", "YS", "Q_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "XS", "QM", "IN", "US", "YS", "Q_", ")_", ")_", "/_", "(_", "2.0_", "*_", "XS", "QP", "LUS", "YS", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Minus", "\\u", "Off", "set", "XY_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Y", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp", "\\u", "x", "\\u", "sq_", "=_", "(_", "x", "\\u", "in_", "+_", "a_", ")_", "*_", "(_", "x", "\\u", "in_", "+_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "y", "\\u", "sq_", "=_", "(_", "y", "\\u", "in_", "+_", "b_", ")_", "*_", "(_", "y", "\\u", "in_", "+_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "(_", "k_", "*_", "(_", "temp", "\\u", "y", "\\u", "sq_", "-_", "temp", "\\u", "x", "\\u", "sq_", ")_", "-_", "(_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "/_", "(_", "2.0_", "*_", "(_", "temp", "\\u", "x", "\\u", "sq_", "+_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Minus", "\\u", "Scaled", "And", "Off", "set", "XY_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Y", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\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 ", " _", "temp", "\\u", "x", "\\u", "sq_", "=_", "(_", "a_", "*_", "x", "\\u", "in_", "+_", "b_", ")_", "*_", "(_", "a_", "*_", "x", "\\u", "in_", "+_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "y", "\\u", "sq_", "=_", "(_", "c_", "*_", "y", "\\u", "in_", "+_", "d_", ")_", "*_", "(_", "c_", "*_", "y", "\\u", "in_", "+_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "(_", "k_", "*_", "(_", "temp", "\\u", "y", "\\u", "sq_", "-_", "temp", "\\u", "x", "\\u", "sq_", ")_", "-_", "(_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", "*_", "numpy_", "._", "power_", "(_", "k_", "*_", "k_", "-_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "/_", "(_", "2.0_", "*_", "(_", "temp", "\\u", "x", "\\u", "sq_", "+_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Plus", "_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XS", "QM", "IN", "US", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QM", "IN", "US", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YS", "QM", "IN", "US", "XS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "YS", "QM", "IN", "US", "XS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XS", "QP", "LUS", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QP", "LUS", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "(_", "k_", "*_", "YS", "QM", "IN", "US", "XS", "Q_", "+_", "XS", "QM", "IN", "US", "YS", "Q_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "XS", "QM", "IN", "US", "YS", "Q_", ")_", ")_", "/_", "(_", "2.0_", "*_", "XS", "QP", "LUS", "YS", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Plus", "\\u", "scaled_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "XS", "QM", "IN", "US", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QM", "IN", "US", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "YS", "QM", "IN", "US", "XS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "YS", "QM", "IN", "US", "XS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XS", "QP", "LUS", "YS", "Q_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "XS", "QP", "LUS", "YS", "Q", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scale_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp_", "=_", "scale_", "*_", "(_", "k_", "*_", "YS", "QM", "IN", "US", "XS", "Q_", "+_", "XS", "QM", "IN", "US", "YS", "Q_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "XS", "QM", "IN", "US", "YS", "Q_", ")_", ")_", "/_", "(_", "2.0_", "*_", "XS", "QP", "LUS", "YS", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Plus", "\\u", "Off", "set", "XY_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Y", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "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 ", " _", "temp", "\\u", "x", "\\u", "sq_", "=_", "(_", "x", "\\u", "in_", "+_", "a_", ")_", "*_", "(_", "x", "\\u", "in_", "+_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "y", "\\u", "sq_", "=_", "(_", "y", "\\u", "in_", "+_", "b_", ")_", "*_", "(_", "y", "\\u", "in_", "+_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "(_", "k_", "*_", "(_", "temp", "\\u", "y", "\\u", "sq_", "-_", "temp", "\\u", "x", "\\u", "sq_", ")_", "+_", "(_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "/_", "(_", "2.0_", "*_", "(_", "temp", "\\u", "x", "\\u", "sq_", "+_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Roman", "Surf", "ace", "Plus", "\\u", "Scaled", "And", "Off", "set", "XY_", "(_", "pye", "q2_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", "._", "Model", "\\u", "3", "D", "\\u", "Base", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Calculat", "e", "Model", "Prediction", "s_", "(_", "self_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "X", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "in_", "=_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Y", "'_", "]_", "#", " ", "only", " ", "need", " ", "to", " ", "perform", " ", "this", " ", "dictionar", "y", " ", "look", "-", "up", " ", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "in", "Coeff", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "in", "Coeff", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "in", "Coeff", "s_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "in", "Coeff", "s_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "in", "Coeff", "s_", "[_", "4_", "]_", "\\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 ", " _", "temp", "\\u", "x", "\\u", "sq_", "=_", "(_", "a_", "*_", "x", "\\u", "in_", "+_", "b_", ")_", "*_", "(_", "a_", "*_", "x", "\\u", "in_", "+_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp", "\\u", "y", "\\u", "sq_", "=_", "(_", "c_", "*_", "y", "\\u", "in_", "+_", "d_", ")_", "*_", "(_", "c_", "*_", "y", "\\u", "in_", "+_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "temp_", "=_", "(_", "k_", "*_", "(_", "temp", "\\u", "y", "\\u", "sq_", "-_", "temp", "\\u", "x", "\\u", "sq_", ")_", "+_", "(_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", "*_", "numpy_", "._", "sqrt_", "(_", "k_", "*_", "k_", "-_", "temp", "\\u", "x", "\\u", "sq_", "-_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "/_", "(_", "2.0_", "*_", "(_", "temp", "\\u", "x", "\\u", "sq_", "+_", "temp", "\\u", "y", "\\u", "sq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "extend", "ed", "Version", "Handler_", "._", "Get", "Addition", "al", "Model", "Prediction", "s_", "(_", "temp_", ",_", "in", "Coeff", "s_", ",_", "in", "Data", "Cache", "Dictionary_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "ones_", "(_", "len_", "(_", "in", "Data", "Cache", "Dictionary_", "[_", "'", "Dependent", "Data", "'_", "]_", ")_", ")_", "*_", "1.0", "E3", "00_", "\\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,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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, 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 ]
Comparison of constants
babble/babble/include/jython/Lib/test/test_types.py
[ { "content": "# Python test set -- part 6, built-in types\n\nfrom test.test_support import *\n\nprint '6. Built-in types'\n\nprint '6.1 Truth value testing'\nif None: raise TestFailed, 'None is true instead of false'\nif 0: raise TestFailed, '0 is true instead of false'\nif 0L: raise TestFailed, '0L is true instead of false'\nif 0.0: raise TestFailed, '0.0 is true instead of false'\nif '': raise TestFailed, '\\'\\' is true instead of false'\nif not 1: raise TestFailed, '1 is false instead of true'\nif not 1L: raise TestFailed, '1L is false instead of true'\nif not 1.0: raise TestFailed, '1.0 is false instead of true'\nif not 'x': raise TestFailed, '\\'x\\' is false instead of true'\nif not {'x': 1}: raise TestFailed, '{\\'x\\': 1} is false instead of true'\nimport sys\nx = C()\nif not f: raise TestFailed, 'f is false instead of true'\nif not C: raise TestFailed, 'C is false instead of true'\nif not sys: raise TestFailed, 'sys is false instead of true'\nif not x: raise TestFailed, 'x is false instead of true'\n\nprint '6.2 Boolean operations'\nif 0 or 0: raise TestFailed, '0 or 0 is true instead of false'\nif 1 and 1: pass\nelse: raise TestFailed, '1 and 1 is false instead of true'\nif not 1: raise TestFailed, 'not 1 is true instead of false'\n\nprint '6.3 Comparisons'\nif 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass\nelse: raise TestFailed, 'int comparisons failed'\nif 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass\nelse: raise TestFailed, 'long int comparisons failed'\nif 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass\nelse: raise TestFailed, 'float comparisons failed'\nif '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass\nelse: raise TestFailed, 'string comparisons failed'\nif None is None: pass\nelse: raise TestFailed, 'identity test failed'\n\ntry: float('')\nexcept ValueError: pass\nelse: raise TestFailed, \"float('') didn't raise ValueError\"\n\ntry: float('5\\0')\nexcept ValueError: pass\nelse: raise TestFailed, \"float('5\\0') didn't raise ValueError\"\n\ntry: 5.0 / 0.0\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5.0 / 0.0 didn't raise ZeroDivisionError\"\n\ntry: 5.0 // 0.0\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5.0 // 0.0 didn't raise ZeroDivisionError\"\n\ntry: 5.0 % 0.0\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5.0 % 0.0 didn't raise ZeroDivisionError\"\n\ntry: 5 / 0L\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5 / 0L didn't raise ZeroDivisionError\"\n\ntry: 5 // 0L\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5 // 0L didn't raise ZeroDivisionError\"\n\ntry: 5 % 0L\nexcept ZeroDivisionError: pass\nelse: raise TestFailed, \"5 % 0L didn't raise ZeroDivisionError\"\n\nprint '6.4 Numeric types (mostly conversions)'\nif 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons'\nif 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons'\nif -1 != -1L or -1 != -1.0 or -1L != -1.0:\n raise TestFailed, 'int/long/float value not equal'\n# calling built-in types without argument must return 0\nif int() != 0: raise TestFailed, 'int() does not return 0'\nif long() != 0L: raise TestFailed, 'long() does not return 0L'\nif float() != 0.0: raise TestFailed, 'float() does not return 0.0'\nif int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass\nelse: raise TestFailed, 'int() does not round properly'\nif long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass\nelse: raise TestFailed, 'long() does not round properly'\nif float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass\nelse: raise TestFailed, 'float() does not work properly'\nprint '6.4.1 32-bit integers'\n# Ensure the first 256 integers are shared\na = 256\nb = 128*2\nif a is not b: raise TestFailed, '256 is not shared'\nif 12 + 24 != 36: raise TestFailed, 'int op'\nif 12 + (-24) != -12: raise TestFailed, 'int op'\nif (-12) + 24 != 12: raise TestFailed, 'int op'\nif (-12) + (-24) != -36: raise TestFailed, 'int op'\nif not 12 < 24: raise TestFailed, 'int op'\nif not -24 < -12: raise TestFailed, 'int op'\n# Test for a particular bug in integer multiply\nxsize, ysize, zsize = 238, 356, 4\nif not (xsize*ysize*zsize == zsize*xsize*ysize == 338912):\n raise TestFailed, 'int mul commutativity'\n# And another.\nm = -sys.maxint - 1\nfor divisor in 1, 2, 4, 8, 16, 32:\n j = m // divisor\n prod = divisor * j\n if prod != m:\n raise TestFailed, \"%r * %r == %r != %r\" % (divisor, j, prod, m)\n if type(prod) is not int:\n raise TestFailed, (\"expected type(prod) to be int, not %r\" %\n type(prod))\n# Check for expected * overflow to long.\nfor divisor in 1, 2, 4, 8, 16, 32:\n j = m // divisor - 1\n prod = divisor * j\n if type(prod) is not long:\n raise TestFailed, (\"expected type(%r) to be long, not %r\" %\n (prod, type(prod)))\n# Check for expected * overflow to long.\nm = sys.maxint\nfor divisor in 1, 2, 4, 8, 16, 32:\n j = m // divisor + 1\n prod = divisor * j\n if type(prod) is not long:\n raise TestFailed, (\"expected type(%r) to be long, not %r\" %\n (prod, type(prod)))\n\nprint '6.4.2 Long integers'\nif 12L + 24L != 36L: raise TestFailed, 'long op'\nif 12L + (-24L) != -12L: raise TestFailed, 'long op'\nif (-12L) + 24L != 12L: raise TestFailed, 'long op'\nif (-12L) + (-24L) != -36L: raise TestFailed, 'long op'\nif not 12L < 24L: raise TestFailed, 'long op'\nif not -24L < -12L: raise TestFailed, 'long op'\nx = sys.maxint\nif int(long(x)) != x: raise TestFailed, 'long op'\ntry: y = int(long(x)+1L)\nexcept OverflowError: raise TestFailed, 'long op'\nif not isinstance(y, long): raise TestFailed, 'long op'\nx = -x\nif int(long(x)) != x: raise TestFailed, 'long op'\nx = x-1\nif int(long(x)) != x: raise TestFailed, 'long op'\ntry: y = int(long(x)-1L)\nexcept OverflowError: raise TestFailed, 'long op'\nif not isinstance(y, long): raise TestFailed, 'long op'\n\ntry: 5 << -5\nexcept ValueError: pass\nelse: raise TestFailed, 'int negative shift <<'\n\ntry: 5L << -5L\nexcept ValueError: pass\nelse: raise TestFailed, 'long negative shift <<'\n\ntry: 5 >> -5\nexcept ValueError: pass\nelse: raise TestFailed, 'int negative shift >>'\n\ntry: 5L >> -5L\nexcept ValueError: pass\nelse: raise TestFailed, 'long negative shift >>'\n\nprint '6.4.3 Floating point numbers'\nif 12.0 + 24.0 != 36.0: raise TestFailed, 'float op'\nif 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op'\nif (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op'\nif (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op'\nif not 12.0 < 24.0: raise TestFailed, 'float op'\nif not -24.0 < -12.0: raise TestFailed, 'float op'\n\nprint '6.5 Sequence types'\n\nprint '6.5.1 Strings'\nif len('') != 0: raise TestFailed, 'len(\\'\\')'\nif len('a') != 1: raise TestFailed, 'len(\\'a\\')'\nif len('abcdef') != 6: raise TestFailed, 'len(\\'abcdef\\')'\nif 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation'\nif 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3'\nif 0*'abcde' != '': raise TestFailed, 'string repetition 0*'\nif min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string'\nif 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass\nelse: raise TestFailed, 'in/not in string'\nx = 'x'*103\nif '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug'\n\n#extended slices for strings\na = '0123456789'\nvereq(a[::], a)\nvereq(a[::2], '02468')\nvereq(a[1::2], '13579')\nvereq(a[::-1],'9876543210')\nvereq(a[::-2], '97531')\nvereq(a[3::-2], '31')\nvereq(a[-100:100:], a)\nvereq(a[100:-100:-1], a[::-1])\nvereq(a[-100L:100L:2L], '02468')\n\nif have_unicode:\n a = unicode('0123456789', 'ascii')\n vereq(a[::], a)\n vereq(a[::2], unicode('02468', 'ascii'))\n vereq(a[1::2], unicode('13579', 'ascii'))\n vereq(a[::-1], unicode('9876543210', 'ascii'))\n vereq(a[::-2], unicode('97531', 'ascii'))\n vereq(a[3::-2], unicode('31', 'ascii'))\n vereq(a[-100:100:], a)\n vereq(a[100:-100:-1], a[::-1])\n vereq(a[-100L:100L:2L], unicode('02468', 'ascii'))\n\n\nprint '6.5.2 Tuples [see test_tuple.py]'\n\nprint '6.5.3 Lists [see test_list.py]'\n\nprint '6.6 Mappings == Dictionaries [see test_dict.py]'\n\n\ntry: type(1, 2)\nexcept TypeError: pass\nelse: raise TestFailed, 'type(), w/2 args expected TypeError'\n\ntry: type(1, 2, 3, 4)\nexcept TypeError: pass\nelse: raise TestFailed, 'type(), w/4 args expected TypeError'\n\n# XXX: Jython lacks buffers\nprint 'Buffers'\nif not is_jython:\n try: buffer('asdf', -1)\n except ValueError: pass\n else: raise TestFailed, \"buffer('asdf', -1) should raise ValueError\"\n cmp(buffer(\"abc\"), buffer(\"def\")) # used to raise a warning: tp_compare didn't return -1, 0, or 1\n\n try: buffer(None)\n except TypeError: pass\n else: raise TestFailed, \"buffer(None) should raise TypeError\"\n\n a = buffer('asdf')\n hash(a)\n b = a * 5\n if a == b:\n raise TestFailed, 'buffers should not be equal'\n if str(b) != ('asdf' * 5):\n raise TestFailed, 'repeated buffer has wrong content'\n if str(a * 0) != '':\n raise TestFailed, 'repeated buffer zero times has wrong content'\n if str(a + buffer('def')) != 'asdfdef':\n raise TestFailed, 'concatenation of buffers yields wrong content'\n if str(buffer(a)) != 'asdf':\n raise TestFailed, 'composing buffers failed'\n if str(buffer(a, 2)) != 'df':\n raise TestFailed, 'specifying buffer offset failed'\n if str(buffer(a, 0, 2)) != 'as':\n raise TestFailed, 'specifying buffer size failed'\n if str(buffer(a, 1, 2)) != 'sd':\n raise TestFailed, 'specifying buffer offset and size failed'\n try: buffer(buffer('asdf', 1), -1)\n except ValueError: pass\n else: raise TestFailed, \"buffer(buffer('asdf', 1), -1) should raise ValueError\"\n if str(buffer(buffer('asdf', 0, 2), 0)) != 'as':\n raise TestFailed, 'composing length-specified buffer failed'\n if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as':\n raise TestFailed, 'composing length-specified buffer failed'\n if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as':\n raise TestFailed, 'composing length-specified buffer failed'\n if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's':\n raise TestFailed, 'composing length-specified buffer failed'\n\n try: a[1] = 'g'\n except TypeError: pass\n else: raise TestFailed, \"buffer assignment should raise TypeError\"\n\n try: a[0:1] = 'g'\n except TypeError: pass\n else: raise TestFailed, \"buffer slice assignment should raise TypeError\"\n\n # array.array() returns an object that does not implement a char buffer,\n # something which int() uses for conversion.\n import array\n try: int(buffer(array.array('c')))\n except TypeError :pass\n else: raise TestFailed, \"char buffer (at C level) not working\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "0 < 1 <= 1 == 1 >= 1 > 0 != 1:", "start_line": 33, "start_column": 3, "end_line": 33, "end_column": 32 }, { "span": "0L < 1L <= 1L == 1L >= 1L > 0L != 1L:", "start_line": 35, "start_column": 3, "end_line": 35, "end_column": 39 }, { "span": "0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0:", "start_line": 37, "start_column": 3, "end_line": 37, "end_column": 46 }, { "span": "'' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b':", "start_line": 39, "start_column": 3, "end_line": 39, "end_column": 47 }, { "span": "None is None:", "start_line": 41, "start_column": 3, "end_line": 41, "end_column": 15 }, { "span": "0 != 0L ", "start_line": 77, "start_column": 3, "end_line": 77, "end_column": 10 }, { "span": "0 != 0.0 ", "start_line": 77, "start_column": 14, "end_line": 77, "end_column": 22 }, { "span": "0L != 0.0:", "start_line": 77, "start_column": 26, "end_line": 77, "end_column": 35 }, { "span": "1 != 1L ", "start_line": 78, "start_column": 3, "end_line": 78, "end_column": 10 }, { "span": "1 != 1.0 ", "start_line": 78, "start_column": 14, "end_line": 78, "end_column": 22 }, { "span": "1L != 1.0:", "start_line": 78, "start_column": 26, "end_line": 78, "end_column": 35 }, { "span": "-1 != -1L ", "start_line": 79, "start_column": 3, "end_line": 79, "end_column": 12 }, { "span": "-1 != -1.0 ", "start_line": 79, "start_column": 16, "end_line": 79, "end_column": 26 }, { "span": "-1L != -1.0:", "start_line": 79, "start_column": 30, "end_line": 79, "end_column": 41 }, { "span": "12 + 24 != 36:", "start_line": 96, "start_column": 3, "end_line": 96, "end_column": 16 }, { "span": "12 + (-24) != -12:", "start_line": 97, "start_column": 3, "end_line": 97, "end_column": 20 }, { "span": "(-12) + 24 != 12:", "start_line": 98, "start_column": 3, "end_line": 98, "end_column": 19 }, { "span": "(-12) + (-24) != -36:", "start_line": 99, "start_column": 3, "end_line": 99, "end_column": 23 }, { "span": "12 < 24:", "start_line": 100, "start_column": 7, "end_line": 100, "end_column": 14 }, { "span": "-24 < -12:", "start_line": 101, "start_column": 7, "end_line": 101, "end_column": 16 }, { "span": "12L + 24L != 36L:", "start_line": 133, "start_column": 3, "end_line": 133, "end_column": 19 }, { "span": "12L + (-24L) != -12L:", "start_line": 134, "start_column": 3, "end_line": 134, "end_column": 23 }, { "span": "(-12L) + 24L != 12L:", "start_line": 135, "start_column": 3, "end_line": 135, "end_column": 22 }, { "span": "(-12L) + (-24L) != -36L:", "start_line": 136, "start_column": 3, "end_line": 136, "end_column": 26 }, { "span": "12L < 24L:", "start_line": 137, "start_column": 7, "end_line": 137, "end_column": 16 }, { "span": "-24L < -12L:", "start_line": 138, "start_column": 7, "end_line": 138, "end_column": 18 }, { "span": "12.0 + 24.0 != 36.0:", "start_line": 169, "start_column": 3, "end_line": 169, "end_column": 22 }, { "span": "12.0 + (-24.0) != -12.0:", "start_line": 170, "start_column": 3, "end_line": 170, "end_column": 26 }, { "span": "(-12.0) + 24.0 != 12.0:", "start_line": 171, "start_column": 3, "end_line": 171, "end_column": 25 }, { "span": "(-12.0) + (-24.0) != -36.0:", "start_line": 172, "start_column": 3, "end_line": 172, "end_column": 29 }, { "span": "12.0 < 24.0:", "start_line": 173, "start_column": 7, "end_line": 173, "end_column": 18 }, { "span": "-24.0 < -12.0:", "start_line": 174, "start_column": 7, "end_line": 174, "end_column": 20 }, { "span": "'xyz' + 'abcde' != 'xyzabcde':", "start_line": 182, "start_column": 3, "end_line": 182, "end_column": 32 }, { "span": "'xyz'*3 != 'xyzxyzxyz':", "start_line": 183, "start_column": 3, "end_line": 183, "end_column": 25 }, { "span": "0*'abcde' != '':", "start_line": 184, "start_column": 3, "end_line": 184, "end_column": 18 }, { "span": "'a' in 'abc' ", "start_line": 186, "start_column": 3, "end_line": 186, "end_column": 15 }, { "span": "'b' in 'abc' ", "start_line": 186, "start_column": 20, "end_line": 186, "end_column": 32 }, { "span": "'c' in 'abc' ", "start_line": 186, "start_column": 37, "end_line": 186, "end_column": 49 }, { "span": "'d' not in 'abc':", "start_line": 186, "start_column": 54, "end_line": 186, "end_column": 70 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "test", " ", "set", " ", "--", " ", "part", " ", "6", ",", " ", "bui", "lt", "-", "in", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test_", "._", "test\\u", "support_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6", ".", " ", "Bu", "ilt", "-", "in", " ", "types", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.1", " ", "Tru", "th", " ", "value", " ", "testi", "ng", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "None_", ":_", "raise_", "Test", "Failed_", ",_", "'", "Non", "e", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "0", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "0", "L", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "0.", "0", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "''_", ":_", "raise_", "Test", "Failed_", ",_", "'\\\\'", "\\\\'", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "1_", ":_", "raise_", "Test", "Failed_", ",_", "'", "1", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "1_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "1", "L", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "1.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "1.0", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "'", "x", "'_", ":_", "raise_", "Test", "Failed_", ",_", "'\\\\'", "x", "\\\\'", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "{_", "'", "x", "'_", ":_", "1_", "}_", ":_", "raise_", "Test", "Failed_", ",_", "'{", "\\\\'", "x", "\\\\':", " ", "1", "}", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "C_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "f_", ":_", "raise_", "Test", "Failed_", ",_", "'", "f", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "C_", ":_", "raise_", "Test", "Failed_", ",_", "'", "C", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sys_", ":_", "raise_", "Test", "Failed_", ",_", "'", "sys", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "x_", ":_", "raise_", "Test", "Failed_", ",_", "'", "x", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.2", " ", "Boo", "lean", " ", "operati", "ons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "or_", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "0", " ", "or", " ", "0", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "1_", "and_", "1_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "1", " ", "and", " ", "1", " ", "is", " ", "fal", "se", " ", "inst", "ead", " ", "of", " ", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "1_", ":_", "raise_", "Test", "Failed_", ",_", "'", "not", " ", "1", " ", "is", " ", "true", " ", "inst", "ead", " ", "of", " ", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.3", " ", "Compari", "sons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "<_", "1_", "<=_", "1_", "==_", "1_", ">=_", "1_", ">_", "0_", "!=_", "1_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "comparisons", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "L_", "<_", "1_", "L_", "<=_", "1_", "L_", "==_", "1_", "L_", ">=_", "1_", "L_", ">_", "0_", "L_", "!=_", "1_", "L_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "int", " ", "comparisons", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0.0_", "<_", "1.0_", "<=_", "1.0_", "==_", "1.0_", ">=_", "1.0_", ">_", "0.0_", "!=_", "1.0_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "comparisons", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "''_", "<_", "'", "a", "'_", "<=_", "'", "a", "'_", "==_", "'", "a", "'_", "<_", "'", "abc", "'_", "<_", "'", "abd", "'_", "<_", "'", "b", "'_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "string", " ", "comparisons", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "None_", "is_", "None_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "identi", "ty", " ", "test", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "float_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "float", "(''", ")", " ", "did", "n", "'", "t", " ", "raise", " ", "Value", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "float_", "(_", "'", "5", "\\\\", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "float", "('", "5", "\\\\", "0", "')", " ", "did", "n", "'", "t", " ", "raise", " ", "Value", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5.0_", "/_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5.0", " ", "/", " ", "0.", "0", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5.0_", "//_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5.0", " ", "//", " ", "0.", "0", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5.0_", "%_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5.0", " ", "%", " ", "0.", "0", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "/_", "0_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5", " ", "/", " ", "0", "L", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "//_", "0_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5", " ", "//", " ", "0", "L", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "%_", "0_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "5", " ", "%", " ", "0", "L", " ", "did", "n", "'", "t", " ", "raise", " ", "Zero", "Divis", "ion", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.4", " ", "Numer", "ic", " ", "types", " ", "(", "most", "ly", " ", "conversions", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "!=_", "0_", "L_", "or_", "0_", "!=_", "0.0_", "or_", "0_", "L_", "!=_", "0.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "mixed", " ", "comparisons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "1_", "!=_", "1_", "L_", "or_", "1_", "!=_", "1.0_", "or_", "1_", "L_", "!=_", "1.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "mixed", " ", "comparisons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", "!=_", "-_", "1_", "L_", "or_", "-_", "1_", "!=_", "-_", "1.0_", "or_", "-_", "1_", "L_", "!=_", "-_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "int", "/", "long", "/", "float", " ", "value", " ", "not", " ", "equal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "calling", " ", "bui", "lt", "-", "in", " ", "types", " ", "with", "out", " ", "argu", "ment", " ", "must", " ", "return", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "int_", "(_", ")_", "!=_", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", "()", " ", "doe", "s", " ", "not", " ", "return", " ", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "long_", "(_", ")_", "!=_", "0_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", "()", " ", "doe", "s", " ", "not", " ", "return", " ", "0", "L", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "float_", "(_", ")_", "!=_", "0.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", "()", " ", "doe", "s", " ", "not", " ", "return", " ", "0.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "1.9", "_", ")_", "==_", "1_", "==_", "int_", "(_", "1.1_", ")_", "and_", "int_", "(_", "-_", "1.1_", ")_", "==_", "-_", "1_", "==_", "int_", "(_", "-_", "1.9", "_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", "()", " ", "doe", "s", " ", "not", " ", "round", " ", "proper", "ly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "long_", "(_", "1.9", "_", ")_", "==_", "1_", "L_", "==_", "long_", "(_", "1.1_", ")_", "and_", "long_", "(_", "-_", "1.1_", ")_", "==_", "-_", "1_", "L_", "==_", "long_", "(_", "-_", "1.9", "_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", "()", " ", "doe", "s", " ", "not", " ", "round", " ", "proper", "ly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "float_", "(_", "1_", ")_", "==_", "1.0_", "and_", "float_", "(_", "-_", "1_", ")_", "==_", "-_", "1.0_", "and_", "float_", "(_", "0_", ")_", "==_", "0.0_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", "()", " ", "doe", "s", " ", "not", " ", "work", " ", "proper", "ly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "6.4", ".1", " ", "32", "-", "bit", " ", "integ", "ers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "the", " ", "first", " ", "256", " ", "integ", "ers", " ", "are", " ", "shared_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "128_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "is_", "not_", "b_", ":_", "raise_", "Test", "Failed_", ",_", "'", "256", " ", "is", " ", "not", " ", "shared", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12_", "+_", "24_", "!=_", "36_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12_", "+_", "(_", "-_", "24_", ")_", "!=_", "-_", "12_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12_", ")_", "+_", "24_", "!=_", "12_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12_", ")_", "+_", "(_", "-_", "24_", ")_", "!=_", "-_", "36_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "12_", "<_", "24_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "-_", "24_", "<_", "-_", "12_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "for", " ", "a", " ", "partic", "ular", " ", "bug", " ", "in", " ", "integ", "er", " ", "multiply_", "\\u\\u\\uNL\\u\\u\\u_", "xsize_", ",_", "ysize", "_", ",_", "zs", "ize_", "=_", "238_", ",_", "356", "_", ",_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "xsize_", "*_", "ysize", "_", "*_", "zs", "ize_", "==_", "zs", "ize_", "*_", "xsize_", "*_", "ysize", "_", "==_", "338", "912", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "mul", " ", "commu", "tati", "vity", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "And", " ", "anot", "her", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "-_", "sys_", "._", "maxint_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "divisor_", "in_", "1_", ",_", "2_", ",_", "4_", ",_", "8_", ",_", "16_", ",_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "m_", "//_", "divisor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod_", "=_", "divisor_", "*_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prod_", "!=_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "\"%", "r", " ", "*", " ", "%", "r", " ", "==", " ", "%", "r", " ", "!=", " ", "%", "r", "\"_", "%_", "(_", "divisor_", ",_", "j_", ",_", "prod_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "prod_", ")_", "is_", "not_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "(_", "\"", "expected", " ", "type", "(", "prod", ")", " ", "to", " ", "be", " ", "int", ",", " ", "not", " ", "%", "r", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "prod_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "expected", " ", "*", " ", "overflow", " ", "to", " ", "long", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "divisor_", "in_", "1_", ",_", "2_", ",_", "4_", ",_", "8_", ",_", "16_", ",_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "m_", "//_", "divisor_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod_", "=_", "divisor_", "*_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "prod_", ")_", "is_", "not_", "long_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "(_", "\"", "expected", " ", "type", "(%", "r", ")", " ", "to", " ", "be", " ", "long", ",", " ", "not", " ", "%", "r", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "prod_", ",_", "type_", "(_", "prod_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "expected", " ", "*", " ", "overflow", " ", "to", " ", "long", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "sys_", "._", "maxint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "divisor_", "in_", "1_", ",_", "2_", ",_", "4_", ",_", "8_", ",_", "16_", ",_", "32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "m_", "//_", "divisor_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prod_", "=_", "divisor_", "*_", "j_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "prod_", ")_", "is_", "not_", "long_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "(_", "\"", "expected", " ", "type", "(%", "r", ")", " ", "to", " ", "be", " ", "long", ",", " ", "not", " ", "%", "r", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "prod_", ",_", "type_", "(_", "prod_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "6.4", ".2", " ", "Long", " ", "integ", "ers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12_", "L_", "+_", "24_", "L_", "!=_", "36_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12_", "L_", "+_", "(_", "-_", "24_", "L_", ")_", "!=_", "-_", "12_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12_", "L_", ")_", "+_", "24_", "L_", "!=_", "12_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12_", "L_", ")_", "+_", "(_", "-_", "24_", "L_", ")_", "!=_", "-_", "36_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "12_", "L_", "<_", "24_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "-_", "24_", "L_", "<_", "-_", "12_", "L_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "sys_", "._", "maxint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "long_", "(_", "x_", ")_", ")_", "!=_", "x_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "y_", "=_", "int_", "(_", "long_", "(_", "x_", ")_", "+_", "1_", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Over", "flow", "Error_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "y_", ",_", "long_", ")_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "-_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "long_", "(_", "x_", ")_", ")_", "!=_", "x_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "x_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "long_", "(_", "x_", ")_", ")_", "!=_", "x_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "y_", "=_", "int_", "(_", "long_", "(_", "x_", ")_", "-_", "1_", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Over", "flow", "Error_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "y_", ",_", "long_", ")_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "<<_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "negati", "ve", " ", "shift", " ", "<<", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "L_", "<<_", "-_", "5_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "negati", "ve", " ", "shift", " ", "<<", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", ">>_", "-_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "int", " ", "negati", "ve", " ", "shift", " ", ">>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "5_", "L_", ">>_", "-_", "5_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "long", " ", "negati", "ve", " ", "shift", " ", ">>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.4", ".3", " ", "Float", "ing", " ", "point", " ", "numbers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12.0_", "+_", "24.0", "_", "!=_", "36.", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "12.0_", "+_", "(_", "-_", "24.0", "_", ")_", "!=_", "-_", "12.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12.0_", ")_", "+_", "24.0", "_", "!=_", "12.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "-_", "12.0_", ")_", "+_", "(_", "-_", "24.0", "_", ")_", "!=_", "-_", "36.", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "12.0_", "<_", "24.0", "_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "-_", "24.0", "_", "<_", "-_", "12.0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "float", " ", "op", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.5", " ", "Sequ", "ence", " ", "types", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.5", ".1", " ", "String", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "''_", ")_", "!=_", "0_", ":_", "raise_", "Test", "Failed_", ",_", "'", "len", "(\\\\'", "\\\\')", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "'", "a", "'_", ")_", "!=_", "1_", ":_", "raise_", "Test", "Failed_", ",_", "'", "len", "(\\\\'", "a", "\\\\')", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "'", "abcde", "f", "'_", ")_", "!=_", "6_", ":_", "raise_", "Test", "Failed_", ",_", "'", "len", "(\\\\'", "abcde", "f", "\\\\')", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "xyz", "'_", "+_", "'", "abcde", "'_", "!=_", "'", "xyz", "abcde", "'_", ":_", "raise_", "Test", "Failed_", ",_", "'", "string", " ", "concate", "nati", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "xyz", "'_", "*_", "3_", "!=_", "'", "xyz", "xyz", "xyz", "'_", ":_", "raise_", "Test", "Failed_", ",_", "'", "string", " ", "repetition", " ", "*", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "*_", "'", "abcde", "'_", "!=_", "''_", ":_", "raise_", "Test", "Failed_", ",_", "'", "string", " ", "repetition", " ", "0", "*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min_", "(_", "'", "abc", "'_", ")_", "!=_", "'", "a", "'_", "or_", "max_", "(_", "'", "abc", "'_", ")_", "!=_", "'", "c", "'_", ":_", "raise_", "Test", "Failed_", ",_", "'", "min", "/", "max", " ", "string", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "a", "'_", "in_", "'", "abc", "'_", "and_", "'", "b", "'_", "in_", "'", "abc", "'_", "and_", "'", "c", "'_", "in_", "'", "abc", "'_", "and_", "'", "d", "'_", "not_", "in_", "'", "abc", "'_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "in", "/", "not", " ", "in", " ", "string", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "'", "x", "'_", "*_", "103_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'%", "s", "!'_", "%_", "x_", "!=_", "x_", "+_", "'!'_", ":_", "raise_", "Test", "Failed_", ",_", "'", "nas", "ty", " ", "string", " ", "format", "ting", " ", "bug", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "extend", "ed", " ", "slice", "s", " ", "for", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "'", "0123456", "789", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "]_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "2_", "]_", ",_", "'", "024", "6", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "1_", ":_", ":_", "2_", "]_", ",_", "'", "135", "7", "9", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "'", "9876", "5432", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "-_", "2_", "]_", ",_", "'", "975", "3", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "3_", ":_", ":_", "-_", "2_", "]_", ",_", "'", "3", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "-_", "100_", ":_", "100_", ":_", "]_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "100_", ":_", "-_", "100_", ":_", "-_", "1_", "]_", ",_", "a_", "[_", ":_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "-_", "100_", "L_", ":_", "100_", "L_", ":_", "2_", "L_", "]_", ",_", "'", "024", "6", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "have", "\\u", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "unicode_", "(_", "'", "0123456", "789", "'_", ",_", "'", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "]_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "2_", "]_", ",_", "unicode_", "(_", "'", "024", "6", "8", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "1_", ":_", ":_", "2_", "]_", ",_", "unicode_", "(_", "'", "135", "7", "9", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "unicode_", "(_", "'", "9876", "5432", "10", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", ":_", ":_", "-_", "2_", "]_", ",_", "unicode_", "(_", "'", "975", "3", "1", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "3_", ":_", ":_", "-_", "2_", "]_", ",_", "unicode_", "(_", "'", "3", "1", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "-_", "100_", ":_", "100_", ":_", "]_", ",_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "100_", ":_", "-_", "100_", ":_", "-_", "1_", "]_", ",_", "a_", "[_", ":_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vere", "q_", "(_", "a_", "[_", "-_", "100_", "L_", ":_", "100_", "L_", ":_", "2_", "L_", "]_", ",_", "unicode_", "(_", "'", "024", "6", "8", "'_", ",_", "'", "ascii", "'_", ")_", ")_", "\\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_", "'", "6.5", ".2", " ", "Tuples", " ", "[", "see", " ", "test\\u", "tuple", ".", "py", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.5", ".3", " ", "List", "s", " ", "[", "see", " ", "test\\u", "list", ".", "py", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "6.6", " ", "Mappings", " ", "==", " ", "Dict", "ionar", "ies", " ", "[", "see", " ", "test\\u", "dict", ".", "py", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "type_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "type", "()", ",", " ", "w", "/", "2", " ", "args", " ", "expected", " ", "Type", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "type_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "'", "type", "()", ",", " ", "w", "/", "4", " ", "args", " ", "expected", " ", "Type", "Error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "Jy", "tho", "n", " ", "lack", "s", " ", "buffers_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Buffers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "jy", "tho", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "buffer", "('", "asd", "f", "',", " ", "-1", ")", " ", "shou", "ld", " ", "raise", " ", "Value", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmp_", "(_", "buffer_", "(_", "\"", "abc", "\"_", ")_", ",_", "buffer_", "(_", "\"", "def", "\"_", ")_", ")_", "#", " ", "used", " ", "to", " ", "raise", " ", "a", " ", "warn", "ing", ":", " ", "tp", "\\u", "compare", " ", "did", "n", "'", "t", " ", "return", " ", "-1", ",", " ", "0", ",", " ", "or", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "buffer_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "buffer", "(", "Non", "e", ")", " ", "shou", "ld", " ", "raise", " ", "Type", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "buffer_", "(_", "'", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "a_", "*_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "==_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "buffer", "s", " ", "shou", "ld", " ", "not", " ", "be", " ", "equal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "b_", ")_", "!=_", "(_", "'", "asd", "f", "'_", "*_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "repeated", " ", "buffer", " ", "has", " ", "wrong", " ", "content", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "a_", "*_", "0_", ")_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "repeated", " ", "buffer", " ", "zero", " ", "times", " ", "has", " ", "wrong", " ", "content", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "a_", "+_", "buffer_", "(_", "'", "def", "'_", ")_", ")_", "!=_", "'", "asd", "fde", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "concate", "nati", "on", " ", "of", " ", "buffer", "s", " ", "yield", "s", " ", "wrong", " ", "content", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "a_", ")_", ")_", "!=_", "'", "asd", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "composi", "ng", " ", "buffer", "s", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "a_", ",_", "2_", ")_", ")_", "!=_", "'", "df", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "speci", "fy", "ing", " ", "buffer", " ", "offset", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "a_", ",_", "0_", ",_", "2_", ")_", ")_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "speci", "fy", "ing", " ", "buffer", " ", "size", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "a_", ",_", "1_", ",_", "2_", ")_", ")_", "!=_", "'", "sd", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "speci", "fy", "ing", " ", "buffer", " ", "offset", " ", "and", " ", "size", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "buffer_", "(_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "1_", ")_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "buffer", "(", "buffer", "('", "asd", "f", "',", " ", "1", "),", " ", "-1", ")", " ", "shou", "ld", " ", "raise", " ", "Value", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "0_", ",_", "2_", ")_", ",_", "0_", ")_", ")_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "composi", "ng", " ", "length", "-", "specified", " ", "buffer", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "0_", ",_", "2_", ")_", ",_", "0_", ",_", "5000_", ")_", ")_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "composi", "ng", " ", "length", "-", "specified", " ", "buffer", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "0_", ",_", "2_", ")_", ",_", "0_", ",_", "-_", "1_", ")_", ")_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "composi", "ng", " ", "length", "-", "specified", " ", "buffer", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "str_", "(_", "buffer_", "(_", "buffer_", "(_", "'", "asd", "f", "'_", ",_", "0_", ",_", "2_", ")_", ",_", "1_", ",_", "2_", ")_", ")_", "!=_", "'", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Test", "Failed_", ",_", "'", "composi", "ng", " ", "length", "-", "specified", " ", "buffer", " ", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "a_", "[_", "1_", "]_", "=_", "'", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "buffer", " ", "assign", "ment", " ", "shou", "ld", " ", "raise", " ", "Type", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "a_", "[_", "0_", ":_", "1_", "]_", "=_", "'", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "buffer", " ", "slice", " ", "assign", "ment", " ", "shou", "ld", " ", "raise", " ", "Type", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "array", ".", "array", "()", " ", "return", "s", " ", "an", " ", "object", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "implement", " ", "a", " ", "char", " ", "buffer", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "whi", "ch", " ", "int", "()", " ", "use", "s", " ", "for", " ", "conve", "rsi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "int_", "(_", "buffer_", "(_", "array_", "._", "array_", "(_", "'", "c", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Type", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "raise_", "Test", "Failed_", ",_", "\"", "char", " ", "buffer", " ", "(", "at", " ", "C", " ", "level", ")", " ", "not", " ", "working", "\"_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Except block handles 'BaseException'
enthought/traits/traits/traits.py
[ { "content": "def _default_value_type ( default_value ):\n try:\n return DefaultValueSpecial.index( default_value ) + 1\n except:\n try:\n return DefaultValueTypes.index( type( default_value ) ) + 3\n except:\n return 0", "metadata": "root._default_value_type", "header": "['module', '___EOS___']", "index": 458 }, { "content": " def define ( self, *value_type, **metadata ):\n default_value_type = -1\n default_value = handler = clone = None\n\n if len( value_type ) > 0:\n default_value = value_type[0]\n value_type = value_type[1:]\n\n if ((len( value_type ) == 0) and\n (type( default_value ) in SequenceTypes)):\n default_value, value_type = default_value[0], default_value\n\n if len( value_type ) == 0:\n default_value = try_trait_cast( default_value )\n\n if default_value in PythonTypes:\n handler = TraitCoerceType( default_value )\n default_value = DefaultValues.get( default_value )\n\n elif isinstance( default_value, CTrait ):\n clone = default_value\n default_value_type, default_value = clone.default_value()\n metadata[ 'type' ] = clone.type\n\n elif isinstance( default_value, TraitHandler ):\n handler = default_value\n default_value = None\n\n elif default_value is ThisClass:\n handler = ThisClass()\n default_value = None\n\n else:\n typeValue = type( default_value )\n\n if isinstance(default_value, basestring):\n string_options = self.extract( metadata, 'min_len',\n 'max_len', 'regex' )\n if len( string_options ) == 0:\n handler = TraitCastType( typeValue )\n else:\n handler = TraitString( **string_options )\n\n elif typeValue in TypeTypes:\n handler = TraitCastType( typeValue )\n\n else:\n metadata.setdefault( 'instance_handler',\n '_instance_changed_handler' )\n handler = TraitInstance( default_value )\n if default_value is handler.aClass:\n default_value = DefaultValues.get( default_value )\n else:\n enum = []\n other = []\n map = {}\n self.do_list( value_type, enum, map, other )\n\n if (((len( enum ) == 1) and (enum[0] is None)) and\n ((len( other ) == 1) and\n isinstance( other[0], TraitInstance ))):\n enum = []\n other[0].allow_none()\n metadata.setdefault( 'instance_handler',\n '_instance_changed_handler' )\n if len( enum ) > 0:\n if (((len( map ) + len( other )) == 0) and\n (default_value not in enum)):\n enum.insert( 0, default_value )\n\n other.append( TraitEnum( enum ) )\n\n if len( map ) > 0:\n other.append( TraitMap( map ) )\n\n if len( other ) == 0:\n handler = TraitHandler()\n\n elif len( other ) == 1:\n handler = other[0]\n if isinstance( handler, CTrait ):\n clone, handler = handler, None\n metadata[ 'type' ] = clone.type\n\n elif isinstance( handler, TraitInstance ):\n metadata.setdefault( 'instance_handler',\n '_instance_changed_handler' )\n\n if default_value is None:\n handler.allow_none()\n\n elif isinstance( default_value, _InstanceArgs ):\n default_value_type = 7\n default_value = ( handler.create_default_value,\n default_value.args, default_value.kw )\n\n elif (len( enum ) == 0) and (len( map ) == 0):\n aClass = handler.aClass\n typeValue = type( default_value )\n\n if typeValue is dict:\n default_value_type = 7\n default_value = ( aClass, (), default_value )\n elif not isinstance( default_value, aClass ):\n if typeValue is not tuple:\n default_value = ( default_value, )\n default_value_type = 7\n default_value = ( aClass, default_value, None )\n else:\n for i, item in enumerate( other ):\n if isinstance( item, CTrait ):\n if item.type != 'trait':\n raise TraitError, (\"Cannot create a complex \"\n \"trait containing %s trait.\" %\n add_article( item.type ) )\n handler = item.handler\n if handler is None:\n break\n other[i] = handler\n else:\n handler = TraitCompound( other )\n\n # Save the results:\n self.handler = handler\n self.clone = clone\n\n if default_value_type < 0:\n if isinstance( default_value, Default ):\n default_value_type = 7\n default_value = default_value.default_value\n else:\n if (handler is None) and (clone is not None):\n handler = clone.handler\n\n if handler is not None:\n default_value_type = handler.default_value_type\n if default_value_type < 0:\n try:\n default_value = handler.validate( None, '',\n default_value )\n except:\n pass\n\n if default_value_type < 0:\n default_value_type = _default_value_type( default_value )\n\n self.default_value_type = default_value_type\n self.default_value = default_value\n self.metadata = metadata.copy()", "metadata": "root._TraitMaker.define", "header": "['class', '_TraitMaker', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '# Ctrait type map for special trait types:', '___NL___', '___EOS___']", "index": 758 } ]
[ { "span": "except:", "start_line": 461, "start_column": 4, "end_line": 461, "end_column": 11 }, { "span": "except:", "start_line": 464, "start_column": 8, "end_line": 464, "end_column": 15 }, { "span": "except:", "start_line": 898, "start_column": 24, "end_line": 898, "end_column": 31 } ]
[]
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", "default", "\\u", "value", "\\u", "type_", "(_", "default", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Default", "Value", "Special", "_", "._", "index_", "(_", "default", "\\u", "value_", ")_", "+_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Default", "Value", "Types_", "._", "index_", "(_", "type_", "(_", "default", "\\u", "value_", ")_", ")_", "+_", "3_", "\\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_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Trait", "Maker_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ct", "rai", "t", " ", "type", " ", "map", " ", "for", " ", "special", " ", "tra", "it", " ", "types", ":_", "\\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_", "define_", "(_", "self_", ",_", "*_", "value", "\\u", "type_", ",_", "**_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "value", "\\u", "type_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "handler_", "=_", "clone_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "value", "\\u", "type_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "value_", "=_", "value", "\\u", "type_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "type_", "=_", "value", "\\u", "type_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "(_", "len_", "(_", "value", "\\u", "type_", ")_", "==_", "0_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "type_", "(_", "default", "\\u", "value_", ")_", "in_", "Sequ", "ence", "Types_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "value_", ",_", "value", "\\u", "type_", "=_", "default", "\\u", "value_", "[_", "0_", "]_", ",_", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value", "\\u", "type_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "value_", "=_", "try", "\\u", "tra", "it", "\\u", "cast_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "default", "\\u", "value_", "in_", "Pyth", "on", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "Trait", "Coe", "rce", "Type_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "Default", "Values_", "._", "get_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "CT", "rai", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "clone_", "=_", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value", "\\u", "type_", ",_", "default", "\\u", "value_", "=_", "clone_", "._", "default", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "type", "'_", "]_", "=_", "clone_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "Trait", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "default", "\\u", "value_", "is_", "Thi", "s", "Class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "Thi", "s", "Class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "None_", "\\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 ", " ", "_", "type", "Value_", "=_", "type_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "string", "\\u", "options_", "=_", "self_", "._", "extract_", "(_", "metadata_", ",_", "'", "min", "\\u", "len", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "len", "'_", ",_", "'", "regex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "string", "\\u", "options_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "=_", "Trait", "Cast", "Type_", "(_", "type", "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 ", " ", " _", "handler_", "=_", "Trait", "String_", "(_", "**_", "string", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type", "Value_", "in_", "Type", "Types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "=_", "Trait", "Cast", "Type_", "(_", "type", "Value_", ")_", "\\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 ", " ", " _", "metadata_", "._", "setdefault_", "(_", "'", "instance", "\\u", "handler", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "instance", "\\u", "change", "d\\u", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Trait", "Instance_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "default", "\\u", "value_", "is_", "handler_", "._", "a", "Class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default", "\\u", "value_", "=_", "Default", "Values_", "._", "get_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enum_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "\\u", "list_", "(_", "value", "\\u", "type_", ",_", "enum_", ",_", "map_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "(_", "(_", "len_", "(_", "enum_", ")_", "==_", "1_", ")_", "and_", "(_", "enum_", "[_", "0_", "]_", "is_", "None_", ")_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "len_", "(_", "other_", ")_", "==_", "1_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "other_", "[_", "0_", "]_", ",_", "Trait", "Instance_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "enum_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other_", "[_", "0_", "]_", "._", "allow", "\\u", "none_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "setdefault_", "(_", "'", "instance", "\\u", "handler", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "instance", "\\u", "change", "d\\u", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "enum_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "(_", "(_", "len_", "(_", "map_", ")_", "+_", "len_", "(_", "other_", ")_", ")_", "==_", "0_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "default", "\\u", "value_", "not_", "in_", "enum_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "enum_", "._", "insert_", "(_", "0_", ",_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "other_", "._", "append_", "(_", "Trait", "Enum_", "(_", "enum_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "map_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "other_", "._", "append_", "(_", "Trait", "Map_", "(_", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "other_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "Trait", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "other_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "other_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "handler_", ",_", "CT", "rai", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "clone_", ",_", "handler_", "=_", "handler_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "type", "'_", "]_", "=_", "clone_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "handler_", ",_", "Trait", "Instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "metadata_", "._", "setdefault_", "(_", "'", "instance", "\\u", "handler", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "instance", "\\u", "change", "d\\u", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "default", "\\u", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "._", "allow", "\\u", "none_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "\\u", "Insta", "nce", "Args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default", "\\u", "value", "\\u", "type_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "(_", "handler_", "._", "create", "\\u", "default", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "value_", "._", "args_", ",_", "default", "\\u", "value_", "._", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "len_", "(_", "enum_", ")_", "==_", "0_", ")_", "and_", "(_", "len_", "(_", "map_", ")_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "a", "Class_", "=_", "handler_", "._", "a", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "Value_", "=_", "type_", "(_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type", "Value_", "is_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default", "\\u", "value", "\\u", "type_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "(_", "a", "Class_", ",_", "(_", ")_", ",_", "default", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "a", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "type", "Value_", "is_", "not_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default", "\\u", "value_", "=_", "(_", "default", "\\u", "value_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default", "\\u", "value", "\\u", "type_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "(_", "a", "Class_", ",_", "default", "\\u", "value_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "i_", ",_", "item_", "in_", "enumerate_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "item_", ",_", "CT", "rai", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "item_", "._", "type_", "!=_", "'", "tra", "it", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Trait", "Error_", ",_", "(_", "\"", "Cann", "ot", " ", "create", " ", "a", " ", "complex", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tra", "it", " ", "contain", "ing", " ", "%", "s", " ", "tra", "it", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "article_", "(_", "item_", "._", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "handler_", "=_", "item_", "._", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handler_", "is_", "None_", ":_", "\\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_", "other_", "[_", "i_", "]_", "=_", "handler_", "\\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 ", " ", " _", "handler_", "=_", "Trait", "Compo", "und_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "results", ":_", "\\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_", "._", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clone_", "=_", "clone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "default", "\\u", "value", "\\u", "type_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "default", "\\u", "value_", ",_", "Default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "value", "\\u", "type_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "value_", "=_", "default", "\\u", "value_", "._", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "handler_", "is_", "None_", ")_", "and_", "(_", "clone_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler_", "=_", "clone_", "._", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "handler_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "default", "\\u", "value", "\\u", "type_", "=_", "handler_", "._", "default", "\\u", "value", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "default", "\\u", "value", "\\u", "type_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "default", "\\u", "value_", "=_", "handler_", "._", "validate_", "(_", "None_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "default", "\\u", "value", "\\u", "type_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "default", "\\u", "value", "\\u", "type_", "=_", "\\u", "default", "\\u", "value", "\\u", "type_", "(_", "default", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "default", "\\u", "value", "\\u", "type_", "=_", "default", "\\u", "value", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "value_", "=_", "default", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metadata_", "=_", "metadata_", "._", "copy_", "(_", ")_", "\\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, 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, 0, 1, 1, 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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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, 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 ]
Missing call to `__init__` during object initialization
StackHut/stackhut/stackhut_toolkit/common/barrister/runtime.py
[ { "content": "class RpcException(Exception, json.JSONEncoder):\n \"\"\"\n Represents a JSON-RPC style exception. Server implementations should raise this\n exception if they wish to communicate error codes back to Barrister clients.\n \"\"\"\n\n", "metadata": "root.RpcException", "header": "['module', '___EOS___']", "index": 104 }, { "content": " def __init__(self, code, msg=\"\", data=None):\n \"\"\"\n Creates a new RpcException\n\n :Parameters:\n code\n Integer representing the error type. Applications may use any positive integer.\n msg\n Human readable description of the error\n data\n Optional extra info about the error. Should be a string, int, or list or dict of strings/ints\n \"\"\"\n self.code = code\n self.msg = msg\n self.data = data", "metadata": "root.RpcException.__init__", "header": "['class', 'RpcException', '(', 'Exception', ',', 'json', '.', 'JSONEncoder', ')', ':', '___EOS___']", "index": 110 } ]
[ { "span": "class RpcException(Exception, json.JSONEncoder):", "start_line": 104, "start_column": 0, "end_line": 104, "end_column": 48 } ]
[ { "span": "def __init__(self, code, msg=\"\", data=None):", "start_line": 110, "start_column": 4, "end_line": 110, "end_column": 48 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Rp", "c", "Exception_", "(_", "Exception_", ",_", "json_", "._", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Represent", "s", " ", "a", " ", "JSO", "N", "-", "RP", "C", " ", "style", " ", "exception", ".", " ", " ", "Server", " ", "implementation", "s", " ", "shou", "ld", " ", "raise", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "if", " ", "the", "y", " ", "wish", " ", "to", " ", "communi", "cate", " ", "error", " ", "codes", " ", "back", " ", "to", " ", "Barri", "ster", " ", "clients", ".", "\\", "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_", "Rp", "c", "Exception_", "(_", "Exception_", ",_", "json_", "._", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "code_", ",_", "msg_", "=_", "\"\"_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "Rp", "c", "Except", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", "code", "\\", "10", ";", " ", " ", " ", " ", "Integer", " ", "represent", "ing", " ", "the", " ", "error", " ", "type", ".", " ", "Applica", "tion", "s", " ", "may", " ", "use", " ", "any", " ", "posit", "ive", " ", "integ", "er", ".", "\\", "10", ";", " ", " ", "msg", "\\", "10", ";", " ", " ", " ", " ", "Huma", "n", " ", "reada", "ble", " ", "description", " ", "of", " ", "the", " ", "error", "\\", "10", ";", " ", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", " ", "extra", " ", "info", " ", "abo", "ut", " ", "the", " ", "error", ".", " ", "Sho", "ul", "d", " ", "be", " ", "a", " ", "string", ",", " ", "int", ",", " ", "or", " ", "list", " ", "or", " ", "dict", " ", "of", " ", "string", "s", "/", "ints", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "=_", "ms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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sisl/Chimp/chimp/memories/__init__.py
[ { "content": "''' Implements Experience Replay Memory '''\n\nfrom replay_memory import ReplayMemoryHDF5\nfrom memory import ReplayMemory", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from replay_memory import ReplayMemoryHDF5", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 42 }, { "span": "from memory import ReplayMemory", "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_", "'''", " ", "Impl", "ement", "s", " ", "Experience", " ", "Repl", "ay", " ", "Memo", "ry", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "repla", "y", "\\u", "memory_", "import_", "Repl", "ay", "Memo", "ry", "HDF", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "memory_", "import_", "Repl", "ay", "Memory_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
Cimpress-MCP/JustReleaseNotes/tests/issuers/AggregateIssuer_Test.py
[ { "content": "import unittest\nimport mock\nfrom mock import patch\nfrom JustReleaseNotes.issuers import GitHubIssues\nimport requests\nimport requests_mock\nimport JustReleaseNotes.issuers.AggregateIssuer\n\n\n\n\nif __name__ == '__main__':\n unittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DummyIssuer:\n\n __ret = None\n\n\n", "metadata": "root.DummyIssuer", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, value):\n self.__ret = value", "metadata": "root.DummyIssuer.__init__", "header": "['class', 'DummyIssuer', ':', '___EOS___']", "index": 12 }, { "content": " def extractTicketsFromMessage(self, message):\n return [self.__ret] if self.__ret in message else [\"NULL\"]", "metadata": "root.DummyIssuer.extractTicketsFromMessage", "header": "['class', 'DummyIssuer', ':', '___EOS___']", "index": 15 }, { "content": " def getTicketInfo(self, ticket):\n if self.__ret == ticket:\n return { \"ticket\" : self.__ret, \"title\" : \"Title of \" + self.__ret }\n else:\n raise", "metadata": "root.DummyIssuer.getTicketInfo", "header": "['class', 'DummyIssuer', ':', '___EOS___']", "index": 18 }, { "content": "class GitHubIssues_Test(unittest.TestCase):\n\n\n", "metadata": "root.GitHubIssues_Test", "header": "['module', '___EOS___']", "index": 24 }, { "content": " @patch('JustReleaseNotes.issuers.factory.create')\n def test_extractTicketsFromMessage_ReturnsTicketsExtractedByEachOfIssuers(self, mock_class):\n mock_class.side_effect = [DummyIssuer(\"first-1\"), DummyIssuer(\"second-1\")]\n\n config = [{ \"Provider\" : \"first\"},{ \"Provider\":\"second\"}]\n issuer = JustReleaseNotes.issuers.AggregateIssuer.AggregateIssuer(config)\n ret = issuer.extractTicketsFromMessage(\"Message containing first-1 and second-1\")\n self.assertIn(\"first-1\", ret)\n self.assertIn(\"second-1\", ret)", "metadata": "root.GitHubIssues_Test.test_extractTicketsFromMessage_ReturnsTicketsExtractedByEachOfIssuers", "header": "['class', 'GitHubIssues_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " @patch('JustReleaseNotes.issuers.factory.create')\n def test_getTicketInfo_ReturnsTicketsExtractedByEachOfIssuers(self, mock_class):\n mock_class.side_effect = [DummyIssuer(\"first-1\"), DummyIssuer(\"second-1\")]\n\n config = [{ \"Provider\" : \"first\"},{ \"Provider\":\"second\"}]\n issuer = JustReleaseNotes.issuers.AggregateIssuer.AggregateIssuer(config)\n ret = issuer.getTicketInfo(\"first-1\")\n self.assertIn(\"first-1\", ret[\"ticket\"])\n self.assertIn(\"Title of first-1\", ret[\"title\"])\n ret = issuer.getTicketInfo(\"second-1\")\n self.assertIn(\"second-1\", ret[\"ticket\"])\n self.assertIn(\"Title of second-1\", ret[\"title\"])", "metadata": "root.GitHubIssues_Test.test_getTicketInfo_ReturnsTicketsExtractedByEachOfIssuers", "header": "['class', 'GitHubIssues_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " @patch('JustReleaseNotes.issuers.factory.create')\n def test_noIssuersReturnsNone(self, mock_class):\n mock_class.side_effect = []\n config = []\n issuer = JustReleaseNotes.issuers.AggregateIssuer.AggregateIssuer(config)\n ret = issuer.getTicketInfo(\"first-1\")\n self.assertEqual(None, ret)", "metadata": "root.GitHubIssues_Test.test_noIssuersReturnsNone", "header": "['class', 'GitHubIssues_Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 } ]
[ { "span": "import mock", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 }, { "span": "from JustReleaseNotes.issuers import GitHubIssues", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 49 }, { "span": "import requests", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "import requests_mock", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Ju", "st", "Release", "Notes_", "._", "issue", "rs_", "import_", "Git", "Hub", "Issues", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "request", "s", "\\u", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ju", "st", "Release", "Notes_", "._", "issue", "rs_", "._", "Aggregate", "Issue", "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\\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_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Du", "mm", "y", "Issue", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "ret_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Issue", "r_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "ret_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Issue", "r_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "Ticke", "ts", "Fro", "m", "Message_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "._", "\\u\\u", "ret_", "]_", "if_", "self_", "._", "\\u\\u", "ret_", "in_", "message_", "else_", "[_", "\"", "NULL", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Du", "mm", "y", "Issue", "r_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Ticke", "t", "Info_", "(_", "self_", ",_", "ticket_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "ret_", "==_", "ticket_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\"", "tick", "et", "\"_", ":_", "self_", "._", "\\u\\u", "ret_", ",_", "\"", "title", "\"_", ":_", "\"", "Tit", "le", " ", "of", " ", "\"_", "+_", "self_", "._", "\\u\\u", "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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Hub", "Issues", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Hub", "Issues", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "patch_", "(_", "'", "Ju", "st", "Release", "Not", "es", ".", "issue", "rs", ".", "factor", "y", ".", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "extract", "Ticke", "ts", "Fro", "m", "Messag", "e\\u", "Return", "s", "Ticke", "ts", "Extract", "ed", "By", "Ea", "ch", "Of", "Issue", "rs_", "(_", "self_", ",_", "mock", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "class_", "._", "side", "\\u", "effect_", "=_", "[_", "Du", "mm", "y", "Issue", "r_", "(_", "\"", "first", "-1", "\"_", ")_", ",_", "Du", "mm", "y", "Issue", "r_", "(_", "\"", "second", "-1", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "[_", "{_", "\"", "Provider", "\"_", ":_", "\"", "first", "\"_", "}_", ",_", "{_", "\"", "Provider", "\"_", ":_", "\"", "second", "\"_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "issuer_", "=_", "Ju", "st", "Release", "Notes_", "._", "issue", "rs_", "._", "Aggregate", "Issue", "r_", "._", "Aggregate", "Issue", "r_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "issuer_", "._", "extract", "Ticke", "ts", "Fro", "m", "Message_", "(_", "\"", "Messag", "e", " ", "contain", "ing", " ", "first", "-1", " ", "and", " ", "second", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "first", "-1", "\"_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "second", "-1", "\"_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Hub", "Issues", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "Ju", "st", "Release", "Not", "es", ".", "issue", "rs", ".", "factor", "y", ".", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "get", "Ticke", "t", "Info", "\\u", "Return", "s", "Ticke", "ts", "Extract", "ed", "By", "Ea", "ch", "Of", "Issue", "rs_", "(_", "self_", ",_", "mock", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "class_", "._", "side", "\\u", "effect_", "=_", "[_", "Du", "mm", "y", "Issue", "r_", "(_", "\"", "first", "-1", "\"_", ")_", ",_", "Du", "mm", "y", "Issue", "r_", "(_", "\"", "second", "-1", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "[_", "{_", "\"", "Provider", "\"_", ":_", "\"", "first", "\"_", "}_", ",_", "{_", "\"", "Provider", "\"_", ":_", "\"", "second", "\"_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "issuer_", "=_", "Ju", "st", "Release", "Notes_", "._", "issue", "rs_", "._", "Aggregate", "Issue", "r_", "._", "Aggregate", "Issue", "r_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "issuer_", "._", "get", "Ticke", "t", "Info_", "(_", "\"", "first", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "first", "-1", "\"_", ",_", "ret_", "[_", "\"", "tick", "et", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "Tit", "le", " ", "of", " ", "first", "-1", "\"_", ",_", "ret_", "[_", "\"", "title", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "issuer_", "._", "get", "Ticke", "t", "Info_", "(_", "\"", "second", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "second", "-1", "\"_", ",_", "ret_", "[_", "\"", "tick", "et", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "Tit", "le", " ", "of", " ", "second", "-1", "\"_", ",_", "ret_", "[_", "\"", "title", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Hub", "Issues", "\\u", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "patch_", "(_", "'", "Ju", "st", "Release", "Not", "es", ".", "issue", "rs", ".", "factor", "y", ".", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "no", "Issue", "rs", "Return", "s", "None_", "(_", "self_", ",_", "mock", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "class_", "._", "side", "\\u", "effect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "issuer_", "=_", "Ju", "st", "Release", "Notes_", "._", "issue", "rs_", "._", "Aggregate", "Issue", "r_", "._", "Aggregate", "Issue", "r_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "issuer_", "._", "get", "Ticke", "t", "Info_", "(_", "\"", "first", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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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ickle\n except ImportError:\n cPickle = pickle\n\n for mod in pickle, cPickle:\n sym1 = util.symbol('foo')\n sym2 = util.symbol('foo')\n\n assert sym1 is sym2\n\n # default\n s = pickle.dumps(sym1)\n sym3 = pickle.loads(s)\n\n for protocol in 0, 1, 2:\n serial = pickle.dumps(sym1)\n rt = pickle.loads(serial)\n assert rt is sym1\n assert rt is sym2", "metadata": "root.test_symbol_pickle", "header": "['module', '___EOS___']", "index": 158 } ]
[ { "span": "for mod in pickle, cPickle:", "start_line": 165, "start_column": 4, "end_line": 165, "end_column": 31 }, { "span": "for protocol in 0, 1, 2:", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Sus", "picio", "us_", "unused_", "loop_", "iteration_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "symbol", "\\u", "pickle_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "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 ", " _", "c", "Pickle_", "=_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mod_", "in_", "pickle_", ",_", "c", "Pickle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sym", "1_", "=_", "util_", "._", "symbol_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym", "2_", "=_", "util_", "._", "symbol_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "sym", "1_", "is_", "sym", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "pickle_", "._", "dumps_", "(_", "sym", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym", "3_", "=_", "pickle_", "._", "loads_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "protocol_", "in_", "0_", ",_", "1_", ",_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serial_", "=_", "pickle_", "._", "dumps_", "(_", "sym", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rt_", "=_", "pickle_", "._", "loads_", "(_", "serial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rt_", "is_", "sym", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rt_", "is_", "sym", "2_" ]
[ 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, 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, 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 ]
Unused import
livid/v2ex/sso.py
[ { "content": "#!/usr/bin/env python\n# coding=utf-8\n\nimport os\nimport re\nimport time\nimport datetime\nimport hashlib\nimport string\nimport random\n\nimport config\n\nfrom google.appengine.ext import webapp\nfrom google.appengine.api import memcache\nfrom google.appengine.ext import db\nfrom google.appengine.ext.webapp import util\nfrom google.appengine.ext.webapp import template\n\nfrom v2ex.babel import Member\nfrom v2ex.babel import Counter\nfrom v2ex.babel import Section\nfrom v2ex.babel import Node\nfrom v2ex.babel import Topic\nfrom v2ex.babel import Reply\nfrom v2ex.babel import Note\n\nfrom v2ex.babel import SYSTEM_VERSION\n\nfrom v2ex.babel.security import *\nfrom v2ex.babel.ua import *\nfrom v2ex.babel.da import *\nfrom v2ex.babel.l10n import *\nfrom v2ex.babel.ext.cookies import Cookies\n\ntemplate.register_template_library('v2ex.templatetags.filters')\n\n\n \n\n\n\nif __name__ == '__main__':\n main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SSOV0Handler(webapp.RequestHandler):", "metadata": "root.SSOV0Handler", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def get(self):\n site = GetSite()\n self.response.headers['Content-type'] = 'application/json'\n u = self.request.get('u').strip().lower()\n p = self.request.get('p').strip()\n failed = '{\"ok\" : 0}'\n if (len(u) > 0) and (len(p) > 0):\n q = db.GqlQuery(\"SELECT * FROM Member WHERE username_lower = :1 AND password = :2\", u, p)\n if q.count() > 0:\n member = q[0]\n if member.avatar_mini_url:\n if (member.avatar_mini_url[0:1] == '/'):\n member.avatar_mini_url = 'http://' + site.domain + member.avatar_mini_url\n member.avatar_normal_url = 'http://' + site.domain + member.avatar_normal_url\n member.avatar_large_url = 'http://' + site.domain + member.avatar_large_url\n else:\n member.avatar_mini_url = 'http://' + site.domain + '/static/img/avatar_mini.png'\n member.avatar_normal_url = 'http://' + site.domain + '/static/img/avatar_normal.png'\n member.avatar_large_url = 'http://' + site.domain + '/static/img/avatar_large.png'\n self.response.out.write('{\"ok\" : 1, \"num\" : ' + str(member.num) + ', \"username\" : \"' + member.username + '\", \"username_lower\" : \"' + member.username_lower + '\", \"email\" : \"' + member.email + '\", \"avatar_mini_url\" : \"' + member.avatar_mini_url + '\", \"avatar_normal_url\" : \"' + member.avatar_normal_url + '\", \"avatar_large_url\" : \"' + member.avatar_large_url + '\", \"created\" : ' + str(time.mktime(member.created.timetuple())) + ', \"last_modified\" : ' + str(time.mktime(member.last_modified.timetuple())) + '}')\n else:\n self.response.out.write(failed)\n else:\n self.response.out.write(failed)", "metadata": "root.SSOV0Handler.get", "header": "['class', 'SSOV0Handler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 38 }, { "content": "class SSOX0Handler(webapp.RequestHandler):", "metadata": "root.SSOX0Handler", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def get(self):\n site = GetSite()\n self.response.headers['Content-type'] = 'application/json'\n x = self.request.get('x').strip()\n n = self.request.get('n').strip().lower()\n failed = '{\"ok\" : 0}'\n if x == config.ssox:\n q = db.GqlQuery(\"SELECT * FROM Member WHERE username_lower = :1\", n)\n if q.count() > 0:\n member = q[0]\n if member.avatar_mini_url:\n if (member.avatar_mini_url[0:1] == '/'):\n member.avatar_mini_url = 'http://' + site.domain + member.avatar_mini_url\n member.avatar_normal_url = 'http://' + site.domain + member.avatar_normal_url\n member.avatar_large_url = 'http://' + site.domain + member.avatar_large_url\n else:\n member.avatar_mini_url = 'http://' + site.domain + '/static/img/avatar_mini.png'\n member.avatar_normal_url = 'http://' + site.domain + '/static/img/avatar_normal.png'\n member.avatar_large_url = 'http://' + site.domain + '/static/img/avatar_large.png'\n self.response.out.write('{\"ok\" : 1, \"num\" : ' + str(member.num) + ', \"username\" : \"' + member.username + '\", \"username_lower\" : \"' + member.username_lower + '\", \"email\" : \"' + member.email + '\", \"password\" : \"' + member.password + '\", \"avatar_mini_url\" : \"' + member.avatar_mini_url + '\", \"avatar_normal_url\" : \"' + member.avatar_normal_url + '\", \"avatar_large_url\" : \"' + member.avatar_large_url + '\", \"created\" : ' + str(time.mktime(member.created.timetuple())) + ', \"last_modified\" : ' + str(time.mktime(member.last_modified.timetuple())) + '}')\n else:\n self.response.out.write(failed)\n else:\n self.response.out.write(failed)", "metadata": "root.SSOX0Handler.get", "header": "['class', 'SSOX0Handler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 64 }, { "content": "def main():\n application = webapp.WSGIApplication([\n ('/sso/v0', SSOV0Handler),\n ('/sso/x0', SSOX0Handler)\n ],\n debug=True)\n util.run_wsgi_app(application)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 90 } ]
[ { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import re", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 }, { "span": "import datetime", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 15 }, { "span": "import hashlib", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 }, { "span": "import string", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "import random", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 13 }, { "span": "from google.appengine.api import memcache", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 41 }, { "span": "from v2ex.babel import Member", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 29 }, { "span": "from v2ex.babel import Counter", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 30 }, { "span": "from v2ex.babel import Section", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 30 }, { "span": "from v2ex.babel import Node", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 27 }, { "span": "from v2ex.babel import Topic", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 28 }, { "span": "from v2ex.babel import Reply", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 28 }, { "span": "from v2ex.babel import Note", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 27 }, { "span": "from v2ex.babel import SYSTEM_VERSION", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 37 }, { "span": "from v2ex.babel.ext.cookies import Cookies", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 42 } ]
[]
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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "webapp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "._", "webapp_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "._", "webapp_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Member_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Section_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "Note_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "import_", "SYSTEM", "\\u", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "._", "security_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "._", "ua_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "._", "da_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "._", "l10", "n_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "v2", "ex_", "._", "babel", "_", "._", "ext_", "._", "cookies_", "import_", "Cooki", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "._", "register", "\\u", "template", "\\u", "library_", "(_", "'", "v2", "ex", ".", "templatet", "ags", ".", "filter", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "SSO", "V0", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSO", "V0", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "Get", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "u", "'_", ")_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "p", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failed_", "=_", "'{", "\"", "ok", "\"", " ", ":", " ", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "u_", ")_", ">_", "0_", ")_", "and_", "(_", "len_", "(_", "p_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "db_", "._", "Gq", "l", "Query_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "Mem", "ber", " ", "WHE", "RE", " ", "user", "name", "\\u", "lower", " ", "=", " ", ":", "1", " ", "AND", " ", "password", " ", "=", " ", ":", "2", "\"_", ",_", "u_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "member_", "=_", "q_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "[_", "0_", ":_", "1_", "]_", "==_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "\\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 ", " ", "_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "mini", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "normal", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "large", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'{", "\"", "ok", "\"", " ", ":", " ", "1", ",", " ", "\"", "num", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "member_", "._", "num_", ")_", "+_", "',", " ", "\"", "user", "name", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "username_", "+_", "'\",", " ", "\"", "user", "name", "\\u", "lower", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "user", "name", "\\u", "lower_", "+_", "'\",", " ", "\"", "email", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "email_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "mini", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "normal", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "large", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "+_", "'\",", " ", "\"", "created", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "time_", "._", "mktime_", "(_", "member_", "._", "created_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "',", " ", "\"", "last", "\\u", "modifi", "ed", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "time_", "._", "mktime_", "(_", "member_", "._", "last", "\\u", "modified_", "._", "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 ", " _", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "failed_", ")_", "\\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_", "._", "response_", "._", "out_", "._", "write_", "(_", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "SSO", "X", "0", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSO", "X", "0", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site_", "=_", "Get", "Site_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "x", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "n", "'_", ")_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failed_", "=_", "'{", "\"", "ok", "\"", " ", ":", " ", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "==_", "config_", "._", "sso", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "db_", "._", "Gq", "l", "Query_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "Mem", "ber", " ", "WHE", "RE", " ", "user", "name", "\\u", "lower", " ", "=", " ", ":", "1", "\"_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "member_", "=_", "q_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "[_", "0_", ":_", "1_", "]_", "==_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "\\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 ", " ", "_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "mini", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "normal", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "=_", "'", "http", "://'_", "+_", "site_", "._", "domain_", "+_", "'/", "static", "/", "img", "/", "avat", "ar", "\\u", "large", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "'{", "\"", "ok", "\"", " ", ":", " ", "1", ",", " ", "\"", "num", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "member_", "._", "num_", ")_", "+_", "',", " ", "\"", "user", "name", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "username_", "+_", "'\",", " ", "\"", "user", "name", "\\u", "lower", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "user", "name", "\\u", "lower_", "+_", "'\",", " ", "\"", "email", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "email_", "+_", "'\",", " ", "\"", "password", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "password_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "mini", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "mini", "\\u", "url_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "normal", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "normal", "\\u", "url_", "+_", "'\",", " ", "\"", "avat", "ar", "\\u", "large", "\\u", "url", "\"", " ", ":", " ", "\"'_", "+_", "member_", "._", "avat", "ar", "\\u", "large", "\\u", "url_", "+_", "'\",", " ", "\"", "created", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "time_", "._", "mktime_", "(_", "member_", "._", "created_", "._", "timetuple_", "(_", ")_", ")_", ")_", "+_", "',", " ", "\"", "last", "\\u", "modifi", "ed", "\"", " ", ":", " ", "'_", "+_", "str_", "(_", "time_", "._", "mktime_", "(_", "member_", "._", "last", "\\u", "modified_", "._", "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 ", " _", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "failed_", ")_", "\\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_", "._", "response_", "._", "out_", "._", "write_", "(_", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "application_", "=_", "webapp_", "._", "WS", "GI", "Application_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "sso", "/", "v", "0", "'_", ",_", "SSO", "V0", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "sso", "/", "x0", "'_", ",_", "SSO", "X", "0", "Handler_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "run", "\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 2, 2, 2, 2 ]
Unused import
livid/v2ex/mapreduce/lib/blobstore/blobstore.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"A Python blobstore API used by app developers.\n\nContains methods used to interface with Blobstore API. Includes db.Model-like\nclass representing a reference to a very large BLOB. Imports db.Key-like\nclass representing a blob-key.\n\"\"\"\n\n\n\nimport cgi\nimport email\nimport os\n\nfrom google.appengine.api import datastore\nfrom google.appengine.api import datastore_errors\nfrom google.appengine.api import datastore_types\nfrom google.appengine.api.blobstore import blobstore\nfrom google.appengine.ext import db\n\n__all__ = ['BLOB_INFO_KIND',\n 'BLOB_KEY_HEADER',\n 'BLOB_RANGE_HEADER',\n 'BlobFetchSizeTooLargeError',\n 'BlobInfo',\n 'BlobInfoParseError',\n 'BlobKey',\n 'BlobNotFoundError',\n 'BlobReferenceProperty',\n 'BlobReader',\n 'DataIndexOutOfRangeError',\n 'Error',\n 'InternalError',\n 'MAX_BLOB_FETCH_SIZE',\n 'UPLOAD_INFO_CREATION_HEADER',\n 'create_upload_url',\n 'delete',\n 'fetch_data',\n 'get',\n 'parse_blob_info']\n\nError = blobstore.Error\nInternalError = blobstore.InternalError\nBlobFetchSizeTooLargeError = blobstore.BlobFetchSizeTooLargeError\nBlobNotFoundError = blobstore.BlobNotFoundError\n_CreationFormatError = blobstore._CreationFormatError\nDataIndexOutOfRangeError = blobstore.DataIndexOutOfRangeError\n\nBlobKey = blobstore.BlobKey\ncreate_upload_url = blobstore.create_upload_url\ndelete = blobstore.delete\n\n\n\n\nBLOB_INFO_KIND = blobstore.BLOB_INFO_KIND\nBLOB_KEY_HEADER = blobstore.BLOB_KEY_HEADER\nBLOB_RANGE_HEADER = blobstore.BLOB_RANGE_HEADER\nMAX_BLOB_FETCH_SIZE = blobstore.MAX_BLOB_FETCH_SIZE\nUPLOAD_INFO_CREATION_HEADER = blobstore.UPLOAD_INFO_CREATION_HEADER\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BlobInfoParseError(Error):\n \"\"\"CGI parameter does not contain valid BlobInfo record.\"\"\"", "metadata": "root.BlobInfoParseError", "header": "['module', '___EOS___']", "index": 69 }, { "content": "class _GqlQuery(db.GqlQuery):\n \"\"\"GqlQuery class that explicitly sets model-class.\n\n This does the same as the original db.GqlQuery class except that it does\n not try to find the model class based on the compiled GQL query. The\n caller instead provides the query with a model class to use for construction.\n\n This class is required for compatibility with the current db.py query\n mechanism but will be removed in the future. DO NOT USE.\n \"\"\"\n", "metadata": "root._GqlQuery", "header": "['module', '___EOS___']", "index": 79 }, { "content": " def __init__(self, query_string, model_class, *args, **kwds):\n \"\"\"Constructor.\n\n Args:\n query_string: Properly formatted GQL query string.\n model_class: Model class from which entities are constructed.\n *args: Positional arguments used to bind numeric references in the query.\n **kwds: Dictionary-based arguments for named references.\n \"\"\"\n from google.appengine.ext import gql\n app = kwds.pop('_app', None)\n self._proto_query = gql.GQL(query_string, _app=app, namespace='')\n super(db.GqlQuery, self).__init__(model_class, namespace='')\n self.bind(*args, **kwds)", "metadata": "root._GqlQuery.__init__", "header": "['class', '_GqlQuery', '(', 'db', '.', 'GqlQuery', ')', ':', '___EOS___']", "index": 90 }, { "content": "class BlobInfo(object):\n \"\"\"Information about blobs in Blobstore.\n\n This is a db.Model-like class that contains information about blobs stored\n by an application. Like db.Model, this class is backed by an Datastore\n entity, however, BlobInfo instances are read-only and have a much more\n limited interface.\n\n Each BlobInfo has a key of type BlobKey associated with it. This key is\n specific to the Blobstore API and is not compatible with db.get. The key\n can be used for quick lookup by passing it to BlobInfo.get. This\n key converts easily to a string, which is web safe and can be embedded\n in URLs.\n\n Properties:\n content_type: Content type of blob.\n creation: Creation date of blob, when it was uploaded.\n filename: Filename user selected from their machine.\n size: Size of uncompressed blob.\n\n All properties are read-only. Attempting to assign a value to a property\n will raise NotImplementedError.\n \"\"\"\n\n _unindexed_properties = frozenset()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BlobInfo", "header": "['module', '___EOS___']", "index": 106 }, { "content": " @property\n def content_type(self):\n return self.__get_value('content_type')", "metadata": "root.BlobInfo.content_type", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 132 }, { "content": " @property\n def creation(self):\n return self.__get_value('creation')", "metadata": "root.BlobInfo.creation", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " @property\n def filename(self):\n return self.__get_value('filename')", "metadata": "root.BlobInfo.filename", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 140 }, { "content": " @property\n def size(self):\n return self.__get_value('size')", "metadata": "root.BlobInfo.size", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def __init__(self, entity_or_blob_key, _values=None):\n \"\"\"Constructor for wrapping blobstore entity.\n\n The constructor should not be used outside this package and tests.\n\n Args:\n entity: Datastore entity that represents the blob reference.\n \"\"\"\n if isinstance(entity_or_blob_key, datastore.Entity):\n self.__entity = entity_or_blob_key\n self.__key = BlobKey(entity_or_blob_key.key().name())\n elif isinstance(entity_or_blob_key, BlobKey):\n self.__entity = _values\n self.__key = entity_or_blob_key\n else:\n TypeError('Must provide Entity or BlobKey')", "metadata": "root.BlobInfo.__init__", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": " @classmethod\n def from_entity(cls, entity):\n \"\"\"Convert entity to BlobInfo.\n\n This method is required for compatibility with the current db.py query\n mechanism but will be removed in the future. DO NOT USE.\n \"\"\"\n return BlobInfo(entity)", "metadata": "root.BlobInfo.from_entity", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " @classmethod\n def properties(cls):\n \"\"\"Set of properties that belong to BlobInfo.\n\n This method is required for compatibility with the current db.py query\n mechanism but will be removed in the future. DO NOT USE.\n \"\"\"\n return set(('content_type', 'creation', 'filename', 'size'))", "metadata": "root.BlobInfo.properties", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 174 }, { "content": " def __get_value(self, name):\n \"\"\"Get a BlobInfo value, loading entity if necessary.\n\n This method allows lazy loading of the underlying datastore entity. It\n should never be invoked directly.\n\n Args:\n name: Name of property to get value for.\n\n Returns:\n Value of BlobInfo property from entity.\n \"\"\"\n if self.__entity is None:\n self.__entity = datastore.Get(\n datastore_types.Key.from_path(\n self.kind(), str(self.__key), namespace=''))\n try:\n return self.__entity[name]\n except KeyError:\n raise AttributeError(name)", "metadata": "root.BlobInfo.__get_value", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 183 }, { "content": " def key(self):\n \"\"\"Get key for blob.\n\n Returns:\n BlobKey instance that identifies this blob.\n \"\"\"\n return self.__key", "metadata": "root.BlobInfo.key", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def delete(self):\n \"\"\"Permanently delete blob from Blobstore.\"\"\"\n delete(self.key())", "metadata": "root.BlobInfo.delete", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " @classmethod\n def get(cls, blob_keys):\n \"\"\"Retrieve BlobInfo by key or list of keys.\n\n Args:\n blob_keys: A key or a list of keys. Keys may be instances of str,\n unicode and BlobKey.\n\n Returns:\n A BlobInfo instance associated with provided key or a list of BlobInfo\n instances if a list of keys was provided. Keys that are not found in\n Blobstore return None as their values.\n \"\"\"\n blob_keys = cls.__normalize_and_convert_keys(blob_keys)\n try:\n entities = datastore.Get(blob_keys)\n except datastore_errors.EntityNotFoundError:\n return None\n if isinstance(entities, datastore.Entity):\n return BlobInfo(entities)\n else:\n references = []\n for entity in entities:\n if entity is not None:\n references.append(BlobInfo(entity))\n else:\n references.append(None)\n return references", "metadata": "root.BlobInfo.get", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 217 }, { "content": " @classmethod\n def all(cls):\n \"\"\"Get query for all Blobs associated with application.\n\n Returns:\n A db.Query object querying over BlobInfo's datastore kind.\n \"\"\"\n return db.Query(model_class=cls, namespace='')", "metadata": "root.BlobInfo.all", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 246 }, { "content": " @classmethod\n def __factory_for_kind(cls, kind):\n if kind == BLOB_INFO_KIND:\n return BlobInfo\n raise ValueError('Cannot query for kind %s' % kind)", "metadata": "root.BlobInfo.__factory_for_kind", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 255 }, { "content": " @classmethod\n def gql(cls, query_string, *args, **kwds):\n \"\"\"Returns a query using GQL query string.\n\n See appengine/ext/gql for more information about GQL.\n\n Args:\n query_string: Properly formatted GQL query string with the\n 'SELECT * FROM <entity>' part omitted\n *args: rest of the positional arguments used to bind numeric references\n in the query.\n **kwds: dictionary-based arguments (for named parameters).\n\n Returns:\n A gql.GqlQuery object querying over BlobInfo's datastore kind.\n \"\"\"\n return _GqlQuery('SELECT * FROM %s %s'\n % (cls.kind(), query_string),\n cls,\n *args,\n **kwds)", "metadata": "root.BlobInfo.gql", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 261 }, { "content": " @classmethod\n def kind(self):\n \"\"\"Get the entity kind for the BlobInfo.\n\n This method is required for compatibility with the current db.py query\n mechanism but will be removed in the future. DO NOT USE.\n \"\"\"\n return BLOB_INFO_KIND", "metadata": "root.BlobInfo.kind", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 283 }, { "content": " @classmethod\n def __normalize_and_convert_keys(cls, keys):\n \"\"\"Normalize and convert all keys to BlobKey type.\n\n This method is based on datastore.NormalizeAndTypeCheck().\n\n Args:\n keys: A single key or a list/tuple of keys. Keys may be a string\n or BlobKey\n\n Returns:\n Single key or list with all strings replaced by BlobKey instances.\n \"\"\"\n if isinstance(keys, (list, tuple)):\n multiple = True\n keys = list(keys)\n else:\n multiple = False\n keys = [keys]\n\n for index, key in enumerate(keys):\n if not isinstance(key, (basestring, BlobKey)):\n raise datastore_errors.BadArgumentError(\n 'Expected str or BlobKey; received %s (a %s)' % (\n key,\n datastore.typename(key)))\n keys[index] = datastore.Key.from_path(cls.kind(), str(key), namespace='')\n\n if multiple:\n return keys\n else:\n return keys[0]", "metadata": "root.BlobInfo.__normalize_and_convert_keys", "header": "['class', 'BlobInfo', '(', 'object', ')', ':', '___EOS___']", "index": 292 }, { "content": "def get(blob_key):\n \"\"\"Get a BlobInfo record from blobstore.\n\n Does the same as BlobInfo.get.\n \"\"\"\n return BlobInfo.get(blob_key)", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 326 }, { "content": "def parse_blob_info(field_storage):\n \"\"\"Parse a BlobInfo record from file upload field_storage.\n\n Args:\n field_storage: cgi.FieldStorage that represents uploaded blob.\n\n Returns:\n BlobInfo record as parsed from the field-storage instance.\n None if there was no field_storage.\n\n Raises:\n BlobInfoParseError when provided field_storage does not contain enough\n information to construct a BlobInfo object.\n \"\"\"\n if field_storage is None:\n return None\n\n field_name = field_storage.name\n\n def get_value(dict, name):\n value = dict.get(name, None)\n if value is None:\n raise BlobInfoParseError(\n 'Field %s has no %s.' % (field_name, name))\n return value\n\n filename = get_value(field_storage.disposition_options, 'filename')\n blob_key = BlobKey(get_value(field_storage.type_options, 'blob-key'))\n\n upload_content = email.message_from_file(field_storage.file)\n content_type = get_value(upload_content, 'content-type')\n size = get_value(upload_content, 'content-length')\n creation_string = get_value(upload_content, UPLOAD_INFO_CREATION_HEADER)\n\n try:\n size = int(size)\n except (TypeError, ValueError):\n raise BlobInfoParseError(\n '%s is not a valid value for %s size.' % (size, field_name))\n\n try:\n creation = blobstore._parse_creation(creation_string, field_name)\n except blobstore._CreationFormatError, err:\n raise BlobInfoParseError(str(err))\n\n return BlobInfo(blob_key,\n {'content_type': content_type,\n 'creation': creation,\n 'filename': filename,\n 'size': size,\n })", "metadata": "root.parse_blob_info", "header": "['module', '___EOS___']", "index": 334 }, { "content": "class BlobReferenceProperty(db.Property):\n \"\"\"Property compatible with db.Model classes.\n\n Add references to blobs to domain models using BlobReferenceProperty:\n\n class Picture(db.Model):\n title = db.StringProperty()\n image = blobstore.BlobReferenceProperty()\n thumbnail = blobstore.BlobReferenceProperty()\n\n To find the size of a picture using this model:\n\n picture = Picture.get(picture_key)\n print picture.image.size\n\n BlobInfo objects are lazily loaded so iterating over models with\n for BlobKeys is efficient, the following does not need to hit\n Datastore for each image key:\n\n list_of_untitled_blobs = []\n for picture in Picture.gql(\"WHERE title=''\"):\n list_of_untitled_blobs.append(picture.image.key())\n \"\"\"\n\n data_type = BlobInfo\n\n\n", "metadata": "root.BlobReferenceProperty", "header": "['module', '___EOS___']", "index": 387 }, { "content": " def get_value_for_datastore(self, model_instance):\n \"\"\"Translate model property to datastore value.\"\"\"\n blob_info = getattr(model_instance, self.name)\n if blob_info is None:\n return None\n return blob_info.key()", "metadata": "root.BlobReferenceProperty.get_value_for_datastore", "header": "['class', 'BlobReferenceProperty', '(', 'db', '.', 'Property', ')', ':', '___EOS___']", "index": 413 }, { "content": " def make_value_from_datastore(self, value):\n \"\"\"Translate datastore value to BlobInfo.\"\"\"\n if value is None:\n return None\n return BlobInfo(value)", "metadata": "root.BlobReferenceProperty.make_value_from_datastore", "header": "['class', 'BlobReferenceProperty', '(', 'db', '.', 'Property', ')', ':', '___EOS___']", "index": 420 }, { "content": " def validate(self, value):\n \"\"\"Validate that assigned value is BlobInfo.\n\n Automatically converts from strings and BlobKey instances.\n \"\"\"\n if isinstance(value, (basestring)):\n value = BlobInfo(BlobKey(value))\n elif isinstance(value, BlobKey):\n value = BlobInfo(value)\n return super(BlobReferenceProperty, self).validate(value)", "metadata": "root.BlobReferenceProperty.validate", "header": "['class', 'BlobReferenceProperty', '(', 'db', '.', 'Property', ')', ':', '___EOS___']", "index": 426 }, { "content": "def fetch_data(blob, start_index, end_index):\n \"\"\"Fetch data for blob.\n\n Fetches a fragment of a blob up to MAX_BLOB_FETCH_SIZE in length. Attempting\n to fetch a fragment that extends beyond the boundaries of the blob will return\n the amount of data from start_index until the end of the blob, which will be\n a smaller size than requested. Requesting a fragment which is entirely\n outside the boundaries of the blob will return empty string. Attempting\n to fetch a negative index will raise an exception.\n\n Args:\n blob: BlobInfo, BlobKey, str or unicode representation of BlobKey of\n blob to fetch data from.\n start_index: Start index of blob data to fetch. May not be negative.\n end_index: End index (inclusive) of blob data to fetch. Must be\n >= start_index.\n\n Returns:\n str containing partial data of blob. If the indexes are legal but outside\n the boundaries of the blob, will return empty string.\n\n Raises:\n TypeError if start_index or end_index are not indexes. Also when blob\n is not a string, BlobKey or BlobInfo.\n DataIndexOutOfRangeError when start_index < 0 or end_index < start_index.\n BlobFetchSizeTooLargeError when request blob fragment is larger than\n MAX_BLOB_FETCH_SIZE.\n BlobNotFoundError when blob does not exist.\n \"\"\"\n if isinstance(blob, BlobInfo):\n blob = blob.key()\n return blobstore.fetch_data(blob, start_index, end_index)", "metadata": "root.fetch_data", "header": "['module', '___EOS___']", "index": 438 }, { "content": "class BlobReader(object):\n \"\"\"Provides a read-only file-like interface to a blobstore blob.\"\"\"\n\n SEEK_SET = 0\n SEEK_CUR = 1\n SEEK_END = 2\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BlobReader", "header": "['module', '___EOS___']", "index": 472 }, { "content": " def __init__(self, blob_key, buffer_size=131072, position=0):\n \"\"\"Constructor.\n\n Args:\n blob_key: The blob key or string blob key to read from.\n buffer_size: The minimum size to fetch chunks of data from blobstore.\n position: The initial position in the file.\n \"\"\"\n self.__blob_key = blob_key\n self.__buffer_size = buffer_size\n self.__buffer = \"\"\n self.__position = position\n self.__buffer_position = 0\n self.__eof = False\n self.__blob_info = None", "metadata": "root.BlobReader.__init__", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 479 }, { "content": " def __iter__(self):\n \"\"\"Returns a file iterator for this BlobReader.\"\"\"\n return self", "metadata": "root.BlobReader.__iter__", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 495 }, { "content": " def __getstate__(self):\n \"\"\"Returns the serialized state for this BlobReader.\"\"\"\n return (self.__blob_key, self.__buffer_size, self.__position)", "metadata": "root.BlobReader.__getstate__", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 499 }, { "content": " def __setstate__(self, state):\n \"\"\"Restores pickled state for this BlobReader.\"\"\"\n self.__init__(*state)", "metadata": "root.BlobReader.__setstate__", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 503 }, { "content": " def close(self):\n \"\"\"Close the file.\n\n A closed file cannot be read or written any more. Any operation which\n requires that the file be open will raise a ValueError after the file has\n been closed. Calling close() more than once is allowed.\n \"\"\"\n self.__blob_key = None", "metadata": "root.BlobReader.close", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 507 }, { "content": " def flush(self):\n raise IOError(\"BlobReaders are read-only\")", "metadata": "root.BlobReader.flush", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 516 }, { "content": " def next(self):\n \"\"\"Returns the next line from the file.\n\n Returns:\n A string, terminted by \\n. The last line may not be terminated by \\n.\n If EOF is reached, an empty string will be returned.\n \"\"\"\n line = self.readline()\n if not line:\n raise StopIteration\n return line", "metadata": "root.BlobReader.next", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 519 }, { "content": " def __read_from_buffer(self, size):\n \"\"\"Reads at most size bytes from the buffer.\n\n Args:\n size: Number of bytes to read, or negative to read the entire buffer.\n Returns:\n Tuple (data, size):\n data: The bytes read from the buffer.\n size: The remaining unread byte count.\n \"\"\"\n if not self.__blob_key:\n raise ValueError(\"File is closed\")\n\n if size < 0:\n end_pos = len(self.__buffer)\n else:\n end_pos = self.__buffer_position + size\n data = self.__buffer[self.__buffer_position:end_pos]\n\n data_length = len(data)\n size -= data_length\n self.__position += data_length\n self.__buffer_position += data_length\n\n if self.__buffer_position == len(self.__buffer):\n self.__buffer = \"\"\n self.__buffer_position = 0\n\n return data, size", "metadata": "root.BlobReader.__read_from_buffer", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 531 }, { "content": " def __fill_buffer(self, size=0):\n \"\"\"Fills the internal buffer.\n\n Args:\n size: Number of bytes to read. Will be clamped to\n [self.__buffer_size, MAX_BLOB_FETCH_SIZE].\n \"\"\"\n read_size = min(max(size, self.__buffer_size), MAX_BLOB_FETCH_SIZE)\n self.__buffer = fetch_data(self.__blob_key, self.__position,\n self.__position + read_size - 1)\n self.__buffer_position = 0\n self.__eof = len(self.__buffer) < read_size", "metadata": "root.BlobReader.__fill_buffer", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 561 }, { "content": " def read(self, size=-1):\n \"\"\"Read at most size bytes from the file.\n\n Fewer bytes are read if the read hits EOF before obtaining size bytes.\n If the size argument is negative or omitted, read all data until EOF is\n reached. The bytes are returned as a string object. An empty string is\n returned when EOF is encountered immediately.\n\n Calling read() without a size specified is likely to be dangerous, as it\n may read excessive amounts of data.\n\n Args:\n size: Optional. The maximum number of bytes to read. When omitted, read()\n returns all remaining data in the file.\n\n Returns:\n The read data, as a string.\n \"\"\"\n data_list = []\n while True:\n data, size = self.__read_from_buffer(size)\n data_list.append(data)\n if size == 0 or self.__eof:\n return ''.join(data_list)\n self.__fill_buffer(size)", "metadata": "root.BlobReader.read", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 574 }, { "content": " def readline(self, size=-1):\n \"\"\"Read one entire line from the file.\n\n A trailing newline character is kept in the string (but may be absent when a\n file ends with an incomplete line). If the size argument is present and\n non-negative, it is a maximum byte count (including the trailing newline)\n and an incomplete line may be returned. An empty string is returned only\n when EOF is encountered immediately.\n\n Args:\n size: Optional. The maximum number of bytes to read.\n\n Returns:\n The read data, as a string.\n \"\"\"\n data_list = []\n while True:\n if size < 0:\n end_pos = len(self.__buffer)\n else:\n end_pos = self.__buffer_position + size\n newline_pos = self.__buffer.find('\\n', self.__buffer_position, end_pos)\n if newline_pos != -1:\n data_list.append(\n self.__read_from_buffer(newline_pos\n - self.__buffer_position + 1)[0])\n break\n else:\n data, size = self.__read_from_buffer(size)\n data_list.append(data)\n if size == 0 or self.__eof:\n break\n self.__fill_buffer()\n return ''.join(data_list)", "metadata": "root.BlobReader.readline", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 600 }, { "content": " def readlines(self, sizehint=None):\n \"\"\"Read until EOF using readline() and return a list of lines thus read.\n\n If the optional sizehint argument is present, instead of reading up to EOF,\n whole lines totalling approximately sizehint bytes (possibly after rounding\n up to an internal buffer size) are read.\n\n Args:\n sizehint: A hint as to the maximum number of bytes to read.\n\n Returns:\n A list of strings, each being a single line from the file.\n \"\"\"\n lines = []\n while sizehint is None or sizehint > 0:\n line = self.readline()\n if sizehint:\n sizehint -= len(line)\n if not line:\n break\n lines.append(line)\n return lines", "metadata": "root.BlobReader.readlines", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 635 }, { "content": " def seek(self, offset, whence=SEEK_SET):\n \"\"\"Set the file's current position, like stdio's fseek().\n\n The whence argument is optional and defaults to os.SEEK_SET or 0 (absolute\n file positioning); other values are os.SEEK_CUR or 1 (seek relative to the\n current position) and os.SEEK_END or 2 (seek relative to the file's end).\n\n Args:\n offset: The relative offset to seek to.\n whence: Defines what the offset is relative to. See description for\n details.\n \"\"\"\n if whence == BlobReader.SEEK_CUR:\n offset = self.__position + offset\n elif whence == BlobReader.SEEK_END:\n offset = self.blob_info.size + offset\n self.__buffer = \"\"\n self.__buffer_position = 0\n self.__position = offset\n self.__eof = False", "metadata": "root.BlobReader.seek", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 658 }, { "content": " def tell(self):\n \"\"\"Return the file's current position, like stdio's ftell().\"\"\"\n return self.__position", "metadata": "root.BlobReader.tell", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 679 }, { "content": " def truncate(self, size):\n raise IOError(\"BlobReaders are read-only\")", "metadata": "root.BlobReader.truncate", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 683 }, { "content": " def write(self, str):\n raise IOError(\"BlobReaders are read-only\")", "metadata": "root.BlobReader.write", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 686 }, { "content": " def writelines(self, sequence):\n raise IOError(\"BlobReaders are read-only\")", "metadata": "root.BlobReader.writelines", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 689 }, { "content": " @property\n def blob_info(self):\n \"\"\"Returns the BlobInfo for this file.\"\"\"\n if not self.__blob_info:\n self.__blob_info = BlobInfo.get(self.__blob_key)\n return self.__blob_info", "metadata": "root.BlobReader.blob_info", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 692 }, { "content": " @property\n def closed(self):\n \"\"\"Returns True if this file is closed, False otherwise.\"\"\"\n return self.__blob_key is None", "metadata": "root.BlobReader.closed", "header": "['class', 'BlobReader', '(', 'object', ')', ':', '___EOS___']", "index": 699 } ]
[ { "span": "import cgi", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 10 }, { "span": "import os", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 9 } ]
[]
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_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "A", " ", "Pyth", "on", " ", "blobs", "tore", " ", "API", " ", "used", " ", "by", " ", "app", " ", "developer", "s", ".", "\\", "10", ";", "\\", "10", ";", "Contain", "s", " ", "method", "s", " ", "used", " ", "to", " ", "interface", " ", "with", " ", "Blo", "bst", "ore", " ", "API", ".", " ", " ", "Includes", " ", "db", ".", "Model", "-", "like", "\\", "10", ";", "class", " ", "represent", "ing", " ", "a", " ", "reference", " ", "to", " ", "a", " ", "very", " ", "large", " ", "BLOB", ".", " ", " ", "Imports", " ", "db", ".", "Key", "-", "like", "\\", "10", ";", "class", " ", "represent", "ing", " ", "a", " ", "blob", "-", "key", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "._", "blobs", "tore_", "import_", "blobs", "tore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "BLOB", "\\u", "INFO", "\\u", "KIND", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BLOB", "\\u", "KEY", "\\u", "HEAD", "ER", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "BLOB", "\\u", "RANGE", "\\u", "HEAD", "ER", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Fe", "tch", "Size", "Too", "Large", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Info", "Pars", "e", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Not", "Foun", "d", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Reference", "Proper", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Blo", "b", "Read", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Data", "Index", "Out", "Of", "Range", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Intern", "al", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UPLOAD", "\\u", "INFO", "\\u", "CREATI", "ON", "\\u", "HEAD", "ER", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "\\u", "upload", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fetch", "\\u", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parse", "\\u", "blob", "\\u", "info", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Error_", "=_", "blobs", "tore_", "._", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Intern", "al", "Error_", "=_", "blobs", "tore_", "._", "Intern", "al", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Blo", "b", "Fe", "tch", "Size", "Too", "Large", "Error_", "=_", "blobs", "tore_", "._", "Blo", "b", "Fe", "tch", "Size", "Too", "Large", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Blo", "b", "Not", "Foun", "d", "Error_", "=_", "blobs", "tore_", "._", "Blo", "b", "Not", "Foun", "d", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Creat", "ion", "Format", "Error_", "=_", "blobs", "tore_", "._", "\\u", "Creat", "ion", "Format", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Data", "Index", "Out", "Of", "Range", "Error_", "=_", "blobs", "tore_", "._", "Data", "Index", "Out", "Of", "Range", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Blo", "b", "Key_", "=_", "blobs", "tore_", "._", "Blo", "b", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "upload", "\\u", "url_", "=_", "blobs", "tore_", "._", "create", "\\u", "upload", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete_", "=_", "blobs", "tore_", "._", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "BLOB", "\\u", "INFO", "\\u", "KIND", "_", "=_", "blobs", "tore_", "._", "BLOB", "\\u", "INFO", "\\u", "KIND", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOB", "\\u", "KEY", "\\u", "HEADER_", "=_", "blobs", "tore_", "._", "BLOB", "\\u", "KEY", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOB", "\\u", "RANGE", "\\u", "HEADER_", "=_", "blobs", "tore_", "._", "BLOB", "\\u", "RANGE", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE_", "=_", "blobs", "tore_", "._", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UPLOAD", "\\u", "INFO", "\\u", "CREATI", "ON", "\\u", "HEADER_", "=_", "blobs", "tore_", "._", "UPLOAD", "\\u", "INFO", "\\u", "CREATI", "ON", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Blo", "b", "Info", "Pars", "e", "Error_", "(_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "CGI", " ", "parameter", " ", "doe", "s", " ", "not", " ", "contain", " ", "valid", " ", "Blo", "b", "Info", " ", "record", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Gq", "l", "Query_", "(_", "db_", "._", "Gq", "l", "Query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gq", "l", "Query", " ", "class", " ", "tha", "t", " ", "explicit", "ly", " ", "sets", " ", "model", "-", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "doe", "s", " ", "the", " ", "same", " ", "as", " ", "the", " ", "original", " ", "db", ".", "Gq", "l", "Query", " ", "class", " ", "except", " ", "tha", "t", " ", "it", " ", "doe", "s", "\\", "10", ";", " ", " ", "not", " ", "try", " ", "to", " ", "find", " ", "the", " ", "model", " ", "class", " ", "based", " ", "on", " ", "the", " ", "compile", "d", " ", "GQ", "L", " ", "query", ".", " ", " ", "The", "\\", "10", ";", " ", " ", "caller", " ", "inst", "ead", " ", "provide", "s", " ", "the", " ", "query", " ", "with", " ", "a", " ", "model", " ", "class", " ", "to", " ", "use", " ", "for", " ", "constructi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "class", " ", "is", " ", "require", "d", " ", "for", " ", "compatibility", " ", "with", " ", "the", " ", "current", " ", "db", ".", "py", " ", "query", "\\", "10", ";", " ", " ", "mechanism", " ", "but", " ", "will", " ", "be", " ", "remove", "d", " ", "in", " ", "the", " ", "future", ".", " ", " ", "DO", " ", "NOT", " ", "USE", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Gq", "l", "Query_", "(_", "db_", "._", "Gq", "l", "Query_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "query", "\\u", "string_", ",_", "model", "\\u", "class_", ",_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "query", "\\u", "string", ":", " ", "Proper", "ly", " ", "format", "ted", " ", "GQ", "L", " ", "query", " ", "string", ".", "\\", "10", ";", " ", " ", "model", "\\u", "class", ":", " ", "Model", " ", "class", " ", "from", " ", "whi", "ch", " ", "entit", "ies", " ", "are", " ", "construct", "ed", ".", "\\", "10", ";", " ", " ", "*", "args", ":", " ", "Position", "al", " ", "argu", "ment", "s", " ", "used", " ", "to", " ", "bind", " ", "numeri", "c", " ", "reference", "s", " ", "in", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", "**", "kwd", "s", ":", " ", "Dict", "ionar", "y", "-", "based", " ", "argu", "ment", "s", " ", "for", " ", "named", " ", "reference", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "gq", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "kwds_", "._", "pop_", "(_", "'\\u", "app", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "proto", "\\u", "query_", "=_", "gq", "l_", "._", "GQ", "L_", "(_", "query", "\\u", "string_", ",_", "\\u", "app_", "=_", "app_", ",_", "namespace_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "db_", "._", "Gq", "l", "Query_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "model", "\\u", "class_", ",_", "namespace_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "*_", "args_", ",_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Blo", "b", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Information", " ", "abo", "ut", " ", "blobs", " ", "in", " ", "Blo", "bst", "ore", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "db", ".", "Model", "-", "like", " ", "class", " ", "tha", "t", " ", "contain", "s", " ", "informati", "on", " ", "abo", "ut", " ", "blobs", " ", "store", "d", "\\", "10", ";", " ", " ", "by", " ", "an", " ", "applica", "tion", ".", " ", " ", "Lik", "e", " ", "db", ".", "Model", ",", " ", "this", " ", "class", " ", "is", " ", "backed", " ", "by", " ", "an", " ", "Datas", "tore", "\\", "10", ";", " ", " ", "entity", ",", " ", "how", "ever", ",", " ", "Blo", "b", "Info", " ", "instance", "s", " ", "are", " ", "read", "-", "only", " ", "and", " ", "have", " ", "a", " ", "muc", "h", " ", "more", "\\", "10", ";", " ", " ", "limited", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Ea", "ch", " ", "Blo", "b", "Info", " ", "has", " ", "a", " ", "key", " ", "of", " ", "type", " ", "Blo", "b", "Key", " ", "associate", "d", " ", "with", " ", "it", ".", " ", "Thi", "s", " ", "key", " ", "is", "\\", "10", ";", " ", " ", "specific", " ", "to", " ", "the", " ", "Blo", "bst", "ore", " ", "API", " ", "and", " ", "is", " ", "not", " ", "compatible", " ", "with", " ", "db", ".", "get", ".", " ", " ", "The", " ", "key", "\\", "10", ";", " ", " ", "can", " ", "be", " ", "used", " ", "for", " ", "quick", " ", "look", "up", " ", "by", " ", "passi", "ng", " ", "it", " ", "to", " ", "Blo", "b", "Info", ".", "get", ".", " ", " ", "Thi", "s", "\\", "10", ";", " ", " ", "key", " ", "convert", "s", " ", "easi", "ly", " ", "to", " ", "a", " ", "string", ",", " ", "whi", "ch", " ", "is", " ", "web", " ", "safe", " ", "and", " ", "can", " ", "be", " ", "embedde", "d", "\\", "10", ";", " ", " ", "in", " ", "URL", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Proper", "ties", ":", "\\", "10", ";", " ", " ", " ", " ", "content", "\\u", "type", ":", " ", "Conten", "t", " ", "type", " ", "of", " ", "blob", ".", "\\", "10", ";", " ", " ", " ", " ", "creati", "on", ":", " ", "Creat", "ion", " ", "date", " ", "of", " ", "blob", ",", " ", "whe", "n", " ", "it", " ", "was", " ", "uploade", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "filename", ":", " ", "File", "name", " ", "user", " ", "selecte", "d", " ", "from", " ", "thei", "r", " ", "machine", ".", "\\", "10", ";", " ", " ", " ", " ", "size", ":", " ", "Size", " ", "of", " ", "uncompressed", " ", "blob", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "All", " ", "proper", "ties", " ", "are", " ", "read", "-", "only", ".", " ", " ", "Atte", "mpt", "ing", " ", "to", " ", "assign", " ", "a", " ", "value", " ", "to", " ", "a", " ", "property", "\\", "10", ";", " ", " ", "will", " ", "raise", " ", "Not", "Impl", "ement", "ed", "Error", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "unin", "dex", "ed", "\\u", "properties_", "=_", "frozenset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "content", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "get", "\\u", "value_", "(_", "'", "content", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "creation_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "get", "\\u", "value_", "(_", "'", "creati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "get", "\\u", "value_", "(_", "'", "filename", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "get", "\\u", "value_", "(_", "'", "size", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", ",_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", ",_", "\\u", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", " ", "for", " ", "wrapp", "ing", " ", "blobs", "tore", " ", "entity", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "construct", "or", " ", "shou", "ld", " ", "not", " ", "be", " ", "used", " ", "outsi", "de", " ", "this", " ", "package", " ", "and", " ", "tests", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "entity", ":", " ", "Datas", "tore", " ", "entity", " ", "tha", "t", " ", "represent", "s", " ", "the", " ", "blob", " ", "reference", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", ",_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "entity_", "=_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "key_", "=_", "Blo", "b", "Key_", "(_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", "._", "key_", "(_", ")_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", ",_", "Blo", "b", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "entity_", "=_", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "key_", "=_", "entity", "\\u", "or", "\\u", "blob", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Type", "Error_", "(_", "'", "Mus", "t", " ", "provide", " ", "Entit", "y", " ", "or", " ", "Blo", "b", "Key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "entity_", "(_", "cls_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "entity", " ", "to", " ", "Blo", "b", "Info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "require", "d", " ", "for", " ", "compatibility", " ", "with", " ", "the", " ", "current", " ", "db", ".", "py", " ", "query", "\\", "10", ";", " ", " ", " ", " ", "mechanism", " ", "but", " ", "will", " ", "be", " ", "remove", "d", " ", "in", " ", "the", " ", "future", ".", " ", " ", "DO", " ", "NOT", " ", "USE", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Blo", "b", "Info_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "properties_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "of", " ", "proper", "ties", " ", "tha", "t", " ", "belo", "ng", " ", "to", " ", "Blo", "b", "Info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "require", "d", " ", "for", " ", "compatibility", " ", "with", " ", "the", " ", "current", " ", "db", ".", "py", " ", "query", "\\", "10", ";", " ", " ", " ", " ", "mechanism", " ", "but", " ", "will", " ", "be", " ", "remove", "d", " ", "in", " ", "the", " ", "future", ".", " ", " ", "DO", " ", "NOT", " ", "USE", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "set_", "(_", "(_", "'", "content", "\\u", "type", "'_", ",_", "'", "creati", "on", "'_", ",_", "'", "filename", "'_", ",_", "'", "size", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "value_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "Blo", "b", "Info", " ", "value", ",", " ", "load", "ing", " ", "entity", " ", "if", " ", "necessar", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "allow", "s", " ", "lazy", " ", "load", "ing", " ", "of", " ", "the", " ", "underl", "ying", " ", "datast", "ore", " ", "entity", ".", " ", " ", "It", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "neve", "r", " ", "be", " ", "invoke", "d", " ", "direct", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "name", ":", " ", "Name", " ", "of", " ", "property", " ", "to", " ", "get", " ", "value", " ", "for", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Value", " ", "of", " ", "Blo", "b", "Info", " ", "property", " ", "from", " ", "entity", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "entity_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "entity_", "=_", "datastore_", "._", "Get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Key_", "._", "from", "\\u", "path_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "kind_", "(_", ")_", ",_", "str_", "(_", "self_", "._", "\\u\\u", "key_", ")_", ",_", "namespace_", "=_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "entity_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "key", " ", "for", " ", "blob", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Blo", "b", "Key", " ", "instance", " ", "tha", "t", " ", "identifi", "es", " ", "this", " ", "blob", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Permanent", "ly", " ", "delete", " ", "blob", " ", "from", " ", "Blo", "bst", "ore", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete_", "(_", "self_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "get_", "(_", "cls_", ",_", "blob", "\\u", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "Blo", "b", "Info", " ", "by", " ", "key", " ", "or", " ", "list", " ", "of", " ", "keys", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "blob", "\\u", "keys", ":", " ", "A", " ", "key", " ", "or", " ", "a", " ", "list", " ", "of", " ", "keys", ".", " ", " ", "Keys", " ", "may", " ", "be", " ", "instance", "s", " ", "of", " ", "str", ",", "\\", "10", ";", " ", " ", "unicode", " ", "and", " ", "Blo", "b", "Key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "Blo", "b", "Info", " ", "instance", " ", "associate", "d", " ", "with", " ", "provided", " ", "key", " ", "or", " ", "a", " ", "list", " ", "of", " ", "Blo", "b", "Info", "\\", "10", ";", " ", " ", "instance", "s", " ", "if", " ", "a", " ", "list", " ", "of", " ", "keys", " ", "was", " ", "provided", ".", " ", " ", "Keys", " ", "tha", "t", " ", "are", " ", "not", " ", "found", " ", "in", "\\", "10", ";", " ", " ", "Blo", "bst", "ore", " ", "return", " ", "Non", "e", " ", "as", " ", "thei", "r", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "\\u", "keys_", "=_", "cls_", "._", "\\u\\u", "normali", "ze", "\\u", "and", "\\u", "convert", "\\u", "keys_", "(_", "blob", "\\u", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entities_", "=_", "datastore_", "._", "Get_", "(_", "blob", "\\u", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "datast", "ore", "\\u", "errors_", "._", "Entit", "y", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "entities_", ",_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Blo", "b", "Info_", "(_", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "references_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "entity_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "references_", "._", "append_", "(_", "Blo", "b", "Info_", "(_", "entity_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "references_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "references_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "all_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "query", " ", "for", " ", "all", " ", "Blo", "bs", " ", "associate", "d", " ", "with", " ", "applica", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "db", ".", "Query", " ", "object", " ", "query", "ing", " ", "over", " ", "Blo", "b", "Info", "'", "s", " ", "datast", "ore", " ", "kind", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "db_", "._", "Query_", "(_", "model", "\\u", "class_", "=_", "cls_", ",_", "namespace_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "\\u\\u", "factor", "y", "\\u", "for", "\\u", "kind_", "(_", "cls_", ",_", "kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kind_", "==_", "BLOB", "\\u", "INFO", "\\u", "KIND", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Blo", "b", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'", "Cann", "ot", " ", "query", " ", "for", " ", "kind", " ", "%", "s", "'_", "%_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "gq", "l_", "(_", "cls_", ",_", "query", "\\u", "string_", ",_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "query", " ", "usi", "ng", " ", "GQ", "L", " ", "query", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "appengine", "/", "ext", "/", "gq", "l", " ", "for", " ", "more", " ", "informati", "on", " ", "abo", "ut", " ", "GQ", "L", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "query", "\\u", "string", ":", " ", "Proper", "ly", " ", "format", "ted", " ", "GQ", "L", " ", "query", " ", "string", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "'", "SELECT", " ", "*", " ", "FROM", " ", "<", "entity", ">'", " ", "part", " ", "omit", "ted", "\\", "10", ";", " ", " ", "*", "args", ":", " ", "rest", " ", "of", " ", "the", " ", "positional", " ", "argu", "ment", "s", " ", "used", " ", "to", " ", "bind", " ", "numeri", "c", " ", "reference", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "query", ".", "\\", "10", ";", " ", " ", "**", "kwd", "s", ":", " ", "dictionar", "y", "-", "based", " ", "argu", "ment", "s", " ", "(", "for", " ", "named", " ", "parameter", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "gq", "l", ".", "Gq", "l", "Query", " ", "object", " ", "query", "ing", " ", "over", " ", "Blo", "b", "Info", "'", "s", " ", "datast", "ore", " ", "kind", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "Gq", "l", "Query_", "(_", "'", "SELECT", " ", "*", " ", "FROM", " ", "%", "s", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "cls_", "._", "kind_", "(_", ")_", ",_", "query", "\\u", "string_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "entity", " ", "kind", " ", "for", " ", "the", " ", "Blo", "b", "Info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "require", "d", " ", "for", " ", "compatibility", " ", "with", " ", "the", " ", "current", " ", "db", ".", "py", " ", "query", "\\", "10", ";", " ", " ", " ", " ", "mechanism", " ", "but", " ", "will", " ", "be", " ", "remove", "d", " ", "in", " ", "the", " ", "future", ".", " ", " ", "DO", " ", "NOT", " ", "USE", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "BLOB", "\\u", "INFO", "\\u", "KIND", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Info_", "(_", "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_", "\\u\\u", "normali", "ze", "\\u", "and", "\\u", "convert", "\\u", "keys_", "(_", "cls_", ",_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Normalize", " ", "and", " ", "convert", " ", "all", " ", "keys", " ", "to", " ", "Blo", "b", "Key", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "based", " ", "on", " ", "datast", "ore", ".", "Normalize", "And", "Type", "Check", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "keys", ":", " ", "A", " ", "single", " ", "key", " ", "or", " ", "a", " ", "list", "/", "tuple", " ", "of", " ", "keys", ".", " ", " ", "Keys", " ", "may", " ", "be", " ", "a", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "Blo", "b", "Key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Sing", "le", " ", "key", " ", "or", " ", "list", " ", "with", " ", "all", " ", "string", "s", " ", "replaced", " ", "by", " ", "Blo", "b", "Key", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "keys_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiple_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "list_", "(_", "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 ", " _", "multiple_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "keys_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "index_", ",_", "key_", "in_", "enumerate_", "(_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "key_", ",_", "(_", "basestring_", ",_", "Blo", "b", "Key_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "datast", "ore", "\\u", "errors_", "._", "Ba", "d", "Arg", "ument", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Expect", "ed", " ", "str", " ", "or", " ", "Blo", "b", "Key", ";", " ", "receive", "d", " ", "%", "s", " ", "(", "a", " ", "%", "s", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datastore_", "._", "typename_", "(_", "key_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "[_", "index_", "]_", "=_", "datastore_", "._", "Key_", "._", "from", "\\u", "path_", "(_", "cls_", "._", "kind_", "(_", ")_", ",_", "str_", "(_", "key_", ")_", ",_", "namespace_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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 ", " _", "return_", "keys_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "blob", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "Blo", "b", "Info", " ", "record", " ", "from", " ", "blobs", "tore", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Do", "es", " ", "the", " ", "same", " ", "as", " ", "Blo", "b", "Info", ".", "get", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Blo", "b", "Info_", "._", "get_", "(_", "blob", "\\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_", "def_", "parse", "\\u", "blob", "\\u", "info_", "(_", "field", "\\u", "storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "Blo", "b", "Info", " ", "record", " ", "from", " ", "file", " ", "upload", " ", "field", "\\u", "storage", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "field", "\\u", "storage", ":", " ", "cgi", ".", "Field", "Stor", "age", " ", "tha", "t", " ", "represent", "s", " ", "uploade", "d", " ", "blob", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Blo", "b", "Info", " ", "record", " ", "as", " ", "parsed", " ", "from", " ", "the", " ", "field", "-", "storage", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "if", " ", "there", " ", "was", " ", "no", " ", "field", "\\u", "storage", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Blo", "b", "Info", "Pars", "e", "Error", " ", "whe", "n", " ", "provided", " ", "field", "\\u", "storage", " ", "doe", "s", " ", "not", " ", "contain", " ", "eno", "ugh", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "to", " ", "construct", " ", "a", " ", "Blo", "b", "Info", " ", "object", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "storage_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "name_", "=_", "field", "\\u", "storage_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "value_", "(_", "dict_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "dict_", "._", "get_", "(_", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Blo", "b", "Info", "Pars", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Field", " ", "%", "s", " ", "has", " ", "no", " ", "%", "s", ".'_", "%_", "(_", "field", "\\u", "name_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "get", "\\u", "value_", "(_", "field", "\\u", "storage_", "._", "disposition", "\\u", "options_", ",_", "'", "filename", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "\\u", "key_", "=_", "Blo", "b", "Key_", "(_", "get", "\\u", "value_", "(_", "field", "\\u", "storage_", "._", "type", "\\u", "options_", ",_", "'", "blob", "-", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "upload", "\\u", "content_", "=_", "email_", "._", "message", "\\u", "from", "\\u", "file_", "(_", "field", "\\u", "storage_", "._", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "get", "\\u", "value_", "(_", "upload", "\\u", "content_", ",_", "'", "content", "-", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "get", "\\u", "value_", "(_", "upload", "\\u", "content_", ",_", "'", "content", "-", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creati", "on", "\\u", "string_", "=_", "get", "\\u", "value_", "(_", "upload", "\\u", "content_", ",_", "UPLOAD", "\\u", "INFO", "\\u", "CREATI", "ON", "\\u", "HEADER_", ")_", "\\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 ", " _", "size_", "=_", "int_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Blo", "b", "Info", "Pars", "e", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "value", " ", "for", " ", "%", "s", " ", "size", ".'_", "%_", "(_", "size_", ",_", "field", "\\u", "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 ", " _", "creation_", "=_", "blobs", "tore_", "._", "\\u", "parse", "\\u", "creation_", "(_", "creati", "on", "\\u", "string_", ",_", "field", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "blobs", "tore_", "._", "\\u", "Creat", "ion", "Format", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Blo", "b", "Info", "Pars", "e", "Error_", "(_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Blo", "b", "Info_", "(_", "blob", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "content", "\\u", "type", "'_", ":_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "creati", "on", "'_", ":_", "creation_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filename", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Blo", "b", "Reference", "Property_", "(_", "db_", "._", "Property_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Proper", "ty", " ", "compatible", " ", "with", " ", "db", ".", "Model", " ", "classe", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Add", " ", "reference", "s", " ", "to", " ", "blobs", " ", "to", " ", "domain", " ", "model", "s", " ", "usi", "ng", " ", "Blo", "b", "Reference", "Proper", "ty", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Picture", "(", "db", ".", "Model", "):", "\\", "10", ";", " ", " ", "title", " ", "=", " ", "db", ".", "String", "Proper", "ty", "()", "\\", "10", ";", " ", " ", "image", " ", "=", " ", "blobs", "tore", ".", "Blo", "b", "Reference", "Proper", "ty", "()", "\\", "10", ";", " ", " ", "thumbnail", " ", "=", " ", "blobs", "tore", ".", "Blo", "b", "Reference", "Proper", "ty", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", "To", " ", "find", " ", "the", " ", "size", " ", "of", " ", "a", " ", "pic", "ture", " ", "usi", "ng", " ", "this", " ", "model", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pic", "ture", " ", "=", " ", "Picture", ".", "get", "(", "pic", "ture", "\\u", "key", ")", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "pic", "ture", ".", "image", ".", "size", "\\", "10", ";", "\\", "10", ";", " ", " ", "Blo", "b", "Info", " ", "object", "s", " ", "are", " ", "laz", "il", "y", " ", "load", "ed", " ", "so", " ", "iterati", "ng", " ", "over", " ", "model", "s", " ", "with", "\\", "10", ";", " ", " ", "for", " ", "Blo", "b", "Keys", " ", "is", " ", "efficien", "t", ",", " ", "the", " ", "follow", "ing", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "hit", "\\", "10", ";", " ", " ", "Datas", "tore", " ", "for", " ", "each", " ", "image", " ", "key", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "list", "\\u", "of", "\\u", "unti", "tle", "d\\u", "blobs", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "pic", "ture", " ", "in", " ", "Picture", ".", "gq", "l", "(\"", "WHE", "RE", " ", "title", "=''", "\"):", "\\", "10", ";", " ", " ", "list", "\\u", "of", "\\u", "unti", "tle", "d\\u", "blobs", ".", "append", "(", "pic", "ture", ".", "image", ".", "key", "())", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "type_", "=_", "Blo", "b", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Blo", "b", "Reference", "Property_", "(_", "db_", "._", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "value", "\\u", "for", "\\u", "datastore_", "(_", "self_", ",_", "model", "\\u", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Translate", " ", "model", " ", "property", " ", "to", " ", "datast", "ore", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blob", "\\u", "info_", "=_", "getattr_", "(_", "model", "\\u", "instance_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "blob", "\\u", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "blob", "\\u", "info_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reference", "Property_", "(_", "db_", "._", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "value", "\\u", "from", "\\u", "datastore_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Translate", " ", "datast", "ore", " ", "value", " ", "to", " ", "Blo", "b", "Info", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Blo", "b", "Info_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reference", "Property_", "(_", "db_", "._", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "tha", "t", " ", "assign", "ed", " ", "value", " ", "is", " ", "Blo", "b", "Info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Automat", "ical", "ly", " ", "convert", "s", " ", "from", " ", "string", "s", " ", "and", " ", "Blo", "b", "Key", " ", "instance", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "basestring_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Blo", "b", "Info_", "(_", "Blo", "b", "Key_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "Blo", "b", "Key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Blo", "b", "Info_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Blo", "b", "Reference", "Property_", ",_", "self_", ")_", "._", "validate_", "(_", "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_", "fetch", "\\u", "data_", "(_", "blob_", ",_", "start", "\\u", "index_", ",_", "end", "\\u", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fe", "tch", " ", "data", " ", "for", " ", "blob", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Fetche", "s", " ", "a", " ", "fragment", " ", "of", " ", "a", " ", "blob", " ", "up", " ", "to", " ", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE", " ", "in", " ", "length", ".", " ", " ", "Atte", "mpt", "ing", "\\", "10", ";", " ", " ", "to", " ", "fetch", " ", "a", " ", "fragment", " ", "tha", "t", " ", "extend", "s", " ", "be", "yon", "d", " ", "the", " ", "bound", "aries", " ", "of", " ", "the", " ", "blob", " ", "will", " ", "return", "\\", "10", ";", " ", " ", "the", " ", "amo", "unt", " ", "of", " ", "data", " ", "from", " ", "start", "\\u", "index", " ", "unti", "l", " ", "the", " ", "end", " ", "of", " ", "the", " ", "blob", ",", " ", "whi", "ch", " ", "will", " ", "be", "\\", "10", ";", " ", " ", "a", " ", "small", "er", " ", "size", " ", "than", " ", "request", "ed", ".", " ", " ", "Request", "ing", " ", "a", " ", "fragment", " ", "whi", "ch", " ", "is", " ", "entire", "ly", "\\", "10", ";", " ", " ", "outsi", "de", " ", "the", " ", "bound", "aries", " ", "of", " ", "the", " ", "blob", " ", "will", " ", "return", " ", "empty", " ", "string", ".", " ", " ", "Atte", "mpt", "ing", "\\", "10", ";", " ", " ", "to", " ", "fetch", " ", "a", " ", "negati", "ve", " ", "index", " ", "will", " ", "raise", " ", "an", " ", "exception", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "blob", ":", " ", "Blo", "b", "Info", ",", " ", "Blo", "b", "Key", ",", " ", "str", " ", "or", " ", "unicode", " ", "represent", "ation", " ", "of", " ", "Blo", "b", "Key", " ", "of", "\\", "10", ";", " ", " ", "blob", " ", "to", " ", "fetch", " ", "data", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "index", ":", " ", "Start", " ", "index", " ", "of", " ", "blob", " ", "data", " ", "to", " ", "fetch", ".", " ", " ", "Ma", "y", " ", "not", " ", "be", " ", "negati", "ve", ".", "\\", "10", ";", " ", " ", " ", " ", "end", "\\u", "index", ":", " ", "End", " ", "index", " ", "(", "inclu", "sive", ")", " ", "of", " ", "blob", " ", "data", " ", "to", " ", "fetch", ".", " ", " ", "Mus", "t", " ", "be", "\\", "10", ";", " ", " ", ">=", " ", "start", "\\u", "index", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "str", " ", "contain", "ing", " ", "partial", " ", "data", " ", "of", " ", "blob", ".", " ", " ", "If", " ", "the", " ", "indexe", "s", " ", "are", " ", "lega", "l", " ", "but", " ", "outsi", "de", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "bound", "aries", " ", "of", " ", "the", " ", "blob", ",", " ", "will", " ", "return", " ", "empty", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Type", "Error", " ", "if", " ", "start", "\\u", "index", " ", "or", " ", "end", "\\u", "index", " ", "are", " ", "not", " ", "indexe", "s", ".", " ", " ", "Al", "so", " ", "whe", "n", " ", "blob", "\\", "10", ";", " ", " ", "is", " ", "not", " ", "a", " ", "string", ",", " ", "Blo", "b", "Key", " ", "or", " ", "Blo", "b", "Info", ".", "\\", "10", ";", " ", " ", " ", " ", "Data", "Index", "Out", "Of", "Range", "Error", " ", "whe", "n", " ", "start", "\\u", "index", " ", "<", " ", "0", " ", "or", " ", "end", "\\u", "index", " ", "<", " ", "start", "\\u", "index", ".", "\\", "10", ";", " ", " ", " ", " ", "Blo", "b", "Fe", "tch", "Size", "Too", "Large", "Error", " ", "whe", "n", " ", "request", " ", "blob", " ", "fragment", " ", "is", " ", "large", "r", " ", "than", "\\", "10", ";", " ", " ", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE", ".", "\\", "10", ";", " ", " ", " ", " ", "Blo", "b", "Not", "Foun", "d", "Error", " ", "whe", "n", " ", "blob", " ", "doe", "s", " ", "not", " ", "exist", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "blob_", ",_", "Blo", "b", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blob_", "=_", "blob_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "blobs", "tore_", "._", "fetch", "\\u", "data_", "(_", "blob_", ",_", "start", "\\u", "index_", ",_", "end", "\\u", "index_", ")_", "\\u\\u\\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_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ides", " ", "a", " ", "read", "-", "only", " ", "file", "-", "like", " ", "interface", " ", "to", " ", "a", " ", "blobs", "tore", " ", "blob", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SEE", "K", "\\u", "SET_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEE", "K", "\\u", "CUR", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SEE", "K", "\\u", "END_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "blob", "\\u", "key_", ",_", "buffer", "\\u", "size_", "=_", "1310", "72_", ",_", "position_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "blob", "\\u", "key", ":", " ", "The", " ", "blob", " ", "key", " ", "or", " ", "string", " ", "blob", " ", "key", " ", "to", " ", "read", " ", "from", ".", "\\", "10", ";", " ", " ", "buffer", "\\u", "size", ":", " ", "The", " ", "minim", "um", " ", "size", " ", "to", " ", "fetch", " ", "chunks", " ", "of", " ", "data", " ", "from", " ", "blobs", "tore", ".", "\\", "10", ";", " ", " ", "position", ":", " ", "The", " ", "initial", " ", "position", " ", "in", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", "=_", "blob", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "size_", "=_", "buffer", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "position_", "=_", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "eof_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "blob", "\\u", "info_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\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", "s", " ", "a", " ", "file", " ", "iter", "ator", " ", "for", " ", "this", " ", "Blo", "b", "Read", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getstate", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "serialize", "d", " ", "state", " ", "for", " ", "this", " ", "Blo", "b", "Read", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", ",_", "self_", "._", "\\u\\u", "buffer", "\\u", "size_", ",_", "self_", "._", "\\u\\u", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Restor", "es", " ", "pickled", " ", "state", " ", "for", " ", "this", " ", "Blo", "b", "Read", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clos", "e", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "close", "d", " ", "file", " ", "cann", "ot", " ", "be", " ", "read", " ", "or", " ", "writt", "en", " ", "any", " ", "more", ".", " ", "Any", " ", "operati", "on", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "require", "s", " ", "tha", "t", " ", "the", " ", "file", " ", "be", " ", "open", " ", "will", " ", "raise", " ", "a", " ", "Value", "Error", " ", "after", " ", "the", " ", "file", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "bee", "n", " ", "close", "d", ".", " ", "Call", "ing", " ", "close", "()", " ", "more", " ", "than", " ", "onc", "e", " ", "is", " ", "allow", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flush_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Blo", "b", "Read", "ers", " ", "are", " ", "read", "-", "only", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "next", " ", "line", " ", "from", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "string", ",", " ", "termin", "ted", " ", "by", " ", "\\\\", "n", ".", " ", "The", " ", "last", " ", "line", " ", "may", " ", "not", " ", "be", " ", "terminate", "d", " ", "by", " ", "\\\\", "n", ".", "\\", "10", ";", " ", " ", "If", " ", "EO", "F", " ", "is", " ", "reache", "d", ",", " ", "an", " ", "empty", " ", "string", " ", "will", " ", "be", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "self_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "read", "\\u", "from", "\\u", "buffer_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", "s", " ", "at", " ", "most", " ", "size", " ", "bytes", " ", "from", " ", "the", " ", "buffer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "size", ":", " ", "Number", " ", "of", " ", "bytes", " ", "to", " ", "read", ",", " ", "or", " ", "negati", "ve", " ", "to", " ", "read", " ", "the", " ", "entire", " ", "buffer", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Tup", "le", " ", "(", "data", ",", " ", "size", "):", "\\", "10", ";", " ", " ", " ", " ", "data", ":", " ", "The", " ", "bytes", " ", "read", " ", "from", " ", "the", " ", "buffer", ".", "\\", "10", ";", " ", " ", " ", " ", "size", ":", " ", "The", " ", "rema", "inin", "g", " ", "unread", " ", "byte", " ", "count", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "File", " ", "is", " ", "close", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "size_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "pos_", "=_", "len_", "(_", "self_", "._", "\\u\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "pos_", "=_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "+_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u\\u", "buffer_", "[_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", ":_", "end", "\\u", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "length_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "-=_", "data\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "position_", "+=_", "data\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "+=_", "data\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "==_", "len_", "(_", "self_", "._", "\\u\\u", "buffer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", ",_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "fill", "\\u", "buffer_", "(_", "self_", ",_", "size_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fil", "ls", " ", "the", " ", "internal", " ", "buffer", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "size", ":", " ", "Number", " ", "of", " ", "bytes", " ", "to", " ", "read", ".", " ", "Wil", "l", " ", "be", " ", "clamp", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "[", "self", ".\\u", "\\u", "buffer", "\\u", "size", ",", " ", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE", "].", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "size_", "=_", "min_", "(_", "max_", "(_", "size_", ",_", "self_", "._", "\\u\\u", "buffer", "\\u", "size_", ")_", ",_", "MAX", "\\u", "BLOB", "\\u", "FETCH", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer_", "=_", "fetch", "\\u", "data_", "(_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", ",_", "self_", "._", "\\u\\u", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "position_", "+_", "read", "\\u", "size_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "eof_", "=_", "len_", "(_", "self_", "._", "\\u\\u", "buffer_", ")_", "<_", "read", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "size_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "at", " ", "most", " ", "size", " ", "bytes", " ", "from", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", "Fe", "wer", " ", "bytes", " ", "are", " ", "read", " ", "if", " ", "the", " ", "read", " ", "hits", " ", "EO", "F", " ", "bef", "ore", " ", "obtain", "ing", " ", "size", " ", "bytes", ".", "\\", "10", ";", " ", "If", " ", "the", " ", "size", " ", "argu", "ment", " ", "is", " ", "negati", "ve", " ", "or", " ", "omit", "ted", ",", " ", "read", " ", "all", " ", "data", " ", "unti", "l", " ", "EO", "F", " ", "is", "\\", "10", ";", " ", "reache", "d", ".", " ", "The", " ", "bytes", " ", "are", " ", "return", "ed", " ", "as", " ", "a", " ", "string", " ", "object", ".", " ", "An", " ", "empty", " ", "string", " ", "is", "\\", "10", ";", " ", "return", "ed", " ", "whe", "n", " ", "EO", "F", " ", "is", " ", "encounter", "ed", " ", "immediate", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", "Call", "ing", " ", "read", "()", " ", "with", "out", " ", "a", " ", "size", " ", "specified", " ", "is", " ", "like", "ly", " ", "to", " ", "be", " ", "danger", "ous", ",", " ", "as", " ", "it", "\\", "10", ";", " ", "may", " ", "read", " ", "excess", "ive", " ", "amounts", " ", "of", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", "size", ":", " ", "Optio", "nal", ".", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "read", ".", " ", "Whe", "n", " ", "omit", "ted", ",", " ", "read", "()", "\\", "10", ";", " ", " ", " ", " ", " ", "return", "s", " ", "all", " ", "rema", "inin", "g", " ", "data", " ", "in", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", "The", " ", "read", " ", "data", ",", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", ",_", "size_", "=_", "self_", "._", "\\u\\u", "read", "\\u", "from", "\\u", "buffer_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "list_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "==_", "0_", "or_", "self_", "._", "\\u\\u", "eof_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "._", "join_", "(_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "fill", "\\u", "buffer_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "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_", "readline_", "(_", "self_", ",_", "size_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "one", " ", "entire", " ", "line", " ", "from", " ", "the", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "trail", "ing", " ", "newline", " ", "character", " ", "is", " ", "kep", "t", " ", "in", " ", "the", " ", "string", " ", "(", "but", " ", "may", " ", "be", " ", "absen", "t", " ", "whe", "n", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "ends", " ", "with", " ", "an", " ", "incomplete", " ", "line", ").", " ", "If", " ", "the", " ", "size", " ", "argu", "ment", " ", "is", " ", "presen", "t", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "non", "-", "negati", "ve", ",", " ", "it", " ", "is", " ", "a", " ", "maxim", "um", " ", "byte", " ", "count", " ", "(", "inclu", "ding", " ", "the", " ", "trail", "ing", " ", "newline", ")", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "an", " ", "incomplete", " ", "line", " ", "may", " ", "be", " ", "return", "ed", ".", " ", "An", " ", "empty", " ", "string", " ", "is", " ", "return", "ed", " ", "only", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "EO", "F", " ", "is", " ", "encounter", "ed", " ", "immediate", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "size", ":", " ", "Optio", "nal", ".", " ", "The", " ", "maxim", "um", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "read", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "read", " ", "data", ",", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "size_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "pos_", "=_", "len_", "(_", "self_", "._", "\\u\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "pos_", "=_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "+_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newline", "\\u", "pos_", "=_", "self_", "._", "\\u\\u", "buffer_", "._", "find_", "(_", "'\\\\", "n", "'_", ",_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", ",_", "end", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "newline", "\\u", "pos_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "list_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "read", "\\u", "from", "\\u", "buffer_", "(_", "newline", "\\u", "pos_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "+_", "1_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", ",_", "size_", "=_", "self_", "._", "\\u\\u", "read", "\\u", "from", "\\u", "buffer_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "list_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", "==_", "0_", "or_", "self_", "._", "\\u\\u", "eof_", ":_", "\\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_", "self_", "._", "\\u\\u", "fill", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "readlines_", "(_", "self_", ",_", "size", "hint_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "unti", "l", " ", "EO", "F", " ", "usi", "ng", " ", "readline", "()", " ", "and", " ", "return", " ", "a", " ", "list", " ", "of", " ", "lines", " ", "thu", "s", " ", "read", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "option", "al", " ", "size", "hin", "t", " ", "argu", "ment", " ", "is", " ", "presen", "t", ",", " ", "inst", "ead", " ", "of", " ", "readi", "ng", " ", "up", " ", "to", " ", "EO", "F", ",", "\\", "10", ";", " ", " ", " ", " ", "whole", " ", "lines", " ", "total", "ling", " ", "approximate", "ly", " ", "size", "hin", "t", " ", "bytes", " ", "(", "possib", "ly", " ", "after", " ", "rounding", "\\", "10", ";", " ", " ", " ", " ", "up", " ", "to", " ", "an", " ", "internal", " ", "buffer", " ", "size", ")", " ", "are", " ", "read", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "size", "hin", "t", ":", " ", "A", " ", "hin", "t", " ", "as", " ", "to", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "bytes", " ", "to", " ", "read", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "list", " ", "of", " ", "string", "s", ",", " ", "each", " ", "bei", "ng", " ", "a", " ", "single", " ", "line", " ", "from", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "size", "hint_", "is_", "None_", "or_", "size", "hint_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "self_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size", "hint_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size", "hint_", "-=_", "len_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "line_", ":_", "\\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_", "lines_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "seek_", "(_", "self_", ",_", "offset_", ",_", "whe", "nce_", "=_", "SEE", "K", "\\u", "SET_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "file", "'", "s", " ", "current", " ", "position", ",", " ", "like", " ", "std", "io", "'", "s", " ", "fse", "ek", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "whe", "nce", " ", "argu", "ment", " ", "is", " ", "option", "al", " ", "and", " ", "default", "s", " ", "to", " ", "os", ".", "SEE", "K", "\\u", "SET", " ", "or", " ", "0", " ", "(", "abs", "olute", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "position", "ing", ");", " ", "other", " ", "values", " ", "are", " ", "os", ".", "SEE", "K", "\\u", "CUR", " ", "or", " ", "1", " ", "(", "seek", " ", "relative", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "current", " ", "position", ")", " ", "and", " ", "os", ".", "SEE", "K", "\\u", "END", " ", "or", " ", "2", " ", "(", "seek", " ", "relative", " ", "to", " ", "the", " ", "file", "'", "s", " ", "end", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "offset", ":", " ", "The", " ", "relative", " ", "offset", " ", "to", " ", "seek", " ", "to", ".", "\\", "10", ";", " ", " ", "whe", "nce", ":", " ", "Define", "s", " ", "what", " ", "the", " ", "offset", " ", "is", " ", "relative", " ", "to", ".", " ", "See", " ", "description", " ", "for", "\\", "10", ";", " ", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "whe", "nce_", "==_", "Blo", "b", "Reader_", "._", "SEE", "K", "\\u", "CUR", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "self_", "._", "\\u\\u", "position_", "+_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "whe", "nce_", "==_", "Blo", "b", "Reader_", "._", "SEE", "K", "\\u", "END_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "self_", "._", "blob", "\\u", "info_", "._", "size_", "+_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "buffer", "\\u", "position_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "position_", "=_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "eof_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "file", "'", "s", " ", "current", " ", "position", ",", " ", "like", " ", "std", "io", "'", "s", " ", "fte", "ll", "().\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "truncate_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Blo", "b", "Read", "ers", " ", "are", " ", "read", "-", "only", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Blo", "b", "Read", "ers", " ", "are", " ", "read", "-", "only", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "writelines_", "(_", "self_", ",_", "sequence_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "IO", "Error_", "(_", "\"", "Blo", "b", "Read", "ers", " ", "are", " ", "read", "-", "only", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "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_", "blob", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "Blo", "b", "Info", " ", "for", " ", "this", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u\\u", "blob", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "blob", "\\u", "info_", "=_", "Blo", "b", "Info_", "._", "get_", "(_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "blob", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Reader_", "(_", "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_", "closed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "Tru", "e", " ", "if", " ", "this", " ", "file", " ", "is", " ", "close", "d", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "blob", "\\u", "key_", "is_", "None_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/libtools.py
[ { "content": "# -*- coding: utf-8 -*-\n\n'''\n Specto Add-on\n Copyright (C) 2015 lambda\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\n\ntry:\n from sqlite3 import dbapi2 as database\nexcept:\n from pysqlite2 import dbapi2 as database\n\nimport os,sys,re,json,urllib,urlparse,datetime,xbmc\n\nfrom resources.lib.libraries import control\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def add(self, name, title, year, imdb, tmdb, range=False):\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 try:\n if not self.dupe_setting == 'true': raise Exception()\n\n id = [imdb, tmdb] if not tmdb == '0' else [imdb]\n lib = control.jsonrpc('{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetMovies\", \"params\": {\"filter\":{\"or\": [{\"field\": \"year\", \"operator\": \"is\", \"value\": \"%s\"}, {\"field\": \"year\", \"operator\": \"is\", \"value\": \"%s\"}, {\"field\": \"year\", \"operator\": \"is\", \"value\": \"%s\"}]}, \"properties\" : [\"imdbnumber\", \"originaltitle\", \"year\"]}, \"id\": 1}' % (year, str(int(year)+1), str(int(year)-1)))\n lib = unicode(lib, 'utf-8', errors='ignore')\n lib = json.loads(lib)['result']['movies']\n lib = [i for i in lib if str(i['imdbnumber']) in id or (i['originaltitle'].encode('utf-8') == title and str(i['year']) == year)][0]\n except:\n lib = []\n\n try:\n if not lib == []: raise Exception()\n\n if self.check_setting == 'true':\n from resources.lib.sources import sources\n src = sources().checkSources(name, title, year, imdb, tmdb, '0', '0', None, None, None, '0', None)\n if src == False: raise Exception()\n\n self.strmFile({'name': name, 'title': title, 'year': year, 'imdb': imdb, 'tmdb': tmdb})\n except:\n pass\n\n if range == True: return\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.add", "header": "['class', 'libmovies', ':', '___EOS___']", "index": 42 }, { "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 strmFile(self, i):\n try:\n name, title, year, imdb, tmdb = i['name'], i['title'], i['year'], i['imdb'], i['tmdb']\n\n sysname, systitle = urllib.quote_plus(name), urllib.quote_plus(title)\n\n transname = name.translate(None, '\\/:*?\"<>|').strip('.')\n\n content = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s' % (sys.argv[0], sysname, systitle, year, imdb, tmdb)\n\n control.makeFile(self.library_folder)\n folder = os.path.join(self.library_folder, transname)\n control.makeFile(folder)\n\n try:\n\t\t\t\tif not 'ftp://' in folder: raise Exception()\n\t\t\t\tfrom ftplib import FTP\n\t\t\t\tftparg = re.compile('ftp://(.+?):(.+?)@(.+?):?(\\d+)?/(.+/?)').findall(folder)\n\t\t\t\tftp = FTP(ftparg[0][2],ftparg[0][0],ftparg[0][1])\n\t\t\t\ttry: ftp.cwd(ftparg[0][4])\n\t\t\t\texcept: ftp.mkd(ftparg[0][4])\n\t\t\t\tftp.quit()\n except:\n\t\t\t\tpass\n\n stream = os.path.join(folder, transname + '.strm')\n file = control.openFile(stream, 'w')\n file.write(str(content))\n file.close()\n except:\n pass", "metadata": "root.libmovies.strmFile", "header": "['class', 'libmovies', ':', '___EOS___']", "index": 107 }, { "content": " def add(self, tvshowtitle, year, imdb, tmdb, tvdb, tvrage, range=False):\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 episodes\n items = episodes.episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, tvrage, idx=False)\n\n try: items = [{'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 items]\n except: items = []\n\n try:\n if not self.dupe_setting == 'true': raise Exception()\n if items == []: raise Exception()\n\n id = [items[0]['imdb'], items[0]['tvdb']]\n if not items[0]['tmdb'] == '0': id += [items[0]['tmdb']]\n\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 lib = [i['title'].encode('utf-8') for i in lib if str(i['imdbnumber']) in id or (i['title'].encode('utf-8') == items[0]['tvshowtitle'] and str(i['year']) == items[0]['year'])][0]\n\n lib = control.jsonrpc('{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetEpisodes\", \"params\": {\"filter\":{\"and\": [{\"field\": \"tvshow\", \"operator\": \"is\", \"value\": \"%s\"}]}, \"properties\": [\"season\", \"episode\"]}, \"id\": 1}' % lib)\n lib = unicode(lib, 'utf-8', errors='ignore')\n lib = json.loads(lib)['result']['episodes']\n lib = ['S%02dE%02d' % (int(i['season']), int(i['episode'])) for i in lib]\n\n items = [i for i in items if not 'S%02dE%02d' % (int(i['season']), int(i['episode'])) in lib]\n except:\n pass\n\n for i in items:\n try:\n if xbmc.abortRequested == True: return sys.exit()\n\n if self.check_setting == 'true':\n if i['episode'] == '1':\n self.block = True\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 == True: self.block = False\n if self.block == True: raise Exception()\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 self.strmFile(i)\n except:\n pass\n\n if range == True: return\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.add", "header": "['class', 'libtvshows', ':', '___EOS___']", "index": 157 }, { "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 strmFile(self, i):\n try:\n name, title, year, imdb, tmdb, tvdb, tvrage, season, episode, tvshowtitle, alter, date = 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\n episodename, episodetitle = urllib.quote_plus(name), urllib.quote_plus(title)\n systitle, syspremiered = urllib.quote_plus(tvshowtitle), urllib.quote_plus(date)\n\n if self.version >= 15:\n transname = '%s (%s) S%02dE%02d' % (tvshowtitle.translate(None, '\\/:*?\"<>|'), year, int(season), int(episode))\n transtitle = '%s (%s)' % (tvshowtitle.translate(None, '\\/:*?\"<>|'), year)\n else:\n transname = name.translate(None, '\\/:*?\"<>|').strip('.')\n transtitle = tvshowtitle.translate(None, '\\/:*?\"<>|').strip('.')\n\n transseason = 'Season %s' % season.translate(None, '\\/:*?\"<>|').strip('.')\n\n content = '%s?action=play&name=%s&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&tvrage=%s&season=%s&episode=%s&tvshowtitle=%s&alter=%s&date=%s' % (sys.argv[0], episodename, episodetitle, year, imdb, tmdb, tvdb, tvrage, season, episode, systitle, alter, syspremiered)\n\n control.makeFile(self.library_folder)\n\n folder = os.path.join(self.library_folder, transtitle)\n control.makeFile(folder)\n\n try:\n\t\t\t\tif not 'ftp://' in folder: raise Exception()\n\t\t\t\tfrom ftplib import FTP\n\t\t\t\tftparg = re.compile('ftp://(.+?):(.+?)@(.+?):?(\\d+)?/(.+/?)').findall(folder)\n\t\t\t\tftp = FTP(ftparg[0][2],ftparg[0][0],ftparg[0][1])\n\t\t\t\ttry: ftp.cwd(ftparg[0][4])\n\t\t\t\texcept: ftp.mkd(ftparg[0][4])\n\t\t\t\tftp.quit()\n except:\n\t\t\t\tpass\n\n folder = os.path.join(folder, transseason)\n control.makeFile(folder)\n\n try:\n\t\t\t\tif not 'ftp://' in folder: raise Exception()\n\t\t\t\tfrom ftplib import FTP\n\t\t\t\tftparg = re.compile('ftp://(.+?):(.+?)@(.+?):?(\\d+)?/(.+/?)').findall(folder)\n\t\t\t\tftp = FTP(ftparg[0][2],ftparg[0][0],ftparg[0][1])\n\t\t\t\ttry: ftp.cwd(ftparg[0][4])\n\t\t\t\texcept: ftp.mkd(ftparg[0][4])\n\t\t\t\tftp.quit()\n except:\n\t\t\t\tpass\n\n stream = os.path.join(folder, transname + '.strm')\n file = control.openFile(stream, 'w')\n file.write(str(content))\n file.close()\n except:\n pass", "metadata": "root.libtvshows.strmFile", "header": "['class', 'libtvshows', ':', '___EOS___']", "index": 247 }, { "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": "except:", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 7 }, { "span": "except:", "start_line": 55, "start_column": 8, "end_line": 55, "end_column": 15 }, { "span": "except:", "start_line": 67, "start_column": 8, "end_line": 67, "end_column": 15 }, { "span": "except:", "start_line": 97, "start_column": 12, "end_line": 97, "end_column": 19 }, { "span": "except: ", "start_line": 127, "start_column": 4, "end_line": 127, "end_column": 11 }, { "span": "except:", "start_line": 129, "start_column": 12, "end_line": 129, "end_column": 19 }, { "span": "except:", "start_line": 136, "start_column": 8, "end_line": 136, "end_column": 15 }, { "span": "except: ", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 15 }, { "span": "except:", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 15 }, { "span": "except:", "start_line": 207, "start_column": 12, "end_line": 207, "end_column": 19 }, { "span": "except:", "start_line": 237, "start_column": 12, "end_line": 237, "end_column": 19 }, { "span": "except: ", "start_line": 276, "start_column": 4, "end_line": 276, "end_column": 11 }, { "span": "except:", "start_line": 278, "start_column": 12, "end_line": 278, "end_column": 19 }, { "span": "except: ", "start_line": 290, "start_column": 4, "end_line": 290, "end_column": 11 }, { "span": "except:", "start_line": 292, "start_column": 12, "end_line": 292, "end_column": 19 }, { "span": "except:", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 15 }, { "span": "except: ", "start_line": 325, "start_column": 16, "end_line": 325, "end_column": 23 }, { "span": "except: ", "start_line": 328, "start_column": 16, "end_line": 328, "end_column": 23 }, { "span": "except: ", "start_line": 342, "start_column": 20, "end_line": 342, "end_column": 27 }, { "span": "except: ", "start_line": 344, "start_column": 20, "end_line": 344, "end_column": 27 }, { "span": "except: ", "start_line": 352, "start_column": 20, "end_line": 352, "end_column": 27 }, { "span": "except: ", "start_line": 355, "start_column": 20, "end_line": 355, "end_column": 27 }, { "span": "except:", "start_line": 358, "start_column": 16, "end_line": 358, "end_column": 23 }, { "span": "except:", "start_line": 363, "start_column": 8, "end_line": 363, "end_column": 15 }, { "span": "except:", "start_line": 370, "start_column": 8, "end_line": 370, "end_column": 15 }, { "span": "except:", "start_line": 382, "start_column": 8, "end_line": 382, "end_column": 15 }, { "span": "except:", "start_line": 386, "start_column": 8, "end_line": 386, "end_column": 15 }, { "span": "except:", "start_line": 398, "start_column": 12, "end_line": 398, "end_column": 19 }, { "span": "except:", "start_line": 413, "start_column": 12, "end_line": 413, "end_column": 19 }, { "span": "except:", "start_line": 428, "start_column": 12, "end_line": 428, "end_column": 19 }, { "span": "except:", "start_line": 441, "start_column": 16, "end_line": 441, "end_column": 23 }, { "span": "except:", "start_line": 466, "start_column": 8, "end_line": 466, "end_column": 15 }, { "span": "except: ", "start_line": 468, "start_column": 12, "end_line": 468, "end_column": 19 }, { "span": "except: ", "start_line": 471, "start_column": 8, "end_line": 471, "end_column": 15 }, { "span": "except:", "start_line": 498, "start_column": 16, "end_line": 498, "end_column": 23 }, { "span": "except: ", "start_line": 500, "start_column": 20, "end_line": 500, "end_column": 27 }, { "span": "except:", "start_line": 505, "start_column": 12, "end_line": 505, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Spect", "o", " ", "Add", "-", "on", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", "lambda", "\\", "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_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sqlite3_", "import_", "dbapi", "2_", "as_", "database_", "\\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_", "pys", "qli", "te", "2_", "import_", "dbapi", "2_", "as_", "database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "re_", ",_", "json_", ",_", "urllib_", ",_", "urlparse_", ",_", "datetime_", ",_", "xbmc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "libraries_", "import_", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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]_", "class_", "libm", "ovi", "es_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "name_", ",_", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "range_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "dupe", "\\u", "setting_", "==_", "'", "true", "'_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "[_", "imdb_", ",_", "tmdb", "_", "]_", "if_", "not_", "tmdb", "_", "==_", "'", "0", "'_", "else_", "[_", "imdb_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "control_", "._", "jsonrpc", "_", "(_", "'{", "\"", "jsonrpc", "\":", " ", "\"", "2.0", "\",", " ", "\"", "method", "\":", " ", "\"", "Vid", "eo", "Libr", "ary", ".", "Get", "Movi", "es", "\",", " ", "\"", "params", "\":", " ", "{", "\"", "filter", "\":{", "\"", "or", "\":", " ", "[{", "\"", "field", "\":", " ", "\"", "year", "\",", " ", "\"", "opera", "tor", "\":", " ", "\"", "is", "\",", " ", "\"", "value", "\":", " ", "\"%", "s", "\"},", " ", "{", "\"", "field", "\":", " ", "\"", "year", "\",", " ", "\"", "opera", "tor", "\":", " ", "\"", "is", "\",", " ", "\"", "value", "\":", " ", "\"%", "s", "\"},", " ", "{", "\"", "field", "\":", " ", "\"", "year", "\",", " ", "\"", "opera", "tor", "\":", " ", "\"", "is", "\",", " ", "\"", "value", "\":", " ", "\"%", "s", "\"}]", "},", " ", "\"", "proper", "ties", "\"", " ", ":", " ", "[\"", "imd", "bn", "umber", "\",", " ", "\"", "original", "title", "\",", " ", "\"", "year", "\"]}", ",", " ", "\"", "id", "\":", " ", "1", "}'_", "%_", "(_", "year_", ",_", "str_", "(_", "int_", "(_", "year_", ")_", "+_", "1_", ")_", ",_", "str_", "(_", "int_", "(_", "year_", ")_", "-_", "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", "'_", "]_", "[_", "'", "movie", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "[_", "i_", "for_", "i_", "in_", "lib_", "if_", "str_", "(_", "i_", "[_", "'", "imd", "bn", "umber", "'_", "]_", ")_", "in_", "id_", "or_", "(_", "i_", "[_", "'", "original", "title", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "==_", "title_", "and_", "str_", "(_", "i_", "[_", "'", "year", "'_", "]_", ")_", "==_", "year_", ")_", "]_", "[_", "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 ", " _", "lib_", "=_", "[_", "]_", "\\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_", "lib_", "==_", "[_", "]_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "check", "\\u", "setting_", "==_", "'", "true", "'_", ":_", "\\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_", "(_", "name_", ",_", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "'", "0", "'_", ",_", "'", "0", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "'", "0", "'_", ",_", "None_", ")_", "\\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_", "self_", "._", "strm", "File_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "title", "'_", ":_", "title_", ",_", "'", "year", "'_", ":_", "year_", ",_", "'", "imd", "b", "'_", ":_", "imdb_", ",_", "'", "tmdb", "'_", ":_", "tmdb", "_", "}_", ")_", "\\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_", "range_", "==_", "True_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "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_", "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_", "strm", "File_", "(_", "self_", ",_", "i_", ")_", ":_", "\\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 ", " _", "name_", ",_", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", "=_", "i_", "[_", "'", "name", "'_", "]_", ",_", "i_", "[_", "'", "title", "'_", "]_", ",_", "i_", "[_", "'", "year", "'_", "]_", ",_", "i_", "[_", "'", "imd", "b", "'_", "]_", ",_", "i_", "[_", "'", "tmdb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "name_", ",_", "syst", "itle_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "name_", ")_", ",_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trans", "name_", "=_", "name_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "'%", "s", "?", "action", "=", "play", "&", "name", "=", "%", "s", "&", "title", "=", "%", "s", "&", "year", "=", "%", "s", "&", "imd", "b", "=", "%", "s", "&", "tmdb", "=", "%", "s", "'_", "%_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ",_", "sys", "name_", ",_", "syst", "itle_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ",_", "trans", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "folder_", ")_", "\\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\t", "\t\t\t_", "if_", "not_", "'", "ftp", "://'_", "in_", "folder_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ftp", "lib_", "import_", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp", "arg_", "=_", "re_", "._", "compile_", "(_", "'", "ftp", "://", "(.+?)", ":(", ".+?)", "@(", ".+?)", ":", "?(", "\\\\", "d", "+)?", "/(.", "+/", "?)'", "_", ")_", "._", "findall_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "=_", "FTP", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "2_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "ftp_", "._", "cwd_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "ftp_", "._", "mkd", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "._", "quit_", "(_", ")_", "\\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_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "os_", "._", "path_", "._", "join_", "(_", "folder_", ",_", "trans", "name_", "+_", "'.", "strm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "control_", "._", "open", "File_", "(_", "stream_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "write_", "(_", "str_", "(_", "content_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "libt", "vs", "how", "s_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "tvshow", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "tvdb", "_", ",_", "tv", "rage_", ",_", "range_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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_", "episodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "episodes_", "._", "episodes_", "(_", ")_", "._", "get_", "(_", "tvshow", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "tvdb", "_", ",_", "tv", "rage_", ",_", "idx_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "items_", "=_", "[_", "{_", "'", "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_", "items_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "items_", "=_", "[_", "]_", "\\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 ", " _", "if_", "not_", "self_", "._", "dupe", "\\u", "setting_", "==_", "'", "true", "'_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "items_", "==_", "[_", "]_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "[_", "items_", "[_", "0_", "]_", "[_", "'", "imd", "b", "'_", "]_", ",_", "items_", "[_", "0_", "]_", "[_", "'", "tvdb", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "items_", "[_", "0_", "]_", "[_", "'", "tmdb", "'_", "]_", "==_", "'", "0", "'_", ":_", "id_", "+=_", "[_", "items_", "[_", "0_", "]_", "[_", "'", "tmdb", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "lib_", "=_", "[_", "i_", "[_", "'", "title", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "for_", "i_", "in_", "lib_", "if_", "str_", "(_", "i_", "[_", "'", "imd", "bn", "umber", "'_", "]_", ")_", "in_", "id_", "or_", "(_", "i_", "[_", "'", "title", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "==_", "items_", "[_", "0_", "]_", "[_", "'", "tvshow", "title", "'_", "]_", "and_", "str_", "(_", "i_", "[_", "'", "year", "'_", "]_", ")_", "==_", "items_", "[_", "0_", "]_", "[_", "'", "year", "'_", "]_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lib_", "=_", "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", "}'_", "%_", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "unicode_", "(_", "lib_", ",_", "'", "utf", "-", "8", "'_", ",_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "json_", "._", "loads_", "(_", "lib_", ")_", "[_", "'", "result", "'_", "]_", "[_", "'", "episode", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "[_", "'", "S", "%", "02", "d", "E", "%", "02", "d", "'_", "%_", "(_", "int_", "(_", "i_", "[_", "'", "season", "'_", "]_", ")_", ",_", "int_", "(_", "i_", "[_", "'", "episode", "'_", "]_", ")_", ")_", "for_", "i_", "in_", "lib_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "items_", "=_", "[_", "i_", "for_", "i_", "in_", "items_", "if_", "not_", "'", "S", "%", "02", "d", "E", "%", "02", "d", "'_", "%_", "(_", "int_", "(_", "i_", "[_", "'", "season", "'_", "]_", ")_", ",_", "int_", "(_", "i_", "[_", "'", "episode", "'_", "]_", ")_", ")_", "in_", "lib_", "]_", "\\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_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "check", "\\u", "setting_", "==_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "i_", "[_", "'", "episode", "'_", "]_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "block_", "=_", "True_", "\\u\\u\\uNEWLINE\\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_", "==_", "True_", ":_", "self_", "._", "block_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "block_", "==_", "True_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "self_", "._", "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_", "if_", "range_", "==_", "True_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "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_", "strm", "File_", "(_", "self_", ",_", "i_", ")_", ":_", "\\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 ", " _", "name_", ",_", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "tvdb", "_", ",_", "tv", "rage_", ",_", "season_", ",_", "episode_", ",_", "tvshow", "title_", ",_", "alter", "_", ",_", "date_", "=_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "episode", "name_", ",_", "episode", "title_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "name_", ")_", ",_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syst", "itle_", ",_", "sysp", "remi", "ere", "d_", "=_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "tvshow", "title_", ")_", ",_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "version_", ">=_", "15_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans", "name_", "=_", "'%", "s", " ", "(%", "s", ")", " ", "S", "%", "02", "d", "E", "%", "02", "d", "'_", "%_", "(_", "tvshow", "title_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", ",_", "year_", ",_", "int_", "(_", "season_", ")_", ",_", "int_", "(_", "episode_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "title_", "=_", "'%", "s", " ", "(%", "s", ")'_", "%_", "(_", "tvshow", "title_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", ",_", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trans", "name_", "=_", "name_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans", "title_", "=_", "tvshow", "title_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trans", "season_", "=_", "'", "Season", " ", "%", "s", "'_", "%_", "season_", "._", "translate_", "(_", "None_", ",_", "'\\\\", "/", ":*", "?\"", "<>", "|'_", ")_", "._", "strip_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "'%", "s", "?", "action", "=", "play", "&", "name", "=", "%", "s", "&", "title", "=", "%", "s", "&", "year", "=", "%", "s", "&", "imd", "b", "=", "%", "s", "&", "tmdb", "=", "%", "s", "&", "tvdb", "=", "%", "s", "&", "tv", "rage", "=", "%", "s", "&", "season", "=", "%", "s", "&", "episode", "=", "%", "s", "&", "tvshow", "title", "=", "%", "s", "&", "alter", "=", "%", "s", "&", "date", "=", "%", "s", "'_", "%_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ",_", "episode", "name_", ",_", "episode", "title_", ",_", "year_", ",_", "imdb_", ",_", "tmdb", "_", ",_", "tvdb", "_", ",_", "tv", "rage_", ",_", "season_", ",_", "episode_", ",_", "syst", "itle_", ",_", "alter", "_", ",_", "sysp", "remi", "ere", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ",_", "trans", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "folder_", ")_", "\\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\t", "\t\t\t_", "if_", "not_", "'", "ftp", "://'_", "in_", "folder_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ftp", "lib_", "import_", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp", "arg_", "=_", "re_", "._", "compile_", "(_", "'", "ftp", "://", "(.+?)", ":(", ".+?)", "@(", ".+?)", ":", "?(", "\\\\", "d", "+)?", "/(.", "+/", "?)'", "_", ")_", "._", "findall_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "=_", "FTP", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "2_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "ftp_", "._", "cwd_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "ftp_", "._", "mkd", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "._", "quit_", "(_", ")_", "\\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_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder_", "=_", "os_", "._", "path_", "._", "join_", "(_", "folder_", ",_", "trans", "season_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "make", "File_", "(_", "folder_", ")_", "\\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\t", "\t\t\t_", "if_", "not_", "'", "ftp", "://'_", "in_", "folder_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ftp", "lib_", "import_", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp", "arg_", "=_", "re_", "._", "compile_", "(_", "'", "ftp", "://", "(.+?)", ":(", ".+?)", "@(", ".+?)", ":", "?(", "\\\\", "d", "+)?", "/(.", "+/", "?)'", "_", ")_", "._", "findall_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "=_", "FTP", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "2_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "ftp", "arg_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "ftp_", "._", "cwd_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "ftp_", "._", "mkd", "_", "(_", "ftp", "arg_", "[_", "0_", "]_", "[_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "._", "quit_", "(_", ")_", "\\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_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "=_", "os_", "._", "path_", "._", "join_", "(_", "folder_", ",_", "trans", "name_", "+_", "'.", "strm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "control_", "._", "open", "File_", "(_", "stream_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "write_", "(_", "str_", "(_", "content_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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_", "._", "update_", "(_", "None_", ",_", "info_", "=_", "info_", ")_", "\\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_", "control_", "._", "sleep_", "(_", "10000_", ")_" ]
[ 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, 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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, 0, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
VisTrails/VisTrails/contrib/SciPy/DSP.py
[ { "content": "############################################################################\n##\n## Copyright (C) 2006-2007 University of Utah. All rights reserved.\n##\n## This file is part of VisTrails.\n##\n## This file may be used under the terms of the GNU General Public\n## License version 2.0 as published by the Free Software Foundation\n## and appearing in the file LICENSE.GPL included in the packaging of\n## this file. Please review the following to ensure GNU General Public\n## Licensing requirements will be met:\n## http://www.opensource.org/licenses/gpl-license.php\n##\n## If you are unsure which license is appropriate for your use (for\n## instance, you are interested in developing a commercial derivative\n## of VisTrails), please contact us at contact@vistrails.org.\n##\n## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n##\n############################################################################\nimport core.modules\nimport core.modules.module_registry\nfrom core.modules.vistrails_module import Module, ModuleError\nfrom SciPy import SciPy\nfrom Matrix import *\nimport scipy\nfrom scipy import sparse, fftpack\nimport numpy\n\n#################################################################\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DSP(SciPy):", "metadata": "root.DSP", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def compute(self):\n pass", "metadata": "root.DSP.compute", "header": "['class', 'DSP', '(', 'SciPy', ')', ':', '___EOS___']", "index": 33 }, { "content": "class FFT(DSP):", "metadata": "root.FFT", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def compute(self):\n mat = self.get_input(\"Signals\")\n pts = self.get_input(\"FFT Samples\")\n\n phasors = fftpack.fft(mat.matrix.data, pts)\n outmat = sparse.csc_matrix(phasors)\n out = SparseMatrix()\n out.matrix = outmat\n self.set_output(\"FFT Output\", out)", "metadata": "root.FFT.compute", "header": "['class', 'FFT', '(', 'DSP', ')', ':', '___EOS___']", "index": 37 }, { "content": "class FFT2(DSP):", "metadata": "root.FFT2", "header": "['module', '___EOS___']", "index": 47 }, { "content": " def compute(self):\n mat = self.get_input(\"Signals\")\n\n phasors = fftpack.fftn(mat.matrix.data)\n outmat = sparse.csc_matrix(phasors)\n out = SparseMatrix()\n out.matrix = outmat\n self.set_output(\"FFT Output\", out)", "metadata": "root.FFT2.compute", "header": "['class', 'FFT2', '(', 'DSP', ')', ':', '___EOS___']", "index": 48 }, { "content": "class WindowedFourierTransform(DSP):", "metadata": "root.WindowedFourierTransform", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def compute(self):\n mat = self.get_input(\"Signal\")\n \n sr = self.get_input(\"Sampling Rate\")\n if self.has_input(\"Window Size\"):\n window = self.get_input(\"Window Size\")\n else:\n window = sr\n\n if self.has_input(\"Stride\"):\n stride = self.get_input(\"Stride\")\n else:\n stride = int(sr / 2)\n\n \n signal_array = mat.matrix.toarray().ravel()\n\n # We now have a 1-D array that we can have good indexing into\n pad = signal_array[0:int(window/2)]\n signal_array = numpy.concatenate((pad,signal_array))\n win_low = 0\n win_hi = window - 1\n phasors = fftpack.fft(signal_array[win_low:win_hi])\n out_array = phasors.ravel()\n\n win_low += stride\n win_hi += stride\n\n while win_hi < signal_array.shape[0]:\n phasors = fftpack.fft(signal_array[win_low:win_hi])\n win_low += stride\n win_hi += stride\n out_array = numpy.vstack([out_array, phasors.ravel()])\n\n out = SparseMatrix()\n out.matrix = sparse.csc_matrix(out_array)\n self.set_output(\"FFT Output\", out)", "metadata": "root.WindowedFourierTransform.compute", "header": "['class', 'WindowedFourierTransform', '(', 'DSP', ')', ':', '___EOS___']", "index": 58 }, { "content": "class ShortTimeFourierTransform(DSP):\n ", "metadata": "root.ShortTimeFourierTransform", "header": "['module', '___EOS___']", "index": 96 }, { "content": " def get_signal(self, sigs, window, offset, size):\n win = scipy.zeros(sigs.shape[0]).ravel()\n win[offset:offset+size] = window.ravel()\n part = sigs * win\n return part", "metadata": "root.ShortTimeFourierTransform.get_signal", "header": "['class', 'ShortTimeFourierTransform', '(', 'DSP', ')', ':', '___EOS___']", "index": 97 }, { "content": " def compute(self):\n mat = self.get_input(\"Signal\")\n sr = self.get_input(\"Sampling Rate\")\n\n if self.has_input(\"Window\"):\n window = self.get_input(\"Window\").matrix.toarray()\n win_size = window.shape[1]\n else:\n win_size = self.get_input(\"WindowSize\")\n window = scipy.signal.hamming(win_size)\n\n if self.has_input(\"Stride\"):\n stride = self.get_input(\"Stride\")\n else:\n stride = int(win_size / 2)\n\n signal_array = mat.matrix.transpose().toarray().ravel()\n\n samples = signal_array.shape[0]\n\n offset = 0\n sig = self.get_signal(signal_array, window, offset, win_size)\n phasors = fftpack.fft(sig).ravel()\n out_array = phasors\n offset += stride\n\n i = 1\n while 1:\n try:\n sig = self.get_signal(signal_array, window, offset, win_size)\n phasors = fftpack.fft(sig)\n offset += stride\n out_array = numpy.vstack([out_array, phasors.ravel()])\n i += 1\n except:\n break\n\n (slices, freqs) = out_array.shape\n ar = out_array[0:,0:sr*2]\n ar = ar[0:,::-1]\n\n out = SparseMatrix()\n sigout = SparseMatrix()\n sigout.matrix = sparse.csc_matrix(signal_array)\n out.matrix = sparse.csc_matrix(ar)\n self.set_output(\"Signal Output\", sigout)\n self.set_output(\"FFT Output\", out)", "metadata": "root.ShortTimeFourierTransform.compute", "header": "['class', 'ShortTimeFourierTransform', '(', 'DSP', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "import core.modules", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 19 }, { "span": "import core.modules.module_registry", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 35 }, { "span": "from core.modules.vistrails_module import Module, ModuleError", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 61 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2007", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "may", " ", "be", " ", "used", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "License", " ", "version", " ", "2.0", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "and", " ", "appear", "ing", " ", "in", " ", "the", " ", "file", " ", "LICENSE", ".", "GP", "L", " ", "include", "d", " ", "in", " ", "the", " ", "packaging", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "this", " ", "file", ".", " ", " ", "Ple", "ase", " ", "review", " ", "the", " ", "follow", "ing", " ", "to", " ", "ensure", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Licen", "sing", " ", "require", "ment", "s", " ", "will", " ", "be", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "gpl", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "If", " ", "you", " ", "are", " ", "uns", "ure", " ", "whi", "ch", " ", "license", " ", "is", " ", "appropr", "iate", " ", "for", " ", "your", " ", "use", " ", "(", "for_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "instance", ",", " ", "you", " ", "are", " ", "interest", "ed", " ", "in", " ", "develop", "ing", " ", "a", " ", "commerc", "ial", " ", "derivative_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "of", " ", "Vis", "Trail", "s", "),", " ", "plea", "se", " ", "contact", " ", "us", " ", "at", " ", "contact", "@", "vist", "rail", "s", ".", "org", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "provided", " ", "AS", " ", "IS", " ", "with", " ", "NO", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "INC", "LU", "DING", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WAR", "RAN", "TY", " ", "OF", " ", "DES", "IGN", ",", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sci", "Py_", "import_", "Sci", "Py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Matrix_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "import_", "sparse_", ",_", "fft", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\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\\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_", "DS", "P_", "(_", "Sci", "Py_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DS", "P_", "(_", "Sci", "Py_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "FFT", "_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FFT", "_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mat_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Signal", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pts_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "FFT", " ", "Sampl", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "mat_", "._", "matrix_", "._", "data_", ",_", "pts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "mat_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "pha", "sor", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "matrix_", "=_", "out", "mat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "FFT", " ", "Output", "\"_", ",_", "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_", "FFT", "2_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FFT", "2_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mat_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Signal", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft", "n_", "(_", "mat_", "._", "matrix_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "mat_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "pha", "sor", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "matrix_", "=_", "out", "mat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "FFT", " ", "Output", "\"_", ",_", "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_", "Window", "ed", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Window", "ed", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mat_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Signal", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sr_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Sampl", "ing", " ", "Rat", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Window", " ", "Size", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Window", " ", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "int_", "(_", "sr_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal", "\\u", "array_", "=_", "mat_", "._", "matrix_", "._", "toa", "rray_", "(_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "have", " ", "a", " ", "1", "-", "D", " ", "array", " ", "tha", "t", " ", "we", " ", "can", " ", "have", " ", "good", " ", "indexing", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "pad_", "=_", "signal", "\\u", "array_", "[_", "0_", ":_", "int_", "(_", "window_", "/_", "2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signal", "\\u", "array_", "=_", "numpy_", "._", "concatenate_", "(_", "(_", "pad_", ",_", "signal", "\\u", "array_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "low_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "hi_", "=_", "window_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "signal", "\\u", "array_", "[_", "win", "\\u", "low_", ":_", "win", "\\u", "hi_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "pha", "sor", "s_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "win", "\\u", "low_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "hi_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "win", "\\u", "hi_", "<_", "signal", "\\u", "array_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "signal", "\\u", "array_", "[_", "win", "\\u", "low_", ":_", "win", "\\u", "hi_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "low_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "hi_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "out", "\\u", "array_", ",_", "pha", "sor", "s_", "._", "ravel_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "matrix_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "out", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "FFT", " ", "Output", "\"_", ",_", "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_", "Short", "Time", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Short", "Time", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "signal_", "(_", "self_", ",_", "sigs_", ",_", "window_", ",_", "offset_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "scipy_", "._", "zeros_", "(_", "sigs_", "._", "shape_", "[_", "0_", "]_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "[_", "offset_", ":_", "offset_", "+_", "size_", "]_", "=_", "window_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "=_", "sigs_", "*_", "win_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "part_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Short", "Time", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mat_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Signal", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sr_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Sampl", "ing", " ", "Rat", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Window", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Window", "\"_", ")_", "._", "matrix_", "._", "toa", "rray_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "size_", "=_", "window_", "._", "shape_", "[_", "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 ", " _", "win", "\\u", "size_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Window", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "scipy_", "._", "signal_", "._", "hamming", "_", "(_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "int_", "(_", "win", "\\u", "size_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal", "\\u", "array_", "=_", "mat_", "._", "matrix_", "._", "transpose_", "(_", ")_", "._", "toa", "rray_", "(_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "samples_", "=_", "signal", "\\u", "array_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig_", "=_", "self_", "._", "get", "\\u", "signal_", "(_", "signal", "\\u", "array_", ",_", "window_", ",_", "offset_", ",_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "sig_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "pha", "sor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sig_", "=_", "self_", "._", "get", "\\u", "signal_", "(_", "signal", "\\u", "array_", ",_", "window_", ",_", "offset_", ",_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "out", "\\u", "array_", ",_", "pha", "sor", "s_", "._", "ravel_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "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 ", " _", "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_", "(_", "slices_", ",_", "freqs_", ")_", "=_", "out", "\\u", "array_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "out", "\\u", "array_", "[_", "0_", ":_", ",_", "0_", ":_", "sr_", "*_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "ar_", "[_", "0_", ":_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "out_", "._", "matrix_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "signal", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "matrix_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Signal", " ", "Output", "\"_", ",_", "sig", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "FFT", " ", "Output", "\"_", ",_", "out_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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[ { "content": " @verify_status([STATUS.ENABLED])\n def fire(self):\n start_time = time.time()\n total_result = ActionResult(did_fire=False)\n while True:\n # Re-try action in list order after EVERY firing\n for action_method in self.__class__.action_priority:\n action_result = action_method(self)\n total_result.merge(action_result)\n # Action firing should fire the first action that can fire,\n # hence when fired start from the beginning\n if action_result.did_fire:\n # FIXME: Make this a hook for the runtime too use, don't\n # import and use calvin_control or metering in actor\n self.metering.fired(self.id, action_method.__name__)\n self.control.log_actor_firing(\n self.id,\n action_method.__name__,\n action_result.tokens_produced,\n action_result.tokens_consumed,\n action_result.production)\n _log.debug(\"Actor %s(%s) did fire %s -> %s\" % (\n self._type, self.id,\n action_method.__name__,\n str(action_result)))\n break\n\n if not action_result.did_fire:\n diff = time.time() - start_time\n if diff > 0.2 and start_time - self._last_time_warning > 120.0:\n # Every other minute warn if an actor runs for longer than 200 ms\n self._last_time_warning = start_time\n _log.warning(\"%s (%s) actor blocked for %f sec\" % (self.name, self._type, diff))\n # We reached the end of the list without ANY firing => return\n return total_result\n # Redundant as of now, kept as reminder for when rewriting exeption handling.\n raise Exception('Exit from fire should ALWAYS be from previous line.')", "metadata": "root.Actor.fire", "header": "['class', 'Actor', '(', 'object', ')', ':', '___EOS___']", "index": 509 } ]
[ { "span": "raise Exception('Exit from fire should ALWAYS be from previous line.')", "start_line": 545, "start_column": 8, "end_line": 545, "end_column": 78 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Actor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "verify", "\\u", "status_", "(_", "[_", "STATUS_", "._", "ENABLED_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fire_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "result_", "=_", "Action", "Result_", "(_", "did", "\\u", "fire_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Re", "-", "try", " ", "action", " ", "in", " ", "list", " ", "order", " ", "after", " ", "EVE", "RY", " ", "fir", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "action", "\\u", "method_", "in_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "action", "\\u", "priority_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "\\u", "result_", "=_", "action", "\\u", "method_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "result_", "._", "merge_", "(_", "action", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Action", " ", "fir", "ing", " ", "shou", "ld", " ", "fire", " ", "the", " ", "first", " ", "action", " ", "tha", "t", " ", "can", " ", "fire", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hen", "ce", " ", "whe", "n", " ", "fired", " ", "start", " ", "from", " ", "the", " ", "beginn", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "action", "\\u", "result_", "._", "did", "\\u", "fire_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Make", " ", "this", " ", "a", " ", "hook", " ", "for", " ", "the", " ", "runt", "ime", " ", "too", " ", "use", ",", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "import", " ", "and", " ", "use", " ", "cal", "vin", "\\u", "control", " ", "or", " ", "metering", " ", "in", " ", "actor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "metering", "_", "._", "fired", "_", "(_", "self_", "._", "id_", ",_", "action", "\\u", "method_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "log", "\\u", "actor", "\\u", "fir", "ing_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "result_", "._", "token", "s", "\\u", "produce", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "result_", "._", "token", "s", "\\u", "consume", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "result_", "._", "production_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "._", "debug_", "(_", "\"", "Act", "or", " ", "%", "s", "(%", "s", ")", " ", "did", " ", "fire", " ", "%", "s", " ", "->", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "type_", ",_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "method_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "action", "\\u", "result_", ")_", ")_", ")_", "\\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_", "action", "\\u", "result_", "._", "did", "\\u", "fire_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diff_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "diff_", ">_", "0.2_", "and_", "start", "\\u", "time_", "-_", "self_", "._", "\\u", "last", "\\u", "time", "\\u", "warning_", ">_", "120", ".0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Every", " ", "other", " ", "minute", " ", "warn", " ", "if", " ", "an", " ", "actor", " ", "runs", " ", "for", " ", "long", "er", " ", "than", " ", "200", " ", "ms_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "last", "\\u", "time", "\\u", "warning_", "=_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "._", "warning_", "(_", "\"%", "s", " ", "(%", "s", ")", " ", "actor", " ", "block", "ed", " ", "for", " ", "%", "f", " ", "sec", "\"_", "%_", "(_", "self_", "._", "name_", ",_", "self_", "._", "\\u", "type_", ",_", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "reache", "d", " ", "the", " ", "end", " ", "of", " ", "the", " ", "list", " ", "with", "out", " ", "ANY", " ", "fir", "ing", " ", "=>", " ", "return_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "total", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Redu", "ndan", "t", " ", "as", " ", "of", " ", "now", ",", " ", "kep", "t", " ", "as", " ", "reminder", " ", "for", " ", "whe", "n", " ", "rew", "riti", "ng", " ", "exe", "ption", " ", "handling", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "'", "Exi", "t", " ", "from", " ", "fire", " ", "shou", "ld", " ", "ALWAYS", " ", "be", " ", "from", " ", "previ", "ous", " ", "line", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
keitaoouchi/seleniumwrapper/test/test_seleniumwrapper.py
[ { "content": " def test_connect_merge_3rd_arguments_with_desired_capabilities(self):\n p = mock.patch(\"selenium.webdriver.Remote\")\n m = p.start()\n p2 = mock.patch(\"seleniumwrapper.wrapper.SeleniumWrapper\")\n m2 = p2.start()\n seleniumwrapper.connect(\"android\", \"http://localhost:4444/wd/hub\", {\"hoge\": \"hoge\"})\n dic = DesiredCapabilities.ANDROID\n dic[\"hoge\"] = \"hoge\"\n m.assert_called_once_with('http://localhost:4444/wd/hub', dic)\n p2.stop()\n p.stop()", "metadata": "root.TestSeleniumWrapperFactory.test_connect_merge_3rd_arguments_with_desired_capabilities", "header": "['class', 'TestSeleniumWrapperFactory', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "m2 ", "start_line": 39, "start_column": 8, "end_line": 39, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Selen", "ium", "Wrapper", "Factory_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connect", "\\u", "merge", "\\u", "3", "rd", "\\u", "argu", "ment", "s", "\\u", "with", "\\u", "desi", "red", "\\u", "capabilities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "mock_", "._", "patch_", "(_", "\"", "sele", "niu", "m", ".", "webdriver", ".", "Remo", "te", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "p_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "mock_", "._", "patch_", "(_", "\"", "sele", "niu", "mw", "rapp", "er", ".", "wrapp", "er", ".", "Selen", "ium", "Wrapper", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m2_", "=_", "p2_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sele", "niu", "mw", "rapp", "er_", "._", "connect_", "(_", "\"", "android", "\"_", ",_", "\"", "http", "://", "local", "host", ":", "4444", "/", "wd", "/", "hub", "\"_", ",_", "{_", "\"", "hog", "e", "\"_", ":_", "\"", "hog", "e", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic_", "=_", "Des", "ired", "Capabilities", "_", "._", "ANDROID", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dic_", "[_", "\"", "hog", "e", "\"_", "]_", "=_", "\"", "hog", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "'", "http", "://", "local", "host", ":", "4444", "/", "wd", "/", "hub", "'_", ",_", "dic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "stop_", "(_", ")_", "\\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, 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 ]
Unused local variable
coleifer/peewee/playhouse/tests/test_migrate.py
[ { "content": " def test_rename_gh380(self):\n u1 = User.create(id='charlie')\n u2 = User.create(id='huey')\n p1 = Page.create(name='p1-1', user=u1)\n p2 = Page.create(name='p2-1', user=u1)\n p3 = Page.create(name='p3-2', user=u2)\n\n migrate(self.migrator.rename_column('page', 'name', 'title'))\n\n column_names = self.get_column_names('page')\n self.assertEqual(column_names, set(['id', 'title', 'user_id']))\n\n class NewPage(Model):\n title = CharField(max_length=100, unique=True, null=True)\n user = ForeignKeyField(User, null=True, related_name='newpages')\n\n class Meta:\n database = self.database\n db_table = Page._meta.db_table\n\n query = (NewPage\n .select(\n NewPage.title,\n NewPage.user)\n .order_by(NewPage.title))\n self.assertEqual(\n [(np.title, np.user.id) for np in query],\n [('p1-1', 'charlie'), ('p2-1', 'charlie'), ('p3-2', 'huey')])", "metadata": "root.BaseMigrationTestCase.test_rename_gh380", "header": "['class', 'BaseMigrationTestCase', '(', 'object', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_drop_not_null(self):\n self._create_people()\n migrate(\n self.migrator.drop_not_null('person', 'first_name'),\n self.migrator.drop_not_null('person', 'last_name'))\n\n p = Person.create(first_name=None, last_name=None)\n query = (Person\n .select()\n .where(\n (Person.first_name >> None) &\n (Person.last_name >> None)))\n self.assertEqual(query.count(), 1)", "metadata": "root.BaseMigrationTestCase.test_drop_not_null", "header": "['class', 'BaseMigrationTestCase', '(', 'object', ')', ':', '___EOS___']", "index": 277 }, { "content": " def test_rename_table(self):\n t1 = Tag.create(tag='t1')\n t2 = Tag.create(tag='t2')\n\n # Move the tag data into a new model/table.\n class Tag_asdf(Tag):\n pass\n self.assertEqual(Tag_asdf._meta.db_table, 'tag_asdf')\n\n # Drop the new table just to be safe.\n Tag_asdf.drop_table(True)\n\n # Rename the tag table.\n migrate(self.migrator.rename_table('tag', 'tag_asdf'))\n\n # Verify the data was moved.\n query = (Tag_asdf\n .select()\n .order_by(Tag_asdf.tag))\n self.assertEqual([t.tag for t in query], ['t1', 't2'])\n\n # Verify the old table is gone.\n with self.database.transaction():\n self.assertRaises(\n DatabaseError,\n Tag.create,\n tag='t3')", "metadata": "root.BaseMigrationTestCase.test_rename_table", "header": "['class', 'BaseMigrationTestCase', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def test_add_foreign_key(self):\n if hasattr(Person, 'newtag_set'):\n delattr(Person, 'newtag_set')\n del Person._meta.reverse_rel['newtag_set']\n\n # Ensure no foreign keys are present at the beginning of the test.\n self.assertEqual(self.database.get_foreign_keys('tag'), [])\n\n field = ForeignKeyField(Person, null=True, to_field=Person.id)\n migrate(self.migrator.add_column('tag', 'person_id', field))\n\n class NewTag(Tag):\n person = field\n\n class Meta:\n db_table = 'tag'\n\n p = Person.create(first_name='First', last_name='Last')\n t1 = NewTag.create(tag='t1', person=p)\n t2 = NewTag.create(tag='t2')\n\n t1_db = NewTag.get(NewTag.tag == 't1')\n self.assertEqual(t1_db.person, p)\n\n t2_db = NewTag.get(NewTag.tag == 't2')\n self.assertEqual(t2_db.person, None)\n\n foreign_keys = self.database.get_foreign_keys('tag')\n self.assertEqual(len(foreign_keys), 1)\n foreign_key = foreign_keys[0]\n self.assertEqual(foreign_key.column, 'person_id')\n self.assertEqual(foreign_key.dest_column, 'id')\n self.assertEqual(foreign_key.dest_table, 'person')", "metadata": "root.BaseMigrationTestCase.test_add_foreign_key", "header": "['class', 'BaseMigrationTestCase', '(', 'object', ')', ':', '___EOS___']", "index": 439 } ]
[ { "span": "p1 ", "start_line": 223, "start_column": 8, "end_line": 223, "end_column": 10 }, { "span": "p2 ", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 10 }, { "span": "p3 ", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 10 }, { "span": "p ", "start_line": 283, "start_column": 8, "end_line": 283, "end_column": 9 }, { "span": "t1 ", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 10 }, { "span": "t2 ", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 10 }, { "span": "t1 ", "start_line": 457, "start_column": 8, "end_line": 457, "end_column": 10 }, { "span": "t2 ", "start_line": 458, "start_column": 8, "end_line": 458, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Base", "Migrat", "ion", "Test", "Case_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rename", "\\u", "gh", "380", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "u1_", "=_", "User_", "._", "create_", "(_", "id_", "=_", "'", "charl", "ie", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u2_", "=_", "User_", "._", "create_", "(_", "id_", "=_", "'", "hue", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "Page_", "._", "create_", "(_", "name_", "=_", "'", "p1", "-1", "'_", ",_", "user_", "=_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "Page_", "._", "create_", "(_", "name_", "=_", "'", "p2", "-1", "'_", ",_", "user_", "=_", "u1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p3_", "=_", "Page_", "._", "create_", "(_", "name_", "=_", "'", "p3", "-", "2", "'_", ",_", "user_", "=_", "u2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "(_", "self_", "._", "migr", "ator_", "._", "rename", "\\u", "column_", "(_", "'", "page", "'_", ",_", "'", "name", "'_", ",_", "'", "title", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "column", "\\u", "names_", "=_", "self_", "._", "get", "\\u", "column", "\\u", "names_", "(_", "'", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "column", "\\u", "names_", ",_", "set_", "(_", "[_", "'", "id", "'_", ",_", "'", "title", "'_", ",_", "'", "user", "\\u", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "New", "Page_", "(_", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "unique_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "Fore", "ign", "Key", "Field_", "(_", "User_", ",_", "null_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "newpa", "ges", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "database_", "=_", "self_", "._", "database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "table_", "=_", "Page_", "._", "\\u", "meta_", "._", "db", "\\u", "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_", "query_", "=_", "(_", "New", "Page_", "\\u\\u\\uNL\\u\\u\\u_", "._", "select_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "New", "Page_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "New", "Page_", "._", "user_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "order", "\\u", "by_", "(_", "New", "Page_", "._", "title_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "np_", "._", "title_", ",_", "np_", "._", "user_", "._", "id_", ")_", "for_", "np_", "in_", "query_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "p1", "-1", "'_", ",_", "'", "charl", "ie", "'_", ")_", ",_", "(_", "'", "p2", "-1", "'_", ",_", "'", "charl", "ie", "'_", ")_", ",_", "(_", "'", "p3", "-", "2", "'_", ",_", "'", "hue", "y", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Migrat", "ion", "Test", "Case_", "(_", "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_", "test\\u", "drop", "\\u", "not", "\\u", "null_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "people_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "migr", "ator_", "._", "drop", "\\u", "not", "\\u", "null_", "(_", "'", "person", "'_", ",_", "'", "first", "\\u", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "migr", "ator_", "._", "drop", "\\u", "not", "\\u", "null_", "(_", "'", "person", "'_", ",_", "'", "last", "\\u", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Person_", "._", "create_", "(_", "first", "\\u", "name_", "=_", "None_", ",_", "last", "\\u", "name_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "(_", "Person_", "\\u\\u\\uNL\\u\\u\\u_", "._", "select_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Person_", "._", "first", "\\u", "name_", ">>_", "None_", ")_", "&_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Person_", "._", "last", "\\u", "name_", ">>_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "query_", "._", "count_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Migrat", "ion", "Test", "Case_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "rename", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t1_", "=_", "Tag_", "._", "create_", "(_", "tag_", "=_", "'", "t1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "Tag_", "._", "create_", "(_", "tag_", "=_", "'", "t2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "the", " ", "tag", " ", "data", " ", "int", "o", " ", "a", " ", "new", " ", "model", "/", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ta", "g", "\\u", "asd", "f_", "(_", "Tag_", ")_", ":_", "\\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_", "._", "assert", "Equal_", "(_", "Ta", "g", "\\u", "asd", "f_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ",_", "'", "tag", "\\u", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Drop", " ", "the", " ", "new", " ", "table", " ", "just", " ", "to", " ", "be", " ", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "Ta", "g", "\\u", "asd", "f_", "._", "drop", "\\u", "table_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rename", " ", "the", " ", "tag", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "(_", "self_", "._", "migr", "ator_", "._", "rename", "\\u", "table_", "(_", "'", "tag", "'_", ",_", "'", "tag", "\\u", "asd", "f", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "data", " ", "was", " ", "moved", "._", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "(_", "Ta", "g", "\\u", "asd", "f_", "\\u\\u\\uNL\\u\\u\\u_", "._", "select_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "order", "\\u", "by_", "(_", "Ta", "g", "\\u", "asd", "f_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "tag_", "for_", "t_", "in_", "query_", "]_", ",_", "[_", "'", "t1", "'_", ",_", "'", "t2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "the", " ", "old", " ", "table", " ", "is", " ", "gone", "._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "database_", "._", "transaction_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Databa", "se", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tag_", "._", "create_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "'", "t3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Migrat", "ion", "Test", "Case_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "foreign", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "Person_", ",_", "'", "newt", "ag", "\\u", "set", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delattr", "_", "(_", "Person_", ",_", "'", "newt", "ag", "\\u", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "Person_", "._", "\\u", "meta_", "._", "reverse", "\\u", "rel_", "[_", "'", "newt", "ag", "\\u", "set", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "no", " ", "foreign", " ", "keys", " ", "are", " ", "presen", "t", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "the", " ", "test", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "database_", "._", "get", "\\u", "foreign", "\\u", "keys_", "(_", "'", "tag", "'_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "field_", "=_", "Fore", "ign", "Key", "Field_", "(_", "Person_", ",_", "null_", "=_", "True_", ",_", "to", "\\u", "field_", "=_", "Person_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrate_", "(_", "self_", "._", "migr", "ator_", "._", "add", "\\u", "column_", "(_", "'", "tag", "'_", ",_", "'", "person", "\\u", "id", "'_", ",_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "New", "Tag_", "(_", "Tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person_", "=_", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "table_", "=_", "'", "tag", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "Person_", "._", "create_", "(_", "first", "\\u", "name_", "=_", "'", "Fi", "rst", "'_", ",_", "last", "\\u", "name_", "=_", "'", "Las", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "New", "Tag_", "._", "create_", "(_", "tag_", "=_", "'", "t1", "'_", ",_", "person_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "New", "Tag_", "._", "create_", "(_", "tag_", "=_", "'", "t2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1", "\\u", "db_", "=_", "New", "Tag_", "._", "get_", "(_", "New", "Tag_", "._", "tag_", "==_", "'", "t1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t1", "\\u", "db_", "._", "person_", ",_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t2", "\\u", "db_", "=_", "New", "Tag_", "._", "get_", "(_", "New", "Tag_", "._", "tag_", "==_", "'", "t2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t2", "\\u", "db_", "._", "person_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "foreign", "\\u", "keys_", "=_", "self_", "._", "database_", "._", "get", "\\u", "foreign", "\\u", "keys_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "foreign", "\\u", "keys_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foreign", "\\u", "key_", "=_", "foreign", "\\u", "keys_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "foreign", "\\u", "key_", "._", "column_", ",_", "'", "person", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "foreign", "\\u", "key_", "._", "dest", "\\u", "column_", ",_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "foreign", "\\u", "key_", "._", "dest", "\\u", "table_", ",_", "'", "person", "'_", ")_", "\\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, 0, 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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 ]
Unused local variable
CGATOxford/cgat/scripts/clean.py
[ { "content": "def main(argv=None):\n \"\"\"script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n \"\"\"\n\n if argv is None:\n argv = sys.argv\n\n parser = E.OptionParser(version=\"%prog version: $Id: clean.py 2782 2009-09-10 11:40:29Z andreas $\",\n usage=globals()[\"__doc__\"])\n\n parser.add_option(\"-g\", \"--glob\", dest=\"glob_pattern\", type=\"string\",\n help=\"glob pattern to use for collecting files [%default].\")\n\n parser.add_option(\"-n\", \"--dry-run\", dest=\"dry_run\", action=\"store_true\",\n help=\"only print out actions, do not execute them [%default].\")\n\n parser.add_option(\"-f\", \"--file-pattern\", dest=\"file_pattern\", type=\"string\",\n help=\"only check files matching this pattern [%default].\")\n\n parser.set_defaults(glob_pattern=\"data.dir\",\n file_pattern=\".out\",\n check_completeness=\"python\",\n skip_dirs=[],\n dry_run=False,\n )\n\n (options, args) = E.Start(parser,\n add_pipe_options=True)\n\n if args:\n starts = args\n elif options.glob_pattern:\n starts = glob.glob(options.glob_pattern)\n else:\n starts = \".\"\n\n ndirs, nfiles, ndeleted = 0, 0, 0\n\n if options.check_completeness == \"python\":\n isComplete = checkPythonRuns\n\n rx = re.compile(options.file_pattern)\n\n for start in starts:\n for root, dirs, files in os.walk(start):\n\n ndirs += 1\n # exclude directories\n for dir in options.skip_dirs:\n if dir in dirs:\n dirs.remove(dir)\n\n for filename in files:\n p = os.path.join(root, filename)\n if rx.search(filename) and not isComplete(p):\n if options.dry_run:\n options.stdlog.write(\"# removing file %s\\n\" % p)\n else:\n os.remove(p)\n ndeleted += 1\n\n if options.loglevel >= 1:\n options.stdlog.write(\"# ndirs=%i, nfiles=%i, ndeleted=%i\\n\" %\n (ndirs, nfiles, ndeleted))\n\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "argv ", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 12 } ]
[]
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_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "script", " ", "main", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "parse", "s", " ", "command", " ", "line", " ", "options", " ", "in", " ", "sys", ".", "argv", ",", " ", "unl", "ess", " ", "*", "argv", "*", " ", "is", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argv_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", ":", " ", "clean", ".", "py", " ", "278", "2", " ", "200", "9", "-0", "9", "-1", "0", " ", "11", ":", "40", ":", "2", "9", "Z", " ", "andr", "eas", " ", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "g", "\"_", ",_", "\"--", "glob", "\"_", ",_", "dest_", "=_", "\"", "glob", "\\u", "pattern", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "glob", " ", "pattern", " ", "to", " ", "use", " ", "for", " ", "collecti", "ng", " ", "files", " ", "[", "%", "default", "].", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "n", "\"_", ",_", "\"--", "dry", "-", "run", "\"_", ",_", "dest_", "=_", "\"", "dry", "\\u", "run", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "only", " ", "print", " ", "out", " ", "action", "s", ",", " ", "do", " ", "not", " ", "execute", " ", "them", " ", "[", "%", "default", "].", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "f", "\"_", ",_", "\"--", "file", "-", "pattern", "\"_", ",_", "dest_", "=_", "\"", "file", "\\u", "pattern", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "only", " ", "check", " ", "files", " ", "matchi", "ng", " ", "this", " ", "pattern", " ", "[", "%", "default", "].", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "glob", "\\u", "pattern_", "=_", "\"", "data", ".", "dir", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "pattern_", "=_", "\".", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "complete", "ness_", "=_", "\"", "python", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "dirs_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dry", "\\u", "run_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "pipe", "\\u", "options_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "starts_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "glob", "\\u", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "starts_", "=_", "glob_", "._", "glob_", "(_", "options_", "._", "glob", "\\u", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "starts_", "=_", "\".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ndi", "rs_", ",_", "nfile", "s_", ",_", "nde", "lete", "d_", "=_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "check", "\\u", "complete", "ness_", "==_", "\"", "python", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Complete_", "=_", "check", "Pyth", "on", "Run", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx_", "=_", "re_", "._", "compile_", "(_", "options_", "._", "file", "\\u", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "start_", "in_", "starts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "start_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ndi", "rs_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exclu", "de", " ", "directories_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dir_", "in_", "options_", "._", "skip", "\\u", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dir_", "in_", "dirs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dirs_", "._", "remove_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rx_", "._", "search_", "(_", "filename_", ")_", "and_", "not_", "is", "Complete_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "options_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "options_", "._", "std", "log_", "._", "write_", "(_", "\"#", " ", "remo", "ving", " ", "file", " ", "%", "s", "\\\\", "n", "\"_", "%_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nde", "lete", "d_", "+=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "loglevel_", ">=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "std", "log_", "._", "write_", "(_", "\"#", " ", "ndi", "rs", "=", "%", "i", ",", " ", "nfile", "s", "=", "%", "i", ",", " ", "nde", "lete", "d", "=", "%", "i", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ndi", "rs_", ",_", "nfile", "s_", ",_", "nde", "lete", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\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, 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, 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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 ]
Except block handles 'BaseException'
kuri65536/python-for-android/python-modules/twisted/twisted/python/modules.py
[ { "content": " def load(self, default=_nothing):\n \"\"\"\n Load this module.\n\n @param default: if specified, the value to return in case of an error.\n\n @return: a genuine python module.\n\n @raise: any type of exception. Importing modules is a risky business;\n the erorrs of any code run at module scope may be raised from here, as\n well as ImportError if something bizarre happened to the system path\n between the discovery of this PythonModule object and the attempt to\n import it. If you specify a default, the error will be swallowed\n entirely, and not logged.\n\n @rtype: types.ModuleType.\n \"\"\"\n try:\n return self.pathEntry.pythonPath.moduleLoader(self.name)\n except: # this needs more thought...\n if default is not _nothing:\n return default\n raise", "metadata": "root.PythonModule.load", "header": "['class', 'PythonModule', '(', '_ModuleIteratorHelper', ')', ':', '___EOS___']", "index": 364 } ]
[ { "span": "except: ", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Pyth", "on", "Module_", "(_", "\\u", "Modul", "e", "Iterat", "or", "Helper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ",_", "default_", "=_", "\\u", "nothing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "this", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "default", ":", " ", "if", " ", "specified", ",", " ", "the", " ", "value", " ", "to", " ", "return", " ", "in", " ", "case", " ", "of", " ", "an", " ", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "a", " ", "genu", "ine", " ", "python", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", ":", " ", "any", " ", "type", " ", "of", " ", "exception", ".", " ", " ", "Import", "ing", " ", "module", "s", " ", "is", " ", "a", " ", "risk", "y", " ", "business", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "ero", "rr", "s", " ", "of", " ", "any", " ", "code", " ", "run", " ", "at", " ", "module", " ", "scope", " ", "may", " ", "be", " ", "raise", "d", " ", "from", " ", "here", ",", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "well", " ", "as", " ", "Import", "Error", " ", "if", " ", "somet", "hing", " ", "biz", "arr", "e", " ", "happ", "ened", " ", "to", " ", "the", " ", "system", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "bet", "ween", " ", "the", " ", "discove", "ry", " ", "of", " ", "this", " ", "Pyth", "on", "Modul", "e", " ", "object", " ", "and", " ", "the", " ", "atte", "mpt", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "it", ".", " ", " ", "If", " ", "you", " ", "speci", "fy", " ", "a", " ", "default", ",", " ", "the", " ", "error", " ", "will", " ", "be", " ", "swa", "llow", "ed", "\\", "10", ";", " ", " ", " ", " ", "entire", "ly", ",", " ", "and", " ", "not", " ", "logged", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "types", ".", "Modul", "e", "Type", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "path", "Entry_", "._", "python", "Path_", "._", "module", "Loader_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "this", " ", "need", "s", " ", "more", " ", "thought", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "default_", "is_", "not_", "\\u", "nothing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
RobotLocomotion/director/src/python/director/surprisetask.py
[ { "content": " def fitSwitchBox(self, polyData, points):\n boxPosition = points[0]\n wallPoint = points[1]\n\n\n # find a frame that is aligned with wall\n searchRadius = 0.2\n planePoints, normal = segmentation.applyLocalPlaneFit(polyData, points[0], searchRadius=np.linalg.norm(points[1] - points[0]), searchRadiusEnd=1.0)\n\n obj = vis.updatePolyData(planePoints, 'wall plane points', color=[0,1,0], visible=False)\n obj.setProperty('Point Size', 7)\n\n viewDirection = segmentation.SegmentationContext.getGlobalInstance().getViewDirection()\n if np.dot(normal, viewDirection) < 0:\n normal = -normal\n\n origin = segmentation.computeCentroid(planePoints)\n\n zaxis = [0,0,1]\n xaxis = normal\n yaxis = np.cross(zaxis, xaxis)\n yaxis /= np.linalg.norm(yaxis)\n zaxis = np.cross(xaxis, yaxis)\n zaxis /= np.linalg.norm(zaxis)\n\n t = transformUtils.getTransformFromAxes(xaxis, yaxis, zaxis)\n\n # translate that frame to the box position\n t.PostMultiply()\n t.Translate(boxPosition)\n\n boxFrame = transformUtils.copyFrame(t)\n self.switchPlanner.spawnBoxAffordanceAtFrame(boxFrame)", "metadata": "root.ImageFitter.fitSwitchBox", "header": "['class', 'ImageFitter', '(', 'ImageBasedAffordanceFit', ')', ':', '___EOS___']", "index": 73 }, { "content": " def addTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(name, func, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n prevFolder = self.folder\n addFolder(name, prevFolder)\n addFunc('plan', planFunc)\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc('execute manip plan', self.drillDemo.commitManipPlan)\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n self.folder = prevFolder\n\n\n self.taskTree.removeAllTasks()\n side = self.getSide()\n\n ###############\n # add the tasks\n\n # prep\n # addFolder('Prep')\n # addTask(rt.CloseHand(name='close left hand', side='Left'))\n # addTask(rt.CloseHand(name='close right hand', side='Right'))\n self.addSwitchTasks()", "metadata": "root.SurpriseTaskPanel.addTasks", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 166 }, { "content": " def addSwitchTasks(self):\n\n # some helpers\n self.folder = None\n def addTask(task, parent=None):\n parent = parent or self.folder\n self.taskTree.onAddTask(task, copy=False, parent=parent)\n def addFunc(name, func, parent=None):\n addTask(rt.CallbackTask(callback=func, name=name), parent=parent)\n def addFolder(name, parent=None):\n self.folder = self.taskTree.addGroup(name, parent=parent)\n return self.folder\n\n def addManipTask(name, planFunc, userPrompt=False):\n\n prevFolder = self.folder\n addFolder(name, prevFolder)\n addFunc('plan', planFunc)\n if not userPrompt:\n addTask(rt.CheckPlanInfo(name='check manip plan info'))\n else:\n addTask(rt.UserPromptTask(name='approve manip plan', message='Please approve manipulation plan.'))\n addFunc('execute manip plan', self.switchPlanner.commitManipPlan)\n addTask(rt.WaitForManipulationPlanExecution(name='wait for manip execution'))\n self.folder = prevFolder\n\n\n self.taskTree.removeAllTasks()\n side = self.getSide()\n\n addFolder('Fit Box Affordance')\n addFunc('fit switch box affordance', self.fitSwitchBox)\n addTask(rt.UserPromptTask(name='verify/adjust affordance', message='verify/adjust affordance.'))\n\n # walk to drill\n addFolder('Walk')\n addFunc('plan footstep frame', self.switchPlanner.spawnFootstepFrame)\n addTask(rt.RequestFootstepPlan(name='plan walk to drill', stanceFrameName='switch box stance frame'))\n addTask(rt.UserPromptTask(name='approve footsteps', message='Please approve footstep plan.'))\n addTask(rt.CommitFootstepPlan(name='walk to switch box', planName='switch box stance frame footstep plan'))\n addTask(rt.WaitForWalkExecution(name='wait for walking'))\n\n armsUp = addFolder('Arms Up')\n addManipTask('Arms Up 1', self.switchPlanner.planArmsPrep1, userPrompt=True)\n self.folder = armsUp\n addManipTask('Arms Up 2', self.switchPlanner.planArmsPrep2, userPrompt=True)\n addTask(rt.CloseHand(side='Right', mode='Pinch', name='set finger pinch'))\n reach = addFolder('Reach')\n\n addFunc('set degrees per second 30', self.setParamsPreTeleop)\n addFunc('update reach frame', self.switchPlanner.updateReachFrame)\n addTask(rt.UserPromptTask(name='adjust frame', message='adjust reach frame if necessary'))\n addManipTask('reach above box', self.onPlanPinchReach, userPrompt=True)\n\n teleop = addFolder('Teleop')\n addFunc('set degrees per second 10', self.setParamsTeleop)\n addTask(rt.UserPromptTask(name='wait for teleop', message='continue when finished with task.'))\n\n\n armsDown = addFolder('Arms Down')\n addTask(rt.UserPromptTask(name='check left hand free', message='check left hand free to close and move back'))\n addTask(rt.CloseHand(name='close left hand', side='Right'))\n addManipTask('Arms Down 1', self.switchPlanner.planArmsPrep2, userPrompt=True)\n self.folder = armsDown\n self.folder = armsDown\n addManipTask('Arms Down 2', self.switchPlanner.planArmsPrep1, userPrompt=True)\n self.folder = armsDown\n addManipTask('plan nominal', self.switchPlanner.planNominal, userPrompt=True)", "metadata": "root.SurpriseTaskPanel.addSwitchTasks", "header": "['class', 'SurpriseTaskPanel', '(', 'TaskUserPanel', ')', ':', '___EOS___']", "index": 205 } ]
[ { "span": "wallPoint ", "start_line": 75, "start_column": 8, "end_line": 75, "end_column": 17 }, { "span": "searchRadius ", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 20 }, { "span": "origin ", "start_line": 89, "start_column": 8, "end_line": 89, "end_column": 14 }, { "span": "addManipTask(", "start_line": 179, "start_column": 12, "end_line": 179, "end_column": 24 }, { "span": "side ", "start_line": 194, "start_column": 8, "end_line": 194, "end_column": 12 }, { "span": "side ", "start_line": 233, "start_column": 8, "end_line": 233, "end_column": 12 }, { "span": "reach ", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 13 }, { "span": "teleop ", "start_line": 259, "start_column": 8, "end_line": 259, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Image", "Fitt", "er_", "(_", "Image", "Base", "d", "Aff", "orda", "nce", "Fit_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit", "Switch", "Box_", "(_", "self_", ",_", "poly", "Data_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "box", "Position_", "=_", "points_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wall", "Point_", "=_", "points_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "a", " ", "frame", " ", "tha", "t", " ", "is", " ", "aligned", " ", "with", " ", "wall_", "\\u\\u\\uNL\\u\\u\\u_", "search", "Radius_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plane", "Points_", ",_", "normal_", "=_", "segmentation_", "._", "appl", "y", "Local", "Plan", "e", "Fit_", "(_", "poly", "Data_", ",_", "points_", "[_", "0_", "]_", ",_", "search", "Radius_", "=_", "np_", "._", "linalg_", "._", "norm_", "(_", "points_", "[_", "1_", "]_", "-_", "points_", "[_", "0_", "]_", ")_", ",_", "search", "Rad", "ius", "End_", "=_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "vis_", "._", "update", "Poly", "Data_", "(_", "plane", "Points_", ",_", "'", "wall", " ", "plane", " ", "points", "'_", ",_", "color_", "=_", "[_", "0_", ",_", "1_", ",_", "0_", "]_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "set", "Property_", "(_", "'", "Point", " ", "Size", "'_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Direction_", "=_", "segmentation_", "._", "Segmentation", "Context_", "._", "get", "Global", "Instance_", "(_", ")_", "._", "get", "View", "Direction_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "dot_", "(_", "normal_", ",_", "view", "Direction_", ")_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normal_", "=_", "-_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "origin_", "=_", "segmentation_", "._", "compute", "Centro", "id_", "(_", "plane", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "za", "xis_", "=_", "[_", "0_", ",_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xaxis_", "=_", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "=_", "np_", "._", "cross_", "(_", "za", "xis_", ",_", "xaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yaxis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "=_", "np_", "._", "cross_", "(_", "xaxis_", ",_", "yaxis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "za", "xis_", "/=_", "np_", "._", "linalg_", "._", "norm_", "(_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "transform", "Utils_", "._", "get", "Transform", "Fro", "m", "Axes_", "(_", "xaxis_", ",_", "yaxis_", ",_", "za", "xis_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translat", "e", " ", "tha", "t", " ", "frame", " ", "to", " ", "the", " ", "box", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "Post", "Multiply", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "Translate", "_", "(_", "box", "Position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "box", "Frame_", "=_", "transform", "Utils_", "._", "copy", "Frame_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Box", "Aff", "orda", "nce", "At", "Frame_", "(_", "box", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "name_", ",_", "func_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "Folder_", "=_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Folder_", "(_", "name_", ",_", "prev", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", "'_", ",_", "plan", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "info", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "self_", "._", "drill", "Demo", "_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "prev", "Folder_", "\\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_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prep_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Fold", "er", "('", "Prep", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Task", "(", "rt", ".", "Clos", "e", "Hand", "(", "name", "='", "close", " ", "left", " ", "hand", "',", " ", "side", "='", "Le", "ft", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", "Task", "(", "rt", ".", "Clos", "e", "Hand", "(", "name", "='", "close", " ", "right", " ", "hand", "',", " ", "side", "='", "Rig", "ht", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "Switch", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sur", "pris", "e", "Task", "Panel_", "(_", "Task", "User", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Switch", "Tasks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "helpers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Task_", "(_", "task_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "=_", "parent_", "or_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "Tree_", "._", "on", "Add", "Task_", "(_", "task_", ",_", "copy_", "=_", "False_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Func_", "(_", "name_", ",_", "func_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Call", "back", "Task_", "(_", "callback_", "=_", "func_", ",_", "name_", "=_", "name_", ")_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Folder_", "(_", "name_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "folder_", "=_", "self_", "._", "task", "Tree_", "._", "add", "Group_", "(_", "name_", ",_", "parent_", "=_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mani", "p", "Task_", "(_", "name_", ",_", "plan", "Func_", ",_", "user", "Prompt_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "Folder_", "=_", "self_", "._", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Folder_", "(_", "name_", ",_", "prev", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", "'_", ",_", "plan", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "Prompt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "Check", "Plan", "Info_", "(_", "name_", "=_", "'", "check", " ", "manip", " ", "plan", " ", "info", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "manip", " ", "plan", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "manipulati", "on", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Func_", "(_", "'", "execute", " ", "manip", " ", "plan", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "commit", "Mani", "p", "Plan_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Manipulat", "ion", "Plan", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "manip", " ", "executi", "on", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "prev", "Folder_", "\\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_", "._", "task", "Tree_", "._", "remove", "All", "Tasks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "side_", "=_", "self_", "._", "get", "Side_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Folder_", "(_", "'", "Fit", " ", "Box", " ", "Aff", "orda", "nce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "fit", " ", "switch", " ", "box", " ", "aff", "orda", "nce", "'_", ",_", "self_", "._", "fit", "Switch", "Box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "verify", "/", "adjust", " ", "aff", "orda", "nce", "'_", ",_", "message_", "=_", "'", "verify", "/", "adjust", " ", "aff", "orda", "nce", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "walk", " ", "to", " ", "drill", "_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Folder_", "(_", "'", "Walk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "plan", " ", "foot", "step", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "spawn", "Foot", "step", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Request", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "plan", " ", "walk", " ", "to", " ", "drill", "'_", ",_", "stance", "Frame", "Name_", "=_", "'", "switch", " ", "box", " ", "stance", " ", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "approve", " ", "foot", "step", "s", "'_", ",_", "message_", "=_", "'", "Ple", "ase", " ", "approve", " ", "foot", "step", " ", "plan", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Commi", "t", "Foot", "step", "Plan_", "(_", "name_", "=_", "'", "walk", " ", "to", " ", "switch", " ", "box", "'_", ",_", "plan", "Name_", "=_", "'", "switch", " ", "box", " ", "stance", " ", "frame", " ", "foot", "step", " ", "plan", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Wait", "For", "Walk", "Execution_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "walking", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arms", "Up_", "=_", "add", "Folder_", "(_", "'", "Arm", "s", " ", "Up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Up", " ", "1", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "1_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Up_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Up", " ", "2", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "2_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "side_", "=_", "'", "Rig", "ht", "'_", ",_", "mode_", "=_", "'", "Pin", "ch", "'_", ",_", "name_", "=_", "'", "set", " ", "finger", " ", "pin", "ch", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reach", "_", "=_", "add", "Folder_", "(_", "'", "Reach", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "Func_", "(_", "'", "set", " ", "degr", "ees", " ", "per", " ", "second", " ", "30", "'_", ",_", "self_", "._", "set", "Param", "s", "Pre", "Tele", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "update", " ", "reach", " ", "frame", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "update", "Reach", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "adjust", " ", "frame", "'_", ",_", "message_", "=_", "'", "adjust", " ", "reach", " ", "frame", " ", "if", " ", "necessar", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "reach", " ", "above", " ", "box", "'_", ",_", "self_", "._", "on", "Plan", "Pin", "ch", "Reach", "_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tele", "op_", "=_", "add", "Folder_", "(_", "'", "Tele", "op", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Func_", "(_", "'", "set", " ", "degr", "ees", " ", "per", " ", "second", " ", "10", "'_", ",_", "self_", "._", "set", "Param", "s", "Tele", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "wait", " ", "for", " ", "tele", "op", "'_", ",_", "message_", "=_", "'", "continue", " ", "whe", "n", " ", "finish", "ed", " ", "with", " ", "task", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arms", "Down_", "=_", "add", "Folder_", "(_", "'", "Arm", "s", " ", "Down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "User", "Prom", "pt", "Task_", "(_", "name_", "=_", "'", "check", " ", "left", " ", "hand", " ", "free", "'_", ",_", "message_", "=_", "'", "check", " ", "left", " ", "hand", " ", "free", " ", "to", " ", "close", " ", "and", " ", "move", " ", "back", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Task_", "(_", "rt_", "._", "Clos", "e", "Hand_", "(_", "name_", "=_", "'", "close", " ", "left", " ", "hand", "'_", ",_", "side_", "=_", "'", "Rig", "ht", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Down", " ", "1", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "2_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "Arm", "s", " ", "Down", " ", "2", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Arm", "s", "Prep", "1_", ",_", "user", "Prompt_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "folder_", "=_", "arms", "Down_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Mani", "p", "Task_", "(_", "'", "plan", " ", "nominal", "'_", ",_", "self_", "._", "switch", "Plann", "er_", "._", "plan", "Nomi", "nal_", ",_", "user", "Prompt_", "=_", "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, 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, 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, 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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 ]
Unused local variable
fatcloud/PyCV-time/opencv-official-samples/earlier/pyramid_segmentation.py
[ { "content": " def on_segment(self):\n comp = cv.PyrSegmentation(self.image0, self.image1, self.storage, \\\n self.level, self.thresh1+1, self.thresh2+1)\n cv.ShowImage(\"Segmentation\", self.image1)", "metadata": "root.PyrSegmentation.on_segment", "header": "['class', 'PyrSegmentation', ':', '___EOS___']", "index": 26 } ]
[ { "span": "comp ", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pyr", "Segmentation", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "segment_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "=_", "cv_", "._", "Pyr", "Segmentation", "_", "(_", "self_", "._", "image", "0_", ",_", "self_", "._", "image1", "_", ",_", "self_", "._", "storage_", ",_", "self_", "._", "level_", ",_", "self_", "._", "thresh", "1_", "+_", "1_", ",_", "self_", "._", "thresh", "2_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cv_", "._", "Show", "Image_", "(_", "\"", "Segmentation", "\"_", ",_", "self_", "._", "image1", "_", ")_", "\\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, 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 ]
Unused import
VisTrails/VisTrails/scripts/merge_vistrails.py
[ { "content": "#!/usr/bin/env python\n###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: contact@vistrails.org\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\n#FIXME !!! DOES NOT MERGE EXECUTION LOGS STORED IN VT FILE !!!\n\nimport sys\nif '../vistrails' not in sys.path:\n sys.path.append('../vistrails')\n\nimport vistrails.db.services.vistrail\nfrom vistrails.db.domain import DBModule, DBConnection, DBPort, DBFunction, \\\n DBParameter, DBLocation, DBPortSpec, DBTag, DBAnnotation, DBVistrail, \\\n DBAction\nfrom vistrails.db.services import io\n\n \nif __name__ == '__main__':\n if len(sys.argv) < 3:\n print \"Usage: %s [output filename] [list of input vistrails]\" % \\\n sys.argv[0]\n sys.exit(0)\n main(sys.argv[1], sys.argv[2:])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main(out_fname, in_fnames):\n \"\"\"main(out_fname: str, in_fnames: list<str>) -> None\n Combines all vistrails specified in in_fnames into a single vistrail\n by renumbering their ids\n\n \"\"\"\n # FIXME this breaks when you use abstractions!\n (save_bundle, vt_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType, in_fnames[0])\n for in_fname in in_fnames[1:]:\n (new_save_bundle, new_save_dir) = io.open_bundle_from_zip_xml(DBVistrail.vtType, in_fname)\n vistrails.db.services.vistrail.merge(save_bundle, new_save_bundle, \"\", True, vt_save_dir, new_save_dir)\n io.save_bundle_to_zip_xml(save_bundle, out_fname)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 48 } ]
[ { "span": "from vistrails.db.domain import DBModule, DBConnection, DBPort, DBFunction, \\\n DBParameter, DBLocation, DBPortSpec, DBTag, DBAnnotation, DBVistrail, \\\n DBAction", "start_line": 43, "start_column": 0, "end_line": 45, "end_column": 12 } ]
[]
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_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", "-", "2016", ",", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2014", ",", " ", "NY", "U", "-", "Poly", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2011", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Conta", "ct", ":", " ", "contact", "@", "vist", "rail", "s", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "\"", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "FIX", "ME", " ", "!!!", " ", "DO", "ES", " ", "NOT", " ", "MERGE", " ", "EXECUT", "ION", " ", "LOG", "S", " ", "STORE", "D", " ", "IN", " ", "VT", " ", "FILE", " ", "!!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'../", "vist", "rail", "s", "'_", "not_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "append_", "(_", "'../", "vist", "rail", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "vist", "rail", "s_", "._", "db_", "._", "services_", "._", "vist", "rail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "domain_", "import_", "DB", "Module_", ",_", "DB", "Connection_", ",_", "DB", "Port_", ",_", "DB", "Function_", ",_", "DB", "Parameter_", ",_", "DB", "Location_", ",_", "DB", "Port", "Spec_", ",_", "DB", "Tag_", ",_", "DBA", "nno", "tation", "_", ",_", "DB", "Vis", "trail_", ",_", "DBA", "ction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "db_", "._", "services_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Us", "age", ":", " ", "%", "s", " ", "[", "output", " ", "filename", "]", " ", "[", "list", " ", "of", " ", "input", " ", "vist", "rail", "s", "]\"_", "%_", "sys_", "._", "argv_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "main_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ",_", "sys_", "._", "argv_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "out", "\\u", "fname_", ",_", "in", "\\u", "fnames_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "main", "(", "out", "\\u", "fname", ":", " ", "str", ",", " ", "in", "\\u", "fname", "s", ":", " ", "list", "<", "str", ">)", " ", "->", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Combine", "s", " ", "all", " ", "vist", "rail", "s", " ", "specified", " ", "in", " ", "in", "\\u", "fname", "s", " ", "int", "o", " ", "a", " ", "single", " ", "vist", "rail", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "ren", "umber", "ing", " ", "thei", "r", " ", "ids", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", " ", "this", " ", "breaks", " ", "whe", "n", " ", "you", " ", "use", " ", "abstract", "ion", "s", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "save", "\\u", "bundle_", ",_", "vt", "\\u", "save", "\\u", "dir_", ")_", "=_", "io_", "._", "open", "\\u", "bundle", "\\u", "from", "\\u", "zip", "\\u", "xml_", "(_", "DB", "Vis", "trail_", "._", "vt", "Type_", ",_", "in", "\\u", "fnames_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "in", "\\u", "fname_", "in_", "in", "\\u", "fnames_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "new", "\\u", "save", "\\u", "bundle_", ",_", "new", "\\u", "save", "\\u", "dir_", ")_", "=_", "io_", "._", "open", "\\u", "bundle", "\\u", "from", "\\u", "zip", "\\u", "xml_", "(_", "DB", "Vis", "trail_", "._", "vt", "Type_", ",_", "in", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "s_", "._", "db_", "._", "services_", "._", "vist", "rail", "_", "._", "merge_", "(_", "save", "\\u", "bundle_", ",_", "new", "\\u", "save", "\\u", "bundle_", ",_", "\"\"_", ",_", "True_", ",_", "vt", "\\u", "save", "\\u", "dir_", ",_", "new", "\\u", "save", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "io_", "._", "save", "\\u", "bundle", "\\u", "to", "\\u", "zip", "\\u", "xml_", "(_", "save", "\\u", "bundle_", ",_", "out", "\\u", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
inpho/vsm/vsm/extensions/editions.py
[ { "content": "import numpy as np\nfrom vsm.corpus import Corpus\n\n\n__all__ = ['eqva', 'new_material']\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def eqva(a1, a2):\n \"\"\"\n modified np.array_equal. considers a1 and a2\n equal when there is 1 difference.\n \"\"\"\n a1.sort()\n a2.sort()\n count = 0\n a1_, a2_ = a1, a2\n if len(a1) > len(a2):\n a1_ = a2\n a2_ = a1\n\n for s in a1:\n if not s in a2:\n count += 1\n\n return count", "metadata": "root.eqva", "header": "['module', '___EOS___']", "index": 7 }, { "content": "def find_idx(ind, c1, c2):\n \"\"\"\n finds exact match (1 diff) in c2 and returns the index.\n \"\"\"\n ctx2 = c2.view_contexts('sentence', as_strings=True)\n ctx = c1.view_contexts('sentence', as_strings=True)[ind]\n \n for i in xrange(len(ctx2)):\n if eqva(ctx, ctx2[i]) < 2:\n return str(i)\n return ''", "metadata": "root.find_idx", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def new_material(c1, c2, idx=0):\n \"\"\"\n Return new material in a list. \n 'idx' is an optional parameter for cutting off references.\n \"\"\"\n ctx1 = c1.view_contexts('sentence', as_strings=True)\n \n if idx == 0:\n ctx2 = c2.view_contexts('sentence', as_strings=True)\n else:\n ctx2 = c2.view_contexts('sentence', as_strings=True)[:idx]\n len2 = len(ctx2)\n\n new = []\n for i in xrange(len(ctx1)):\n if i < len2:\n if len(ctx1[i]) == 0: # empty tokens.\n pass\n else:\n ind = find_idx(i, c1, c2)\n if len(ind) == 0:\n new.append(i)\n return new", "metadata": "root.new_material", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "import numpy as np", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 18 }, { "span": "from vsm.corpus import Corpus", "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_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vs", "m_", "._", "corpus_", "import_", "Corpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "eq", "va", "'_", ",_", "'", "new", "\\u", "material", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "eq", "va_", "(_", "a1_", ",_", "a2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "modifi", "ed", " ", "np", ".", "array", "\\u", "equal", ".", " ", "consider", "s", " ", "a1", " ", "and", " ", "a2", "\\", "10", ";", " ", " ", " ", " ", "equal", " ", "whe", "n", " ", "there", " ", "is", " ", "1", " ", "difference", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a2_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1", "\\u_", ",_", "a2", "\\u_", "=_", "a1_", ",_", "a2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "a1_", ")_", ">_", "len_", "(_", "a2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a1", "\\u_", "=_", "a2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a2", "\\u_", "=_", "a1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s_", "in_", "a1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "s_", "in_", "a2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "+=_", "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_", "return_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "idx_", "(_", "ind_", ",_", "c1_", ",_", "c2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "find", "s", " ", "exact", " ", "match", " ", "(", "1", " ", "diff", ")", " ", "in", " ", "c2", " ", "and", " ", "return", "s", " ", "the", " ", "index", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx", "2_", "=_", "c2_", "._", "view", "\\u", "contexts_", "(_", "'", "sentence", "'_", ",_", "as", "\\u", "strings_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "c1_", "._", "view", "\\u", "contexts_", "(_", "'", "sentence", "'_", ",_", "as", "\\u", "strings_", "=_", "True_", ")_", "[_", "ind_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "ctx", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "eq", "va_", "(_", "ctx_", ",_", "ctx", "2_", "[_", "i_", "]_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "i_", ")_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "material_", "(_", "c1_", ",_", "c2_", ",_", "idx_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "new", " ", "material", " ", "in", " ", "a", " ", "list", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "'", "idx", "'", " ", "is", " ", "an", " ", "option", "al", " ", "parameter", " ", "for", " ", "cutt", "ing", " ", "off", " ", "reference", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx", "1_", "=_", "c1_", "._", "view", "\\u", "contexts_", "(_", "'", "sentence", "'_", ",_", "as", "\\u", "strings_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "idx_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx", "2_", "=_", "c2_", "._", "view", "\\u", "contexts_", "(_", "'", "sentence", "'_", ",_", "as", "\\u", "strings_", "=_", "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 ", " _", "ctx", "2_", "=_", "c2_", "._", "view", "\\u", "contexts_", "(_", "'", "sentence", "'_", ",_", "as", "\\u", "strings_", "=_", "True_", ")_", "[_", ":_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "len", "2_", "=_", "len_", "(_", "ctx", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "len_", "(_", "ctx", "1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "<_", "len", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "ctx", "1_", "[_", "i_", "]_", ")_", "==_", "0_", ":_", "#", " ", "empty", " ", "token", "s", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ind_", "=_", "find", "\\u", "idx_", "(_", "i_", ",_", "c1_", ",_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "ind_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/__init__.py
[ { "content": "#\n# Copyright (c) 2001 - 2015 The SCons Foundation\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n#\n\n__revision__ = \"src/engine/SCons/Tool/MSCommon/__init__.py rel_2.3.5:3329:275e75118ad4 2015/06/20 11:18:26 bdbaddog\"\n\n__doc__ = \"\"\"\nCommon functions for Microsoft Visual Studio and Visual C/C++.\n\"\"\"\n\nimport copy\nimport os\nimport re\nimport subprocess\n\nimport SCons.Errors\nimport SCons.Platform.win32\nimport SCons.Util\n\nfrom SCons.Tool.MSCommon.sdk import mssdk_exists, \\\n mssdk_setup_env\n\nfrom SCons.Tool.MSCommon.vc import msvc_exists, \\\n msvc_setup_env, \\\n msvc_setup_env_once\n\nfrom SCons.Tool.MSCommon.vs import get_default_version, \\\n get_vs_by_version, \\\n merge_default_version, \\\n msvs_exists, \\\n query_versions\n\n# Local Variables:\n# tab-width:4\n# indent-tabs-mode:nil\n# End:\n# vim: set expandtab tabstop=4 shiftwidth=4:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import copy", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 11 }, { "span": "import os", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 9 }, { "span": "import re", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 9 }, { "span": "import subprocess", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 17 }, { "span": "import SCons.Errors", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 19 }, { "span": "import SCons.Platform.win32", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 27 }, { "span": "import SCons.Util", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 17 }, { "span": "from SCons.Tool.MSCommon.sdk import mssdk_exists, \\\n mssdk_setup_env", "start_line": 38, "start_column": 0, "end_line": 39, "end_column": 51 }, { "span": "from SCons.Tool.MSCommon.vc import msvc_exists, \\\n msvc_setup_env, \\\n msvc_setup_env_once", "start_line": 41, "start_column": 0, "end_line": 43, "end_column": 54 }, { "span": "from SCons.Tool.MSCommon.vs import get_default_version, \\\n get_vs_by_version, \\\n merge_default_version, \\\n msvs_exists, \\\n query_versions", "start_line": 45, "start_column": 0, "end_line": 49, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "1", " ", "-", " ", "201", "5", " ", "The", " ", "SC", "ons", " ", "Foun", "dati", "on_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTION_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"", "src", "/", "eng", "ine", "/", "SC", "ons", "/", "Tool", "/", "MS", "Common", "/\\u", "\\u", "init", "\\u\\u", ".", "py", " ", "rel", "\\u", "2.3", ".5", ":", "332", "9", ":", "275", "e7", "511", "8a", "d4", " ", "201", "5", "/", "0", "6", "/", "20", " ", "11", ":", "1", "8", ":", "2", "6", " ", "bdb", "add", "og", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "doc\\u\\u_", "=_", "\"\"\"", "\\", "10", ";", "Common", " ", "function", "s", " ", "for", " ", "Micro", "soft", " ", "Vis", "ual", " ", "Stud", "io", " ", "and", " ", "Vis", "ual", " ", "C", "/", "C", "++", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "SC", "ons_", "._", "Errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "SC", "ons_", "._", "Platform_", "._", "win32", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "SC", "ons_", "._", "Util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "SC", "ons_", "._", "Tool_", "._", "MS", "Common_", "._", "sdk_", "import_", "mss", "dk", "\\u", "exists_", ",_", "mss", "dk", "\\u", "setup", "\\u", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "SC", "ons_", "._", "Tool_", "._", "MS", "Common_", "._", "vc_", "import_", "msvc", "\\u", "exists_", ",_", "msvc", "\\u", "setup", "\\u", "env_", ",_", "msvc", "\\u", "setup", "\\u", "env", "\\u", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "SC", "ons_", "._", "Tool_", "._", "MS", "Common_", "._", "vs_", "import_", "get", "\\u", "default", "\\u", "version_", ",_", "get", "\\u", "vs", "\\u", "by", "\\u", "version_", ",_", "merge", "\\u", "default", "\\u", "version_", ",_", "msv", "s", "\\u", "exists_", ",_", "query", "\\u", "versions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "Varia", "bles", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tab", "-", "widt", "h", ":", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indent", "-", "tabs", "-", "mode", ":", "nil_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "End", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", " ", "set", " ", "expand", "tab", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", ":_", "\\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, 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 1, 1, 1, 1, 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, 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 ]
Unused import
mpirnat/hackday/hackday/blog/urls.py
[ { "content": "from django.conf.urls.defaults import patterns, include, url\nfrom hackday.blog.feeds import LatestEntriesFeed\n\nurlpatterns = patterns('hackday.blog.views',\n url(r'^$', 'index', name='blog-index'),\n url(r'^(?P<entry_id>\\d+)/*$', 'entry', name='blog-entry'),\n url(r'^(?P<entry_id>\\d+)/email*$', 'email', name='blog-entry-email'),\n url(r'^category/(?P<slug>[\\w_-]+)/*$', 'category', name='blog-category'),\n url(r'^tag/(?P<slug>[\\w_-]+)/*$', 'tag', name='blog-tag'),\n url(r'^add/*$', 'blog_edit', name='blog-add'),\n url(r'^edit/(?P<entry_id>\\d+)/*$', 'blog_edit', name='blog-edit'),\n url(r'^feed/$', LatestEntriesFeed(), name='blog-feed'),\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf.urls.defaults import patterns, include, url", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "._", "defaults_", "import_", "patterns_", ",_", "include_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hack", "day_", "._", "blog_", "._", "feeds_", "import_", "Late", "st", "Entr", "ies", "Feed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "'", "hack", "day", ".", "blog", ".", "views", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "$'_", ",_", "'", "index", "'_", ",_", "name_", "=_", "'", "blog", "-", "index", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "(?", "P", "<", "entry", "\\u", "id", ">\\\\", "d", "+)", "/*", "$'_", ",_", "'", "entry", "'_", ",_", "name_", "=_", "'", "blog", "-", "entry", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "(?", "P", "<", "entry", "\\u", "id", ">\\\\", "d", "+)", "/", "email", "*$'_", ",_", "'", "email", "'_", ",_", "name_", "=_", "'", "blog", "-", "entry", "-", "email", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "category", "/(", "?", "P", "<", "slug", ">[", "\\\\", "w", "\\u-]", "+)", "/*", "$'_", ",_", "'", "category", "'_", ",_", "name_", "=_", "'", "blog", "-", "category", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "tag", "/(", "?", "P", "<", "slug", ">[", "\\\\", "w", "\\u-]", "+)", "/*", "$'_", ",_", "'", "tag", "'_", ",_", "name_", "=_", "'", "blog", "-", "tag", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "add", "/*", "$'_", ",_", "'", "blog", "\\u", "edit", "'_", ",_", "name_", "=_", "'", "blog", "-", "add", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "edit", "/(", "?", "P", "<", "entry", "\\u", "id", ">\\\\", "d", "+)", "/*", "$'_", ",_", "'", "blog", "\\u", "edit", "'_", ",_", "name_", "=_", "'", "blog", "-", "edit", "'_", ")_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2, 2 ]
Unused import
sunlightlabs/read_FEC/fecreader/summary_data/management/commands/write_weekly_files.py
[ { "content": "# write some files \n\nimport csv \n\nfrom datetime import datetime, date\n\nfrom django.conf import settings\nfrom django.db.models import Sum\nfrom django.core.management.base import BaseCommand, CommandError\n\n\nfrom formdata.models import SkedE\nfrom summary_data.models import Committee_Overlay\nfrom datetime import date\nfrom summary_data.utils.weekly_update_utils import get_week_number, get_week_end, summarize_week_queryset, summarize_week_queryset_cumulative\n\nCHART_CSV_DOWNLOAD_DIR = settings.CHART_CSV_DOWNLOAD_DIR\nCSV_FILE_NAME = 'weekly_ies.csv'\nCSV_FILE_NAME_CUMULATIVE = 'weekly_ies_cumulative.csv'\n\n\n\ndata_start = date(2013,1,1)\nwrite_cumulative = False\n\n\n\n\n## some queries to help define sets\nall_ies = SkedE.objects.filter(superceded_by_amendment=False)\n\nall_outside_groups = Committee_Overlay.objects.filter(total_indy_expenditures__gt=0)\ndem_id_list = [i.fec_id for i in all_outside_groups.filter(political_orientation='D')]\nrep_id_list = [i.fec_id for i in all_outside_groups.filter(political_orientation='R')]\n\n\nnoncommittees = Committee_Overlay.objects.filter(ctype__in=['I'], total_indy_expenditures__gt=0)\nnoncommittee_id_list = [i.fec_id for i in noncommittees]\ndem_noncommittee_id_list = [i.fec_id for i in noncommittees.filter(political_orientation='D')]\nrep_noncommittee_id_list = [i.fec_id for i in noncommittees.filter(political_orientation='R')]\n\n\nsuperpacs = Committee_Overlay.objects.filter(ctype__in=['U', 'O'], total_indy_expenditures__gt=0)\nsuperpac_id_list = [i.fec_id for i in superpacs]\ndem_superpac_id_list = [i.fec_id for i in superpacs.filter(political_orientation='D')]\nrep_superpac_id_list = [i.fec_id for i in superpacs.filter(political_orientation='R')]\n\nparty_committees = Committee_Overlay.objects.filter(ctype__in=['X', 'Y', 'Z'], total_indy_expenditures__gt=0)\nparty_committee_id_list = [i.fec_id for i in party_committees]\ndem_party_committee_id_list = [i.fec_id for i in party_committees.filter(political_orientation='D')]\nrep_party_committee_id_list = [i.fec_id for i in party_committees.filter(political_orientation='R')]\n\n# donation queries\n\n\n\ndata_series = [\n {'data_id':0,'data_series_name':'All Independent Expenditures', 'q':all_ies},\n {'data_id':1,'data_series_name':'Dark Money IEs', 'q':all_ies.filter(filer_committee_id_number__in=noncommittee_id_list)},\n {'data_id':2,'data_series_name':'Super PAC IEs', 'q':all_ies.filter(filer_committee_id_number__in=superpac_id_list)},\n {'data_id':3,'data_series_name':'Party Committee IEs', 'q':all_ies.filter(filer_committee_id_number__in=party_committee_id_list)},\n \n {'data_id':4,'data_series_name':'All Democratic IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_id_list)},\n {'data_id':5,'data_series_name':'All Republican IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_id_list)},\n \n {'data_id':6,'data_series_name':'Democratic Dark Money IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_noncommittee_id_list)},\n {'data_id':7,'data_series_name':'Republican Dark Money IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_noncommittee_id_list)},\n\n {'data_id':8,'data_series_name':'Democratic Super PAC IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_superpac_id_list)},\n {'data_id':9,'data_series_name':'Republican Super PAC IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_superpac_id_list)},\n\n {'data_id':10,'data_series_name':'Republican Party Committees IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_party_committee_id_list)},\n {'data_id':11,'data_series_name':'Democratic Party Committees IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_party_committee_id_list)},\n\n {'data_id':12,'data_series_name':'Democratic Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_id_list, candidate_office_checked='S')},\n {'data_id':13,'data_series_name':'Republican Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_id_list, candidate_office_checked='S')},\n {'data_id':14,'data_series_name':'Democratic House IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_id_list, candidate_office_checked='H')},\n {'data_id':15,'data_series_name':'Republican House IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_id_list, candidate_office_checked='H')},\n \n {'data_id':16,'data_series_name':'Democratic Super PAC Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_superpac_id_list, candidate_office_checked='S')},\n {'data_id':17,'data_series_name':'Republican Super PAC Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_superpac_id_list, candidate_office_checked='S')},\n {'data_id':18,'data_series_name':'Democratic Super PAC House IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_superpac_id_list, candidate_office_checked='H')},\n {'data_id':19,'data_series_name':'Republican Super PAC House IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_superpac_id_list, candidate_office_checked='H')},\n \n {'data_id':20,'data_series_name':'Democratic Dark Money Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_noncommittee_id_list, candidate_office_checked='S')},\n {'data_id':21,'data_series_name':'Republican Dark Money Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_noncommittee_id_list, candidate_office_checked='S')},\n {'data_id':22,'data_series_name':'Democratic Dark Money House IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_noncommittee_id_list, candidate_office_checked='H')},\n {'data_id':23,'data_series_name':'Republican Dark Money House IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_noncommittee_id_list, candidate_office_checked='H')},\n \n {'data_id':24,'data_series_name':'Democratic Party Committees Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_party_committee_id_list, candidate_office_checked='S')},\n {'data_id':25,'data_series_name':'Republican Party Committees Senate IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_party_committee_id_list, candidate_office_checked='S')},\n {'data_id':26,'data_series_name':'Democratic Party Committees House IEs', 'q':all_ies.filter(filer_committee_id_number__in=dem_party_committee_id_list, candidate_office_checked='H')},\n {'data_id':27,'data_series_name':'Republican Party Committees House IEs', 'q':all_ies.filter(filer_committee_id_number__in=rep_party_committee_id_list, candidate_office_checked='H')}\n\n\n]\n\n\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def make_header(start_week_number, end_week_number):\n headers = ['data_id','data_series_name']\n for week in range(start_week_number, end_week_number + 1):\n headers.append(get_week_end(week).strftime(\"%m/%d/%Y\"))\n return headers", "metadata": "root.make_header", "header": "['module', '___EOS___']", "index": 26 }, { "content": "class Command(BaseCommand):\n help = \"Write some data csvs\"\n requires_model_validation = False\n \n ", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 102 }, { "content": " def handle(self, *args, **options):\n today = date(2014,11,1)\n last_week = get_week_number(today) - 1\n first_week = get_week_number(data_start)\n \n \n outf = \"%s/%s\" % (CHART_CSV_DOWNLOAD_DIR, CSV_FILE_NAME)\n print \"writing to %s\" % outf\n outfile = open(outf, 'w')\n field_names = make_header(first_week, last_week)\n outfile.write(\",\".join(field_names) +\"\\n\")\n dw = csv.writer(outfile)\n\n if write_cumulative:\n\n outcumf = \"%s/%s\" % (CHART_CSV_DOWNLOAD_DIR, CSV_FILE_NAME_CUMULATIVE) \n print \"writing cumulative numbers to %s\" % outcumf\n outcumfile = open(outcumf, 'w')\n field_names = make_header(first_week, last_week)\n outcumfile.write(\",\".join(field_names) +\"\\n\")\n cumdw = csv.writer(outcumfile)\n\n\n \n for data in data_series:\n this_row = [data['data_id'], data['data_series_name']]\n this_cum_row = [data['data_id'], data['data_series_name']]\n for week in range(first_week, last_week+1):\n print \"handling %s week %s\" % (data['data_series_name'], week)\n this_row.append(summarize_week_queryset(week, data['q']))\n if write_cumulative:\n this_cum_row.append(summarize_week_queryset_cumulative(week, data['q']))\n dw.writerow(this_row)\n if write_cumulative:\n cumdw.writerow(this_cum_row)", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 107 } ]
[ { "span": "from django.db.models import Sum", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 32 }, { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "write", " ", "some", " ", "files", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Sum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "form", "data_", "._", "models_", "import_", "Ske", "d", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "summar", "y", "\\u", "data_", "._", "models_", "import_", "Committe", "e\\u", "Overla", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "summar", "y", "\\u", "data_", "._", "utils_", "._", "week", "ly", "\\u", "update", "\\u", "utils_", "import_", "get", "\\u", "week", "\\u", "number_", ",_", "get", "\\u", "week", "\\u", "end_", ",_", "summarize", "\\u", "week", "\\u", "queryset_", ",_", "summarize", "\\u", "week", "\\u", "querys", "et", "\\u", "cumul", "ative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CHAR", "T", "\\u", "CSV", "\\u", "DOWNLOAD", "\\u", "DIR_", "=_", "settings_", "._", "CHAR", "T", "\\u", "CSV", "\\u", "DOWNLOAD", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CSV", "\\u", "FILE", "\\u", "NAME_", "=_", "'", "week", "ly", "\\u", "ies", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CSV", "\\u", "FILE", "\\u", "NAME", "\\u", "CU", "MUL", "ATI", "VE_", "=_", "'", "week", "ly", "\\u", "ies", "\\u", "cumul", "ative", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "start_", "=_", "date_", "(_", "2013_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "cumul", "ative_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "some", " ", "querie", "s", " ", "to", " ", "help", " ", "defin", "e", " ", "sets_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "ies_", "=_", "Ske", "d", "E_", "._", "objects_", "._", "filter_", "(_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "outsi", "de", "\\u", "groups_", "=_", "Committe", "e\\u", "Overla", "y_", "._", "objects_", "._", "filter_", "(_", "total", "\\u", "ind", "y", "\\u", "expen", "dit", "ure", "s", "\\u\\u", "gt_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dem", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "all", "\\u", "outsi", "de", "\\u", "groups_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "D", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "all", "\\u", "outsi", "de", "\\u", "groups_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "R", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nonc", "ommit", "tee", "s_", "=_", "Committe", "e\\u", "Overla", "y_", "._", "objects_", "._", "filter_", "(_", "ctype", "\\u\\u", "in_", "=_", "[_", "'", "I", "'_", "]_", ",_", "total", "\\u", "ind", "y", "\\u", "expen", "dit", "ure", "s", "\\u\\u", "gt_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "nonc", "ommit", "tee", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dem", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "nonc", "ommit", "tee", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "D", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "nonc", "ommit", "tee", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "R", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super", "pac", "s_", "=_", "Committe", "e\\u", "Overla", "y_", "._", "objects_", "._", "filter_", "(_", "ctype", "\\u\\u", "in_", "=_", "[_", "'", "U", "'_", ",_", "'", "O", "'_", "]_", ",_", "total", "\\u", "ind", "y", "\\u", "expen", "dit", "ure", "s", "\\u\\u", "gt_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super", "pac", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "super", "pac", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dem", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "super", "pac", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "D", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "super", "pac", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "R", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "part", "y", "\\u", "committee", "s_", "=_", "Committe", "e\\u", "Overla", "y_", "._", "objects_", "._", "filter_", "(_", "ctype", "\\u\\u", "in_", "=_", "[_", "'", "X", "'_", ",_", "'", "Y", "'_", ",_", "'", "Z", "'_", "]_", ",_", "total", "\\u", "ind", "y", "\\u", "expen", "dit", "ure", "s", "\\u\\u", "gt_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "part", "y", "\\u", "committee", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dem", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "part", "y", "\\u", "committee", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "D", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rep", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", "=_", "[_", "i_", "._", "fec", "\\u", "id_", "for_", "i_", "in_", "part", "y", "\\u", "committee", "s_", "._", "filter_", "(_", "politic", "al", "\\u", "orientation_", "=_", "'", "R", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "donation", " ", "queries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "series_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "0_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "All", " ", "Inde", "pend", "ent", " ", "Expe", "ndi", "tures", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "1_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Dar", "k", " ", "Mone", "y", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "2_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Super", " ", "PAC", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "super", "pac", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "3_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Part", "y", " ", "Committe", "e", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "4_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "All", " ", "Demo", "cra", "tic", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "5_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "All", " ", "Rep", "ubli", "can", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "6_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Dar", "k", " ", "Mone", "y", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "7_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Dar", "k", " ", "Mone", "y", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "8_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Super", " ", "PAC", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "9_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Super", " ", "PAC", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "10_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Part", "y", " ", "Committe", "es", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "11_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Part", "y", " ", "Committe", "es", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "12_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "13_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "14_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "15_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "16_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Super", " ", "PAC", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "17_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Super", " ", "PAC", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "18_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Super", " ", "PAC", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "19_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Super", " ", "PAC", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "super", "pac", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "20_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Dar", "k", " ", "Mone", "y", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "21_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Dar", "k", " ", "Mone", "y", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "22_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Dar", "k", " ", "Mone", "y", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "23_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Dar", "k", " ", "Mone", "y", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "nonc", "ommit", "tee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "24_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Part", "y", " ", "Committe", "es", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "25_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Part", "y", " ", "Committe", "es", " ", "Sen", "ate", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "S", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "26_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Demo", "cra", "tic", " ", "Part", "y", " ", "Committe", "es", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "dem", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "data\\u", "id", "'_", ":_", "27_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", ":_", "'", "Rep", "ubli", "can", " ", "Part", "y", " ", "Committe", "es", " ", "House", " ", "IE", "s", "'_", ",_", "'", "q", "'_", ":_", "all", "\\u", "ies_", "._", "filter_", "(_", "filer", "\\u", "committee", "\\u", "id", "\\u", "number", "\\u\\u", "in_", "=_", "rep", "\\u", "part", "y", "\\u", "committee", "\\u", "id", "\\u", "list_", ",_", "candidate", "\\u", "office", "\\u", "checked_", "=_", "'", "H", "'_", ")_", "}_", "\\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_", "\\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_", "make", "\\u", "header_", "(_", "start", "\\u", "week", "\\u", "number_", ",_", "end", "\\u", "week", "\\u", "number_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "[_", "'", "data\\u", "id", "'_", ",_", "'", "data\\u", "series", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "week_", "in_", "range_", "(_", "start", "\\u", "week", "\\u", "number_", ",_", "end", "\\u", "week", "\\u", "number_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "._", "append_", "(_", "get", "\\u", "week", "\\u", "end_", "(_", "week_", ")_", "._", "strftime_", "(_", "\"%", "m", "/", "%", "d", "/", "%", "Y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "\"", "Write", " ", "some", " ", "data", " ", "csv", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "s", "\\u", "model", "\\u", "validation_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "today_", "=_", "date_", "(_", "2014_", ",_", "11_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "week_", "=_", "get", "\\u", "week", "\\u", "number_", "(_", "today_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "week_", "=_", "get", "\\u", "week", "\\u", "number_", "(_", "data\\u", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outf_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "CHAR", "T", "\\u", "CSV", "\\u", "DOWNLOAD", "\\u", "DIR_", ",_", "CSV", "\\u", "FILE", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "writ", "ing", " ", "to", " ", "%", "s", "\"_", "%_", "outf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "open_", "(_", "outf_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "names_", "=_", "make", "\\u", "header_", "(_", "first", "\\u", "week_", ",_", "last", "\\u", "week_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "._", "write_", "(_", "\",\"_", "._", "join_", "(_", "field", "\\u", "names_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dw_", "=_", "csv_", "._", "writer_", "(_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "write", "\\u", "cumul", "ative_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "cum", "f_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "CHAR", "T", "\\u", "CSV", "\\u", "DOWNLOAD", "\\u", "DIR_", ",_", "CSV", "\\u", "FILE", "\\u", "NAME", "\\u", "CU", "MUL", "ATI", "VE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "writ", "ing", " ", "cumul", "ative", " ", "numbers", " ", "to", " ", "%", "s", "\"_", "%_", "out", "cum", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "cum", "file_", "=_", "open_", "(_", "out", "cum", "f_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "names_", "=_", "make", "\\u", "header_", "(_", "first", "\\u", "week_", ",_", "last", "\\u", "week_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "cum", "file_", "._", "write_", "(_", "\",\"_", "._", "join_", "(_", "field", "\\u", "names_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cum", "dw_", "=_", "csv_", "._", "writer_", "(_", "out", "cum", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "data_", "in_", "data\\u", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "row_", "=_", "[_", "data_", "[_", "'", "data\\u", "id", "'_", "]_", ",_", "data_", "[_", "'", "data\\u", "series", "\\u", "name", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "cum", "\\u", "row_", "=_", "[_", "data_", "[_", "'", "data\\u", "id", "'_", "]_", ",_", "data_", "[_", "'", "data\\u", "series", "\\u", "name", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "week_", "in_", "range_", "(_", "first", "\\u", "week_", ",_", "last", "\\u", "week_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "handling", " ", "%", "s", " ", "week", " ", "%", "s", "\"_", "%_", "(_", "data_", "[_", "'", "data\\u", "series", "\\u", "name", "'_", "]_", ",_", "week_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "row_", "._", "append_", "(_", "summarize", "\\u", "week", "\\u", "queryset_", "(_", "week_", ",_", "data_", "[_", "'", "q", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "write", "\\u", "cumul", "ative_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "this", "\\u", "cum", "\\u", "row_", "._", "append_", "(_", "summarize", "\\u", "week", "\\u", "querys", "et", "\\u", "cumul", "ative_", "(_", "week_", ",_", "data_", "[_", "'", "q", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dw_", "._", "writerow_", "(_", "this", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "write", "\\u", "cumul", "ative_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cum", "dw_", "._", "writerow_", "(_", "this", "\\u", "cum", "\\u", "row_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
glue-viz/glue/glue/external/pvextractor/gui.py
[ { "content": "from __future__ import print_function\n\nimport os\nimport math\nimport warnings\n\nimport numpy as np\n\nfrom matplotlib.collections import LineCollection\nfrom matplotlib.transforms import Bbox\nfrom matplotlib.patches import Polygon\n\nfrom .geometry.path import Path, get_endpoints\nfrom . import extract_pv_slice\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def distance(x1, y1, x2, y2, x3, y3):\n \"\"\"\n Find the shortest distance between a point (x3, y3) and the line passing\n through the points (x1, y1) and (x2, y2).\n \"\"\"\n\n px = x2-x1\n py = y2-y1\n\n something = px * px + py * py\n\n u = ((x3 - x1) * px + (y3 - y1) * py) / float(something)\n\n x = x1 + u * px\n y = y1 + u * py\n\n dx = x - x3\n dy = y - y3\n\n dist = math.sqrt(dx*dx + dy*dy)\n\n return dist", "metadata": "root.distance", "header": "['module', '___EOS___']", "index": 16 }, { "content": "class MovableSliceBox(object):\n\n\n\n\n\n\n\n", "metadata": "root.MovableSliceBox", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def __init__(self, box, callback):\n self.box = box\n self.press = None\n self.background = None\n self.point_counter = 0\n self.callback = callback\n self.mode = 0\n self.show_poly = False\n self.cidpress = self.box.figure.canvas.mpl_connect('draw_event', self.draw_slicer)", "metadata": "root.MovableSliceBox.__init__", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def connect(self):\n self.cidpress = self.box.figure.canvas.mpl_connect('key_press_event', self.key_press)\n self.cidpress = self.box.figure.canvas.mpl_connect('button_press_event', self.on_press)\n self.cidmotion = self.box.figure.canvas.mpl_connect('motion_notify_event', self.on_motion)", "metadata": "root.MovableSliceBox.connect", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def draw_slicer(self, event):\n\n axes = self.box.axes\n canvas = self.box.figure.canvas\n\n self.box.axes.draw_artist(self.box)\n\n if self.show_poly:\n\n path = Path(zip(self.box.x, self.box.y))\n path.width = self.box.width\n\n patches = path.to_patches(1, ec='green', fc='none',\n transform=self.box.axes.transData,\n clip_on=True, clip_box=self.box.axes.bbox)\n\n for patch in patches:\n self.box.axes.draw_artist(patch)", "metadata": "root.MovableSliceBox.draw_slicer", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def on_press(self, event):\n\n if self.box.figure.canvas.toolbar.mode != '':\n return\n\n if event.inaxes != self.box.axes:\n return\n\n if self.mode == 1:\n self.callback(self.box)\n self.mode += 1\n return\n\n if self.mode == 2:\n self.box.x = []\n self.box.y = []\n self.mode = 0\n self.point_counter = 0\n\n self.press = event.xdata, event.ydata\n\n self.point_counter += 1\n\n axes = self.box.axes\n canvas = self.box.figure.canvas\n\n if self.point_counter == 1: # first point\n\n self.box.x.append(event.xdata)\n self.box.x.append(event.xdata)\n self.box.y.append(event.ydata)\n self.box.y.append(event.ydata)\n\n self.box.width = 0.\n\n self.box.set_animated(True)\n canvas.draw()\n self.background = canvas.copy_from_bbox(self.box.axes.bbox)\n\n elif self.mode == 0:\n\n self.box.x.append(event.xdata)\n self.box.y.append(event.ydata)\n\n self.box._update_segments()\n\n # now redraw just the lineangle\n axes.draw_artist(self.box)\n\n canvas.blit(axes.bbox)", "metadata": "root.MovableSliceBox.on_press", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def key_press(self, event):\n\n if self.box.figure.canvas.toolbar.mode != '':\n return\n\n if event.key == 'enter' and self.mode == 0:\n self.mode += 1\n self.box.x = self.box.x[:-1]\n self.box.y = self.box.y[:-1]\n\n if event.key == 'y' and self.mode == 2:\n self.show_poly = not self.show_poly\n self.draw_slicer(event)\n self.box.figure.canvas.draw()", "metadata": "root.MovableSliceBox.key_press", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 128 }, { "content": " def on_motion(self, event):\n\n if self.box.figure.canvas.toolbar.mode != '':\n return\n\n if self.point_counter == 0:\n return\n\n if self.mode == 2:\n return\n\n canvas = self.box.figure.canvas\n axes = self.box.axes\n canvas.restore_region(self.background)\n\n if event.inaxes != self.box.axes:\n return\n\n if self.mode == 0:\n self.box.x[-1] = event.xdata\n self.box.y[-1] = event.ydata\n elif self.mode == 1:\n self.box.width = distance(self.box.x[-2], self.box.y[-2], self.box.x[-1], self.box.y[-1], event.xdata, event.ydata) * 2\n\n self.box._update_segments()\n\n # redraw just the current lineangle\n axes.draw_artist(self.box)\n\n # blit just the redrawn area\n canvas.blit(axes.bbox)", "metadata": "root.MovableSliceBox.on_motion", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 143 }, { "content": " def disconnect(self):\n self.box.figure.canvas.mpl_disconnect(self.cidpress)\n self.box.figure.canvas.mpl_disconnect(self.cidmotion)", "metadata": "root.MovableSliceBox.disconnect", "header": "['class', 'MovableSliceBox', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": "class SliceCurve(LineCollection):\n\n", "metadata": "root.SliceCurve", "header": "['module', '___EOS___']", "index": 180 }, { "content": " def __init__(self, x=[], y=[], width=None, **kwargs):\n\n super(SliceCurve, self).__init__([], **kwargs)\n\n self.x = x\n self.y = y\n self.width = width\n\n self._update_segments()", "metadata": "root.SliceCurve.__init__", "header": "['class', 'SliceCurve', '(', 'LineCollection', ')', ':', '___EOS___']", "index": 182 }, { "content": " def _update_segments(self):\n\n if not self.x:\n return\n\n x1, y1, x2, y2 = get_endpoints(self.x, self.y, self.width)\n\n # Find central line\n line = zip(self.x, self.y)\n\n # Find bounding rectangle\n rect = zip(np.hstack([x1,x2[::-1], x1[0]]),\n np.hstack([y1,y2[::-1], y1[0]]))\n\n self.set_segments((list(line), list(rect)))\n self.set_linestyles(('solid', 'dashed'))\n self.set_linewidths((2, 1))", "metadata": "root.SliceCurve._update_segments", "header": "['class', 'SliceCurve', '(', 'LineCollection', ')', ':', '___EOS___']", "index": 192 }, { "content": "class PVSlicer(object):\n\n\n\n\n\n\n\n\n", "metadata": "root.PVSlicer", "header": "['module', '___EOS___']", "index": 211 }, { "content": " def __init__(self, filename, backend=\"Qt4Agg\", clim=None):\n\n self.filename = filename\n\n try:\n from spectral_cube import SpectralCube\n cube = SpectralCube.read(filename, format='fits')\n self.array = cube._data\n except:\n warnings.warn(\"spectral_cube package is not available - using astropy.io.fits directly\")\n from astropy.io import fits\n self.array = fits.getdata(filename)\n if self.array.ndim != 3:\n raise ValueError(\"dataset does not have 3 dimensions (install the spectral_cube package to avoid this error)\")\n\n self.backend = backend\n\n import matplotlib as mpl\n mpl.use(self.backend)\n import matplotlib.pyplot as plt\n\n self.fig = plt.figure(figsize=(14, 8))\n\n self.ax1 = self.fig.add_axes([0.1, 0.1, 0.4, 0.7])\n\n if clim is None:\n warnings.warn(\"clim not defined and will be determined from the data\")\n # To work with large arrays, sub-sample the data\n # (but don't do it for small arrays)\n n1 = max(self.array.shape[0] / 10, 1)\n n2 = max(self.array.shape[1] / 10, 1)\n n3 = max(self.array.shape[2] / 10, 1)\n sub_array = self.array[::n1,::n2,::n3]\n cmin = np.min(sub_array[~np.isnan(sub_array) & ~np.isinf(sub_array)])\n cmax = np.max(sub_array[~np.isnan(sub_array) & ~np.isinf(sub_array)])\n crange = cmax - cmin\n self._clim = (cmin - crange, cmax + crange)\n else:\n self._clim = clim\n\n self.slice = int(round(self.array.shape[0] / 2.))\n\n from matplotlib.widgets import Slider\n\n self.slice_slider_ax = self.fig.add_axes([0.1, 0.95, 0.4, 0.03])\n self.slice_slider_ax.set_xticklabels(\"\")\n self.slice_slider_ax.set_yticklabels(\"\")\n self.slice_slider = Slider(self.slice_slider_ax, \"3-d slice\", 0, self.array.shape[0], valinit=self.slice, valfmt=\"%i\")\n self.slice_slider.on_changed(self.update_slice)\n self.slice_slider.drawon = False\n\n self.image = self.ax1.imshow(self.array[self.slice, :,:], origin='lower', interpolation='nearest', vmin=self._clim[0], vmax=self._clim[1], cmap=plt.cm.gray)\n\n self.vmin_slider_ax = self.fig.add_axes([0.1, 0.90, 0.4, 0.03])\n self.vmin_slider_ax.set_xticklabels(\"\")\n self.vmin_slider_ax.set_yticklabels(\"\")\n self.vmin_slider = Slider(self.vmin_slider_ax, \"vmin\", self._clim[0], self._clim[1], valinit=self._clim[0])\n self.vmin_slider.on_changed(self.update_vmin)\n self.vmin_slider.drawon = False\n\n self.vmax_slider_ax = self.fig.add_axes([0.1, 0.85, 0.4, 0.03])\n self.vmax_slider_ax.set_xticklabels(\"\")\n self.vmax_slider_ax.set_yticklabels(\"\")\n self.vmax_slider = Slider(self.vmax_slider_ax, \"vmax\", self._clim[0], self._clim[1], valinit=self._clim[1])\n self.vmax_slider.on_changed(self.update_vmax)\n self.vmax_slider.drawon = False\n\n self.grid1 = None\n self.grid2 = None\n self.grid3 = None\n\n self.ax2 = self.fig.add_axes([0.55, 0.1, 0.4, 0.7])\n\n # Add slicing box\n self.box = SliceCurve(colors=(0.8, 0.0, 0.0))\n self.ax1.add_collection(self.box)\n self.movable = MovableSliceBox(self.box, callback=self.update_pv_slice)\n self.movable.connect()\n\n # Add save button\n from matplotlib.widgets import Button\n self.save_button_ax = self.fig.add_axes([0.65, 0.90, 0.20, 0.05])\n self.save_button = Button(self.save_button_ax, 'Save slice to FITS')\n self.save_button.on_clicked(self.save_fits)\n self.file_status_text = self.fig.text(0.75, 0.875, \"\", ha='center', va='center')\n self.set_file_status(None)\n\n self.set_file_status(None)\n self.pv_slice = None\n\n self.cidpress = self.fig.canvas.mpl_connect('button_press_event', self.click)", "metadata": "root.PVSlicer.__init__", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 213 }, { "content": " def set_file_status(self, status, filename=None):\n if status == 'instructions':\n self.file_status_text.set_text('Please enter filename in terminal')\n self.file_status_text.set_color('red')\n elif status == 'saved':\n self.file_status_text.set_text('File successfully saved to {0}'.format(filename))\n self.file_status_text.set_color('green')\n else:\n self.file_status_text.set_text('')\n self.file_status_text.set_color('black')\n self.fig.canvas.draw()", "metadata": "root.PVSlicer.set_file_status", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 305 }, { "content": " def click(self, event):\n\n if event.inaxes != self.ax2:\n return\n\n self.slice_slider.set_val(event.ydata)", "metadata": "root.PVSlicer.click", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 317 }, { "content": " def save_fits(self, *args, **kwargs):\n\n self.set_file_status('instructions')\n\n print(\"Enter filename: \", end='')\n try:\n plot_name = raw_input()\n except NameError:\n plot_name = input()\n\n if self.pv_slice is None:\n return\n\n from astropy.io import fits\n self.pv_slice.writeto(plot_name, clobber=True)\n print(\"Saved file to: \", plot_name)\n\n self.set_file_status('saved', filename=plot_name)", "metadata": "root.PVSlicer.save_fits", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 324 }, { "content": " def update_pv_slice(self, box):\n\n path = Path(zip(box.x, box.y))\n path.width = box.width\n\n self.pv_slice = extract_pv_slice(self.array, path)\n\n self.ax2.cla()\n self.ax2.imshow(self.pv_slice.data, origin='lower', aspect='auto', interpolation='nearest')\n\n self.fig.canvas.draw()", "metadata": "root.PVSlicer.update_pv_slice", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 343 }, { "content": " def show(self, block=True):\n import matplotlib.pyplot as plt\n plt.show(block=block)", "metadata": "root.PVSlicer.show", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 355 }, { "content": " def update_slice(self, pos=None):\n\n if self.array.ndim == 2:\n self.image.set_array(self.array)\n else:\n self.slice = int(round(pos))\n self.image.set_array(self.array[self.slice, :, :])\n\n self.fig.canvas.draw()", "metadata": "root.PVSlicer.update_slice", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 359 }, { "content": " def update_vmin(self, vmin):\n if vmin > self._clim[1]:\n self._clim = (self._clim[1], self._clim[1])\n else:\n self._clim = (vmin, self._clim[1])\n self.image.set_clim(*self._clim)\n self.fig.canvas.draw()", "metadata": "root.PVSlicer.update_vmin", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 369 }, { "content": " def update_vmax(self, vmax):\n if vmax < self._clim[0]:\n self._clim = (self._clim[0], self._clim[0])\n else:\n self._clim = (self._clim[0], vmax)\n self.image.set_clim(*self._clim)\n self.fig.canvas.draw()", "metadata": "root.PVSlicer.update_vmax", "header": "['class', 'PVSlicer', '(', 'object', ')', ':', '___EOS___']", "index": 377 } ]
[ { "span": "import os", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "from matplotlib.transforms import Bbox", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 38 }, { "span": "from matplotlib.patches import Polygon", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "matplotlib_", "._", "collections_", "import_", "Line", "Collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "transforms_", "import_", "Bb", "ox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "patches_", "import_", "Polygon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "geometry_", "._", "path_", "import_", "Path_", ",_", "get", "\\u", "endpoints_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "extract", "\\u", "pv", "\\u", "slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "distance_", "(_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", ",_", "x3_", ",_", "y3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "the", " ", "short", "est", " ", "distance", " ", "bet", "ween", " ", "a", " ", "point", " ", "(", "x3", ",", " ", "y", "3", ")", " ", "and", " ", "the", " ", "line", " ", "passi", "ng", "\\", "10", ";", " ", " ", " ", " ", "through", " ", "the", " ", "points", " ", "(", "x1", ",", " ", "y1", ")", " ", "and", " ", "(", "x2", ",", " ", "y2", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "px_", "=_", "x2_", "-_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py_", "=_", "y2_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "something_", "=_", "px_", "*_", "px_", "+_", "py_", "*_", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "=_", "(_", "(_", "x3_", "-_", "x1_", ")_", "*_", "px_", "+_", "(_", "y3_", "-_", "y1_", ")_", "*_", "py_", ")_", "/_", "float_", "(_", "something_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "x1_", "+_", "u_", "*_", "px_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "y1_", "+_", "u_", "*_", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dx_", "=_", "x_", "-_", "x3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "y_", "-_", "y3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dist_", "=_", "math_", "._", "sqrt_", "(_", "dx_", "*_", "dx_", "+_", "dy_", "*_", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "dist_", "\\u\\u\\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_", "Mo", "vable", "Slice", "Box_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Mo", "vable", "Slice", "Box_", "(_", "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_", ",_", "box_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "=_", "box_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "press_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "background_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "point", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback_", "=_", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mode_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "show", "\\u", "poly_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cid", "press_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "draw", "\\u", "event", "'_", ",_", "self_", "._", "draw", "\\u", "slicer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cid", "press_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "key", "\\u", "press", "\\u", "event", "'_", ",_", "self_", "._", "key", "\\u", "press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cid", "press_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "button", "\\u", "press", "\\u", "event", "'_", ",_", "self_", "._", "on", "\\u", "press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cid", "motion_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "moti", "on", "\\u", "notif", "y", "\\u", "event", "'_", ",_", "self_", "._", "on", "\\u", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "\\u", "slicer", "_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "axes_", "=_", "self_", "._", "box_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "box_", "._", "axes_", "._", "draw", "\\u", "artist_", "(_", "self_", "._", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "show", "\\u", "poly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "Path_", "(_", "zip_", "(_", "self_", "._", "box_", "._", "x_", ",_", "self_", "._", "box_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "._", "width_", "=_", "self_", "._", "box_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "patches_", "=_", "path_", "._", "to", "\\u", "patches_", "(_", "1_", ",_", "ec_", "=_", "'", "green", "'_", ",_", "fc_", "=_", "'", "none", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "self_", "._", "box_", "._", "axes_", "._", "trans", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clip", "\\u", "on_", "=_", "True_", ",_", "clip", "\\u", "box_", "=_", "self_", "._", "box_", "._", "axes_", "._", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "patch_", "in_", "patches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "axes_", "._", "draw", "\\u", "artist_", "(_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "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_", "on", "\\u", "press_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "toolbar_", "._", "mode_", "!=_", "''_", ":_", "\\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_", "event_", "._", "ina", "xes_", "!=_", "self_", "._", "box_", "._", "axes_", ":_", "\\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_", "self_", "._", "mode_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "callback_", "(_", "self_", "._", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mode_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "mode_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mode_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "point", "\\u", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "press_", "=_", "event_", "._", "xdata_", ",_", "event_", "._", "ydata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "point", "\\u", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "=_", "self_", "._", "box_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "point", "\\u", "counter_", "==_", "1_", ":_", "#", " ", "first", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "x_", "._", "append_", "(_", "event_", "._", "xdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "x_", "._", "append_", "(_", "event_", "._", "xdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "._", "append_", "(_", "event_", "._", "ydata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "._", "append_", "(_", "event_", "._", "ydata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "box_", "._", "width_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "box_", "._", "set\\u", "animate", "d_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "background_", "=_", "canvas_", "._", "copy", "\\u", "from", "\\u", "bbox_", "(_", "self_", "._", "box_", "._", "axes_", "._", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "mode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "x_", "._", "append_", "(_", "event_", "._", "xdata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "._", "append_", "(_", "event_", "._", "ydata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "box_", "._", "\\u", "update", "\\u", "segments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "redraw", " ", "just", " ", "the", " ", "linea", "ngle", "_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "._", "draw", "\\u", "artist_", "(_", "self_", "._", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "canvas_", "._", "blit_", "(_", "axes_", "._", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key", "\\u", "press_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "toolbar_", "._", "mode_", "!=_", "''_", ":_", "\\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_", "event_", "._", "key_", "==_", "'", "enter", "'_", "and_", "self_", "._", "mode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mode_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "x_", "=_", "self_", "._", "box_", "._", "x_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "=_", "self_", "._", "box_", "._", "y_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "._", "key_", "==_", "'", "y", "'_", "and_", "self_", "._", "mode_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "poly_", "=_", "not_", "self_", "._", "show", "\\u", "poly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "\\u", "slicer", "_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "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_", "on", "\\u", "motion_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "toolbar_", "._", "mode_", "!=_", "''_", ":_", "\\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_", "self_", "._", "point", "\\u", "counter_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "mode_", "==_", "2_", ":_", "\\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_", "canvas_", "=_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axes_", "=_", "self_", "._", "box_", "._", "axes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "._", "restore", "\\u", "region_", "(_", "self_", "._", "background_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "event_", "._", "ina", "xes_", "!=_", "self_", "._", "box_", "._", "axes_", ":_", "\\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_", "self_", "._", "mode_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "x_", "[_", "-_", "1_", "]_", "=_", "event_", "._", "xdata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "y_", "[_", "-_", "1_", "]_", "=_", "event_", "._", "ydata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "mode_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "width_", "=_", "distance_", "(_", "self_", "._", "box_", "._", "x_", "[_", "-_", "2_", "]_", ",_", "self_", "._", "box_", "._", "y_", "[_", "-_", "2_", "]_", ",_", "self_", "._", "box_", "._", "x_", "[_", "-_", "1_", "]_", ",_", "self_", "._", "box_", "._", "y_", "[_", "-_", "1_", "]_", ",_", "event_", "._", "xdata_", ",_", "event_", "._", "ydata_", ")_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "box_", "._", "\\u", "update", "\\u", "segments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redraw", " ", "just", " ", "the", " ", "current", " ", "linea", "ngle", "_", "\\u\\u\\uNL\\u\\u\\u_", "axes_", "._", "draw", "\\u", "artist_", "(_", "self_", "._", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "blit", " ", "just", " ", "the", " ", "redraw", "n", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "canvas_", "._", "blit_", "(_", "axes_", "._", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mo", "vable", "Slice", "Box_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "disconnect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "disconnect_", "(_", "self_", "._", "cid", "press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "box_", "._", "figure_", "._", "canvas_", "._", "mpl", "\\u", "disconnect_", "(_", "self_", "._", "cid", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Slice", "Curve_", "(_", "Line", "Collection_", ")_", ":_", "\\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_", "Slice", "Curve_", "(_", "Line", "Collection_", ")_", ":_", "\\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_", ",_", "x_", "=_", "[_", "]_", ",_", "y_", "=_", "[_", "]_", ",_", "width_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Slice", "Curve_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "[_", "]_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "width_", "=_", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "segments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Slice", "Curve_", "(_", "Line", "Collection_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "segments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "x_", ":_", "\\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_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", "=_", "get", "\\u", "endpoints_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "self_", "._", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "central", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "zip_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "bound", "ing", " ", "rectangle_", "\\u\\u\\uNL\\u\\u\\u_", "rect_", "=_", "zip_", "(_", "np_", "._", "hstack_", "(_", "[_", "x1_", ",_", "x2_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "x1_", "[_", "0_", "]_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "np_", "._", "hstack_", "(_", "[_", "y1_", ",_", "y2_", "[_", ":_", ":_", "-_", "1_", "]_", ",_", "y1_", "[_", "0_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "segments_", "(_", "(_", "list_", "(_", "line_", ")_", ",_", "list_", "(_", "rect_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "linestyle", "s_", "(_", "(_", "'", "solid", "'_", ",_", "'", "dashed", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "line", "widths_", "(_", "(_", "2_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "filename_", ",_", "backend_", "=_", "\"", "Qt", "4", "Agg", "\"_", ",_", "clim", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filename_", "=_", "filename_", "\\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_", "spectral", "\\u", "cube_", "import_", "Spectra", "l", "Cube_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cube_", "=_", "Spectra", "l", "Cube_", "._", "read_", "(_", "filename_", ",_", "format_", "=_", "'", "fits", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "array_", "=_", "cube_", "._", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "spectral", "\\u", "cube", " ", "package", " ", "is", " ", "not", " ", "avail", "able", " ", "-", " ", "usi", "ng", " ", "astro", "py", ".", "io", ".", "fits", " ", "direct", "ly", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "astropy_", "._", "io_", "import_", "fits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "array_", "=_", "fits_", "._", "getdata_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "array_", "._", "ndim_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "dataset", " ", "doe", "s", " ", "not", " ", "have", " ", "3", " ", "dimension", "s", " ", "(", "install", " ", "the", " ", "spectral", "\\u", "cube", " ", "package", " ", "to", " ", "avoid", " ", "this", " ", "error", ")\"_", ")_", "\\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_", "._", "backend_", "=_", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "as_", "mpl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mpl_", "._", "use_", "(_", "self_", "._", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "14_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ax1_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.1_", ",_", "0.1_", ",_", "0.4_", ",_", "0.7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "clim", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "clim", " ", "not", " ", "defin", "ed", " ", "and", " ", "will", " ", "be", " ", "dete", "rmin", "ed", " ", "from", " ", "the", " ", "data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "work", " ", "with", " ", "large", " ", "arrays", ",", " ", "sub", "-", "sample", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "but", " ", "don", "'", "t", " ", "do", " ", "it", " ", "for", " ", "small", " ", "arrays", ")_", "\\u\\u\\uNL\\u\\u\\u_", "n1_", "=_", "max_", "(_", "self_", "._", "array_", "._", "shape_", "[_", "0_", "]_", "/_", "10_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "max_", "(_", "self_", "._", "array_", "._", "shape_", "[_", "1_", "]_", "/_", "10_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n3_", "=_", "max_", "(_", "self_", "._", "array_", "._", "shape_", "[_", "2_", "]_", "/_", "10_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "array_", "=_", "self_", "._", "array_", "[_", ":_", ":_", "n1_", ",_", ":_", ":_", "n2_", ",_", ":_", ":_", "n3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmi", "n_", "=_", "np_", "._", "min_", "(_", "sub\\u", "array_", "[_", "~_", "np_", "._", "isnan_", "(_", "sub\\u", "array_", ")_", "&_", "~_", "np_", "._", "isinf", "_", "(_", "sub\\u", "array_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cma", "x_", "=_", "np_", "._", "max_", "(_", "sub\\u", "array_", "[_", "~_", "np_", "._", "isnan_", "(_", "sub\\u", "array_", ")_", "&_", "~_", "np_", "._", "isinf", "_", "(_", "sub\\u", "array_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cra", "nge_", "=_", "cma", "x_", "-_", "cmi", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clim", "_", "=_", "(_", "cmi", "n_", "-_", "cra", "nge_", ",_", "cma", "x_", "+_", "cra", "nge_", ")_", "\\u\\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", "clim", "_", "=_", "clim", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "slice_", "=_", "int_", "(_", "round_", "(_", "self_", "._", "array_", "._", "shape_", "[_", "0_", "]_", "/_", "2._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "matplotlib_", "._", "widgets_", "import_", "Slider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "slice", "\\u", "slide", "r", "\\u", "ax_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.1_", ",_", "0.95_", ",_", "0.4_", ",_", "0.03_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "xticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "yticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "slider_", "=_", "Slider_", "(_", "self_", "._", "slice", "\\u", "slide", "r", "\\u", "ax_", ",_", "\"", "3", "-", "d", " ", "slice", "\"_", ",_", "0_", ",_", "self_", "._", "array_", "._", "shape_", "[_", "0_", "]_", ",_", "vali", "nit_", "=_", "self_", "._", "slice_", ",_", "val", "fmt_", "=_", "\"%", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "slider_", "._", "on", "\\u", "changed_", "(_", "self_", "._", "update", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "slider_", "._", "draw", "on_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "image_", "=_", "self_", "._", "ax1_", "._", "imshow_", "(_", "self_", "._", "array_", "[_", "self_", "._", "slice_", ",_", ":_", ",_", ":_", "]_", ",_", "origin_", "=_", "'", "lower", "'_", ",_", "interpolation_", "=_", "'", "near", "est", "'_", ",_", "vmin_", "=_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ",_", "vmax_", "=_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ",_", "cmap_", "=_", "plt_", "._", "cm_", "._", "gray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slide", "r", "\\u", "ax_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.1_", ",_", "0.90", "_", ",_", "0.4_", ",_", "0.03_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "xticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "yticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slider_", "=_", "Slider_", "(_", "self_", "._", "vmin", "\\u", "slide", "r", "\\u", "ax_", ",_", "\"", "vmin", "\"_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ",_", "vali", "nit_", "=_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slider_", "._", "on", "\\u", "changed_", "(_", "self_", "._", "update", "\\u", "vmin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vmin", "\\u", "slider_", "._", "draw", "on_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slide", "r", "\\u", "ax_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.1_", ",_", "0.85_", ",_", "0.4_", ",_", "0.03_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "xticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slide", "r", "\\u", "ax_", "._", "set\\u", "yticklabels_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slider_", "=_", "Slider_", "(_", "self_", "._", "vma", "x", "\\u", "slide", "r", "\\u", "ax_", ",_", "\"", "vma", "x", "\"_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ",_", "vali", "nit_", "=_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slider_", "._", "on", "\\u", "changed_", "(_", "self_", "._", "update", "\\u", "vmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vma", "x", "\\u", "slider_", "._", "draw", "on_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "grid", "1_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid", "2_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid", "3_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ax2_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.55", "_", ",_", "0.1_", ",_", "0.4_", ",_", "0.7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "slicing", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "box_", "=_", "Slice", "Curve_", "(_", "colors_", "=_", "(_", "0.8_", ",_", "0.0_", ",_", "0.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax1_", "._", "add", "\\u", "collection_", "(_", "self_", "._", "box_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mov", "able_", "=_", "Mo", "vable", "Slice", "Box_", "(_", "self_", "._", "box_", ",_", "callback_", "=_", "self_", "._", "update", "\\u", "pv", "\\u", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mov", "able_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "save", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "matplotlib_", "._", "widgets_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "button", "\\u", "ax_", "=_", "self_", "._", "fig_", "._", "add", "\\u", "axes_", "(_", "[_", "0.65_", ",_", "0.90", "_", ",_", "0.20", "_", ",_", "0.05_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "button_", "=_", "Button_", "(_", "self_", "._", "save", "\\u", "button", "\\u", "ax_", ",_", "'", "Save", " ", "slice", " ", "to", " ", "FIT", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save", "\\u", "button_", "._", "on", "\\u", "clicked_", "(_", "self_", "._", "save", "\\u", "fits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "status", "\\u", "text_", "=_", "self_", "._", "fig_", "._", "text_", "(_", "0.75_", ",_", "0.87", "5_", ",_", "\"\"_", ",_", "ha_", "=_", "'", "center", "'_", ",_", "va_", "=_", "'", "center", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "file", "\\u", "status_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "file", "\\u", "status_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pv", "\\u", "slice_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cid", "press_", "=_", "self_", "._", "fig_", "._", "canvas_", "._", "mpl", "\\u", "connect_", "(_", "'", "button", "\\u", "press", "\\u", "event", "'_", ",_", "self_", "._", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "file", "\\u", "status_", "(_", "self_", ",_", "status_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "status_", "==_", "'", "instruct", "ion", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "text_", "(_", "'", "Ple", "ase", " ", "enter", " ", "filename", " ", "in", " ", "termina", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "color_", "(_", "'", "red", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "'", "saved", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "text_", "(_", "'", "File", " ", "success", "full", "y", " ", "saved", " ", "to", " ", "{", "0", "}'_", "._", "format_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "color_", "(_", "'", "green", "'_", ")_", "\\u\\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_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "text_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "status", "\\u", "text_", "._", "set\\u", "color_", "(_", "'", "black", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "click_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "ina", "xes_", "!=_", "self_", "._", "ax2_", ":_", "\\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_", "._", "slice", "\\u", "slider_", "._", "set\\u", "val_", "(_", "event_", "._", "ydata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "\\u", "fits_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "file", "\\u", "status_", "(_", "'", "instruct", "ion", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Enter", " ", "filename", ":", " ", "\"_", ",_", "end_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plot", "\\u", "name_", "=_", "raw", "\\u", "input_", "(_", ")_", "\\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 ", " _", "plot", "\\u", "name_", "=_", "input_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "pv", "\\u", "slice_", "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_", "from_", "astropy_", "._", "io_", "import_", "fits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pv", "\\u", "slice_", "._", "writet", "o_", "(_", "plot", "\\u", "name_", ",_", "clobber", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Save", "d", " ", "file", " ", "to", ":", " ", "\"_", ",_", "plot", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "file", "\\u", "status_", "(_", "'", "saved", "'_", ",_", "filename_", "=_", "plot", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "pv", "\\u", "slice_", "(_", "self_", ",_", "box_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "Path_", "(_", "zip_", "(_", "box_", "._", "x_", ",_", "box_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "._", "width_", "=_", "box_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pv", "\\u", "slice_", "=_", "extract", "\\u", "pv", "\\u", "slice_", "(_", "self_", "._", "array_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ax2_", "._", "cla", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ax2_", "._", "imshow_", "(_", "self_", "._", "pv", "\\u", "slice_", "._", "data_", ",_", "origin_", "=_", "'", "lower", "'_", ",_", "aspect_", "=_", "'", "auto", "'_", ",_", "interpolation_", "=_", "'", "near", "est", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show_", "(_", "self_", ",_", "block_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", "block_", "=_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "slice_", "(_", "self_", ",_", "pos_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "array_", "._", "ndim_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "image_", "._", "set\\u", "array_", "(_", "self_", "._", "array_", ")_", "\\u\\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_", "._", "slice_", "=_", "int_", "(_", "round_", "(_", "pos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "image_", "._", "set\\u", "array_", "(_", "self_", "._", "array_", "[_", "self_", "._", "slice_", ",_", ":_", ",_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "vmin_", "(_", "self_", ",_", "vmin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vmin_", ">_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clim", "_", "=_", "(_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clim", "_", "=_", "(_", "vmin_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "image_", "._", "set\\u", "clim", "_", "(_", "*_", "self_", "._", "\\u", "clim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PV", "Slice", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "vmax_", "(_", "self_", ",_", "vmax_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "vmax_", "<_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clim", "_", "=_", "(_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ",_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clim", "_", "=_", "(_", "self_", "._", "\\u", "clim", "_", "[_", "0_", "]_", ",_", "vmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "image_", "._", "set\\u", "clim", "_", "(_", "*_", "self_", "._", "\\u", "clim", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fig_", "._", "canvas_", "._", "draw_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 1, 1, 1, 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, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
BD2KGenomics/toil/src/toil/lib/bioio.py
[ { "content": "# Copyright (C) 2015 UCSC Computational Genomics Lab\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import\nimport sys\nimport os\nimport logging\nimport resource\nimport logging.handlers\nimport tempfile\nimport random\nimport math\nimport shutil\nfrom argparse import ArgumentParser\nfrom optparse import OptionContainer, OptionGroup\nimport subprocess\nimport xml.etree.cElementTree as ET\nfrom xml.dom import minidom # For making stuff pretty\n\ndefaultLogLevel = logging.INFO\n\n# TODO: looks like this can be removed\n\nloggingFormatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)s %(message)s')\n\nlogger = logging.getLogger(__name__)\nrootLogger = logging.getLogger()\n\n\n__loggingFiles = []\n\n\n \n\n\nsupportedLogLevels = (logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG)\n\n\n\n\n\n\n\n\n#########################################################\n#########################################################\n#########################################################\n#testing settings\n#########################################################\n#########################################################\n#########################################################\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getLogLevelString():\n return logging.getLevelName(rootLogger.getEffectiveLevel())", "metadata": "root.getLogLevelString", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def addLoggingFileHandler(fileName, rotatingLogging=False):\n if fileName in __loggingFiles:\n return\n __loggingFiles.append(fileName)\n if rotatingLogging:\n handler = logging.handlers.RotatingFileHandler(fileName, maxBytes=1000000, backupCount=1)\n else:\n handler = logging.FileHandler(fileName)\n rootLogger.addHandler(handler)\n return handler", "metadata": "root.addLoggingFileHandler", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def setLogLevel(level, logger=rootLogger):\n \"\"\"\n Sets the log level to a given string level (like \"INFO\"). Operates on the\n root logger by default, but another logger can be specified instead.\n \"\"\"\n level = level.upper()\n if level == \"OFF\": level = \"CRITICAL\"\n # Note that getLevelName works in both directions, numeric to textual and textual to numeric\n numericLevel = logging.getLevelName(level)\n assert logging.getLevelName(numericLevel) == level\n logger.setLevel(numericLevel)\n # There are quite a few cases where we expect AWS requests to fail, but it seems\n # that boto handles these by logging the error *and* raising an exception. We\n # don't want to confuse the user with those error messages.\n logging.getLogger( 'boto' ).setLevel( logging.CRITICAL )", "metadata": "root.setLogLevel", "header": "['module', '___EOS___']", "index": 54 }, { "content": "def logFile(fileName, printFunction=logger.info):\n \"\"\"Writes out a formatted version of the given log file\n \"\"\"\n printFunction(\"Reporting file: %s\" % fileName)\n shortName = fileName.split(\"/\")[-1]\n fileHandle = open(fileName, 'r')\n line = fileHandle.readline()\n while line != '':\n if line[-1] == '\\n':\n line = line[:-1]\n printFunction(\"%s:\\t%s\" % (shortName, line))\n line = fileHandle.readline()\n fileHandle.close()", "metadata": "root.logFile", "header": "['module', '___EOS___']", "index": 70 }, { "content": "def logStream(fileHandle, shortName, printFunction=logger.info):\n \"\"\"Writes out a formatted version of the given log stream.\n \"\"\"\n printFunction(\"Reporting file: %s\" % shortName)\n line = fileHandle.readline()\n while line != '':\n if line[-1] == '\\n':\n line = line[:-1]\n printFunction(\"%s:\\t%s\" % (shortName, line))\n line = fileHandle.readline()\n fileHandle.close()", "metadata": "root.logStream", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def addLoggingOptions(parser):\n # Wrapper function that allows toil to be used with both the optparse and\n # argparse option parsing modules\n if isinstance(parser, ArgumentParser):\n group = parser.add_argument_group(\"Logging Options\",\n \"Options that control logging\")\n _addLoggingOptions(group.add_argument)\n else:\n raise RuntimeError(\"Unanticipated class passed to \"\n \"addLoggingOptions(), %s. Expecting \"\n \"argparse.ArgumentParser\" % parser.__class__)", "metadata": "root.addLoggingOptions", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def _addLoggingOptions(addOptionFn):\n \"\"\"\n Adds logging options\n \"\"\"\n # BEFORE YOU ADD OR REMOVE OPTIONS TO THIS FUNCTION, KNOW THAT YOU MAY ONLY USE VARIABLES ACCEPTED BY BOTH\n # optparse AND argparse FOR EXAMPLE, YOU MAY NOT USE default=%default OR default=%(default)s\n defaultLogLevelName = logging.getLevelName( defaultLogLevel )\n addOptionFn(\"--logOff\", dest=\"logCritical\", action=\"store_true\", default=False,\n help=\"Same as --logCritical\")\n for level in supportedLogLevels:\n levelName = logging.getLevelName(level)\n levelNameCapitalized = levelName.capitalize()\n addOptionFn(\"--log\" + levelNameCapitalized, dest=\"logLevel\",\n action=\"store_const\", const=levelName,\n help=\"Turn on logging at level %s and above. (default is %s)\" % (levelName, defaultLogLevelName))\n addOptionFn(\"--logLevel\", dest=\"logLevel\", default=defaultLogLevelName,\n help=(\"Log at given level (may be either OFF (or CRITICAL), ERROR, WARN (or WARNING), INFO or DEBUG). \"\n \"(default is %s)\" % defaultLogLevelName))\n addOptionFn(\"--logFile\", dest=\"logFile\", help=\"File to log in\")\n addOptionFn(\"--rotatingLogging\", dest=\"logRotating\", action=\"store_true\", default=False,\n help=\"Turn on rotating logging, which prevents log files getting too big.\")", "metadata": "root._addLoggingOptions", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def setLoggingFromOptions(options):\n \"\"\"\n Sets the logging from a dictionary of name/value options.\n \"\"\"\n logging.basicConfig(format=\"%(asctime)s %(levelname)s:%(name)s: %(message)s\")\n rootLogger.setLevel(defaultLogLevel)\n if options.logLevel is not None:\n setLogLevel(options.logLevel)\n logger.info(\"Logging set at level: %s\" % getLogLevelString())\n if options.logFile is not None:\n addLoggingFileHandler(options.logFile, options.logRotating)\n logger.info(\"Logging to file: %s\" % options.logFile)", "metadata": "root.setLoggingFromOptions", "header": "['module', '___EOS___']", "index": 132 }, { "content": "def system(command):\n \"\"\"\n A convenience wrapper around subprocess.check_call that logs the command before passing it\n on. The command can be either a string or a sequence of strings. If it is a string shell=True\n will be passed to subprocess.check_call.\n\n :type command: str | sequence[string]\n \"\"\"\n logger.debug('Running: %r', command)\n subprocess.check_call(command, shell=isinstance(command,basestring), bufsize=-1)", "metadata": "root.system", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def getTotalCpuTimeAndMemoryUsage():\n \"\"\"Gives the total cpu time and memory usage of itself and its children.\n \"\"\"\n me = resource.getrusage(resource.RUSAGE_SELF)\n childs = resource.getrusage(resource.RUSAGE_CHILDREN)\n totalCPUTime = me.ru_utime+me.ru_stime+childs.ru_utime+childs.ru_stime\n totalMemoryUsage = me.ru_maxrss+ me.ru_maxrss\n return totalCPUTime, totalMemoryUsage", "metadata": "root.getTotalCpuTimeAndMemoryUsage", "header": "['module', '___EOS___']", "index": 156 }, { "content": "def getTotalCpuTime():\n \"\"\"Gives the total cpu time, including the children.\n \"\"\"\n return getTotalCpuTimeAndMemoryUsage()[0]", "metadata": "root.getTotalCpuTime", "header": "['module', '___EOS___']", "index": 165 }, { "content": "def getTotalMemoryUsage():\n \"\"\"Gets the amount of memory used by the process and its children.\n \"\"\"\n return getTotalCpuTimeAndMemoryUsage()[1]", "metadata": "root.getTotalMemoryUsage", "header": "['module', '___EOS___']", "index": 170 }, { "content": "def absSymPath(path):\n \"\"\"like os.path.abspath except it doesn't dereference symlinks\n \"\"\"\n curr_path = os.getcwd()\n return os.path.normpath(os.path.join(curr_path, path))", "metadata": "root.absSymPath", "header": "['module', '___EOS___']", "index": 175 }, { "content": "class TestStatus:\n ###Global variables used by testing framework to run tests.\n TEST_SHORT = 0\n TEST_MEDIUM = 1\n TEST_LONG = 2\n TEST_VERY_LONG = 3\n\n TEST_STATUS = TEST_SHORT\n\n SAVE_ERROR_LOCATION = None\n\n getTestStatus = staticmethod(getTestStatus)\n\n setTestStatus = staticmethod(setTestStatus)\n\n getSaveErrorLocation = staticmethod(getSaveErrorLocation)\n\n setSaveErrorLocation = staticmethod(setSaveErrorLocation)\n\n getTestSetup = staticmethod(getTestSetup)\n\n getPathToDataSets = staticmethod(getPathToDataSets)", "metadata": "root.TestStatus", "header": "['module', '___EOS___']", "index": 189 }, { "content": " def getTestStatus():\n return TestStatus.TEST_STATUS", "metadata": "root.TestStatus.getTestStatus", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 200 }, { "content": " def setTestStatus(status):\n assert status in (TestStatus.TEST_SHORT, TestStatus.TEST_MEDIUM, TestStatus.TEST_LONG, TestStatus.TEST_VERY_LONG)\n TestStatus.TEST_STATUS = status", "metadata": "root.TestStatus.setTestStatus", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 204 }, { "content": " def getSaveErrorLocation():\n \"\"\"Location to in which to write inputs which created test error.\n \"\"\"\n return TestStatus.SAVE_ERROR_LOCATION", "metadata": "root.TestStatus.getSaveErrorLocation", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 209 }, { "content": " def setSaveErrorLocation(dir):\n \"\"\"Set location in which to write inputs which created test error.\n \"\"\"\n logger.info(\"Location to save error files in: %s\" % dir)\n assert os.path.isdir(dir)\n TestStatus.SAVE_ERROR_LOCATION = dir", "metadata": "root.TestStatus.setSaveErrorLocation", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 215 }, { "content": " def getTestSetup(shortTestNo=1, mediumTestNo=5, longTestNo=100, veryLongTestNo=0):\n if TestStatus.TEST_STATUS == TestStatus.TEST_SHORT:\n return shortTestNo\n elif TestStatus.TEST_STATUS == TestStatus.TEST_MEDIUM:\n return mediumTestNo\n elif TestStatus.TEST_STATUS == TestStatus.TEST_LONG:\n return longTestNo\n else: #Used for long example tests\n return veryLongTestNo", "metadata": "root.TestStatus.getTestSetup", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 223 }, { "content": " def getPathToDataSets():\n \"\"\"This method is used to store the location of\n the path where all the data sets used by tests for analysis are kept.\n These are not kept in the distrbution itself for reasons of size.\n \"\"\"\n assert \"SON_TRACE_DATASETS\" in os.environ\n return os.environ[\"SON_TRACE_DATASETS\"]", "metadata": "root.TestStatus.getPathToDataSets", "header": "['class', 'TestStatus', ':', '___NEWLINE___', '###Global variables used by testing framework to run tests.', '___NL___', '___EOS___']", "index": 234 }, { "content": "def getBasicOptionParser( parser=None):\n if parser is None:\n parser = ArgumentParser()\n\n addLoggingOptions(parser)\n\n parser.add_argument(\"--tempDirRoot\", dest=\"tempDirRoot\", type=str,\n help=\"Path to where temporary directory containing all temp files are created, by default uses the current working directory as the base.\",\n default=tempfile.gettempdir())\n\n return parser", "metadata": "root.getBasicOptionParser", "header": "['module', '___EOS___']", "index": 243 }, { "content": "def parseBasicOptions(parser):\n \"\"\"Setups the standard things from things added by getBasicOptionParser.\n \"\"\"\n options = parser.parse_args()\n\n setLoggingFromOptions(options)\n\n #Set up the temp dir root\n if options.tempDirRoot == \"None\": # FIXME: Really, a string containing the word None?\n options.tempDirRoot = tempfile.gettempdir()\n\n return options", "metadata": "root.parseBasicOptions", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def getRandomAlphaNumericString(length=10):\n \"\"\"Returns a random alpha numeric string of the given length.\n \"\"\"\n return \"\".join([ random.choice('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') for i in xrange(0, length) ])", "metadata": "root.getRandomAlphaNumericString", "header": "['module', '___EOS___']", "index": 268 }, { "content": "def makePublicDir(dirName):\n \"\"\"Makes a given subdirectory if it doesn't already exist, making sure it is public.\n \"\"\"\n if not os.path.exists(dirName):\n os.mkdir(dirName)\n os.chmod(dirName, 0777)\n return dirName", "metadata": "root.makePublicDir", "header": "['module', '___EOS___']", "index": 273 }, { "content": "def getTempFile(suffix=\"\", rootDir=None):\n \"\"\"Returns a string representing a temporary file, that must be manually deleted\n \"\"\"\n if rootDir is None:\n handle, tmpFile = tempfile.mkstemp(suffix)\n os.close(handle)\n return tmpFile\n else:\n tmpFile = os.path.join(rootDir, \"tmp_\" + getRandomAlphaNumericString() + suffix)\n open(tmpFile, 'w').close()\n os.chmod(tmpFile, 0777) #Ensure everyone has access to the file.\n return tmpFile", "metadata": "root.getTempFile", "header": "['module', '___EOS___']", "index": 281 } ]
[ { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import math", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 11 }, { "span": "import shutil", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 13 }, { "span": "from optparse import OptionContainer, OptionGroup", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 49 }, { "span": "import xml.etree.cElementTree as ET", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 35 }, { "span": "from xml.dom import minidom ", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", "UCS", "C", " ", "Computation", "al", " ", "Geno", "mic", "s", " ", "Lab", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "argparse_", "import_", "Arg", "ument", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Container_", ",_", "Optio", "n", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "c", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "import_", "minidom_", "#", " ", "For", " ", "mak", "ing", " ", "stu", "ff", " ", "pretty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Log", "Level_", "=_", "logging_", "._", "INFO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "look", "s", " ", "like", " ", "this", " ", "can", " ", "be", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "ing", "Formatter_", "=_", "logging_", "._", "Formatter_", "(_", "'%", "(", "asc", "time", ")", "s", " ", "%", "(", "level", "name", ")", "s", " ", "%", "(", "linen", "o", ")", "s", " ", "%", "(", "message", ")", "s", "'_", ")_", "\\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_", "root", "Logger_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "\\u\\u\\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", "logg", "ing", "Files_", "=_", "[_", "]_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "support", "ed", "Log", "Levels_", "=_", "(_", "logging_", "._", "CRITICAL_", ",_", "logging_", "._", "ERROR_", ",_", "logging_", "._", "WARNING_", ",_", "logging_", "._", "INFO_", ",_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "#", "testi", "ng", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Log", "Leve", "l", "String_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "root", "Logger_", "._", "get", "Effe", "ctive", "Level_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "Log", "ging", "File", "Handler_", "(_", "file", "Name_", ",_", "rotati", "ng", "Logging_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file", "Name_", "in_", "\\u\\u", "logg", "ing", "Files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "logg", "ing", "Files_", "._", "append_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rotati", "ng", "Logging_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "logging_", "._", "handlers_", "._", "Rot", "ati", "ng", "File", "Handler_", "(_", "file", "Name_", ",_", "max", "Bytes_", "=_", "1000000_", ",_", "backup", "Count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Logger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Log", "Level_", "(_", "level_", ",_", "logger_", "=_", "root", "Logger_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "log", " ", "level", " ", "to", " ", "a", " ", "give", "n", " ", "string", " ", "level", " ", "(", "like", " ", "\"", "INFO", "\")", ".", " ", "Opera", "tes", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "root", " ", "logg", "er", " ", "by", " ", "default", ",", " ", "but", " ", "anot", "her", " ", "logg", "er", " ", "can", " ", "be", " ", "specified", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level_", "=_", "level_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", "==_", "\"", "OFF", "\"_", ":_", "level_", "=_", "\"", "CRIT", "ICAL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "get", "Leve", "l", "Name", " ", "works", " ", "in", " ", "bot", "h", " ", "direction", "s", ",", " ", "numeri", "c", " ", "to", " ", "textu", "al", " ", "and", " ", "textu", "al", " ", "to", " ", "numeric_", "\\u\\u\\uNL\\u\\u\\u_", "numeri", "c", "Level_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "numeri", "c", "Level_", ")_", "==_", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "set", "Level_", "(_", "numeri", "c", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "quite", " ", "a", " ", "few", " ", "case", "s", " ", "where", " ", "we", " ", "expect", " ", "AW", "S", " ", "request", "s", " ", "to", " ", "fail", ",", " ", "but", " ", "it", " ", "see", "ms_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "boto", " ", "handle", "s", " ", "these", " ", "by", " ", "logg", "ing", " ", "the", " ", "error", " ", "*", "and", "*", " ", "rais", "ing", " ", "an", " ", "exception", ".", " ", "We", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "want", " ", "to", " ", "conf", "use", " ", "the", " ", "user", " ", "with", " ", "tho", "se", " ", "error", " ", "message", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", "'", "boto", "'_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "CRITICAL_", ")_", "\\u\\u\\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_", "log", "File_", "(_", "file", "Name_", ",_", "print", "Function_", "=_", "logger_", "._", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "out", " ", "a", " ", "format", "ted", " ", "version", " ", "of", " ", "the", " ", "give", "n", " ", "log", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Function_", "(_", "\"", "Report", "ing", " ", "file", ":", " ", "%", "s", "\"_", "%_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "Name_", "=_", "file", "Name_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Handle_", "=_", "open_", "(_", "file", "Name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "file", "Handle_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "line_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "[_", "-_", "1_", "]_", "==_", "'\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "Function_", "(_", "\"%", "s", ":\\\\", "t", "%", "s", "\"_", "%_", "(_", "short", "Name_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "file", "Handle_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Handle_", "._", "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_", "def_", "log", "Stream_", "(_", "file", "Handle_", ",_", "short", "Name_", ",_", "print", "Function_", "=_", "logger_", "._", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "out", " ", "a", " ", "format", "ted", " ", "version", " ", "of", " ", "the", " ", "give", "n", " ", "log", " ", "stream", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Function_", "(_", "\"", "Report", "ing", " ", "file", ":", " ", "%", "s", "\"_", "%_", "short", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "file", "Handle_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "line_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "[_", "-_", "1_", "]_", "==_", "'\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print", "Function_", "(_", "\"%", "s", ":\\\\", "t", "%", "s", "\"_", "%_", "(_", "short", "Name_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "file", "Handle_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Handle_", "._", "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_", "def_", "add", "Log", "ging", "Options_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wrapper", " ", "function", " ", "tha", "t", " ", "allow", "s", " ", "toi", "l", " ", "to", " ", "be", " ", "used", " ", "with", " ", "bot", "h", " ", "the", " ", "optparse", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argp", "arse", " ", "option", " ", "pars", "ing", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "parser_", ",_", "Arg", "ument", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "parser_", "._", "add", "\\u", "argu", "ment", "\\u", "group_", "(_", "\"", "Log", "ging", " ", "Optio", "ns", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Optio", "ns", " ", "tha", "t", " ", "control", " ", "logg", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "add", "Log", "ging", "Options_", "(_", "group_", "._", "add", "\\u", "argument_", ")_", "\\u\\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_", "Run", "time", "Error_", "(_", "\"", "Una", "ntic", "ipat", "ed", " ", "class", " ", "pass", "ed", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "Log", "ging", "Optio", "ns", "()", ",", " ", "%", "s", ".", " ", "Expecti", "ng", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "argp", "arse", ".", "Arg", "ument", "Parser", "\"_", "%_", "parser_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "add", "Log", "ging", "Options_", "(_", "add", "Optio", "n", "Fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "logg", "ing", " ", "options", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BEFORE", " ", "YOU", " ", "ADD", " ", "OR", " ", "REMOVE", " ", "OPTION", "S", " ", "TO", " ", "THIS", " ", "FUNC", "TIO", "N", ",", " ", "KN", "OW", " ", "THA", "T", " ", "YOU", " ", "MA", "Y", " ", "ONL", "Y", " ", "USE", " ", "VARIABLES", " ", "ACCEPTED", " ", "BY", " ", "BOTH_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "optparse", " ", "AND", " ", "argp", "arse", " ", "FOR", " ", "EXAMPLE", ",", " ", "YOU", " ", "MA", "Y", " ", "NOT", " ", "USE", " ", "default", "=", "%", "default", " ", "OR", " ", "default", "=", "%", "(", "default", ")", "s_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Log", "Leve", "l", "Name_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "default", "Log", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Optio", "n", "Fn_", "(_", "\"--", "log", "Off", "\"_", ",_", "dest_", "=_", "\"", "log", "Crit", "ical", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Sam", "e", " ", "as", " ", "--", "log", "Crit", "ical", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "level_", "in_", "support", "ed", "Log", "Levels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level", "Name_", "=_", "logging_", "._", "get", "Leve", "l", "Name_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "Name", "Capita", "lize", "d_", "=_", "level", "Name_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Optio", "n", "Fn_", "(_", "\"--", "log", "\"_", "+_", "level", "Name", "Capita", "lize", "d_", ",_", "dest_", "=_", "\"", "log", "Leve", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "const", "\"_", ",_", "const_", "=_", "level", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Turn", " ", "on", " ", "logg", "ing", " ", "at", " ", "level", " ", "%", "s", " ", "and", " ", "above", ".", " ", "(", "default", " ", "is", " ", "%", "s", ")\"_", "%_", "(_", "level", "Name_", ",_", "default", "Log", "Leve", "l", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Optio", "n", "Fn_", "(_", "\"--", "log", "Leve", "l", "\"_", ",_", "dest_", "=_", "\"", "log", "Leve", "l", "\"_", ",_", "default_", "=_", "default", "Log", "Leve", "l", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "(_", "\"", "Log", " ", "at", " ", "give", "n", " ", "level", " ", "(", "may", " ", "be", " ", "eit", "her", " ", "OFF", " ", "(", "or", " ", "CRIT", "ICAL", "),", " ", "ERROR", ",", " ", "WARN", " ", "(", "or", " ", "WARN", "ING", "),", " ", "INFO", " ", "or", " ", "DEBU", "G", ").", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "default", " ", "is", " ", "%", "s", ")\"_", "%_", "default", "Log", "Leve", "l", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Optio", "n", "Fn_", "(_", "\"--", "log", "File", "\"_", ",_", "dest_", "=_", "\"", "log", "File", "\"_", ",_", "help_", "=_", "\"", "File", " ", "to", " ", "log", " ", "in", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "Optio", "n", "Fn_", "(_", "\"--", "rotati", "ng", "Log", "ging", "\"_", ",_", "dest_", "=_", "\"", "log", "Rot", "ati", "ng", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Turn", " ", "on", " ", "rotati", "ng", " ", "logg", "ing", ",", " ", "whi", "ch", " ", "prevent", "s", " ", "log", " ", "files", " ", "getti", "ng", " ", "too", " ", "big", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Log", "ging", "Fro", "m", "Options_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "logg", "ing", " ", "from", " ", "a", " ", "dictionar", "y", " ", "of", " ", "name", "/", "value", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "basic", "Config_", "(_", "format_", "=_", "\"%", "(", "asc", "time", ")", "s", " ", "%", "(", "level", "name", ")", "s", ":", "%", "(", "name", ")", "s", ":", " ", "%", "(", "message", ")", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Logger_", "._", "set", "Level_", "(_", "default", "Log", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "log", "Level_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set", "Log", "Level_", "(_", "options_", "._", "log", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Log", "ging", " ", "set", " ", "at", " ", "level", ":", " ", "%", "s", "\"_", "%_", "get", "Log", "Leve", "l", "String_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "log", "File_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Log", "ging", "File", "Handler_", "(_", "options_", "._", "log", "File_", ",_", "options_", "._", "log", "Rot", "ati", "ng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Log", "ging", " ", "to", " ", "file", ":", " ", "%", "s", "\"_", "%_", "options_", "._", "log", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "system_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "convenien", "ce", " ", "wrapp", "er", " ", "aro", "und", " ", "subproc", "ess", ".", "check", "\\u", "call", " ", "tha", "t", " ", "logs", " ", "the", " ", "command", " ", "bef", "ore", " ", "passi", "ng", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "on", ".", " ", "The", " ", "command", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "string", " ", "or", " ", "a", " ", "sequence", " ", "of", " ", "string", "s", ".", " ", "If", " ", "it", " ", "is", " ", "a", " ", "string", " ", "shell", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "subproc", "ess", ".", "check", "\\u", "call", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "command", ":", " ", "str", " ", "|", " ", "sequence", "[", "string", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Run", "ning", ":", " ", "%", "r", "'_", ",_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "command_", ",_", "shell_", "=_", "isinstance_", "(_", "command_", ",_", "basestring_", ")_", ",_", "bufsize_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Total", "Cp", "u", "Time", "And", "Memo", "ry", "Usage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "s", " ", "the", " ", "total", " ", "cpu", " ", "time", " ", "and", " ", "memory", " ", "usage", " ", "of", " ", "its", "elf", " ", "and", " ", "its", " ", "child", "ren", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "me_", "=_", "resource_", "._", "getr", "usage_", "(_", "resource_", "._", "RUS", "AGE", "\\u", "SELF", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "childs_", "=_", "resource_", "._", "getr", "usage_", "(_", "resource_", "._", "RUS", "AGE", "\\u", "CHILD", "REN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "CPU", "Time_", "=_", "me_", "._", "ru", "\\u", "utime", "_", "+_", "me_", "._", "ru", "\\u", "stime", "_", "+_", "childs_", "._", "ru", "\\u", "utime", "_", "+_", "childs_", "._", "ru", "\\u", "stime", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "Memo", "ry", "Usage_", "=_", "me_", "._", "ru", "\\u", "maxr", "ss_", "+_", "me_", "._", "ru", "\\u", "maxr", "ss_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "total", "CPU", "Time_", ",_", "total", "Memo", "ry", "Usage_", "\\u\\u\\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", "Total", "Cp", "u", "Time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "s", " ", "the", " ", "total", " ", "cpu", " ", "time", ",", " ", "inclu", "ding", " ", "the", " ", "child", "ren", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "Total", "Cp", "u", "Time", "And", "Memo", "ry", "Usage_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Total", "Memo", "ry", "Usage_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", "s", " ", "the", " ", "amo", "unt", " ", "of", " ", "memory", " ", "used", " ", "by", " ", "the", " ", "process", " ", "and", " ", "its", " ", "child", "ren", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "Total", "Cp", "u", "Time", "And", "Memo", "ry", "Usage_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "abs", "Sym", "Path_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "like", " ", "os", ".", "path", ".", "abs", "path", " ", "except", " ", "it", " ", "doe", "sn", "'", "t", " ", "dereferenc", "e", " ", "symlinks", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "\\u", "path_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "curr", "\\u", "path_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TEST", "\\u", "SHORT", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "MEDIUM", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "LONG_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEST", "\\u", "VERY", "\\u", "LONG_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "STATUS_", "=_", "TEST", "\\u", "SHORT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SAVE", "\\u", "ERROR", "\\u", "LOCATION_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "Test", "Status_", "=_", "staticmethod_", "(_", "get", "Test", "Status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set", "Test", "Status_", "=_", "staticmethod_", "(_", "set", "Test", "Status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "Save", "Error", "Location_", "=_", "staticmethod_", "(_", "get", "Save", "Error", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set", "Save", "Error", "Location_", "=_", "staticmethod_", "(_", "set", "Save", "Error", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "Test", "Setup_", "=_", "staticmethod_", "(_", "get", "Test", "Setup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "Path", "To", "Data", "Sets_", "=_", "staticmethod_", "(_", "get", "Path", "To", "Data", "Sets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Test", "Status_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Test", "Status_", "._", "TEST", "\\u", "STATUS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Test", "Status_", "(_", "status_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "status_", "in_", "(_", "Test", "Status_", "._", "TEST", "\\u", "SHORT", "_", ",_", "Test", "Status_", "._", "TEST", "\\u", "MEDIUM", "_", ",_", "Test", "Status_", "._", "TEST", "\\u", "LONG_", ",_", "Test", "Status_", "._", "TEST", "\\u", "VERY", "\\u", "LONG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Test", "Status_", "._", "TEST", "\\u", "STATUS_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Save", "Error", "Location_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Locat", "ion", " ", "to", " ", "in", " ", "whi", "ch", " ", "to", " ", "write", " ", "inputs", " ", "whi", "ch", " ", "created", " ", "test", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Test", "Status_", "._", "SAVE", "\\u", "ERROR", "\\u", "LOCATION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Save", "Error", "Location_", "(_", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "location", " ", "in", " ", "whi", "ch", " ", "to", " ", "write", " ", "inputs", " ", "whi", "ch", " ", "created", " ", "test", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Locat", "ion", " ", "to", " ", "save", " ", "error", " ", "files", " ", "in", ":", " ", "%", "s", "\"_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isdir_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Test", "Status_", "._", "SAVE", "\\u", "ERROR", "\\u", "LOCATION_", "=_", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Test", "Setup_", "(_", "short", "Test", "No_", "=_", "1_", ",_", "medium", "Test", "No_", "=_", "5_", ",_", "long", "Test", "No_", "=_", "100_", ",_", "very", "Long", "Test", "No_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Test", "Status_", "._", "TEST", "\\u", "STATUS_", "==_", "Test", "Status_", "._", "TEST", "\\u", "SHORT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "short", "Test", "No_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Test", "Status_", "._", "TEST", "\\u", "STATUS_", "==_", "Test", "Status_", "._", "TEST", "\\u", "MEDIUM", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "medium", "Test", "No_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Test", "Status_", "._", "TEST", "\\u", "STATUS_", "==_", "Test", "Status_", "._", "TEST", "\\u", "LONG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "long", "Test", "No_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", "Us", "ed", " ", "for", " ", "long", " ", "example", " ", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "very", "Long", "Test", "No_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "Global", " ", "variab", "les", " ", "used", " ", "by", " ", "testi", "ng", " ", "frame", "work", " ", "to", " ", "run", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Path", "To", "Data", "Sets_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "is", " ", "used", " ", "to", " ", "store", " ", "the", " ", "location", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "path", " ", "where", " ", "all", " ", "the", " ", "data", " ", "sets", " ", "used", " ", "by", " ", "tests", " ", "for", " ", "analys", "is", " ", "are", " ", "kep", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "are", " ", "not", " ", "kep", "t", " ", "in", " ", "the", " ", "distr", "but", "ion", " ", "its", "elf", " ", "for", " ", "reasons", " ", "of", " ", "size", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "SON", "\\u", "TRACE", "\\u", "DATASET", "S", "\"_", "in_", "os_", "._", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "environ_", "[_", "\"", "SON", "\\u", "TRACE", "\\u", "DATASET", "S", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Basic", "Optio", "n", "Parser_", "(_", "parser_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parser_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "add", "Log", "ging", "Options_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\"--", "temp", "Dir", "Roo", "t", "\"_", ",_", "dest_", "=_", "\"", "temp", "Dir", "Roo", "t", "\"_", ",_", "type_", "=_", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Path", " ", "to", " ", "where", " ", "temporar", "y", " ", "director", "y", " ", "contain", "ing", " ", "all", " ", "temp", " ", "files", " ", "are", " ", "created", ",", " ", "by", " ", "default", " ", "use", "s", " ", "the", " ", "current", " ", "working", " ", "director", "y", " ", "as", " ", "the", " ", "base", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "parser_", "\\u\\u\\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", "Basic", "Options_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "ups", " ", "the", " ", "standard", " ", "thing", "s", " ", "from", " ", "thing", "s", " ", "adde", "d", " ", "by", " ", "get", "Basic", "Optio", "n", "Parser", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "set", "Log", "ging", "Fro", "m", "Options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Set", " ", "up", " ", "the", " ", "temp", " ", "dir", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "temp", "Dir", "Root_", "==_", "\"", "Non", "e", "\"_", ":_", "#", " ", "FIX", "ME", ":", " ", "Real", "ly", ",", " ", "a", " ", "string", " ", "contain", "ing", " ", "the", " ", "word", " ", "Non", "e", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "temp", "Dir", "Root_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Random", "Al", "pha", "Numer", "ic", "String_", "(_", "length_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "random", " ", "alpha", " ", "numeri", "c", " ", "string", " ", "of", " ", "the", " ", "give", "n", " ", "length", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"_", "._", "join_", "(_", "[_", "random_", "._", "choice_", "(_", "'", "0123456", "789", "ABCDE", "FG", "HI", "JK", "LM", "NOP", "QR", "STU", "VW", "XY", "Za", "bcd", "efg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "'_", ")_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "length_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Public", "Dir_", "(_", "dir", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "a", " ", "give", "n", " ", "subdirectory", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "alr", "ead", "y", " ", "exist", ",", " ", "mak", "ing", " ", "sure", " ", "it", " ", "is", " ", "public", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dir", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "dir", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "dir", "Name_", ",_", "0_", "777_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dir", "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", "Temp", "File_", "(_", "suffix_", "=_", "\"\"_", ",_", "root", "Dir_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "string", " ", "represent", "ing", " ", "a", " ", "temporar", "y", " ", "file", ",", " ", "tha", "t", " ", "must", " ", "be", " ", "manu", "ally", " ", "delete", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Dir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", ",_", "tmp", "File_", "=_", "tempfile_", "._", "mkstemp_", "(_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tmp", "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 ", " _", "tmp", "File_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root", "Dir_", ",_", "\"", "tmp", "\\u\"_", "+_", "get", "Random", "Al", "pha", "Numer", "ic", "String_", "(_", ")_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "File_", ",_", "'", "w", "'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chmod_", "(_", "tmp", "File_", ",_", "0_", "777_", ")_", "#", "Ensur", "e", " ", "everyone", " ", "has", " ", "access", " ", "to", " ", "the", " ", "file", "._",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jlmadurga/django-telegram-bot/setup.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\n\nimport telegrambot\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\nversion = telegrambot.__version__\n\nif sys.argv[-1] == 'publish':\n try:\n import wheel\n except ImportError:\n print('Wheel library missing. Please run \"pip install wheel\"')\n sys.exit()\n os.system('python setup.py sdist upload')\n os.system('python setup.py bdist_wheel upload')\n sys.exit()\n\nif sys.argv[-1] == 'tag':\n print(\"Tagging the version on github:\")\n os.system(\"git tag -a %s -m 'version %s'\" % (version, version))\n os.system(\"git push --tags\")\n sys.exit()\n\nreadme = open('README.rst').read()\nhistory = open('HISTORY.rst').read().replace('.. :changelog:', '')\n\nsetup(\n name='django-telegram-bot',\n version=\"0.5.0\",\n description=\"\"\"Django app to write Telegram bots\"\"\",\n long_description=readme + '\\n\\n' + history,\n author='Juan Madurga',\n author_email='jlmadurga@gmail.com',\n url='https://github.com/jlmadurga/django-telegram-bot',\n packages=[\n 'telegrambot',\n ],\n include_package_data=True,\n install_requires=[\n 'django>=1.8.0',\n 'python-telegram-bot==3.2.0',\n 'djangorestframework==3.3.2',\n ],\n license=\"BSD\",\n zip_safe=False,\n keywords='django-telegram-bot',\n classifiers=[\n 'Development Status :: 3 - Alpha',\n 'Framework :: Django',\n 'Framework :: Django :: 1.8',\n 'Framework :: Django :: 1.9',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Natural Language :: English',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5', \n ],\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import wheel", "start_line": 17, "start_column": 8, "end_line": 17, "end_column": 20 } ]
[]
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_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tele", "gram", "bot_", "\\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_", "setuptools_", "import_", "setup_", "\\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_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "tele", "gram", "bot_", "._", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "argv_", "[_", "-_", "1_", "]_", "==_", "'", "publi", "sh", "'_", ":_", "\\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_", "wheel_", "\\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 ", " _", "print_", "(_", "'", "Whe", "el", " ", "librar", "y", " ", "missi", "ng", ".", " ", "Ple", "ase", " ", "run", " ", "\"", "pip", " ", "install", " ", "wheel", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "system_", "(_", "'", "python", " ", "setup", ".", "py", " ", "sdist", " ", "upload", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "'", "python", " ", "setup", ".", "py", " ", "bdist", "\\u", "wheel", " ", "upload", "'_", ")_", "\\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_", "if_", "sys_", "._", "argv_", "[_", "-_", "1_", "]_", "==_", "'", "tag", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Tagg", "ing", " ", "the", " ", "version", " ", "on", " ", "git", "hub", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "git", " ", "tag", " ", "-", "a", " ", "%", "s", " ", "-", "m", " ", "'", "version", " ", "%", "s", "'\"_", "%_", "(_", "version_", ",_", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "git", " ", "push", " ", "--", "tags", "\"_", ")_", "\\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_", "readme_", "=_", "open_", "(_", "'", "READ", "ME", ".", "rst", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "history_", "=_", "open_", "(_", "'", "HISTORY", ".", "rst", "'_", ")_", "._", "read_", "(_", ")_", "._", "replace_", "(_", "'..", " ", ":", "change", "log", ":'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "django", "-", "tele", "gram", "-", "bot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "0.", "5.0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"\"\"", "Dj", "ang", "o", " ", "app", " ", "to", " ", "write", " ", "Tele", "gram", " ", "bot", "s", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "readme_", "+_", "'\\\\", "n", "\\\\", "n", "'_", "+_", "history_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Ju", "an", " ", "Mad", "urg", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "jl", "mad", "urg", "a", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "jl", "mad", "urg", "a", "/", "django", "-", "tele", "gram", "-", "bot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tele", "gram", "bot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ">=", "1.8", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "python", "-", "tele", "gram", "-", "bot", "==", "3.2", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", "rest", "frame", "work", "==", "3.3", ".2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\"", "BS", "D", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "django", "-", "tele", "gram", "-", "bot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "Dj", "ang", "o", " ", "::", " ", "1.9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "::", " ", "Eng", "lish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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
bradleyfay/py-Goldsberry/goldsberry/__init__.py
[ { "content": "__author__ = 'Bradley Fay'\n__email__ = 'bradley.fay@gmail.com'\n__version__ = '1.0.1'\n\nimport goldsberry.game\nimport goldsberry.league\nimport goldsberry.player\nimport goldsberry.team\nimport goldsberry.draft\nimport goldsberry.playtype\nimport goldsberry.sportvu\nfrom goldsberry.player.player import PlayerList\nfrom goldsberry.game.game import GameIDs", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import goldsberry.game", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 22 }, { "span": "import goldsberry.league", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 24 }, { "span": "import goldsberry.player", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 24 }, { "span": "import goldsberry.team", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 22 }, { "span": "import goldsberry.draft", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 23 }, { "span": "import goldsberry.playtype", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 26 }, { "span": "import goldsberry.sportvu", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 25 }, { "span": "from goldsberry.player.player import PlayerList", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 47 }, { "span": "from goldsberry.game.game import GameIDs", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Bra", "dle", "y", " ", "Fa", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "'", "bra", "dle", "y", ".", "fa", "y", "@", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "1.0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "game_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "league_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "player_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "team_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "draft_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "play", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gold", "sb", "err", "y_", "._", "sport", "vu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gold", "sb", "err", "y_", "._", "player_", "._", "player_", "import_", "Player", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gold", "sb", "err", "y_", "._", "game_", "._", "game_", "import_", "Game", "ID", "s_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 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, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused local variable
kuri65536/python-for-android/python-modules/twisted/twisted/mail/scripts/mailmail.py
[ { "content": "def parseOptions(argv):\n o = Options()\n o.to = [e for e in argv if not e.startswith('-')]\n o.sender = getlogin()\n\n # Just be very stupid\n\n # Skip -bm -- it is the default\n\n # -bp lists queue information. Screw that.\n if '-bp' in argv:\n raise _unsupportedOption\n\n # -bs makes sendmail use stdin/stdout as its transport. Screw that.\n if '-bs' in argv:\n raise _unsupportedOption\n\n # -F sets who the mail is from, but is overridable by the From header\n if '-F' in argv:\n o.sender = argv[argv.index('-F') + 1]\n o.to.remove(o.sender)\n\n # -i and -oi makes us ignore lone \".\"\n if ('-i' in argv) or ('-oi' in argv):\n raise _unsupportedOption\n\n # -odb is background delivery\n if '-odb' in argv:\n o.background = True\n else:\n o.background = False\n\n # -odf is foreground delivery\n if '-odf' in argv:\n o.background = False\n else:\n o.background = True\n\n # -oem and -em cause errors to be mailed back to the sender.\n # It is also the default.\n\n # -oep and -ep cause errors to be printed to stderr\n if ('-oep' in argv) or ('-ep' in argv):\n o.printErrors = True\n else:\n o.printErrors = False\n\n # -om causes a copy of the message to be sent to the sender if the sender\n # appears in an alias expansion. We do not support aliases.\n if '-om' in argv:\n raise _unsupportedOption\n\n # -t causes us to pick the recipients of the message from the To, Cc, and Bcc\n # headers, and to remove the Bcc header if present.\n if '-t' in argv:\n o.recipientsFromHeaders = True\n o.excludeAddresses = o.to\n o.to = []\n else:\n o.recipientsFromHeaders = False\n o.exludeAddresses = []\n\n requiredHeaders = {\n 'from': [],\n 'to': [],\n 'cc': [],\n 'bcc': [],\n 'date': [],\n }\n\n headers = []\n buffer = StringIO.StringIO()\n while 1:\n write = 1\n line = sys.stdin.readline()\n if not line.strip():\n break\n\n hdrs = line.split(': ', 1)\n\n hdr = hdrs[0].lower()\n if o.recipientsFromHeaders and hdr in ('to', 'cc', 'bcc'):\n o.to.extend([\n a[1] for a in rfc822.AddressList(hdrs[1]).addresslist\n ])\n if hdr == 'bcc':\n write = 0\n elif hdr == 'from':\n o.sender = rfc822.parseaddr(hdrs[1])[1]\n\n if hdr in requiredHeaders:\n requiredHeaders[hdr].append(hdrs[1])\n\n if write:\n buffer.write(line)\n\n if not requiredHeaders['from']:\n buffer.write('From: %s\\r\\n' % (o.sender,))\n if not requiredHeaders['to']:\n if not o.to:\n raise SystemExit(\"No recipients specified.\")\n buffer.write('To: %s\\r\\n' % (', '.join(o.to),))\n if not requiredHeaders['date']:\n buffer.write('Date: %s\\r\\n' % (smtp.rfc822date(),))\n\n buffer.write(line)\n\n if o.recipientsFromHeaders:\n for a in o.excludeAddresses:\n try:\n o.to.remove(a)\n except:\n pass\n\n buffer.seek(0, 0)\n o.body = StringIO.StringIO(buffer.getvalue() + sys.stdin.read())\n return o", "metadata": "root.parseOptions", "header": "['module', '___EOS___']", "index": 60 } ]
[ { "span": "headers ", "start_line": 130, "start_column": 4, "end_line": 130, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "Options_", "(_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "=_", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "to_", "=_", "[_", "e_", "for_", "e_", "in_", "argv_", "if_", "not_", "e_", "._", "startswith_", "(_", "'-'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "sender_", "=_", "getl", "ogin", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "be", " ", "very", " ", "stu", "pid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ski", "p", " ", "-", "bm", " ", "--", " ", "it", " ", "is", " ", "the", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "bp", " ", "lists", " ", "queue", " ", "informati", "on", ".", " ", " ", "Scr", "ew", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'-", "bp", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "unsup", "porte", "d", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "bs", " ", "make", "s", " ", "sendm", "ail", " ", "use", " ", "std", "in", "/", "stdout", " ", "as", " ", "its", " ", "transport", ".", " ", " ", "Scr", "ew", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "bs", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "unsup", "porte", "d", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "F", " ", "sets", " ", "who", " ", "the", " ", "mail", " ", "is", " ", "from", ",", " ", "but", " ", "is", " ", "overrid", "able", " ", "by", " ", "the", " ", "Fro", "m", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "F", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "sender_", "=_", "argv_", "[_", "argv_", "._", "index_", "(_", "'-", "F", "'_", ")_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "to_", "._", "remove_", "(_", "o_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "i", " ", "and", " ", "-", "oi", " ", "make", "s", " ", "us", " ", "ignore", " ", "lone", " ", "\".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'-", "i", "'_", "in_", "argv_", ")_", "or_", "(_", "'-", "oi", "'_", "in_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "unsup", "porte", "d", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "odb", " ", "is", " ", "background", " ", "delivery", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "odb", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "background_", "=_", "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 ", " _", "o_", "._", "background_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "od", "f", " ", "is", " ", "fore", "ground", " ", "delivery", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "od", "f", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "background_", "=_", "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 ", " _", "o_", "._", "background_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "oem", " ", "and", " ", "-", "em", " ", "caus", "e", " ", "error", "s", " ", "to", " ", "be", " ", "mail", "ed", " ", "back", " ", "to", " ", "the", " ", "sender", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "als", "o", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "oe", "p", " ", "and", " ", "-", "ep", " ", "caus", "e", " ", "error", "s", " ", "to", " ", "be", " ", "printed", " ", "to", " ", "stderr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'-", "oe", "p", "'_", "in_", "argv_", ")_", "or_", "(_", "'-", "ep", "'_", "in_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "print", "Errors_", "=_", "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 ", " _", "o_", "._", "print", "Errors_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "om", " ", "caus", "es", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "message", " ", "to", " ", "be", " ", "sent", " ", "to", " ", "the", " ", "sender", " ", "if", " ", "the", " ", "sender_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appear", "s", " ", "in", " ", "an", " ", "alias", " ", "expansion", ".", " ", " ", "We", " ", "do", " ", "not", " ", "support", " ", "alias", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "om", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "unsup", "porte", "d", "Option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "t", " ", "caus", "es", " ", "us", " ", "to", " ", "pick", " ", "the", " ", "recip", "ients", " ", "of", " ", "the", " ", "message", " ", "from", " ", "the", " ", "To", ",", " ", "Cc", ",", " ", "and", " ", "Bc", "c_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "header", "s", ",", " ", "and", " ", "to", " ", "remove", " ", "the", " ", "Bc", "c", " ", "header", " ", "if", " ", "presen", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'-", "t", "'_", "in_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "recip", "ients", "Fro", "m", "Headers_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "exclu", "de", "Address", "es_", "=_", "o_", "._", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "to_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "recip", "ients", "Fro", "m", "Headers_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "ex", "lud", "e", "Address", "es_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "require", "d", "Headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cc", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bcc", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "sys_", "._", "stdin_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line_", "._", "strip_", "(_", ")_", ":_", "\\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_", "hdrs_", "=_", "line_", "._", "split_", "(_", "':", " ", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hdr_", "=_", "hdrs_", "[_", "0_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "o_", "._", "recip", "ients", "Fro", "m", "Headers_", "and_", "hdr_", "in_", "(_", "'", "to", "'_", ",_", "'", "cc", "'_", ",_", "'", "bcc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "to_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "[_", "1_", "]_", "for_", "a_", "in_", "rfc", "822", "_", "._", "Address", "List_", "(_", "hdrs_", "[_", "1_", "]_", ")_", "._", "address", "list_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hdr_", "==_", "'", "bcc", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hdr_", "==_", "'", "from", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "sender_", "=_", "rfc", "822", "_", "._", "parse", "addr_", "(_", "hdrs_", "[_", "1_", "]_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hdr_", "in_", "require", "d", "Headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "require", "d", "Headers_", "[_", "hdr_", "]_", "._", "append_", "(_", "hdrs_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "._", "write_", "(_", "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_", "not_", "require", "d", "Headers_", "[_", "'", "from", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "._", "write_", "(_", "'", "Fro", "m", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "o_", "._", "sender_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "require", "d", "Headers_", "[_", "'", "to", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "o_", "._", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "System", "Exit_", "(_", "\"", "No", " ", "recip", "ients", " ", "specified", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buffer_", "._", "write_", "(_", "'", "To", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "',", " ", "'_", "._", "join_", "(_", "o_", "._", "to_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "require", "d", "Headers_", "[_", "'", "date", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "._", "write_", "(_", "'", "Date", ":", " ", "%", "s", "\\\\", "r", "\\\\", "n", "'_", "%_", "(_", "smtp_", "._", "rfc", "822", "date_", "(_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buffer_", "._", "write_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "o_", "._", "recip", "ients", "Fro", "m", "Headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a_", "in_", "o_", "._", "exclu", "de", "Address", "es_", ":_", "\\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 ", " _", "o_", "._", "to_", "._", "remove_", "(_", "a_", ")_", "\\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_", "buffer_", "._", "seek_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "._", "body_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "buffer_", "._", "getvalue_", "(_", ")_", "+_", "sys_", "._", "stdin_",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
stopstalk/stopstalk-deployment/static/scripts/submissions3.py
[ { "content": "def get_submissions(user_id,\n handle,\n stopstalk_handle,\n submissions,\n site,\n custom=False):\n \"\"\"\n Get the submissions and populate the database\n \"\"\"\n\n db = current.db\n count = 0\n\n if submissions == {}:\n print \"0\"\n return 0\n\n global rows\n\n for i in sorted(submissions[handle].iterkeys()):\n for j in sorted(submissions[handle][i].iterkeys()):\n submission = submissions[handle][i][j]\n if len(submission) == 7:\n count += 1\n row = []\n if custom:\n row.extend([\"--\", user_id])\n else:\n row.extend([user_id, \"--\"])\n\n row.extend([stopstalk_handle,\n handle,\n site,\n submission[0],\n submission[2],\n submission[1],\n submission[5],\n submission[3],\n submission[4],\n submission[6]])\n\n encoded_row = []\n for x in row:\n if isinstance(x, basestring):\n tmp = x.encode(\"ascii\", \"ignore\")\n\n # @ToDo: Dirty hack! Do something with\n # replace and escaping quotes\n tmp = tmp.replace(\"\\\"\", \"\").replace(\"'\", \"\")\n if tmp == \"--\":\n tmp = \"NULL\"\n else:\n tmp = u\"\\\"\" + tmp + u\"\\\"\"\n encoded_row.append(tmp)\n else:\n encoded_row.append(str(x))\n\n rows.append(u\"(\" + u\", \".join(encoded_row) + u\")\")\n\n\n if count != 0:\n print \"%s\" % (count)\n else:\n print \"0\"\n return count", "metadata": "root.get_submissions", "header": "['module', '___EOS___']", "index": 48 } ]
[ { "span": "db ", "start_line": 58, "start_column": 4, "end_line": 58, "end_column": 6 } ]
[]
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_", "def_", "get", "\\u", "submissions_", "(_", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "stal", "k", "\\u", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submissions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "custom_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "subm", "ission", "s", " ", "and", " ", "populate", " ", "the", " ", "databa", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "submissions_", "==_", "{_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "sorted_", "(_", "submissions_", "[_", "handle_", "]_", "._", "iterkeys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "sorted_", "(_", "submissions_", "[_", "handle_", "]_", "[_", "i_", "]_", "._", "iterkeys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "=_", "submissions_", "[_", "handle_", "]_", "[_", "i_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "submission_", ")_", "==_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "custom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "._", "extend_", "(_", "[_", "\"--\"_", ",_", "user", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "row_", "._", "extend_", "(_", "[_", "user", "\\u", "id_", ",_", "\"--\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "._", "extend_", "(_", "[_", "stop", "stal", "k", "\\u", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "site_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "submission_", "[_", "6_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "d\\u", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "x_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tmp_", "=_", "x_", "._", "encode_", "(_", "\"", "ascii", "\"_", ",_", "\"", "ignore", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "To", "Do", ":", " ", "Dirty", " ", "hack", "!", " ", "Do", " ", "somet", "hing", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "replace", " ", "and", " ", "esca", "ping", " ", "quotes_", "\\u\\u\\uNL\\u\\u\\u_", "tmp_", "=_", "tmp_", "._", "replace_", "(_", "\"\\\\\"\"_", ",_", "\"\"_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "==_", "\"--\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tmp_", "=_", "\"", "NULL", "\"_", "\\u\\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_", "=_", "u", "\"\\\\\"\"_", "+_", "tmp_", "+_", "u", "\"\\\\\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encode", "d\\u", "row_", "._", "append_", "(_", "tmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "encode", "d\\u", "row_", "._", "append_", "(_", "str_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rows_", "._", "append_", "(_", "u", "\"(\"_", "+_", "u", "\",", " ", "\"_", "._", "join_", "(_", "encode", "d\\u", "row_", ")_", "+_", "u", "\")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "count_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", "\"_", "%_", "(_", "count_", ")_", "\\u\\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_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "count_", "\\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, 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,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statsmodels/statsmodels/tsa/statespace/tests/test_kalman.py
[ { "content": " @classmethod\n def setup_class(cls):\n raise SkipTest('Not implemented')\n super(TestClark1987Single, cls).setup_class(\n dtype=np.float32, conserve_memory=0\n )\n cls.model, cls.filter = cls.init_filter()\n cls.result = cls.run_filter()", "metadata": "root.TestClark1987Single.setup_class", "header": "['class', 'TestClark1987Single', '(', 'Clark1987', ')', ':', '___EOS___']", "index": 196 }, { "content": " @classmethod\n def setup_class(cls):\n raise SkipTest('Not implemented')\n super(TestClark1987SingleComplex, cls).setup_class(\n dtype=np.complex64, conserve_memory=0\n )\n cls.model, cls.filter = cls.init_filter()\n cls.result = cls.run_filter()", "metadata": "root.TestClark1987SingleComplex.setup_class", "header": "['class', 'TestClark1987SingleComplex', '(', 'Clark1987', ')', ':', '___EOS___']", "index": 247 } ]
[ { "span": "super(TestClark1987Single, cls).setup_class(\n dtype=np.float32, conserve_memory=0\n )", "start_line": 199, "start_column": 8, "end_line": 201, "end_column": 9 }, { "span": "super(TestClark1987SingleComplex, cls).setup_class(\n dtype=np.complex64, conserve_memory=0\n )", "start_line": 250, "start_column": 8, "end_line": 252, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Test", "Clar", "k", "1987", "Single_", "(_", "Clar", "k", "1987", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Not", " ", "implemented", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Clar", "k", "1987", "Single_", ",_", "cls_", ")_", "._", "setup", "\\u", "class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "np_", "._", "float32_", ",_", "conserv", "e\\u", "memory_", "=_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "model_", ",_", "cls_", "._", "filter_", "=_", "cls_", "._", "init", "\\u", "filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "result_", "=_", "cls_", "._", "run", "\\u", "filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Clar", "k", "1987", "Sing", "le", "Complex_", "(_", "Clar", "k", "1987", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ski", "p", "Test_", "(_", "'", "Not", " ", "implemented", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Test", "Clar", "k", "1987", "Sing", "le", "Complex_", ",_", "cls_", ")_", "._", "setup", "\\u", "class_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "np_", "._", "complex", "64_", ",_", "conserv", "e\\u", "memory_", "=_", "0_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "model_", ",_", "cls_", "._", "filter_", "=_", "cls_", "._", "init", "\\u", "filter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "result_", "=_", "cls_", "._", "run", "\\u", "filter_", "(_", ")_", "\\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, 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, 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, 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, 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 ]
Unused import
ARTbio/tools-artbio/unstable/development/msp_hmmer/hmmer.py
[ { "content": "\"\"\"\nHmmer classes\n\"\"\"\n\nimport data\nimport logging\nimport re\nimport string\nfrom cgi import escape\nfrom galaxy.datatypes.metadata import MetadataElement\nfrom galaxy.datatypes import metadata\nimport galaxy.model\nfrom galaxy import util\nfrom sniff import *\n\nlog = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Hmm( data.Text ):\n \"\"\"Class for hmmer database files\"\"\"\n\n file_ext = 'hmm'\n", "metadata": "root.Hmm", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def init_meta( self, dataset, copy_from=None ):\n data.Text.init_meta( self, dataset, copy_from=copy_from )", "metadata": "root.Hmm.init_meta", "header": "['class', 'Hmm', '(', 'data', '.', 'Text', ')', ':', '___EOS___']", "index": 22 }, { "content": "class HmmPressed( Hmm ):\n \"\"\"Class describing a hmmer database produced by hmmpress\"\"\"\n\n file_ext = 'hmmPressed'\n composite_type='basic'\n\n MetadataElement( readonly=True, optional=True, visible=False, no_value=0 )\n", "metadata": "root.HmmPressed", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __init__(self,**kwd):\n data.Data.__init__(self, **kwd)\n self.add_composite_file('hmm.h3m')\n self.add_composite_file('hmm.h3i')\n self.add_composite_file('hmm.h3f')\n self.add_composite_file('hmm.h3p')", "metadata": "root.HmmPressed.__init__", "header": "['class', 'HmmPressed', '(', 'Hmm', ')', ':', '___EOS___']", "index": 33 }, { "content": " def set_peek( self, dataset, is_multi_byte=False ):\n if not dataset.dataset.purged:\n dataset.peek = \"Folder of multiple files\"\n dataset.blurb = \"Folder of multiple files\"\n else:\n dataset.peek = 'file does not exist'\n dataset.blurb = 'file purged from disk'", "metadata": "root.HmmPressed.set_peek", "header": "['class', 'HmmPressed', '(', 'Hmm', ')', ':', '___EOS___']", "index": 39 }, { "content": " def display_peek( self, dataset ):\n try:\n return dataset.peek\n except:\n return \"Folder of multiple files\"", "metadata": "root.HmmPressed.display_peek", "header": "['class', 'HmmPressed', '(', 'Hmm', ')', ':', '___EOS___']", "index": 46 }, { "content": " def get_mime(self):\n \"\"\"Returns the mime type of the datatype\"\"\"\n return 'text/plain'", "metadata": "root.HmmPressed.get_mime", "header": "['class', 'HmmPressed', '(', 'Hmm', ')', ':', '___EOS___']", "index": 51 } ]
[ { "span": "import re", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 9 }, { "span": "import string", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 13 }, { "span": "from galaxy.datatypes import metadata", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 37 }, { "span": "import galaxy.model", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 19 }, { "span": "from galaxy import util", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Hm", "mer", " ", "classe", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cgi_", "import_", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "galaxy_", "._", "datatypes_", "._", "metadata_", "import_", "Meta", "data", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "galaxy_", "._", "datatypes_", "import_", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "galaxy_", "._", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "galaxy_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sniff", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Hm", "m_", "(_", "data_", "._", "Text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Class", " ", "for", " ", "hmm", "er", " ", "databa", "se", " ", "files", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "ext_", "=_", "'", "hmm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hm", "m_", "(_", "data_", "._", "Text_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init", "\\u", "meta_", "(_", "self_", ",_", "dataset_", ",_", "copy", "\\u", "from_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "Text_", "._", "init", "\\u", "meta_", "(_", "self_", ",_", "dataset_", ",_", "copy", "\\u", "from_", "=_", "copy", "\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Hm", "m", "Pressed_", "(_", "Hm", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Class", " ", "descri", "bing", " ", "a", " ", "hmm", "er", " ", "databa", "se", " ", "produce", "d", " ", "by", " ", "hmm", "press", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "ext_", "=_", "'", "hmm", "Press", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "composi", "te", "\\u", "type_", "=_", "'", "basic", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Meta", "data", "Element_", "(_", "readonly_", "=_", "True_", ",_", "optional_", "=_", "True_", ",_", "visible_", "=_", "False_", ",_", "no", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hm", "m", "Pressed_", "(_", "Hm", "m_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwd", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "Data_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwd", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "composi", "te", "\\u", "file_", "(_", "'", "hmm", ".", "h", "3", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "composi", "te", "\\u", "file_", "(_", "'", "hmm", ".", "h", "3", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "composi", "te", "\\u", "file_", "(_", "'", "hmm", ".", "h", "3f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "composi", "te", "\\u", "file_", "(_", "'", "hmm", ".", "h", "3p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hm", "m", "Pressed_", "(_", "Hm", "m_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "peek_", "(_", "self_", ",_", "dataset_", ",_", "is", "\\u", "multi", "\\u", "byte_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dataset_", "._", "dataset_", "._", "pur", "ged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "._", "peek_", "=_", "\"", "Fold", "er", " ", "of", " ", "multiple", " ", "files", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset_", "._", "blur", "b_", "=_", "\"", "Fold", "er", " ", "of", " ", "multiple", " ", "files", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "._", "peek_", "=_", "'", "file", " ", "doe", "s", " ", "not", " ", "exist", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset_", "._", "blur", "b_", "=_", "'", "file", " ", "pur", "ged", " ", "from", " ", "disk", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hm", "m", "Pressed_", "(_", "Hm", "m_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "display", "\\u", "peek_", "(_", "self_", ",_", "dataset_", ")_", ":_", "\\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_", "dataset_", "._", "peek_", "\\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_", "\"", "Fold", "er", " ", "of", " ", "multiple", " ", "files", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hm", "m", "Pressed_", "(_", "Hm", "m_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "mime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "mime", " ", "type", " ", "of", " ", "the", " ", "datatype", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "text", "/", "plain", "'_" ]
[ 4, 4, 4, 4, 4, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Sage-Bionetworks/synapsePythonClient/tests/integration/test_caching.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom builtins import str\n\nimport filecmp, os, sys, traceback, logging, requests, uuid\nimport time, random\nfrom threading import Lock\nimport six\n\nif six.PY2:\n import thread\n from Queue import Queue\nelse:\n import _thread as thread\n from queue import Queue\n\nimport synapseclient\nimport synapseclient.utils as utils\nimport synapseclient.cache as cache\nfrom synapseclient.exceptions import *\nfrom synapseclient.utils import MB, GB\nfrom synapseclient import Activity, Entity, Project, Folder, File\n\nimport integration\nfrom integration import schedule_for_cleanup\n\n \n\n \n#############\n## Helpers ##\n#############\n\n \n \n######################\n## Thread Behaviors ## \n######################\n\n\n \n \n \n####################\n## Thread Helpers ##\n####################\n \n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def setup(module):\n print('\\n')\n print('~' * 60)\n print(os.path.basename(__file__))\n print('~' * 60)\n module.syn = integration.syn\n module.project = integration.project\n \n # Use the module-level syn object to communicate between main and child threads\n # - Read-only objects (for the children)\n module.syn.test_parent = module.syn.store(Project(name=str(uuid.uuid4())))\n schedule_for_cleanup(module.syn.test_parent)\n module.syn.test_keepRunning = True\n \n # - Child writeable objects\n module.syn.test_errors = Queue()\n module.syn.test_runCountMutex = Lock()\n module.syn.test_threadsRunning = 0", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def teardown(module):\n del module.syn.test_parent\n del module.syn.test_keepRunning\n del module.syn.test_errors\n del module.syn.test_runCountMutex\n del module.syn.test_threadsRunning", "metadata": "root.teardown", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def test_threaded_access():\n \"\"\"Starts multiple threads to perform store and get calls randomly.\"\"\"\n ## Doesn't this test look like a DOS attack on Synapse?\n ## Maybe it should be called explicity...\n \n # Suppress most of the output from the many REST calls\n # Otherwise, it flood the screen with irrelevant data upon error\n requests_log = logging.getLogger(\"requests\")\n requests_originalLevel = requests_log.getEffectiveLevel()\n requests_log.setLevel(logging.WARNING)\n \n print(\"Starting threads\")\n store_thread = wrap_function_as_child_thread(thread_keep_storing_one_File)\n get_thread = wrap_function_as_child_thread(thread_get_files_from_Project)\n update_thread = wrap_function_as_child_thread(thread_get_and_update_file_from_Project)\n thread.start_new_thread(store_thread, ())\n thread.start_new_thread(store_thread, ())\n thread.start_new_thread(store_thread, ())\n thread.start_new_thread(store_thread, ())\n thread.start_new_thread(get_thread, ())\n thread.start_new_thread(get_thread, ())\n thread.start_new_thread(get_thread, ())\n thread.start_new_thread(update_thread, ())\n thread.start_new_thread(update_thread, ())\n thread.start_new_thread(update_thread, ())\n \n # Give the threads some time to wreak havoc on the cache\n time.sleep(20)\n \n print(\"Terminating threads\")\n syn.test_keepRunning = False\n while syn.test_threadsRunning > 0:\n time.sleep(1)\n\n # Reset the requests logging level\n requests_log.setLevel(requests_originalLevel)\n \n collect_errors_and_fail()", "metadata": "root.test_threaded_access", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def wrap_function_as_child_thread(function):\n \"\"\"Wraps the given function so that it ties into the main thread.\"\"\"\n \n def child_thread():\n syn.test_runCountMutex.acquire()\n syn.test_threadsRunning += 1\n syn.test_runCountMutex.release()\n \n try:\n function()\n except Exception:\n syn.test_errors.put(traceback.format_exc())\n \n syn.test_runCountMutex.acquire()\n syn.test_threadsRunning -= 1\n syn.test_runCountMutex.release()\n \n return child_thread", "metadata": "root.wrap_function_as_child_thread", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def collect_errors_and_fail():\n \"\"\"Pulls error traces from the error queue and fails if the queue is not empty.\"\"\"\n failures = []\n for i in range(syn.test_errors.qsize()):\n failures.append(syn.test_errors.get())\n if len(failures) > 0:\n raise SynapseError('\\n' + '\\n'.join(failures))", "metadata": "root.collect_errors_and_fail", "header": "['module', '___EOS___']", "index": 117 }, { "content": "def thread_keep_storing_one_File():\n \"\"\"Makes one file and stores it over and over again.\"\"\"\n \n # Make a local file to continuously store\n path = utils.make_bogus_data_file()\n schedule_for_cleanup(path)\n myPrecious = File(path, parent=syn.test_parent, description='This bogus file is MINE', mwa=\"hahahah\")\n \n while syn.test_keepRunning:\n stored = store_catch_412_HTTPError(myPrecious)\n if stored is not None:\n myPrecious = stored\n # print(\"I've stored %s\" % myPrecious.id)\n else: \n myPrecious = syn.get(myPrecious)\n # print(\"Grrr... Someone modified my %s\" % myPrecious.id)\n \n sleep_for_a_bit()", "metadata": "root.thread_keep_storing_one_File", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def thread_get_files_from_Project():\n \"\"\"Continually polls and fetches items from the Project.\"\"\"\n \n while syn.test_keepRunning:\n for id in get_all_ids_from_Project():\n # print(\"I got %s\" % id)\n pass\n \n sleep_for_a_bit()", "metadata": "root.thread_get_files_from_Project", "header": "['module', '___EOS___']", "index": 149 }, { "content": "def thread_get_and_update_file_from_Project():\n \"\"\"Fetches one item from the Project and updates it with a new file.\"\"\"\n \n while syn.test_keepRunning:\n id = get_all_ids_from_Project()\n if len(id) <= 0:\n continue\n \n id = id[random.randrange(len(id))]\n entity = syn.get(id)\n \n # Replace the file and re-store\n path = utils.make_bogus_data_file()\n schedule_for_cleanup(path)\n entity.path = path\n entity = store_catch_412_HTTPError(entity)\n if entity is not None:\n # print(\"I updated %s\" % entity.id)\n assert os.stat(entity.path) == os.stat(path)\n \n sleep_for_a_bit()", "metadata": "root.thread_get_and_update_file_from_Project", "header": "['module', '___EOS___']", "index": 159 }, { "content": "def sleep_for_a_bit():\n \"\"\"Sleeps for a random amount of seconds between 1 and 5 inclusive.\"\"\"\n \n time.sleep(random.randint(1, 5))", "metadata": "root.sleep_for_a_bit", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def get_all_ids_from_Project():\n \"\"\"Fetches all currently available Synapse IDs from the parent Project.\"\"\"\n \n others = syn.chunkedQuery('select id from entity where parentId==\"%s\"' % syn.test_parent.id)\n return [result['entity.id'] for result in others]", "metadata": "root.get_all_ids_from_Project", "header": "['module', '___EOS___']", "index": 190 }, { "content": "def store_catch_412_HTTPError(entity):\n \"\"\"Returns the stored Entity if the function succeeds or None if the 412 is caught.\"\"\"\n try:\n return syn.store(entity)\n except SynapseHTTPError as err:\n # Some other thread modified the Entity, so try again\n if err.response.status_code == 412:\n return None\n raise", "metadata": "root.store_catch_412_HTTPError", "header": "['module', '___EOS___']", "index": 196 } ]
[ { "span": "import filecmp, os, sys, traceback, logging, requests, uuid", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 59 }, { "span": "import synapseclient", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 20 }, { "span": "import synapseclient.cache as cache", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 35 }, { "span": "from synapseclient.utils import MB, GB", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 38 }, { "span": "from synapseclient import Activity, Entity, Project, Folder, File", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 65 } ]
[]
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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "builtins_", "import_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "filec", "mp_", ",_", "os_", ",_", "sys_", ",_", "traceback_", ",_", "logging_", ",_", "requests_", ",_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", ",_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Queue_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u", "thread_", "as_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "queue_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "synapse", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "synapse", "client_", "._", "utils_", "as_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "synapse", "client_", "._", "cache_", "as_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synapse", "client_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synapse", "client_", "._", "utils_", "import_", "MB_", ",_", "GB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "synapse", "client_", "import_", "Activity_", ",_", "Entity_", ",_", "Project_", ",_", "Folder_", ",_", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "integration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "integration_", "import_", "schedule", "\\u", "for", "\\u", "cleanup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "##", " ", "Help", "ers", " ", "##", "_", "\\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_", "##", " ", "Thread", " ", "Behavio", "rs", " ", "##", " _", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thread", " ", "Help", "ers", " ", "##", "_", "\\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\\uNL\\u\\u\\u_", "def_", "setup_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'~'_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'~'_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "syn_", "=_", "integration_", "._", "syn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "project_", "=_", "integration_", "._", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "module", "-", "level", " ", "syn", " ", "object", " ", "to", " ", "communi", "cate", " ", "bet", "ween", " ", "main", " ", "and", " ", "child", " ", "threads_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Read", "-", "only", " ", "object", "s", " ", "(", "for", " ", "the", " ", "child", "ren", ")_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "._", "syn_", "._", "test\\u", "parent_", "=_", "module_", "._", "syn_", "._", "store_", "(_", "Project_", "(_", "name_", "=_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule", "\\u", "for", "\\u", "cleanup_", "(_", "module_", "._", "syn_", "._", "test\\u", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "syn_", "._", "test\\u", "keep", "Running_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Chil", "d", " ", "writea", "ble", " ", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "module_", "._", "syn_", "._", "test\\u", "errors_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "=_", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "syn_", "._", "test\\u", "thread", "s", "Running_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "teardown_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "module_", "._", "syn_", "._", "test\\u", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module_", "._", "syn_", "._", "test\\u", "keep", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module_", "._", "syn_", "._", "test\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module_", "._", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module_", "._", "syn_", "._", "test\\u", "thread", "s", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "threaded", "\\u", "access_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "s", " ", "multiple", " ", "thread", "s", " ", "to", " ", "perform", " ", "store", " ", "and", " ", "get", " ", "calls", " ", "random", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Do", "esn", "'", "t", " ", "this", " ", "test", " ", "look", " ", "like", " ", "a", " ", "DOS", " ", "attac", "k", " ", "on", " ", "Synapse", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Ma", "yb", "e", " ", "it", " ", "shou", "ld", " ", "be", " ", "call", "ed", " ", "explicit", "y", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Suppress", " ", "most", " ", "of", " ", "the", " ", "output", " ", "from", " ", "the", " ", "many", " ", "REST", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Ot", "her", "wis", "e", ",", " ", "it", " ", "flood", " ", "the", " ", "screen", " ", "with", " ", "irre", "lev", "ant", " ", "data", " ", "upo", "n", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "request", "s", "\\u", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "request", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "original", "Level_", "=_", "request", "s", "\\u", "log_", "._", "get", "Effe", "ctive", "Level_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "s", "\\u", "log_", "._", "set", "Level_", "(_", "logging_", "._", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Start", "ing", " ", "thread", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store", "\\u", "thread_", "=_", "wrap", "\\u", "function", "\\u", "as", "\\u", "child", "\\u", "thread_", "(_", "thread", "\\u", "keep", "\\u", "stor", "ing", "\\u", "one", "\\u", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "thread_", "=_", "wrap", "\\u", "function", "\\u", "as", "\\u", "child", "\\u", "thread_", "(_", "thread", "\\u", "get", "\\u", "files", "\\u", "from", "\\u", "Project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "thread_", "=_", "wrap", "\\u", "function", "\\u", "as", "\\u", "child", "\\u", "thread_", "(_", "thread", "\\u", "get", "\\u", "and", "\\u", "update", "\\u", "file", "\\u", "from", "\\u", "Project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "store", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "store", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "store", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "store", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "get", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "get", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "get", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "update", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "update", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "update", "\\u", "thread_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "the", " ", "thread", "s", " ", "some", " ", "time", " ", "to", " ", "wre", "ak", " ", "hav", "oc", " ", "on", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Terminati", "ng", " ", "thread", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syn_", "._", "test\\u", "keep", "Running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "syn_", "._", "test\\u", "thread", "s", "Running_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reset", " ", "the", " ", "request", "s", " ", "logg", "ing", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request", "s", "\\u", "log_", "._", "set", "Level_", "(_", "request", "s", "\\u", "original", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "collect", "\\u", "error", "s", "\\u", "and", "\\u", "fail_", "(_", ")_", "\\u\\u\\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_", "wrap", "\\u", "function", "\\u", "as", "\\u", "child", "\\u", "thread_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wra", "ps", " ", "the", " ", "give", "n", " ", "function", " ", "so", " ", "tha", "t", " ", "it", " ", "ties", " ", "int", "o", " ", "the", " ", "main", " ", "thread", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "child", "\\u", "thread_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syn_", "._", "test\\u", "thread", "s", "Running_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "(_", ")_", "\\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 ", " _", "syn_", "._", "test\\u", "errors_", "._", "put_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syn_", "._", "test\\u", "thread", "s", "Running_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syn_", "._", "test\\u", "run", "Count", "Mute", "x_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "child", "\\u", "thread_", "\\u\\u\\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_", "collect", "\\u", "error", "s", "\\u", "and", "\\u", "fail_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pul", "ls", " ", "error", " ", "trace", "s", " ", "from", " ", "the", " ", "error", " ", "queue", " ", "and", " ", "fail", "s", " ", "if", " ", "the", " ", "queue", " ", "is", " ", "not", " ", "empty", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "syn_", "._", "test\\u", "errors_", "._", "qsize_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "failures_", "._", "append_", "(_", "syn_", "._", "test\\u", "errors_", "._", "get_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "failures_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Synapse", "Error_", "(_", "'\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "failures_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "thread", "\\u", "keep", "\\u", "stor", "ing", "\\u", "one", "\\u", "File_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "one", " ", "file", " ", "and", " ", "store", "s", " ", "it", " ", "over", " ", "and", " ", "over", " ", "again", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "local", " ", "file", " ", "to", " ", "continuous", "ly", " ", "store_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "utils_", "._", "make", "\\u", "bog", "us", "\\u", "data\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule", "\\u", "for", "\\u", "cleanup_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "Prec", "ious", "_", "=_", "File_", "(_", "path_", ",_", "parent_", "=_", "syn_", "._", "test\\u", "parent_", ",_", "description_", "=_", "'", "Thi", "s", " ", "bog", "us", " ", "file", " ", "is", " ", "MIN", "E", "'_", ",_", "mw", "a_", "=_", "\"", "hah", "aha", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "syn_", "._", "test\\u", "keep", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stored_", "=_", "store", "\\u", "catch", "\\u", "412", "\\u", "HTTP", "Error_", "(_", "my", "Prec", "ious", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stored_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Prec", "ious", "_", "=_", "stored_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "I", "'", "ve", " ", "store", "d", " ", "%", "s", "\"", " ", "%", " ", "my", "Prec", "ious", ".", "id", ")_", "\\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 ", " _", "my", "Prec", "ious", "_", "=_", "syn_", "._", "get_", "(_", "my", "Prec", "ious", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Gr", "rr", "...", " ", "Some", "one", " ", "modifi", "ed", " ", "my", " ", "%", "s", "\"", " ", "%", " ", "my", "Prec", "ious", ".", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sleep", "\\u", "for", "\\u", "a", "\\u", "bit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "thread", "\\u", "get", "\\u", "files", "\\u", "from", "\\u", "Project_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Continu", "ally", " ", "polls", " ", "and", " ", "fetches", " ", "items", " ", "from", " ", "the", " ", "Project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "syn_", "._", "test\\u", "keep", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "id_", "in_", "get", "\\u", "all", "\\u", "ids", "\\u", "from", "\\u", "Project_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "I", " ", "got", " ", "%", "s", "\"", " ", "%", " ", "id", ")_", "\\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_", "sleep", "\\u", "for", "\\u", "a", "\\u", "bit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "thread", "\\u", "get", "\\u", "and", "\\u", "update", "\\u", "file", "\\u", "from", "\\u", "Project_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fetche", "s", " ", "one", " ", "item", " ", "from", " ", "the", " ", "Project", " ", "and", " ", "update", "s", " ", "it", " ", "with", " ", "a", " ", "new", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "syn_", "._", "test\\u", "keep", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "get", "\\u", "all", "\\u", "ids", "\\u", "from", "\\u", "Project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "id_", ")_", "<=_", "0_", ":_", "\\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_", "id_", "=_", "id_", "[_", "random_", "._", "randrange_", "(_", "len_", "(_", "id_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "syn_", "._", "get_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "the", " ", "file", " ", "and", " ", "re", "-", "store_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "utils_", "._", "make", "\\u", "bog", "us", "\\u", "data\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule", "\\u", "for", "\\u", "cleanup_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "store", "\\u", "catch", "\\u", "412", "\\u", "HTTP", "Error_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "I", " ", "update", "d", " ", "%", "s", "\"", " ", "%", " ", "entity", ".", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "os_", "._", "stat_", "(_", "entity_", "._", "path_", ")_", "==_", "os_", "._", "stat_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sleep", "\\u", "for", "\\u", "a", "\\u", "bit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sleep", "\\u", "for", "\\u", "a", "\\u", "bit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sleep", "s", " ", "for", " ", "a", " ", "random", " ", "amo", "unt", " ", "of", " ", "second", "s", " ", "bet", "ween", " ", "1", " ", "and", " ", "5", " ", "inclu", "sive", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "random_", "._", "randint_", "(_", "1_", ",_", "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_", "def_", "get", "\\u", "all", "\\u", "ids", "\\u", "from", "\\u", "Project_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fetche", "s", " ", "all", " ", "currentl", "y", " ", "avail", "able", " ", "Synapse", " ", "ID", "s", " ", "from", " ", "the", " ", "parent", " ", "Project", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "others_", "=_", "syn_", "._", "chunked", "Query_", "(_", "'", "select", " ", "id", " ", "from", " ", "entity", " ", "where", " ", "parent", "Id", "==", "\"%", "s", "\"'_", "%_", "syn_", "._", "test\\u", "parent_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "result_", "[_", "'", "entity", ".", "id", "'_", "]_", "for_", "result_", "in_", "others_", "]_", "\\u\\u\\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_", "store", "\\u", "catch", "\\u", "412", "\\u", "HTTP", "Error_", "(_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "store", "d", " ", "Entit", "y", " ", "if", " ", "the", " ", "function", " ", "succeeds", " ", "or", " ", "Non", "e", " ", "if", " ", "the", " ", "412", " ", "is", " ", "cau", "ght", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "syn_", "._", "store_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Synapse", "HTTP", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "other", " ", "thread", " ", "modifi", "ed", " ", "the", " ", "Entit", "y", ",", " ", "so", " ", "try", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "response_", "._", "status", "\\u", "code_", "==_", "412", "_", ":_", "\\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_", "raise_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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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 ]
Unused import
sunlightlabs/read_FEC/fecreader/fec_alerts/utils/filing_processors.py
[ { "content": "from django.core.management.base import BaseCommand, CommandError\nfrom dateutil.parser import parse as dateparse\n\nfrom parsing.form_parser import form_parser, ParserMissingError\nfrom parsing.filing import filing\nfrom parsing.read_FEC_settings import FILECACHE_DIRECTORY\nfrom fec_alerts.models import new_filing\nfrom fec_alerts.utils.form_mappers import *\nfrom shared_utils.cycle_utils import get_cycle_from_date\n\n\nfrom django.db import connection, transaction\n\n\nverbose = True\ncursor = connection.cursor()\n\n\"\"\" These routines are no longer used. \ndef exec_raw_sql(cmd_list):\n for cmd in cmd_list:\n try:\n print \"running cmd <<<%s>>>\" % cmd\n cursor.execute(cmd)\n status = cursor.statusmessage\n if status:\n print \"STATUS: %s\" % status\n except IntegrityError:\n print \"Integrity Error!!!\"\n\n\ndef mark_superceded_body_rows(header_row):\n print \"Marking superceded body rows\"\n SkedA.objects.filter(header=header_row, superceded_by_amendment=False).update(superceded_by_amendment=True)\n SkedB.objects.filter(header=header_row, superceded_by_amendment=False).update(superceded_by_amendment=True)\n SkedE.objects.filter(header=header_row, superceded_by_amendment=False).update(superceded_by_amendment=True)\n OtherLine.objects.filter(header=header_row, superceded_by_amendment=False).update(superceded_by_amendment=True)\n\n\ndef mark_superceded_amendment_header_rows(header_row):\n print \"marking superceded amendment header rows\"\n try:\n original = Filing_Header.objects.get(filing_number=header_row.amends_filing, is_superceded=False)\n #print \"Writing amended original: %s %s\" % (original.filing_number, header.filing_number)\n original.is_superceded=True\n original.amended_by = header.filing_number\n original.save()\n # mark child rows as amended\n mark_superceded_body_rows(original)\n \n except Filing_Header.DoesNotExist:\n pass\n \n\n # Now find others that amend the same filing \n earlier_amendments = Filing_Header.objects.filter(is_amendment=True,amends_filing=header_row.amends_filing, filing_number__lt=header_row.filing_number, is_superceded=False)\n \n for earlier_amendment in earlier_amendments:\n #print \"** Handling prior amendment: %s %s\" % (earlier_amendment.filing_number, header.filing_number)\n earlier_amendment.is_superceded=True\n earlier_amendment.amended_by = header_row.filing_number\n earlier_amendment.save()\n # \n mark_superceded_body_rows(earlier_amendment)\n \n\n\"\"\"\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def process_new_filing(thisnewfiling, fp=None, filing_time=None, filing_time_is_exact=False):\n \"\"\" Enter the file header if needed. \"\"\"\n \n if not fp:\n fp = form_parser()\n \n #print \"Processing filing %s\" % (filingnum)\n f1 = filing(thisnewfiling.filing_number)\n if f1.get_error():\n return False\n \n form = f1.get_form_type()\n version = f1.get_version()\n\n ## leave the form if it's already been entered-- that's where it says if it is terminated. \n if not thisnewfiling.form_type:\n thisnewfiling.form_type = form\n \n # check if it's an amendment based on form types -- if so, mark it. Otherwise the F1's will look like they haven't been amended. \n try:\n if thisnewfiling.form_type[-1].upper() == 'A':\n thisnewfiling.is_amendment = True\n except IndexError:\n pass\n\n # only parse forms that we're set up to read\n if not fp.is_allowed_form(form):\n if verbose:\n print \"Not a parseable form: %s - %s\" % (form, thisnewfiling.filing_number)\n \n if thisnewfiling.is_amendment:\n thisnewfiling.save()\n return True\n\n header = f1.get_first_row()\n header_line = fp.parse_form_line(header, version)\n\n amended_filing=None\n if f1.is_amendment:\n amended_filing = f1.headers['filing_amended']\n\n\n \n from_date = None\n through_date = None\n #print \"header line is: %s \" % header_line\n try:\n # dateparse('') will give today, oddly\n if header_line['coverage_from_date']:\n from_date = dateparse(header_line['coverage_from_date'])\n if from_date:\n thisnewfiling.cycle = get_cycle_from_date(from_date)\n except KeyError:\n print \"problem with coverage_from_date\"\n pass\n \n try: \n if header_line['coverage_through_date']:\n through_date = dateparse(header_line['coverage_through_date'])\n if through_date:\n thisnewfiling.cycle = get_cycle_from_date(through_date)\n except KeyError:\n print \"coverage_through_date\"\n pass\n\n \n # Create the filing -- but don't mark it as being complete. \n \n\n \n \n \n thisnewfiling.fec_id = f1.headers['fec_id']\n thisnewfiling.coverage_from_date = from_date\n thisnewfiling.coverage_to_date = through_date\n thisnewfiling.is_amendment = f1.is_amendment\n thisnewfiling.amends_filing = amended_filing\n thisnewfiling.amendment_number = f1.headers['report_number'] or None\n thisnewfiling.header_data = header_line\n \n print thisnewfiling.__dict__\n\n thisnewfiling.save()\n \n return True", "metadata": "root.process_new_filing", "header": "['module', '___EOS___']", "index": 67 } ]
[ { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 65 }, { "span": "from parsing.form_parser import form_parser, ParserMissingError", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 63 }, { "span": "from parsing.read_FEC_settings import FILECACHE_DIRECTORY", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 57 }, { "span": "from fec_alerts.models import new_filing", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 40 }, { "span": "from django.db import connection, transaction", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "._", "parser_", "import_", "parse_", "as_", "date", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "parsing_", "._", "form", "\\u", "parser_", "import_", "form", "\\u", "parser_", ",_", "Parser", "Missing", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "parsing_", "._", "filing", "_", "import_", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "parsing_", "._", "read", "\\u", "FE", "C", "\\u", "settings_", "import_", "FILE", "CACHE", "\\u", "DIRECTORY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fec", "\\u", "alerts_", "._", "models_", "import_", "new", "\\u", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fec", "\\u", "alerts_", "._", "utils_", "._", "form", "\\u", "mapper", "s_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shared", "\\u", "utils_", "._", "cycle", "\\u", "utils_", "import_", "get", "\\u", "cycle", "\\u", "from", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", ",_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "connection_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "The", "se", " ", "routin", "es", " ", "are", " ", "no", " ", "long", "er", " ", "used", ".", " ", "\\", "10", ";", "def", " ", "exec", "\\u", "raw", "\\u", "sql", "(", "cmd", "\\u", "list", "):", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "cmd", " ", "in", " ", "cmd", "\\u", "list", ":", "\\", "10", ";", " ", " ", " ", " ", "try", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "runn", "ing", " ", "cmd", " ", "<<", "<", "%", "s", ">>>", "\"", " ", "%", " ", "cmd", "\\", "10", ";", " ", " ", " ", " ", "cursor", ".", "execute", "(", "cmd", ")", "\\", "10", ";", " ", " ", " ", " ", "status", " ", "=", " ", "cursor", ".", "status", "message", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "status", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "STATUS", ":", " ", "%", "s", "\"", " ", "%", " ", "status", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "Int", "egr", "it", "y", "Error", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Int", "egr", "it", "y", " ", "Error", "!!!", "\"", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "def", " ", "mark", "\\u", "superc", "eded", "\\u", "body", "\\u", "rows", "(", "header", "\\u", "row", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "Mark", "ing", " ", "superc", "eded", " ", "body", " ", "rows", "\"", "\\", "10", ";", " ", " ", " ", " ", "Ske", "d", "A", ".", "object", "s", ".", "filter", "(", "header", "=", "header", "\\u", "row", ",", " ", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Fal", "se", ").", "update", "(", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Ske", "d", "B", ".", "object", "s", ".", "filter", "(", "header", "=", "header", "\\u", "row", ",", " ", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Fal", "se", ").", "update", "(", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Ske", "d", "E", ".", "object", "s", ".", "filter", "(", "header", "=", "header", "\\u", "row", ",", " ", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Fal", "se", ").", "update", "(", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "Line", ".", "object", "s", ".", "filter", "(", "header", "=", "header", "\\u", "row", ",", " ", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Fal", "se", ").", "update", "(", "superc", "eded", "\\u", "by", "\\u", "amend", "ment", "=", "Tru", "e", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "def", " ", "mark", "\\u", "superc", "eded", "\\u", "amend", "ment", "\\u", "header", "\\u", "rows", "(", "header", "\\u", "row", "):", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "marking", " ", "superc", "eded", " ", "amend", "ment", " ", "header", " ", "rows", "\"", "\\", "10", ";", " ", " ", " ", " ", "try", ":", "\\", "10", ";", " ", " ", " ", " ", "original", " ", "=", " ", "Fil", "ing", "\\u", "Head", "er", ".", "object", "s", ".", "get", "(", "filing", "\\u", "number", "=", "header", "\\u", "row", ".", "amend", "s", "\\u", "filing", ",", " ", "is", "\\u", "superc", "eded", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "#", "print", " ", "\"", "Writ", "ing", " ", "amend", "ed", " ", "original", ":", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "original", ".", "filing", "\\u", "number", ",", " ", "header", ".", "filing", "\\u", "number", ")", "\\", "10", ";", " ", " ", " ", " ", "original", ".", "is", "\\u", "superc", "eded", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "original", ".", "amend", "ed", "\\u", "by", " ", "=", " ", "header", ".", "filing", "\\u", "number", "\\", "10", ";", " ", " ", " ", " ", "original", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "mark", " ", "child", " ", "rows", " ", "as", " ", "amend", "ed", "\\", "10", ";", " ", " ", " ", " ", "mark", "\\u", "superc", "eded", "\\u", "body", "\\u", "rows", "(", "original", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "Fil", "ing", "\\u", "Head", "er", ".", "Do", "es", "Not", "Exist", ":", "\\", "10", ";", " ", " ", " ", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "No", "w", " ", "find", " ", "other", "s", " ", "tha", "t", " ", "amend", " ", "the", " ", "same", " ", "filing", " ", "\\", "10", ";", " ", " ", " ", " ", "ear", "lie", "r", "\\u", "amend", "ment", "s", " ", "=", " ", "Fil", "ing", "\\u", "Head", "er", ".", "object", "s", ".", "filter", "(", "is", "\\u", "amend", "ment", "=", "Tru", "e", ",", "amend", "s", "\\u", "filing", "=", "header", "\\u", "row", ".", "amend", "s", "\\u", "filing", ",", " ", "filing", "\\u", "number", "\\u\\u", "lt", "=", "header", "\\u", "row", ".", "filing", "\\u", "number", ",", " ", "is", "\\u", "superc", "eded", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ear", "lie", "r", "\\u", "amend", "ment", " ", "in", " ", "ear", "lie", "r", "\\u", "amend", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "#", "print", " ", "\"**", " ", "Hand", "ling", " ", "prior", " ", "amend", "ment", ":", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "ear", "lie", "r", "\\u", "amend", "ment", ".", "filing", "\\u", "number", ",", " ", "header", ".", "filing", "\\u", "number", ")", "\\", "10", ";", " ", " ", " ", " ", "ear", "lie", "r", "\\u", "amend", "ment", ".", "is", "\\u", "superc", "eded", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "ear", "lie", "r", "\\u", "amend", "ment", ".", "amend", "ed", "\\u", "by", " ", "=", " ", "header", "\\u", "row", ".", "filing", "\\u", "number", "\\", "10", ";", " ", " ", " ", " ", "ear", "lie", "r", "\\u", "amend", "ment", ".", "save", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "\\", "10", ";", " ", " ", " ", " ", "mark", "\\u", "superc", "eded", "\\u", "body", "\\u", "rows", "(", "ear", "lie", "r", "\\u", "amend", "ment", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\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_", "process", "\\u", "new", "\\u", "filing", "_", "(_", "this", "newf", "ilin", "g_", ",_", "fp_", "=_", "None_", ",_", "filing", "\\u", "time_", "=_", "None_", ",_", "filing", "\\u", "time", "\\u", "is", "\\u", "exact_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Enter", " ", "the", " ", "file", " ", "header", " ", "if", " ", "need", "ed", ".", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "fp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "form", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Process", "ing", " ", "filing", " ", "%", "s", "\"", " ", "%", " ", "(", "filing", "num", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f1_", "=_", "filing", "_", "(_", "this", "newf", "ilin", "g_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f1_", "._", "get", "\\u", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form_", "=_", "f1_", "._", "get", "\\u", "form", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "f1_", "._", "get", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "lea", "ve", " ", "the", " ", "form", " ", "if", " ", "it", "'", "s", " ", "alr", "ead", "y", " ", "bee", "n", " ", "enter", "ed", "--", " ", "tha", "t", "'", "s", " ", "where", " ", "it", " ", "say", "s", " ", "if", " ", "it", " ", "is", " ", "terminate", "d", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "this", "newf", "ilin", "g_", "._", "form", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "newf", "ilin", "g_", "._", "form", "\\u", "type_", "=_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "it", "'", "s", " ", "an", " ", "amend", "ment", " ", "based", " ", "on", " ", "form", " ", "types", " ", "--", " ", "if", " ", "so", ",", " ", "mark", " ", "it", ".", " ", "Ot", "her", "wis", "e", " ", "the", " ", "F1", "'", "s", " ", "will", " ", "look", " ", "like", " ", "the", "y", " ", "have", "n", "'", "t", " ", "bee", "n", " ", "amend", "ed", ".", " _", "\\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_", "this", "newf", "ilin", "g_", "._", "form", "\\u", "type_", "[_", "-_", "1_", "]_", "._", "upper_", "(_", ")_", "==_", "'", "A", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "newf", "ilin", "g_", "._", "is", "\\u", "amend", "ment_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "parse", " ", "forms", " ", "tha", "t", " ", "we", "'", "re", " ", "set", " ", "up", " ", "to", " ", "read_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fp_", "._", "is", "\\u", "allow", "ed", "\\u", "form_", "(_", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Not", " ", "a", " ", "parse", "able", " ", "form", ":", " ", "%", "s", " ", "-", " ", "%", "s", "\"_", "%_", "(_", "form_", ",_", "this", "newf", "ilin", "g_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "this", "newf", "ilin", "g_", "._", "is", "\\u", "amend", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "newf", "ilin", "g_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "f1_", "._", "get", "\\u", "first", "\\u", "row_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "\\u", "line_", "=_", "fp_", "._", "parse", "\\u", "form", "\\u", "line_", "(_", "header_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "amend", "ed", "\\u", "filing", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f1_", "._", "is", "\\u", "amend", "ment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amend", "ed", "\\u", "filing", "_", "=_", "f1_", "._", "headers_", "[_", "'", "filing", "\\u", "amend", "ed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "\\u", "date_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "through", "\\u", "date_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "header", " ", "line", " ", "is", ":", " ", "%", "s", " ", "\"", " ", "%", " ", "header", "\\u", "line_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "date", "parse", "(''", ")", " ", "will", " ", "give", " ", "toda", "y", ",", " ", "odd", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "header", "\\u", "line_", "[_", "'", "covera", "ge", "\\u", "from", "\\u", "date", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "date_", "=_", "date", "parse_", "(_", "header", "\\u", "line_", "[_", "'", "covera", "ge", "\\u", "from", "\\u", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "newf", "ilin", "g_", "._", "cycle_", "=_", "get", "\\u", "cycle", "\\u", "from", "\\u", "date_", "(_", "from", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "problem", " ", "with", " ", "covera", "ge", "\\u", "from", "\\u", "date", "\"_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "header", "\\u", "line_", "[_", "'", "covera", "ge", "\\u", "through", "\\u", "date", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "through", "\\u", "date_", "=_", "date", "parse_", "(_", "header", "\\u", "line_", "[_", "'", "covera", "ge", "\\u", "through", "\\u", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "through", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "newf", "ilin", "g_", "._", "cycle_", "=_", "get", "\\u", "cycle", "\\u", "from", "\\u", "date_", "(_", "through", "\\u", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "covera", "ge", "\\u", "through", "\\u", "date", "\"_", "\\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_", "#", " ", "Creat", "e", " ", "the", " ", "filing", " ", "--", " ", "but", " ", "don", "'", "t", " ", "mark", " ", "it", " ", "as", " ", "bei", "ng", " ", "complete", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "fec", "\\u", "id_", "=_", "f1_", "._", "headers_", "[_", "'", "fec", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "from", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "=_", "through", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "is", "\\u", "amend", "ment_", "=_", "f1_", "._", "is", "\\u", "amend", "ment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "amend", "s", "\\u", "filing", "_", "=_", "amend", "ed", "\\u", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "amend", "ment", "\\u", "number_", "=_", "f1_", "._", "headers_", "[_", "'", "report", "\\u", "number", "'_", "]_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "header", "\\u", "data_", "=_", "header", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "this", "newf", "ilin", "g_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "this", "newf", "ilin", "g_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Module is imported with 'import' and 'import from'
numba/numba/docs/gh-pages.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Script to commit the doc build outputs into the github-pages repo.\n\nUse:\n\n gh-pages.py [tag]\n\nIf no tag is given, the current output of 'git describe' is used. If given,\nthat is how the resulting directory will be named.\n\nIn practice, you should use either actual clean tags from a current build or\nsomething like 'current' as a stable URL for the most current version of the \"\"\"\nfrom __future__ import print_function, division, absolute_import\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\nimport os\nimport re\nimport shutil\nimport sys\nfrom os import chdir as cd\nfrom os.path import join as pjoin\n\nfrom subprocess import Popen, PIPE, CalledProcessError, check_call\n\n#-----------------------------------------------------------------------------\n# Globals\n#-----------------------------------------------------------------------------\n\npages_dir = 'gh-pages'\nhtml_dir = '_build/html'\npdf_dir = '_build/latex'\npages_repo = 'git@github.com:numba/numba-doc.git'\n\n#-----------------------------------------------------------------------------\n# Functions\n#-----------------------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n#-----------------------------------------------------------------------------\n# Script starts\n#-----------------------------------------------------------------------------\nif __name__ == '__main__':\n # The tag can be given as a positional argument\n try:\n tag = sys.argv[1]\n except IndexError:\n try:\n tag = sh2('git describe --exact-match').decode()\n except CalledProcessError:\n tag = \"dev\" # Fallback\n print(\"Using dev\")\n\n startdir = os.getcwd()\n if not os.path.exists(pages_dir):\n # init the repo\n init_repo(pages_dir)\n else:\n # ensure up-to-date before operating\n cd(pages_dir)\n sh('git checkout gh-pages')\n sh('git pull')\n cd(startdir)\n\n dest = pjoin(pages_dir, tag)\n\n # don't `make html` here, because gh-pages already depends on html in Makefile\n # sh('make html')\n if tag != 'dev':\n # only build pdf for non-dev targets\n #sh2('make pdf')\n pass\n\n # This is pretty unforgiving: we unconditionally nuke the destination\n # directory, and then copy the html tree in there\n shutil.rmtree(dest, ignore_errors=True)\n shutil.copytree(html_dir, dest)\n if tag != 'dev':\n #shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf'))\n pass\n\n try:\n cd(pages_dir)\n status = sh2('git status | head -1').decode()\n branch = re.match('\\#?\\s*On branch (.*)$', status).group(1)\n if branch != 'gh-pages':\n e = 'On %r, git branch is %r, MUST be \"gh-pages\"' % (pages_dir,\n branch)\n raise RuntimeError(e)\n\n sh('git add -A %s' % tag)\n sh('git commit -m\"Updated doc release: %s\"' % tag)\n print()\n print('Most recent 3 commits:')\n sys.stdout.flush()\n sh('git --no-pager log --oneline HEAD~3..')\n finally:\n cd(startdir)\n\n print()\n print('Now verify the build in: %r' % dest)\n print(\"If everything looks good, 'git push'\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Script", " ", "to", " ", "commit", " ", "the", " ", "doc", " ", "build", " ", "output", "s", " ", "int", "o", " ", "the", " ", "git", "hub", "-", "page", "s", " ", "repo", ".", "\\", "10", ";", "\\", "10", ";", "Us", "e", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "gh", "-", "page", "s", ".", "py", " ", "[", "tag", "]", "\\", "10", ";", "\\", "10", ";", "If", " ", "no", " ", "tag", " ", "is", " ", "give", "n", ",", " ", "the", " ", "current", " ", "output", " ", "of", " ", "'", "git", " ", "descri", "be", "'", " ", "is", " ", "used", ".", " ", " ", "If", " ", "give", "n", ",", "\\", "10", ";", "tha", "t", " ", "is", " ", "how", " ", "the", " ", "result", "ing", " ", "director", "y", " ", "will", " ", "be", " ", "named", ".", "\\", "10", ";", "\\", "10", ";", "In", " ", "practic", "e", ",", " ", "you", " ", "shou", "ld", " ", "use", " ", "eit", "her", " ", "actual", " ", "clean", " ", "tags", " ", "from", " ", "a", " ", "current", " ", "build", " ", "or", "\\", "10", ";", "somet", "hing", " ", "like", " ", "'", "current", "'", " ", "as", " ", "a", " ", "stable", " ", "URL", " ", "for", " ", "the", " ", "most", " ", "current", " ", "version", " ", "of", " ", "the", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "division_", ",_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Imports", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "chdir_", "as_", "cd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "as_", "pjoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "subprocess_", "import_", "Popen_", ",_", "PIPE_", ",_", "Call", "ed", "Process", "Error_", ",_", "check", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "page", "s", "\\u", "dir_", "=_", "'", "gh", "-", "page", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html", "\\u", "dir_", "=_", "'\\u", "build", "/", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdf", "\\u", "dir_", "=_", "'\\u", "build", "/", "late", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "s", "\\u", "repo_", "=_", "'", "git", "@", "git", "hub", ".", "com", ":", "numb", "a", "/", "numb", "a", "-", "doc", ".", "git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Functions_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Script", " ", "starts_", "\\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_", "#", " ", "The", " ", "tag", " ", "can", " ", "be", " ", "give", "n", " ", "as", " ", "a", " ", "positional", " ", "argument_", "\\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 ", " _", "tag_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "sh", "2_", "(_", "'", "git", " ", "descri", "be", " ", "--", "exact", "-", "match", "'_", ")_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Call", "ed", "Process", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "\"", "dev", "\"_", "#", " ", "Fallback", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Us", "ing", " ", "dev", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "startd", "ir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "page", "s", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "init", " ", "the", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "\\u", "repo_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "up", "-", "to", "-", "date", " ", "bef", "ore", " ", "operati", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "check", "out", " ", "gh", "-", "page", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "pull", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cd_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "=_", "pjoin_", "(_", "page", "s", "\\u", "dir_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "`", "make", " ", "html", "`", " ", "here", ",", " ", "bec", "aus", "e", " ", "gh", "-", "page", "s", " ", "alr", "ead", "y", " ", "depend", "s", " ", "on", " ", "html", " ", "in", " ", "Make", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sh", "('", "make", " ", "html", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tag_", "!=_", "'", "dev", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "build", " ", "pdf", " ", "for", " ", "non", "-", "dev", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sh", "2", "('", "make", " ", "pdf", "')", "_", "\\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_", "#", " ", "Thi", "s", " ", "is", " ", "pretty", " ", "unfo", "rgi", "ving", ":", " ", "we", " ", "uncon", "dition", "ally", " ", "nuk", "e", " ", "the", " ", "destination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", ",", " ", "and", " ", "then", " ", "copy", " ", "the", " ", "html", " ", "tree", " ", "in", " ", "there", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "dest_", ",_", "ignore", "\\u", "errors_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copytree_", "(_", "html", "\\u", "dir_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "!=_", "'", "dev", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "shut", "il", ".", "copy", "(", "pj", "oin", "(", "pdf", "\\u", "dir", ",", " ", "'", "ipython", ".", "pdf", "')", ",", " ", "pj", "oin", "(", "dest", ",", " ", "'", "ipython", ".", "pdf", "'))", "_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", "(_", "page", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "sh", "2_", "(_", "'", "git", " ", "status", " ", "|", " ", "head", " ", "-1", "'_", ")_", "._", "decode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "re_", "._", "match_", "(_", "'\\\\", "#", "?\\\\", "s", "*", "On", " ", "branch", " ", "(.*)", "$'_", ",_", "status_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "branch_", "!=_", "'", "gh", "-", "page", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "'", "On", " ", "%", "r", ",", " ", "git", " ", "branch", " ", "is", " ", "%", "r", ",", " ", "MUS", "T", " ", "be", " ", "\"", "gh", "-", "page", "s", "\"'_", "%_", "(_", "page", "s", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "add", " ", "-", "A", " ", "%", "s", "'_", "%_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "commit", " ", "-", "m", "\"", "Update", "d", " ", "doc", " ", "release", ":", " ", "%", "s", "\"'_", "%_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Mos", "t", " ", "recent", " ", "3", " ", "commit", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "'", "git", " ", "--", "no", "-", "pager", " ", "log", " ", "--", "one", "line", " ", "HEAD", "~", "3", "..'_", ")_", "\\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 ", " _", "cd_", "(_", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "No", "w", " ", "verify", " ", "the", " ", "build", " ", "in", ":", " ", "%", "r", "'_", "%_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "If", " ", "every", "thing", " ", "look", "s", " ", "good", ",", " ", "'", "git", " ", "push", "'\"_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 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 ]
Unused local variable
ipython/ipython-py3k/IPython/zmq/session.py
[ { "content": " def _check_packers(self):\n \"\"\"check packers for binary data and datetime support.\"\"\"\n pack = self.pack\n unpack = self.unpack\n \n # check simple serialization\n msg = dict(a=[1,'hi'])\n try:\n packed = pack(msg)\n except Exception:\n raise ValueError(\"packer could not serialize a simple message\")\n \n # ensure packed message is bytes\n if not isinstance(packed, bytes):\n raise ValueError(\"message packed to %r, but bytes are required\"%type(packed))\n \n # check that unpack is pack's inverse\n try:\n unpacked = unpack(packed)\n except Exception:\n raise ValueError(\"unpacker could not handle the packer's output\")\n \n # check datetime support\n msg = dict(t=datetime.now())\n try:\n unpacked = unpack(pack(msg))\n except Exception:\n self.pack = lambda o: pack(squash_dates(o))\n self.unpack = lambda s: extract_dates(unpack(s))", "metadata": "root.Session._check_packers", "header": "['class', 'Session', '(', 'Configurable', ')', ':', '___EOS___']", "index": 320 } ]
[ { "span": "unpacked ", "start_line": 345, "start_column": 12, "end_line": 345, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Session_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "packer", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "check", " ", "packer", "s", " ", "for", " ", "binar", "y", " ", "data", " ", "and", " ", "datetime", " ", "support", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pack_", "=_", "self_", "._", "pack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unpack_", "=_", "self_", "._", "unpack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "simple", " ", "serialization_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "dict_", "(_", "a_", "=_", "[_", "1_", ",_", "'", "hi", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "packed_", "=_", "pack_", "(_", "msg_", ")_", "\\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_", "Value", "Error_", "(_", "\"", "packer", " ", "coul", "d", " ", "not", " ", "serialize", " ", "a", " ", "simple", " ", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "pack", "ed", " ", "message", " ", "is", " ", "bytes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "packed_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "message", " ", "pack", "ed", " ", "to", " ", "%", "r", ",", " ", "but", " ", "bytes", " ", "are", " ", "require", "d", "\"_", "%_", "type_", "(_", "packed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "tha", "t", " ", "unpack", " ", "is", " ", "pack", "'", "s", " ", "inverse_", "\\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 ", " _", "unpacked", "_", "=_", "unpack_", "(_", "packed_", ")_", "\\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_", "Value", "Error_", "(_", "\"", "unpack", "er", " ", "coul", "d", " ", "not", " ", "handle", " ", "the", " ", "packer", "'", "s", " ", "output", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "datetime", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "dict_", "(_", "t_", "=_", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unpacked", "_", "=_", "unpack_", "(_", "pack_", "(_", "msg_", ")_", ")_", "\\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 ", " _", "self_", "._", "pack_", "=_", "lambda_", "o_", ":_", "pack_", "(_", "squash", "\\u", "dates_", "(_", "o_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unpack_", "=_", "lambda_", "s_", ":_", "extract", "\\u", "dates_", "(_", "unpack_", "(_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
EricssonResearch/calvin-base/calvin/utilities/calvin_callback.py
[ { "content": " def fname3(arg2, kwarg1):\n \"\"\"docstring for fname\"\"\"\n raise Exception(\"Buuuu!\")\n return True", "metadata": "root.fname3", "header": "['module', '___EOS___']", "index": 184 } ]
[ { "span": "return True", "start_line": 187, "start_column": 8, "end_line": 187, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fname", "3_", "(_", "arg2_", ",_", "kwarg", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "docstr", "ing", " ", "for", " ", "fname", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "Bu", "uu", "u", "!\"_", ")_", "\\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, 0, 1, 2 ]
Except block handles 'BaseException'
joshmarshall/jsonrpclib/jsonrpclib/SimpleJSONRPCServer.py
[ { "content": " def _marshaled_single_dispatch(self, request):\n # TODO - Use the multiprocessing and skip the response if\n # it is a notification\n # Put in support for custom dispatcher here\n # (See SimpleXMLRPCServer._marshaled_dispatch)\n method = request.get('method')\n params = request.get('params')\n try:\n response = self._dispatch(method, params)\n except:\n exc_type, exc_value, exc_tb = sys.exc_info()\n fault = Fault(-32603, '%s:%s' % (exc_type, exc_value))\n return fault.response()\n if 'id' not in request.keys() or request['id'] is None:\n # It's a notification\n return None\n try:\n response = jsonrpclib.dumps(response,\n methodresponse=True,\n rpcid=request['id']\n )\n return response\n except:\n exc_type, exc_value, exc_tb = sys.exc_info()\n fault = Fault(-32603, '%s:%s' % (exc_type, exc_value))\n return fault.response()", "metadata": "root.SimpleJSONRPCDispatcher._marshaled_single_dispatch", "header": "['class', 'SimpleJSONRPCDispatcher', '(', 'SimpleXMLRPCServer', '.', 'SimpleXMLRPCDispatcher', ')', ':', '___EOS___']", "index": 90 }, { "content": " def _dispatch(self, method, params):\n func = None\n try:\n func = self.funcs[method]\n except KeyError:\n if self.instance is not None:\n if hasattr(self.instance, '_dispatch'):\n return self.instance._dispatch(method, params)\n else:\n try:\n func = SimpleXMLRPCServer.resolve_dotted_attribute(\n self.instance,\n method,\n True\n )\n except AttributeError:\n pass\n if func is not None:\n try:\n if isinstance(params, types.ListType):\n response = func(*params)\n else:\n response = func(**params)\n return response\n # except TypeError:\n # return Fault(-32602, 'Invalid parameters.')\n except:\n err_lines = traceback.format_exc().splitlines()\n trace_string = '%s | %s' % (err_lines[-3], err_lines[-1])\n fault = jsonrpclib.Fault(-32603, 'Server error: %s' %\n trace_string)\n return fault\n else:\n return Fault(-32601, 'Method %s not supported.' % method)", "metadata": "root.SimpleJSONRPCDispatcher._dispatch", "header": "['class', 'SimpleJSONRPCDispatcher', '(', 'SimpleXMLRPCServer', '.', 'SimpleXMLRPCDispatcher', ')', ':', '___EOS___']", "index": 117 } ]
[ { "span": "except:", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 15 }, { "span": "except:", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 15 }, { "span": "except:", "start_line": 143, "start_column": 12, "end_line": 143, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Simple", "JSONR", "PC", "Dispatcher_", "(_", "Simple", "XMLRPC", "Server_", "._", "Simple", "XMLRPC", "Dispatcher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "marshal", "ed", "\\u", "single", "\\u", "dispatch_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "-", " ", "Us", "e", " ", "the", " ", "multipro", "cess", "ing", " ", "and", " ", "skip", " ", "the", " ", "response", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "is", " ", "a", " ", "notification_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "in", " ", "support", " ", "for", " ", "custom", " ", "dispatcher", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "See", " ", "Simple", "XMLRPC", "Server", ".\\u", "marshal", "ed", "\\u", "dispatch", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "request_", "._", "get_", "(_", "'", "method", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "request_", "._", "get_", "(_", "'", "params", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u", "dispatch_", "(_", "method_", ",_", "params_", ")_", "\\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 ", " _", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fault_", "=_", "Fault_", "(_", "-_", "326", "03_", ",_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fault_", "._", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "id", "'_", "not_", "in_", "request_", "._", "keys_", "(_", ")_", "or_", "request_", "[_", "'", "id", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "notification_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "jsonrpc", "lib_", "._", "dumps_", "(_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method", "response_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rpc", "id_", "=_", "request_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\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 ", " _", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fault_", "=_", "Fault_", "(_", "-_", "326", "03_", ",_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fault_", "._", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "JSONR", "PC", "Dispatcher_", "(_", "Simple", "XMLRPC", "Server_", "._", "Simple", "XMLRPC", "Dispatcher_", ")_", ":_", "\\u\\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", "dispatch_", "(_", "self_", ",_", "method_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "=_", "self_", "._", "funcs_", "[_", "method_", "]_", "\\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 ", " _", "if_", "self_", "._", "instance_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "instance_", ",_", "'\\u", "dispatch", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "instance_", "._", "\\u", "dispatch_", "(_", "method_", ",_", "params_", ")_", "\\u\\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 ", " ", " _", "func_", "=_", "Simple", "XMLRPC", "Server_", "._", "resolve", "\\u", "dot", "ted", "\\u", "attribute_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "func_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "params_", ",_", "types_", "._", "List", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "=_", "func_", "(_", "*_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "=_", "func_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "except", " ", "Type", "Error", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Fau", "lt", "(-", "326", "02", ",", " ", "'", "Inva", "lid", " ", "parameter", "s", ".'", ")_", "\\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 ", " _", "err", "\\u", "lines_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trace", "\\u", "string_", "=_", "'%", "s", " ", "|", " ", "%", "s", "'_", "%_", "(_", "err", "\\u", "lines_", "[_", "-_", "3_", "]_", ",_", "err", "\\u", "lines_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fault_", "=_", "jsonrpc", "lib_", "._", "Fault_", "(_", "-_", "326", "03_", ",_", "'", "Server", " ", "error", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "trace", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fault_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fault_", "(_", "-_", "326", "01_", ",_", "'", "Meth", "od", " ", "%", "s", " ", "not", " ", "support", "ed", ".'_", "%_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4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2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
bolme/pyvision/src/pyvision/analysis/bee.py
[ { "content": " def saveBeeFormat(self,filename):\n #maybe check for overwrite? and add param for allowing overwrite\n f = open(filename, \"wb\")\n \n # write line 1 : file_type and version\n file_type = 'D'\n if self.matrix.dtype == np.byte: \n file_type = 'M'\n elif self.is_distance:\n file_type = 'D'\n else:\n file_type = 'S'\n \n f.write(file_type)\n f.write(\"2\\x0a\")\n \n # write lines 2 and 3 (target and query sigsets)\n f.write(self.target_filename+\"\\x0a\")\n f.write(self.query_filename+\"\\x0a\")\n \n # write line 4 (MF n_queries n_targets magic_number)\n magic_number = struct.pack('=I',0x12345678)\n assert len(magic_number) == 4 # Bug fix: verify the magic number is really 4 bytes\n if file_type == 'M':\n f.write(\"MB %d %d %s\\x0a\" %(self.n_queries, self.n_targets, magic_number))\n else:\n f.write(\"MF %d %d %s\\x0a\" %(self.n_queries, self.n_targets, magic_number))\n \n # write the data\n f.write(self.matrix)\n f.close()", "metadata": "root.BEEDistanceMatrix.saveBeeFormat", "header": "['class', 'BEEDistanceMatrix', ':', '___EOS___']", "index": 536 } ]
[ { "span": "file_type ", "start_line": 541, "start_column": 8, "end_line": 541, "end_column": 17 } ]
[ { "span": "file_type ", "start_line": 543, "start_column": 12, "end_line": 543, "end_column": 21 }, { "span": "file_type ", "start_line": 545, "start_column": 12, "end_line": 545, "end_column": 21 }, { "span": "file_type ", "start_line": 547, "start_column": 12, "end_line": 547, "end_column": 21 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "BE", "ED", "ista", "nce", "Matrix_", ":_", "\\u\\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", "Bee", "Format_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "may", "be", " ", "check", " ", "for", " ", "overwrit", "e", "?", " ", "and", " ", "add", " ", "param", " ", "for", " ", "allow", "ing", " ", "overwrite_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "\"", "wb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "line", " ", "1", " ", ":", " ", "file", "\\u", "type", " ", "and", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "type_", "=_", "'", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "matrix_", "._", "dtype_", "==_", "np_", "._", "byte_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "type_", "=_", "'", "M", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "is", "\\u", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "type_", "=_", "'", "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 ", " _", "file", "\\u", "type_", "=_", "'", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "file", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "2", "\\\\", "x0", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "lines", " ", "2", " ", "and", " ", "3", " ", "(", "target", " ", "and", " ", "query", " ", "sig", "sets", ")_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "self_", "._", "target", "\\u", "filename_", "+_", "\"\\\\", "x0", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "self_", "._", "query", "\\u", "filename_", "+_", "\"\\\\", "x0", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "line", " ", "4", " ", "(", "MF", " ", "n", "\\u", "querie", "s", " ", "n", "\\u", "target", "s", " ", "magic", "\\u", "number", ")_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "number_", "=_", "struct_", "._", "pack_", "(_", "'=", "I", "'_", ",_", "0x12", "3456", "78_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "magic", "\\u", "number_", ")_", "==_", "4_", "#", " ", "Bug", " ", "fix", ":", " ", "verify", " ", "the", " ", "magic", " ", "number", " ", "is", " ", "reall", "y", " ", "4", " ", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "type_", "==_", "'", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "MB", " ", "%", "d", " ", "%", "d", " ", "%", "s", "\\\\", "x0", "a", "\"_", "%_", "(_", "self_", "._", "n", "\\u", "queries_", ",_", "self_", "._", "n", "\\u", "targets_", ",_", "magic", "\\u", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"", "MF", " ", "%", "d", " ", "%", "d", " ", "%", "s", "\\\\", "x0", "a", "\"_", "%_", "(_", "self_", "._", "n", "\\u", "queries_", ",_", "self_", "._", "n", "\\u", "targets_", ",_", "magic", "\\u", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "self_", "._", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\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, 0, 1, 1, 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, 2, 2, 2, 3, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Use of 'global' at module level
douban/python-libmemcached/benchmark.py
[ { "content": "#!/usr/bin/env python\n\nimport time\nimport random\nimport sys\n\n\noptions = None\ntotal_time = None\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n global total_time\n print \"total_time is %f\" % total_time\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "global total_time", "start_line": 281, "start_column": 4, "end_line": 281, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[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_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "total", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "total", "\\u", "time", " ", "is", " ", "%", "f", "\"_", "%_", "total", "\\u", "time_", "\\u\\u\\uDEDENT\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
nextml/NEXT/next/dashboard/AppDashboard.py
[ { "content": " def compute_duration_multiline_plot(self,app_id,exp_uid,task):\n \"\"\"\n Description: Returns multiline plot where there is a one-to-one mapping lines to \n algorithms and each line indicates the durations to complete the task (wrt to the api call) \n\n Expected input:\n (string) task : must be in {'getQuery','processAnswer','predict'}\n\n Expected output (in dict):\n (dict) MPLD3 plot dictionary\n \"\"\"\n alg_list,didSucceed,message = self.db.get(app_id+':experiments',exp_uid,'alg_list')\n\n x_min = numpy.float('inf')\n x_max = -numpy.float('inf')\n y_min = numpy.float('inf')\n y_max = -numpy.float('inf')\n list_of_alg_dicts = []\n\n for algorithm in alg_list:\n alg_id = algorithm['alg_id']\n alg_uid = algorithm['alg_uid']\n alg_label = algorithm['alg_label']\n \n list_of_log_dict,didSucceed,message = self.ell.get_logs_with_filter(app_id+':ALG-DURATION',{'alg_uid':alg_uid,'task':task})\n list_of_log_dict = sorted(list_of_log_dict, key=lambda item: utils.str2datetime(item['timestamp']) )\n\n x = []\n y = []\n t = []\n k=0\n for item in list_of_log_dict:\n k+=1\n x.append(k)\n y.append( item.get('app_duration',0.) + item.get('duration_enqueued',0.) )\n t.append(str(item['timestamp'])[:-3])\n \n x = numpy.array(x)\n y = numpy.array(y)\n t = numpy.array(t)\n num_items = len(list_of_log_dict)\n multiplier = min(num_items,MAX_SAMPLES_PER_PLOT)\n incr_inds = [ k*num_items/multiplier for k in range(multiplier)]\n max_inds = list(numpy.argsort(-y)[0:multiplier])\n final_inds = sorted(set(incr_inds + max_inds))\n x = list(x[final_inds])\n y = list(y[final_inds])\n t = list(t[final_inds])\n\n\n alg_dict = {}\n alg_dict['legend_label'] = alg_label\n alg_dict['x'] = x\n alg_dict['y'] = y\n alg_dict['t'] = t\n try:\n x_min = min(x_min,min(x))\n x_max = max(x_max,max(x))\n y_min = min(y_min,min(y))\n y_max = max(y_max,max(y))\n except:\n pass\n\n list_of_alg_dicts.append(alg_dict)\n\n return_dict = {}\n return_dict['data'] = list_of_alg_dicts\n return_dict['plot_type'] = 'multi_line_plot'\n return_dict['x_label'] = 'API Call'\n return_dict['x_min'] = x_min\n return_dict['x_max'] = x_max\n return_dict['y_label'] = 'Duration (s)'\n return_dict['y_min'] = y_min\n return_dict['y_max'] = y_max\n\n\n import matplotlib.pyplot as plt\n import mpld3\n fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))\n for alg_dict in list_of_alg_dicts:\n ax.plot(alg_dict['x'],alg_dict['y'],label=alg_dict['legend_label'])\n ax.set_xlabel('API Call')\n ax.set_ylabel('Duration (s)')\n ax.set_xlim([x_min,x_max])\n ax.set_ylim([y_min,y_max])\n ax.grid(color='white', linestyle='solid')\n ax.set_title(task, size=14)\n legend = ax.legend(loc=2,ncol=3,mode=\"expand\")\n for label in legend.get_texts():\n label.set_fontsize('small')\n plot_dict = mpld3.fig_to_dict(fig)\n\n\n return plot_dict", "metadata": "root.AppDashboard.compute_duration_multiline_plot", "header": "['class', 'AppDashboard', '(', 'object', ')', ':', '___EOS___']", "index": 100 }, { "content": " def compute_duration_detailed_stacked_area_plot(self,app_id,exp_uid,task,alg_label,detailedDB=False):\n \"\"\"\n Description: Returns stacked area plot for a particular algorithm and task where the durations\n are broken down into compute,db_set,db_get (for cpu, database_set, database_get)\n\n Expected input:\n (string) task : must be in {'getQuery','processAnswer','predict'}\n (string) alg_label : must be a valid alg_label contained in alg_list list of dicts \n\n Expected output (in dict):\n (dict) MPLD3 plot dictionary\n \"\"\"\n\n alg_list,didSucceed,message = self.db.get(app_id+':experiments',exp_uid,'alg_list')\n\n for algorithm in alg_list:\n if algorithm['alg_label'] == alg_label:\n alg_id = algorithm['alg_id']\n alg_uid = algorithm['alg_uid']\n\n list_of_log_dict,didSucceed,message = self.ell.get_logs_with_filter(app_id+':ALG-DURATION',{'alg_uid':alg_uid,'task':task})\n list_of_log_dict = sorted(list_of_log_dict, key=lambda item: utils.str2datetime(item['timestamp']) )\n\n\n y = []\n for item in list_of_log_dict:\n y.append( item.get('app_duration',0.) + item.get('duration_enqueued',0.) )\n y = numpy.array(y)\n num_items = len(list_of_log_dict)\n multiplier = min(num_items,MAX_SAMPLES_PER_PLOT)\n incr_inds = [ k*num_items/multiplier for k in range(multiplier)]\n max_inds = list(numpy.argsort(-y)[0:multiplier])\n final_inds = sorted(set(incr_inds + max_inds))\n\n\n x = []\n t = []\n enqueued = []\n admin = []\n dbOverhead = []\n dbGet = []\n dbSet = []\n compute = []\n\n max_y_value = 0.\n min_y_value = float('inf')\n for idx in final_inds:\n item = list_of_log_dict[idx]\n x.append(idx+1)\n t.append(str(item.get('timestamp','')))\n\n _alg_duration = item.get('duration',0.)\n _alg_duration_dbGet = item.get('duration_dbGet',0.)\n _alg_duration_dbSet = item.get('duration_dbSet',0.)\n _duration_enqueued = item.get('duration_enqueued',0.)\n _app_duration = item.get('app_duration',0.)\n\n if (_app_duration+_duration_enqueued) > max_y_value:\n max_y_value = _app_duration + _duration_enqueued\n if (_app_duration+_duration_enqueued) < min_y_value:\n min_y_value = _app_duration + _duration_enqueued\n \n enqueued.append(_duration_enqueued)\n admin.append(_app_duration-_alg_duration)\n dbSet.append(_alg_duration_dbSet)\n dbGet.append(_alg_duration_dbGet)\n compute.append( _alg_duration - _alg_duration_dbSet - _alg_duration_dbGet )\n\n try:\n min_x = min(x)\n max_x = max(x)\n except:\n min_x = 0.\n max_x = 0.\n\n import matplotlib.pyplot as plt\n import mpld3\n fig, ax = plt.subplots(subplot_kw=dict(axisbg='#EEEEEE'))\n stack_coll = ax.stackplot(x,compute,dbGet,dbSet,admin,enqueued, alpha=.5)\n ax.set_xlabel('API Call')\n ax.set_ylabel('Duration (s)')\n ax.set_xlim([min_x,max_x])\n ax.set_ylim([0.,max_y_value])\n ax.grid(color='white', linestyle='solid')\n ax.set_title(alg_label+' - '+task, size=14)\n proxy_rects = [plt.Rectangle((0, 0), 1, 1, alpha=.5,fc=pc.get_facecolor()[0]) for pc in stack_coll]\n legend = ax.legend(proxy_rects, ['compute','dbGet','dbSet','admin','enqueued'],loc=2,ncol=3,mode=\"expand\")\n for label in legend.get_texts():\n label.set_fontsize('small')\n plot_dict = mpld3.fig_to_dict(fig)\n \n\n return plot_dict", "metadata": "root.AppDashboard.compute_duration_detailed_stacked_area_plot", "header": "['class', 'AppDashboard', '(', 'object', ')', ':', '___EOS___']", "index": 196 }, { "content": " def response_time_histogram(self,app_id,exp_uid,alg_label):\n \"\"\"\n Description: returns the data to plot response time histogram of processAnswer for each algorithm \n\n Expected input:\n (string) alg_label : must be a valid alg_label contained in alg_list list of dicts \n\n Expected output (in dict):\n (dict) MPLD3 plot dictionary\n \"\"\"\n\n alg_list,didSucceed,message = self.db.get(app_id+':experiments',exp_uid,'alg_list')\n\n for algorithm in alg_list:\n if algorithm['alg_label'] == alg_label:\n alg_id = algorithm['alg_id']\n alg_uid = algorithm['alg_uid']\n\n list_of_query_dict,didSucceed,message = self.db.get_docs_with_filter(app_id+':queries',{'exp_uid':exp_uid,'alg_uid':alg_uid})\n\n\n t = []\n for item in list_of_query_dict:\n try:\n t.append(item['response_time'])\n except:\n pass\n\n import matplotlib.pyplot as plt\n import mpld3\n fig, ax = plt.subplots(subplot_kw=dict(axisbg='#FFFFFF'))\n ax.hist(t,MAX_SAMPLES_PER_PLOT,range=(0,30),alpha=0.5,color='black')\n ax.set_xlim(0, 30)\n ax.set_axis_off()\n ax.set_xlabel('Durations (s)')\n ax.set_ylabel('Count')\n ax.set_title(alg_label + \" - response time\", size=14)\n plot_dict = mpld3.fig_to_dict(fig)\n\n return plot_dict", "metadata": "root.AppDashboard.response_time_histogram", "header": "['class', 'AppDashboard', '(', 'object', ')', ':', '___EOS___']", "index": 291 }, { "content": " def network_delay_histogram(self,app_id,exp_uid,alg_label):\n \"\"\"\n Description: returns the data to network delay histogram of the time it takes to getQuery+processAnswer for each algorithm \n\n Expected input:\n (string) alg_label : must be a valid alg_label contained in alg_list list of dicts \n\n Expected output (in dict):\n (dict) MPLD3 plot dictionary\n \"\"\"\n\n alg_list,didSucceed,message = self.db.get(app_id+':experiments',exp_uid,'alg_list')\n\n for algorithm in alg_list:\n if algorithm['alg_label'] == alg_label:\n alg_id = algorithm['alg_id']\n alg_uid = algorithm['alg_uid']\n\n list_of_query_dict,didSucceed,message = self.db.get_docs_with_filter(app_id+':queries',{'exp_uid':exp_uid,'alg_uid':alg_uid})\n\n t = []\n for item in list_of_query_dict:\n try:\n t.append(item['network_delay'])\n except:\n pass\n\n import matplotlib.pyplot as plt\n import mpld3\n fig, ax = plt.subplots(subplot_kw=dict(axisbg='#FFFFFF'))\n ax.hist(t,MAX_SAMPLES_PER_PLOT,range=(0,5),alpha=0.5,color='black')\n ax.set_xlim(0, 5)\n ax.set_axis_off()\n ax.set_xlabel('Durations (s)')\n ax.set_ylabel('Count')\n ax.set_title(alg_label + \" - network delay\", size=14)\n plot_dict = mpld3.fig_to_dict(fig)\n\n return plot_dict", "metadata": "root.AppDashboard.network_delay_histogram", "header": "['class', 'AppDashboard', '(', 'object', ')', ':', '___EOS___']", "index": 332 } ]
[ { "span": "except:", "start_line": 160, "start_column": 6, "end_line": 160, "end_column": 13 }, { "span": "except:", "start_line": 267, "start_column": 4, "end_line": 267, "end_column": 11 }, { "span": "except:", "start_line": 316, "start_column": 6, "end_line": 316, "end_column": 13 }, { "span": "except:", "start_line": 356, "start_column": 6, "end_line": 356, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "App", "Dash", "board_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "duration", "\\u", "multiline", "\\u", "plot_", "(_", "self_", ",_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", ":", " ", "Return", "s", " ", "multiline", " ", "plot", " ", "where", " ", "there", " ", "is", " ", "a", " ", "one", "-", "to", "-", "one", " ", "mapping", " ", "lines", " ", "to", " ", "\\", "10", ";", " ", " ", " ", " ", "algo", "rit", "hms", " ", "and", " ", "each", " ", "line", " ", "indicat", "es", " ", "the", " ", "duration", "s", " ", "to", " ", "complete", " ", "the", " ", "task", " ", "(", "wrt", " ", "to", " ", "the", " ", "api", " ", "call", ")", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", ":", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "task", " ", ":", " ", " ", "must", " ", "be", " ", "in", " ", "{", "'", "get", "Query", "','", "process", "Answer", "','", "predi", "ct", "'}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "dict", "):", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "MPL", "D3", " ", "plot", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "min_", "=_", "numpy_", "._", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "max_", "=_", "-_", "numpy_", "._", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "min_", "=_", "numpy_", "._", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "max_", "=_", "-_", "numpy_", "._", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "alg", "\\u", "dicts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "ell_", "._", "get", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "task_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", "=_", "sorted_", "(_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ",_", "key_", "=_", "lambda_", "item_", ":_", "utils_", "._", "str2", "datetime_", "(_", "item_", "[_", "'", "timestamp", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "append_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "._", "append_", "(_", "item_", "._", "get_", "(_", "'", "app", "\\u", "duration", "'_", ",_", "0._", ")_", "+_", "item_", "._", "get_", "(_", "'", "duration", "\\u", "enqueue", "d", "'_", ",_", "0._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "append_", "(_", "str_", "(_", "item_", "[_", "'", "timestamp", "'_", "]_", ")_", "[_", ":_", "-_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "numpy_", "._", "array_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "numpy_", "._", "array_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "numpy_", "._", "array_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "items_", "=_", "len_", "(_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiplier_", "=_", "min_", "(_", "num", "\\u", "items_", ",_", "MAX", "\\u", "SAMPLES", "\\u", "PER", "\\u", "PLOT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incr", "\\u", "inds_", "=_", "[_", "k_", "*_", "num", "\\u", "items_", "/_", "multiplier_", "for_", "k_", "in_", "range_", "(_", "multiplier_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "inds_", "=_", "list_", "(_", "numpy_", "._", "argsort_", "(_", "-_", "y_", ")_", "[_", "0_", ":_", "multiplier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "inds_", "=_", "sorted_", "(_", "set_", "(_", "incr", "\\u", "inds_", "+_", "max", "\\u", "inds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "list_", "(_", "x_", "[_", "final", "\\u", "inds_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "list_", "(_", "y_", "[_", "final", "\\u", "inds_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "list_", "(_", "t_", "[_", "final", "\\u", "inds_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "dict_", "[_", "'", "legend", "\\u", "label", "'_", "]_", "=_", "alg", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "dict_", "[_", "'", "x", "'_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "dict_", "[_", "'", "y", "'_", "]_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "dict_", "[_", "'", "t", "'_", "]_", "=_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "min_", "=_", "min_", "(_", "x", "\\u", "min_", ",_", "min_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "max_", "=_", "max_", "(_", "x", "\\u", "max_", ",_", "max_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "min_", "=_", "min_", "(_", "y", "\\u", "min_", ",_", "min_", "(_", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "max_", "=_", "max_", "(_", "y", "\\u", "max_", ",_", "max_", "(_", "y_", ")_", ")_", "\\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_", "list", "\\u", "of", "\\u", "alg", "\\u", "dicts_", "._", "append_", "(_", "alg", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "data", "'_", "]_", "=_", "list", "\\u", "of", "\\u", "alg", "\\u", "dicts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "plot", "\\u", "type", "'_", "]_", "=_", "'", "multi", "\\u", "line", "\\u", "plot", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "x", "\\u", "label", "'_", "]_", "=_", "'", "API", " ", "Call", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "x", "\\u", "min", "'_", "]_", "=_", "x", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "x", "\\u", "max", "'_", "]_", "=_", "x", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "y", "\\u", "label", "'_", "]_", "=_", "'", "Dur", "ation", " ", "(", "s", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "y", "\\u", "min", "'_", "]_", "=_", "y", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "dict_", "[_", "'", "y", "\\u", "max", "'_", "]_", "=_", "y", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mpl", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "subplot", "\\u", "kw_", "=_", "dict_", "(_", "axis", "bg_", "=_", "'#", "EEE", "EEE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "alg", "\\u", "dict_", "in_", "list", "\\u", "of", "\\u", "alg", "\\u", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "plot_", "(_", "alg", "\\u", "dict_", "[_", "'", "x", "'_", "]_", ",_", "alg", "\\u", "dict_", "[_", "'", "y", "'_", "]_", ",_", "label_", "=_", "alg", "\\u", "dict_", "[_", "'", "legend", "\\u", "label", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "'", "API", " ", "Call", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "'", "Dur", "ation", " ", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "[_", "x", "\\u", "min_", ",_", "x", "\\u", "max_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "[_", "y", "\\u", "min_", ",_", "y", "\\u", "max_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "grid_", "(_", "color_", "=_", "'", "white", "'_", ",_", "linestyle_", "=_", "'", "solid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "task_", ",_", "size_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "legend_", "=_", "ax_", "._", "legend_", "(_", "loc_", "=_", "2_", ",_", "ncol_", "=_", "3_", ",_", "mode_", "=_", "\"", "expand", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "legend_", "._", "get", "\\u", "texts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "._", "set\\u", "fontsize_", "(_", "'", "small", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plot", "\\u", "dict_", "=_", "mpl", "d3_", "._", "fig", "\\u", "to", "\\u", "dict_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "plot", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Dash", "board_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "duration", "\\u", "detailed", "\\u", "stacked", "\\u", "area", "\\u", "plot_", "(_", "self_", ",_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "task_", ",_", "alg", "\\u", "label_", ",_", "detailed", "DB_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", ":", " ", "Return", "s", " ", "stacked", " ", "area", " ", "plot", " ", "for", " ", "a", " ", "partic", "ular", " ", "algo", "rit", "hm", " ", "and", " ", "task", " ", "where", " ", "the", " ", "duration", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "broken", " ", "down", " ", "int", "o", " ", "compute", ",", "db", "\\u", "set", ",", "db", "\\u", "get", " ", "(", "for", " ", "cpu", ",", " ", "databa", "se", "\\u", "set", ",", " ", "databa", "se", "\\u", "get", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", ":", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "task", " ", ":", " ", " ", "must", " ", "be", " ", "in", " ", "{", "'", "get", "Query", "','", "process", "Answer", "','", "predi", "ct", "'}", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "alg", "\\u", "label", " ", "contain", "ed", " ", "in", " ", "alg", "\\u", "list", " ", "list", " ", "of", " ", "dict", "s", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "dict", "):", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "MPL", "D3", " ", "plot", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "==_", "alg", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "ell_", "._", "get", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "task_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", "=_", "sorted_", "(_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ",_", "key_", "=_", "lambda_", "item_", ":_", "utils_", "._", "str2", "datetime_", "(_", "item_", "[_", "'", "timestamp", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "._", "append_", "(_", "item_", "._", "get_", "(_", "'", "app", "\\u", "duration", "'_", ",_", "0._", ")_", "+_", "item_", "._", "get_", "(_", "'", "duration", "\\u", "enqueue", "d", "'_", ",_", "0._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "y_", "=_", "numpy_", "._", "array_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "items_", "=_", "len_", "(_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiplier_", "=_", "min_", "(_", "num", "\\u", "items_", ",_", "MAX", "\\u", "SAMPLES", "\\u", "PER", "\\u", "PLOT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "incr", "\\u", "inds_", "=_", "[_", "k_", "*_", "num", "\\u", "items_", "/_", "multiplier_", "for_", "k_", "in_", "range_", "(_", "multiplier_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "inds_", "=_", "list_", "(_", "numpy_", "._", "argsort_", "(_", "-_", "y_", ")_", "[_", "0_", ":_", "multiplier_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "inds_", "=_", "sorted_", "(_", "set_", "(_", "incr", "\\u", "inds_", "+_", "max", "\\u", "inds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enqueue", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Over", "head_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Get_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Set_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "y", "\\u", "value_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "y", "\\u", "value_", "=_", "float_", "(_", "'", "inf", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", "in_", "final", "\\u", "inds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "list", "\\u", "of", "\\u", "log", "\\u", "dict_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "._", "append_", "(_", "idx_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "append_", "(_", "str_", "(_", "item_", "._", "get_", "(_", "'", "timestamp", "'_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "alg", "\\u", "duration_", "=_", "item_", "._", "get_", "(_", "'", "duration", "'_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Get_", "=_", "item_", "._", "get_", "(_", "'", "duration", "\\u", "db", "Get", "'_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Set_", "=_", "item_", "._", "get_", "(_", "'", "duration", "\\u", "db", "Set", "'_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "duration", "\\u", "enqueue", "d_", "=_", "item_", "._", "get_", "(_", "'", "duration", "\\u", "enqueue", "d", "'_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "app", "\\u", "duration_", "=_", "item_", "._", "get_", "(_", "'", "app", "\\u", "duration", "'_", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "\\u", "app", "\\u", "duration_", "+_", "\\u", "duration", "\\u", "enqueue", "d_", ")_", ">_", "max", "\\u", "y", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "y", "\\u", "value_", "=_", "\\u", "app", "\\u", "duration_", "+_", "\\u", "duration", "\\u", "enqueue", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u", "app", "\\u", "duration_", "+_", "\\u", "duration", "\\u", "enqueue", "d_", ")_", "<_", "min", "\\u", "y", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "y", "\\u", "value_", "=_", "\\u", "app", "\\u", "duration_", "+_", "\\u", "duration", "\\u", "enqueue", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "enqueue", "d_", "._", "append_", "(_", "\\u", "duration", "\\u", "enqueue", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "._", "append_", "(_", "\\u", "app", "\\u", "duration_", "-_", "\\u", "alg", "\\u", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Set_", "._", "append_", "(_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Get_", "._", "append_", "(_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute_", "._", "append_", "(_", "\\u", "alg", "\\u", "duration_", "-_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Set_", "-_", "\\u", "alg", "\\u", "duration", "\\u", "db", "Get_", ")_", "\\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 ", " _", "min", "\\u", "x_", "=_", "min_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "x_", "=_", "max_", "(_", "x_", ")_", "\\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 ", " _", "min", "\\u", "x_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "x_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mpl", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "subplot", "\\u", "kw_", "=_", "dict_", "(_", "axis", "bg_", "=_", "'#", "EEE", "EEE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stack", "\\u", "coll_", "=_", "ax_", "._", "stack", "plot_", "(_", "x_", ",_", "compute_", ",_", "db", "Get_", ",_", "db", "Set_", ",_", "admin_", ",_", "enqueue", "d_", ",_", "alpha_", "=_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "'", "API", " ", "Call", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "'", "Dur", "ation", " ", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "[_", "min", "\\u", "x_", ",_", "max", "\\u", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "[_", "0._", ",_", "max", "\\u", "y", "\\u", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "grid_", "(_", "color_", "=_", "'", "white", "'_", ",_", "linestyle_", "=_", "'", "solid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "alg", "\\u", "label_", "+_", "'", " ", "-", " ", "'_", "+_", "task_", ",_", "size_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy", "\\u", "rects_", "=_", "[_", "plt_", "._", "Rectangle_", "(_", "(_", "0_", ",_", "0_", ")_", ",_", "1_", ",_", "1_", ",_", "alpha_", "=_", ".5_", ",_", "fc_", "=_", "pc_", "._", "get", "\\u", "facecolor_", "(_", ")_", "[_", "0_", "]_", ")_", "for_", "pc_", "in_", "stack", "\\u", "coll_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "legend_", "=_", "ax_", "._", "legend_", "(_", "proxy", "\\u", "rects_", ",_", "[_", "'", "compute", "'_", ",_", "'", "db", "Get", "'_", ",_", "'", "db", "Set", "'_", ",_", "'", "admin", "'_", ",_", "'", "enqueue", "d", "'_", "]_", ",_", "loc_", "=_", "2_", ",_", "ncol_", "=_", "3_", ",_", "mode_", "=_", "\"", "expand", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "label_", "in_", "legend_", "._", "get", "\\u", "texts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "._", "set\\u", "fontsize_", "(_", "'", "small", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plot", "\\u", "dict_", "=_", "mpl", "d3_", "._", "fig", "\\u", "to", "\\u", "dict_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "plot", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Dash", "board_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "response", "\\u", "time", "\\u", "histogram_", "(_", "self_", ",_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", ":", " ", "return", "s", " ", "the", " ", "data", " ", "to", " ", "plot", " ", "response", " ", "time", " ", "histo", "gram", " ", "of", " ", "process", "Answer", " ", "for", " ", "each", " ", "algo", "rit", "hm", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", ":", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "alg", "\\u", "label", " ", "contain", "ed", " ", "in", " ", "alg", "\\u", "list", " ", "list", " ", "of", " ", "dict", "s", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "dict", "):", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "MPL", "D3", " ", "plot", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "==_", "alg", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "of", "\\u", "query", "\\u", "dict_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "list", "\\u", "of", "\\u", "query", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "append_", "(_", "item_", "[_", "'", "response", "\\u", "time", "'_", "]_", ")_", "\\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_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mpl", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "subplot", "\\u", "kw_", "=_", "dict_", "(_", "axis", "bg_", "=_", "'#", "FFFF", "FF", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "hist_", "(_", "t_", ",_", "MAX", "\\u", "SAMPLES", "\\u", "PER", "\\u", "PLOT", "_", ",_", "range_", "=_", "(_", "0_", ",_", "30_", ")_", ",_", "alpha_", "=_", "0.5_", ",_", "color_", "=_", "'", "black", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "axis", "\\u", "off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "'", "Dur", "ation", "s", " ", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "'", "Count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "alg", "\\u", "label_", "+_", "\"", " ", "-", " ", "response", " ", "time", "\"_", ",_", "size_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "dict_", "=_", "mpl", "d3_", "._", "fig", "\\u", "to", "\\u", "dict_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "plot", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "App", "Dash", "board_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "network", "\\u", "dela", "y", "\\u", "histogram_", "(_", "self_", ",_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", ":", " ", "return", "s", " ", "the", " ", "data", " ", "to", " ", "network", " ", "dela", "y", " ", "histo", "gram", " ", "of", " ", "the", " ", "time", " ", "it", " ", "take", "s", " ", "to", " ", "get", "Query", "+", "process", "Answer", " ", "for", " ", "each", " ", "algo", "rit", "hm", " ", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", ":", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "alg", "\\u", "label", " ", "contain", "ed", " ", "in", " ", "alg", "\\u", "list", " ", "list", " ", "of", " ", "dict", "s", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "dict", "):", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "MPL", "D3", " ", "plot", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "==_", "alg", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "of", "\\u", "query", "\\u", "dict_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "self_", "._", "db_", "._", "get", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "list", "\\u", "of", "\\u", "query", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "append_", "(_", "item_", "[_", "'", "network", "\\u", "dela", "y", "'_", "]_", ")_", "\\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_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mpl", "d3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "subplot", "\\u", "kw_", "=_", "dict_", "(_", "axis", "bg_", "=_", "'#", "FFFF", "FF", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "hist_", "(_", "t_", ",_", "MAX", "\\u", "SAMPLES", "\\u", "PER", "\\u", "PLOT", "_", ",_", "range_", "=_", "(_", "0_", ",_", "5_", ")_", ",_", "alpha_", "=_", "0.5_", ",_", "color_", "=_", "'", "black", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "axis", "\\u", "off_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "'", "Dur", "ation", "s", " ", "(", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "'", "Count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "title_", "(_", "alg", "\\u", "label_", "+_", "\"", " ", "-", " ", "network", " ", "dela", "y", "\"_", ",_", "size_", "=_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "dict_", "=_", "mpl", "d3_", "._", "fig", "\\u", "to", "\\u", "dict_", "(_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "plot", "\\u", "dict_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 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 ]
Unused import
ufora/ufora/ufora/FORA/Reasoner/SimpleForwardReasoner_test.py
[ { "content": "# Copyright 2015 Ufora Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport unittest\nimport os\nimport re\nimport time\n\nimport ufora.FORA.python.FORA as FORA\nimport ufora.FORA.python.Evaluator.Evaluator as Evaluator\nimport ufora.FORA.python.Evaluator.LocalEvaluator as LocalEvaluator\nimport ufora.FORA.python.Runtime as Runtime\nimport ufora.native.FORA as FORANative\nimport ufora.native.Cumulus as CumulusNative\nimport ufora.native.CallbackScheduler as CallbackScheduler\nimport logging\nimport ufora.native.TCMalloc as TCMallocNative\nimport pyfora\n\n\n\n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def makeJovt(*args):\n return FORANative.JOVListToJOVT(list(args))", "metadata": "root.makeJovt", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def symbolJov(sym):\n return FORANative.parseStringToJOV(\"`\" + sym)", "metadata": "root.symbolJov", "header": "['module', '___EOS___']", "index": 33 }, { "content": "class TestSimpleForwardReasoner(unittest.TestCase):\n \n\n\n\n\n\n\n\n\n\n\n\n\n\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.TestSimpleForwardReasoner", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def setUp(self):\n self.callbackScheduler = CallbackScheduler.singletonForTesting()\n self.runtime = Runtime.getMainRuntime()\n self.axioms = self.runtime.getAxioms()\n self.compiler = self.runtime.getTypedForaCompiler()\n self.builtinsAsJOV = FORANative.JudgmentOnValue.Constant(FORA.builtin().implVal_)\n\n pyforaPath = os.path.join(os.path.split(pyfora.__file__)[0], \"fora/purePython\")\n self.purePythonAsJOV = FORANative.JudgmentOnValue.Constant(FORA.importModule(pyforaPath).implVal_)\n \n self.instructionGraph = self.runtime.getInstructionGraph()\n self.reasoner = FORANative.SimpleForwardReasoner(self.compiler, self.instructionGraph, self.axioms)", "metadata": "root.TestSimpleForwardReasoner.setUp", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def nodeAndFrameCounts(self, reasoner, frame):\n allFrames = set()\n toCheck = [frame]\n while toCheck:\n frameToCheck = toCheck.pop()\n if frameToCheck not in allFrames:\n allFrames.add(frameToCheck)\n for subframe in reasoner.subframesFor(frameToCheck).values():\n toCheck.append(subframe)\n\n reachableFrames = len(allFrames)\n allFrameCount = reasoner.totalFrameCount()\n badApplyNodes = 0\n\n for f in allFrames:\n for n in f.unknownApplyNodes():\n badApplyNodes += 1\n\n return badApplyNodes, reachableFrames, reasoner.totalFrameCount()", "metadata": "root.TestSimpleForwardReasoner.nodeAndFrameCounts", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def dumpReasonerSummary(self, reasoner, frame):\n badApplyNodes, reachableFrames, allFrameCount = self.nodeAndFrameCounts(reasoner, frame)\n logging.info(\"Reaching %s of %s frames with %s bad nodes.\", reachableFrames, allFrameCount, badApplyNodes)", "metadata": "root.TestSimpleForwardReasoner.dumpReasonerSummary", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def test_builtin_math_isSimple(self):\n frame = self.reasoner.reasonAboutApply(makeJovt(self.builtinsAsJOV, symbolJov(\"Member\"), symbolJov(\"math\")))\n\n self.assertFrameHasConstantResult(frame)", "metadata": "root.TestSimpleForwardReasoner.test_builtin_math_isSimple", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def reasonAboutExpression(self, expression, **variableJudgments):\n keys = sorted(list(variableJudgments.keys()))\n\n functionText = \"fun(\" + \",\".join(['_'] + keys) + \") { \" + expression + \" }\"\n\n frame = self.reasoner.reasonAboutApply(\n makeJovt(\n FORANative.parseStringToJOV(functionText), \n *[FORANative.parseStringToJOV(variableJudgments[k]) \n if isinstance(variableJudgments[k],str) else variableJudgments[k] for k in keys]\n )\n )\n\n self.dumpReasonerSummary(self.reasoner, frame)\n\n #self.reasoner.compile(frame)\n\n #while self.compiler.anyCompilingOrPending():\n # time.sleep(0.001)\n\n return frame", "metadata": "root.TestSimpleForwardReasoner.reasonAboutExpression", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_nested_iterators(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun() {\n let ix = 0\n while (ix < 10)\n {\n ix = ix + 1\n if (ix % 5)\n yield ix\n else\n yield ix + 1\n }\n };\n let g = fun() {\n for ix in f() {\n if (ix % 5)\n yield ix\n else\n yield ix + 1\n }\n };\n let h = fun() {\n for ix in g() {\n yield ix\n }\n }\n let i = fun() {\n for ix in h() {\n yield ix\n }\n }\n\n let res = 0\n for ix in i()\n res = res + ix\n return res\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_nested_iterators", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 102 }, { "content": " def test_pure_python_lt(self):\n frame = self.reasonAboutExpression(\n \"purePython.PyFloat(x).__lt__(purePython.PyFloat(x+1.0)).@m\",\n purePython = self.purePythonAsJOV,\n x=\"{Float64}\"\n )\n self.assertFrameHasResultJOV(frame, \"{Bool}\")", "metadata": "root.TestSimpleForwardReasoner.test_pure_python_lt", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 144 }, { "content": " def test_pure_python_isinstance(self):\n frame = self.reasonAboutExpression(\n \"purePython.IsInstance(purePython.PyFloat(1.0), purePython.PyTuple((purePython.IntType,purePython.BoolType,purePython.BoolType,purePython.BoolType,purePython.FloatType))).@m\",\n purePython = self.purePythonAsJOV\n )\n self.assertFrameHasResultJOV(frame, \"true\")\n self.assertFrameHasConstantResult(frame)", "metadata": "root.TestSimpleForwardReasoner.test_pure_python_isinstance", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_loop_resolves(self):\n frame = self.reasonAboutExpression(\n \"\"\"let res = 0; \n while (x > 0) { \n x = x - 1; \n res = res + x\n }\n res\"\"\",\n x = \"10\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_loop_resolves", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_loop_with_iterator(self):\n frame = self.reasonAboutExpression(\n \"\"\"let res = 0; \n let sequence = fun(x) { while (x > 0) { yield x; x = x - 1 } };\n for ix in sequence(100) {\n res = res + ix\n }\n res\"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_loop_with_iterator", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_tuple_matching(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n match (x) with (()) { 0 } ((z)) { 1 }\n \"\"\",\n x = \"({Int64})\"\n )\n\n self.assertFrameHasResultJOV(frame, \"1\")", "metadata": "root.TestSimpleForwardReasoner.test_tuple_matching", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 185 }, { "content": " def test_nested_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let sum = fun(a,b,f) { \n let res = f(a)\n a = a + 1\n while (a<b) {\n res = res + f(a)\n a = a + 1\n }\n return res\n }\n\n sum(0,100, fun(x) { sum(0, 100, fun(x) { x })})\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_nested_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 195 }, { "content": " def test_tuple_iterator(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n [x for x in (1,2,3)]\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Vector([{Int64}])}\")", "metadata": "root.TestSimpleForwardReasoner.test_tuple_iterator", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def test_tuple_loop_resolves(self):\n frame = self.reasonAboutExpression(\n \"\"\"let res = (); \n while (x > 0) { \n x = x - 1; \n res = res + (x,)\n }\n res\"\"\",\n x = \"10\"\n )\n\n self.assertFrameHasResultJOV(frame, \"(...{Int64})\")", "metadata": "root.TestSimpleForwardReasoner.test_tuple_loop_resolves", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 223 }, { "content": " def test_function_call_works(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x) { x + 1 };\n let g = fun(x,y) { x + y };\n let res = 0; \n while (x > 0) { \n x = x - 1; \n res = res + f(x) + g(x,10)\n }\n res\"\"\",\n x = \"10\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_function_call_works", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 236 }, { "content": " def test_function_call_with_branching_works(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let res = 0\n\n let f = fun(x) { x + 1 };\n let g = fun(x) { x + 2 };\n\n while (res < 1000)\n {\n let toCall = nothing\n\n if (res > 10)\n toCall = f\n else \n toCall = g\n\n res = res + toCall(res)\n }\n\n return res\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")\n self.assertTrue(len(frame.unknownApplyNodes()) == 0)", "metadata": "root.TestSimpleForwardReasoner.test_function_call_with_branching_works", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_function_call_and_branching(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x) { x + 1 };\n let g = fun(x) { x + 2 };\n let res = 0; \n while (x > 0) { \n x = x - 1; \n if (x % 2 == 0)\n res = res + f(x)\n else\n res = res + g(x)\n }\n res\"\"\",\n x = \"10\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_function_call_and_branching", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 279 }, { "content": " def test_tuple_tracing_works(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x) { x + 1 };\n let t = (\"asdf\", 2)\n t[f(0)]\n \"\"\",\n x = \"10\"\n )\n\n self.assertFrameHasResultJOV(frame, \"2\")", "metadata": "root.TestSimpleForwardReasoner.test_tuple_tracing_works", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def test_simple_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x, res = 0) \n {\n if (x == 0) \n return res; \n return f(x-1,res+x) \n };\n\n f(1000)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_simple_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 310 }, { "content": " def test_simple_dual_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x1, x2, res = 0) \n {\n if (x1 == 0 or x2 == 0) \n return res; \n return f(x1-1,x2,res+x1) + f(x1, x2 - 1, res+x2)\n };\n\n f(1000, 1000)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_simple_dual_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 326 }, { "content": " def test_simple_mutual_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x1, res = 0) \n {\n if (x1 == 0) \n return res; \n return g(x1-1,res+x1)\n },\n g = fun(x2, res) {\n f(x2, res) + 2\n };\n\n f(1000, 1000)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_simple_mutual_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 342 }, { "content": " def test_call_site_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun\n (`int ) { 0 } \n (`str) { \"asdf\" }\n (`tuple) { (f(`int), f(`str)) }\n ;\n\n f(`tuple)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"(0,'asdf')\")", "metadata": "root.TestSimpleForwardReasoner.test_call_site_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 361 }, { "content": " def test_recursion_on_tuples(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x, res=()) \n {\n if (x == 0)\n return res\n else\n return f(x-1,(x,res))\n };\n\n f(1000)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"({Int64}, (...*))\")", "metadata": "root.TestSimpleForwardReasoner.test_recursion_on_tuples", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 376 }, { "content": " def DISABLEDtest_memory_load(self):\n b0 = TCMallocNative.getBytesUsed()\n b1 = b0\n for ix in range(10000):\n self.reasonAboutExpression(\n \"\"\"\n let g = fun(t) { size(t) }\n let f = fun(t) { let c = g; c((1,) + t) + c((2,) + t) + c((3,) + t) };\n let f2 = fun(t) { let c = f; c((1,) + t) + c((2,) + t) + c((3,) + t) };\n let f3 = fun(t) { let c = f2; c((1,) + t) + c((2,) + t) + c((3,) + t) };\n let f4 = fun(t) { let c = f3; c((1,) + t) + c((2,) + t) + c((3,) + t) };\n \n f4((x,))\n \"\"\", x = str(ix)\n )\n\n print (b1 - b0) / (ix+1) / 1024 / 1024.0, \" MB per for a total of \",\\\n (TCMallocNative.getBytesUsed() - b0) / 1024 / 1024.0, \" MB allocated.\"\n\n b1 = TCMallocNative.getBytesUsed()", "metadata": "root.TestSimpleForwardReasoner.DISABLEDtest_memory_load", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 393 }, { "content": " def test_recursion_on_tuples_2(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun((), soFar) { () } \n (x, soFar) { (x[0]+soFar,) + f(x[1,], soFar+x[0]) }\n\n f((1,2,3), 0)\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame,\"(... {Int64})\")", "metadata": "root.TestSimpleForwardReasoner.test_recursion_on_tuples_2", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 414 }, { "content": " def test_two_layer_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x, res = 0) \n {\n if (x == 0) \n return res; \n return g(x-1,res+x) \n },\n g = fun(x,res) { f(x,res) * 2 };\n\n f(1000)\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_two_layer_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 426 }, { "content": " def test_same_function_called_with_different_arguments(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(x) { \n let res = 2; \n while (res>0) {\n res = res - 1; \n x = x + x\n }; \n x \n };\n\n (f(10),f(\"asdf\"))\n \"\"\"\n )\n\n self.assertFrameHasResultJOV(frame, \"({Int64},{String})\")", "metadata": "root.TestSimpleForwardReasoner.test_same_function_called_with_different_arguments", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 443 }, { "content": " def test_heterogeneous_vec_of_vec(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n [[0],[\"1.0\"]][0]\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"{Vector([{Int64}])}\", \"{Vector([{String}])}\")", "metadata": "root.TestSimpleForwardReasoner.test_heterogeneous_vec_of_vec", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 461 }, { "content": " def test_vector_recursion(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f = fun(v) {\n if (size(v) == 100)\n return v\n return f([v[0], [v[0]]])\n }\n f([0])\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"{Vector}\")", "metadata": "root.TestSimpleForwardReasoner.test_vector_recursion", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 470 }, { "content": " def test_list_comprehension(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n [x for x in (1,2,3)]\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"{Vector([{Int64}])}\")", "metadata": "root.TestSimpleForwardReasoner.test_list_comprehension", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 484 }, { "content": " def test_switch_is_exclusive_and_disjoint(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n match (x) with (1) { 1 } (\"2\") { 2 }\n \"\"\",\n x=\"{Int64}\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"1\")", "metadata": "root.TestSimpleForwardReasoner.test_switch_is_exclusive_and_disjoint", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 493 }, { "content": " def test_alternativesWork(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n match (#ASDF(z:x)) with (#ASDF(z:x)) { x }\n \"\"\",\n x=\"{Int64}\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"{Int64}\")", "metadata": "root.TestSimpleForwardReasoner.test_alternativesWork", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 503 }, { "content": " def test_heterogeneous_vec_of_vec_function_apply(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let res = []\n let ix = 0\n let v = [[0],[\"1.0\"]]\n\n while (ix < size(v))\n {\n res = res :: v[ix]\n ix = ix + 1\n }\n res\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"{Vector([{Vector([{Int64}])}, {Vector([{String}])}])}\")", "metadata": "root.TestSimpleForwardReasoner.test_heterogeneous_vec_of_vec_function_apply", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 513 }, { "content": " def test_tuple_function_iteration(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f1 = {_+1};\n let f2 = {_+2};\n let f3 = {_+3};\n let f4 = {_+4};\n \n let fs = (f1, f2, f3, f4);\n\n let res = 0\n\n for f in fs\n res = res + f(1)\n\n res\n \"\"\"\n )\n\n self.assertFrameHasResultJOVs(frame, \"14\")", "metadata": "root.TestSimpleForwardReasoner.test_tuple_function_iteration", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 531 }, { "content": " def test_tuple_function_iteration2(self):\n frame = self.reasonAboutExpression(\n \"\"\"\n let f1 = {_+1};\n let f2 = {_+2};\n let f3 = {_+3};\n let f4 = {_+4};\n \n let fs = (f1, f2, f3, f4);\n\n let res = 0\n\n for f in fs\n for f2 in fs\n res = res + f(1) + f2(1)\n\n res\n \"\"\"\n )\n\n self.assertTrue(len(frame.unknownApplyNodes()) > 0)", "metadata": "root.TestSimpleForwardReasoner.test_tuple_function_iteration2", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 552 }, { "content": " def assertFrameHasConstantResult(self, frame):\n self.assertTrue(len(frame.exits().resultPart().vals) == 1, frame.exits())\n self.assertTrue(len(frame.exits().throwPart().vals) == 0, frame.exits())\n self.assertTrue(frame.exits().resultPart()[0].constant())", "metadata": "root.TestSimpleForwardReasoner.assertFrameHasConstantResult", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 574 }, { "content": " def assertFrameHasResultJOV(self, frame, resultJOV):\n if isinstance(resultJOV, str):\n resultJOV = FORANative.parseStringToJOV(resultJOV)\n\n self.assertTrue(len(frame.exits().resultPart().vals) == 1, frame.exits())\n self.assertEqual(frame.exits().resultPart()[0], resultJOV)", "metadata": "root.TestSimpleForwardReasoner.assertFrameHasResultJOV", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 579 }, { "content": " def assertFrameHasResultJOVs(self, frame, *resultJOVs):\n self.assertTrue(len(frame.unknownApplyNodes()) == 0)\n\n jovsToFind = []\n for resultJOV in resultJOVs:\n if isinstance(resultJOV, str):\n resultJOV = FORANative.parseStringToJOV(resultJOV)\n jovsToFind.append(resultJOV)\n resultJOVs = list(jovsToFind)\n\n for res in frame.exits().resultPart():\n self.assertTrue(res in jovsToFind, \n \"Code produced unexpected JOV: %s. Result was %s but expected %s\" % \n (res, frame.exits().resultPart(), resultJOVs)\n )\n jovsToFind.remove(res)\n\n self.assertTrue(\n len(jovsToFind) == 0, \n \"Code didn't produce these jovs: %s. Produced %s instead.\" % \n (jovsToFind, frame.exits().resultPart())\n )", "metadata": "root.TestSimpleForwardReasoner.assertFrameHasResultJOVs", "header": "['class', 'TestSimpleForwardReasoner', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 586 } ]
[ { "span": "import re", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 }, { "span": "import time", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 11 }, { "span": "import ufora.FORA.python.Evaluator.Evaluator as Evaluator", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 57 }, { "span": "import ufora.FORA.python.Evaluator.LocalEvaluator as LocalEvaluator", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 67 }, { "span": "import ufora.native.Cumulus as CumulusNative", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "201", "5", " ", "Uf", "ora", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "FOR", "A_", "as_", "FOR", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "Evaluator_", "._", "Evaluator_", "as_", "Evaluator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "Evaluator_", "._", "Local", "Evaluator_", "as_", "Local", "Evaluator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "Runtime_", "as_", "Runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "FOR", "A_", "as_", "FOR", "AN", "ative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "Cum", "ulus", "_", "as_", "Cum", "ulus", "Nat", "ive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "Call", "back", "Scheduler_", "as_", "Call", "back", "Scheduler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "TC", "Mal", "loc_", "as_", "TC", "Mal", "loc", "Nat", "ive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyf", "ora", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "Jo", "vt_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "FOR", "AN", "ative_", "._", "JO", "VL", "ist", "To", "JO", "VT", "_", "(_", "list_", "(_", "args_", ")_", ")_", "\\u\\u\\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_", "symbol", "Jo", "v_", "(_", "sym_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "FOR", "AN", "ative_", "._", "parse", "String", "To", "JO", "V_", "(_", "\"`", "\"_", "+_", "sym_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "callback", "Scheduler_", "=_", "Call", "back", "Scheduler_", "._", "singleton", "For", "Test", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "runtime_", "=_", "Runtime_", "._", "get", "Main", "Runtime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "axiom", "s_", "=_", "self_", "._", "runtime_", "._", "get", "Axi", "oms", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compiler_", "=_", "self_", "._", "runtime_", "._", "get", "Type", "d", "For", "a", "Compiler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bui", "lti", "ns", "As", "JO", "V_", "=_", "FOR", "AN", "ative_", "._", "Jud", "gment", "On", "Value_", "._", "Constant_", "(_", "FOR", "A_", "._", "builtin_", "(_", ")_", "._", "impl", "Val", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pyf", "ora", "Path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "split_", "(_", "pyf", "ora", "_", "._", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", "\"", "fora", "/", "pure", "Pyth", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pure", "Pyth", "on", "As", "JO", "V_", "=_", "FOR", "AN", "ative_", "._", "Jud", "gment", "On", "Value_", "._", "Constant_", "(_", "FOR", "A_", "._", "import", "Module_", "(_", "pyf", "ora", "Path_", ")_", "._", "impl", "Val", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "instruct", "ion", "Graph_", "=_", "self_", "._", "runtime_", "._", "get", "Instr", "ucti", "on", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reason", "er_", "=_", "FOR", "AN", "ative_", "._", "Simple", "Forward", "Rea", "son", "er_", "(_", "self_", "._", "compiler_", ",_", "self_", "._", "instruct", "ion", "Graph_", ",_", "self_", "._", "axiom", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "node", "And", "Frame", "Counts_", "(_", "self_", ",_", "reason", "er_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Frames_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "Check_", "=_", "[_", "frame_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "to", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame", "To", "Check_", "=_", "to", "Check_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frame", "To", "Check_", "not_", "in_", "all", "Frames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Frames_", "._", "add_", "(_", "frame", "To", "Check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subf", "rame_", "in_", "reason", "er_", "._", "subf", "rame", "s", "For_", "(_", "frame", "To", "Check_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "to", "Check_", "._", "append_", "(_", "subf", "rame_", ")_", "\\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_", "reachable", "Frames_", "=_", "len_", "(_", "all", "Frames_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "Frame", "Count_", "=_", "reason", "er_", "._", "total", "Frame", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "Apply", "Nodes_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "all", "Frames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "f_", "._", "unknown", "Apply", "Nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bad", "Apply", "Nodes_", "+=_", "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_", "return_", "bad", "Apply", "Nodes_", ",_", "reachable", "Frames_", ",_", "reason", "er_", "._", "total", "Frame", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump", "Rea", "son", "er", "Summary_", "(_", "self_", ",_", "reason", "er_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bad", "Apply", "Nodes_", ",_", "reachable", "Frames_", ",_", "all", "Frame", "Count_", "=_", "self_", "._", "node", "And", "Frame", "Counts_", "(_", "reason", "er_", ",_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Reach", "ing", " ", "%", "s", " ", "of", " ", "%", "s", " ", "frames", " ", "with", " ", "%", "s", " ", "bad", " ", "nodes", ".\"_", ",_", "reachable", "Frames_", ",_", "all", "Frame", "Count_", ",_", "bad", "Apply", "Nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bui", "lti", "n", "\\u", "math", "\\u", "is", "Simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "er_", "._", "reason", "Abo", "ut", "Apply", "_", "(_", "make", "Jo", "vt_", "(_", "self_", "._", "bui", "lti", "ns", "As", "JO", "V_", ",_", "symbol", "Jo", "v_", "(_", "\"", "Mem", "ber", "\"_", ")_", ",_", "symbol", "Jo", "v_", "(_", "\"", "math", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Const", "ant", "Result_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reason", "Abo", "ut", "Expression_", "(_", "self_", ",_", "expression_", ",_", "**_", "variab", "le", "Jud", "gment", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "sorted_", "(_", "list_", "(_", "variab", "le", "Jud", "gment", "s_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "function", "Text_", "=_", "\"", "fun", "(\"_", "+_", "\",\"_", "._", "join_", "(_", "[_", "'\\u'_", "]_", "+_", "keys_", ")_", "+_", "\")", " ", "{", " ", "\"_", "+_", "expression_", "+_", "\"", " ", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "frame_", "=_", "self_", "._", "reason", "er_", "._", "reason", "Abo", "ut", "Apply", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Jo", "vt_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FOR", "AN", "ative_", "._", "parse", "String", "To", "JO", "V_", "(_", "function", "Text_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "[_", "FOR", "AN", "ative_", "._", "parse", "String", "To", "JO", "V_", "(_", "variab", "le", "Jud", "gment", "s_", "[_", "k_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "variab", "le", "Jud", "gment", "s_", "[_", "k_", "]_", ",_", "str_", ")_", "else_", "variab", "le", "Jud", "gment", "s_", "[_", "k_", "]_", "for_", "k_", "in_", "keys_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dump", "Rea", "son", "er", "Summary_", "(_", "self_", "._", "reason", "er_", ",_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "reason", "er", ".", "compile", "(", "frame", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "le", " ", "self", ".", "compiler", ".", "any", "Compil", "ing", "Or", "Pend", "ing", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "time", ".", "sleep", "(", "0.001", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "iterators", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "ix", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "ix", " ", "<", " ", "10", ")", "\\", "10", ";", " ", " ", "{", "\\", "10", ";", " ", " ", "ix", " ", "=", " ", "ix", " ", "+", " ", "1", "\\", "10", ";", " ", " ", "if", " ", "(", "ix", " ", "%", " ", "5", ")", "\\", "10", ";", " ", " ", "yield", " ", "ix", "\\", "10", ";", " ", " ", "else", "\\", "10", ";", " ", " ", "yield", " ", "ix", " ", "+", " ", "1", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "g", " ", "=", " ", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ix", " ", "in", " ", "f", "()", " ", "{", "\\", "10", ";", " ", " ", "if", " ", "(", "ix", " ", "%", " ", "5", ")", "\\", "10", ";", " ", " ", "yield", " ", "ix", "\\", "10", ";", " ", " ", "else", "\\", "10", ";", " ", " ", "yield", " ", "ix", " ", "+", " ", "1", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "h", " ", "=", " ", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ix", " ", "in", " ", "g", "()", " ", "{", "\\", "10", ";", " ", " ", "yield", " ", "ix", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "i", " ", "=", " ", "fun", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ix", " ", "in", " ", "h", "()", " ", "{", "\\", "10", ";", " ", " ", "yield", " ", "ix", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ix", " ", "in", " ", "i", "()", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "ix", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pure", "\\u", "python", "\\u", "lt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pure", "Pyth", "on", ".", "Py", "Float", "(", "x", ").", "\\u\\u", "lt", "\\u\\u", "(", "pure", "Pyth", "on", ".", "Py", "Float", "(", "x", "+", "1.0", "))", ".", "@", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pure", "Python_", "=_", "self_", "._", "pure", "Pyth", "on", "As", "JO", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"{", "Float", "64", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Boo", "l", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pure", "\\u", "python", "\\u", "isinstance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pure", "Pyth", "on", ".", "Is", "Insta", "nce", "(", "pure", "Pyth", "on", ".", "Py", "Float", "(", "1.0", "),", " ", "pure", "Pyth", "on", ".", "Py", "Tup", "le", "((", "pure", "Pyth", "on", ".", "Int", "Type", ",", "pure", "Pyth", "on", ".", "Boo", "l", "Type", ",", "pure", "Pyth", "on", ".", "Boo", "l", "Type", ",", "pure", "Pyth", "on", ".", "Boo", "l", "Type", ",", "pure", "Pyth", "on", ".", "Float", "Type", ")))", ".", "@", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pure", "Python_", "=_", "self_", "._", "pure", "Pyth", "on", "As", "JO", "V_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Const", "ant", "Result_", "(_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop", "\\u", "resolve", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "let", " ", "res", " ", "=", " ", "0", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "x", " ", ">", " ", "0", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "x", " ", "-", " ", "1", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "x", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"", "10", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "loop", "\\u", "with", "\\u", "iterator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "let", " ", "res", " ", "=", " ", "0", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "sequence", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "whi", "le", " ", "(", "x", " ", ">", " ", "0", ")", " ", "{", " ", "yield", " ", "x", ";", " ", "x", " ", "=", " ", "x", " ", "-", " ", "1", " ", "}", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "ix", " ", "in", " ", "sequence", "(", "100", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "ix", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "matching_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "(", "x", ")", " ", "with", " ", "((", "))", " ", "{", " ", "0", " ", "}", " ", "((", "z", "))", " ", "{", " ", "1", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"(", "{", "Int64", "})\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "sum", " ", "=", " ", "fun", "(", "a", ",", "b", ",", "f", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "f", "(", "a", ")", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "=", " ", "a", " ", "+", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "a", "<", "b", ")", " ", "{", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "f", "(", "a", ")", "\\", "10", ";", " ", " ", "a", " ", "=", " ", "a", " ", "+", " ", "1", "\\", "10", ";", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sum", "(", "0", ",", "100", ",", " ", "fun", "(", "x", ")", " ", "{", " ", "sum", "(", "0", ",", " ", "100", ",", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "})", "})", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "iterator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "[", "x", " ", "for", " ", "x", " ", "in", " ", "(", "1", ",", "2", ",", "3", ")]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Vector", "([", "{", "Int64", "}]", ")}", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "loop", "\\u", "resolve", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "let", " ", "res", " ", "=", " ", "();", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "x", " ", ">", " ", "0", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "x", " ", "-", " ", "1", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "(", "x", ",)", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"", "10", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"(.", "..", "{", "Int64", "})\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "function", "\\u", "call", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "1", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "g", " ", "=", " ", "fun", "(", "x", ",", "y", ")", " ", "{", " ", "x", " ", "+", " ", "y", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "x", " ", ">", " ", "0", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "x", " ", "-", " ", "1", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "f", "(", "x", ")", " ", "+", " ", "g", "(", "x", ",", "10", ")", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"", "10", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "function", "\\u", "call", "\\u", "with", "\\u", "branch", "ing", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "1", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "g", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "2", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "res", " ", "<", " ", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "to", "Call", " ", "=", " ", "not", "hing", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "res", " ", ">", " ", "10", ")", "\\", "10", ";", " ", " ", "to", "Call", " ", "=", " ", "f", "\\", "10", ";", " ", " ", " ", " ", "else", " ", " ", " ", "\\", "10", ";", " ", " ", "to", "Call", " ", "=", " ", "g", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "to", "Call", "(", "res", ")", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "unknown", "Apply", "Nodes_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "function", "\\u", "call", "\\u", "and", "\\u", "branch", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "1", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "g", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "2", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "x", " ", ">", " ", "0", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "x", " ", "-", " ", "1", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x", " ", "%", " ", "2", " ", "==", " ", "0", ")", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "f", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "else", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "g", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"", "10", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "tracing", "\\u", "works_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "x", " ", "+", " ", "1", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "t", " ", "=", " ", "(\"", "asd", "f", "\",", " ", "2", ")", "\\", "10", ";", " ", " ", " ", " ", "t", "[", "f", "(", "0", ")]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"", "10", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ",", " ", "res", " ", "=", " ", "0", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x", " ", "==", " ", "0", ")", " ", "\\", "10", ";", " ", " ", "return", " ", "res", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "f", "(", "x", "-1", ",", "res", "+", "x", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "dual", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x1", ",", " ", "x2", ",", " ", "res", " ", "=", " ", "0", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x1", " ", "==", " ", "0", " ", "or", " ", "x2", " ", "==", " ", "0", ")", " ", "\\", "10", ";", " ", " ", "return", " ", "res", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "f", "(", "x1", "-1", ",", "x2", ",", "res", "+", "x1", ")", " ", "+", " ", "f", "(", "x1", ",", " ", "x2", " ", "-", " ", "1", ",", " ", "res", "+", "x2", ")", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "1000", ",", " ", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "mutual", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x1", ",", " ", "res", " ", "=", " ", "0", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x1", " ", "==", " ", "0", ")", " ", "\\", "10", ";", " ", " ", "return", " ", "res", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "g", "(", "x1", "-1", ",", "res", "+", "x1", ")", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "g", " ", "=", " ", "fun", "(", "x2", ",", " ", "res", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "x2", ",", " ", "res", ")", " ", "+", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "1000", ",", " ", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "call", "\\u", "site", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "\\", "10", ";", " ", " ", " ", " ", "(", "`", "int", " ", ")", " ", "{", " ", "0", " ", "}", " ", "\\", "10", ";", " ", " ", " ", " ", "(", "`", "str", ")", " ", "{", " ", "\"", "asd", "f", "\"", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "(", "`", "tuple", ")", " ", "{", " ", "(", "f", "(", "`", "int", "),", " ", "f", "(", "`", "str", "))", " ", "}", "\\", "10", ";", " ", " ", " ", " ", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "`", "tuple", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"(", "0", ",'", "asd", "f", "')\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recursion", "\\u", "on", "\\u", "tuples_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ",", " ", "res", "=(", "))", " ", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x", " ", "==", " ", "0", ")", "\\", "10", ";", " ", " ", "return", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "else", "\\", "10", ";", " ", " ", "return", " ", "f", "(", "x", "-1", ",(", "x", ",", "res", "))\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"(", "{", "Int64", "},", " ", "(.", "..", "*)", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "DISABLED", "test\\u", "memory", "\\u", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b0_", "=_", "TC", "Mal", "loc", "Nat", "ive_", "._", "get", "Byte", "s", "Used_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "b0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ix_", "in_", "range_", "(_", "10000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "g", " ", "=", " ", "fun", "(", "t", ")", " ", "{", " ", "size", "(", "t", ")", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "t", ")", " ", "{", " ", "let", " ", "c", " ", "=", " ", "g", ";", " ", "c", "((", "1", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "2", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "3", ",)", " ", "+", " ", "t", ")", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f2", " ", "=", " ", "fun", "(", "t", ")", " ", "{", " ", "let", " ", "c", " ", "=", " ", "f", ";", " ", "c", "((", "1", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "2", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "3", ",)", " ", "+", " ", "t", ")", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f3", " ", "=", " ", "fun", "(", "t", ")", " ", "{", " ", "let", " ", "c", " ", "=", " ", "f2", ";", " ", "c", "((", "1", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "2", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "3", ",)", " ", "+", " ", "t", ")", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f4", " ", "=", " ", "fun", "(", "t", ")", " ", "{", " ", "let", " ", "c", " ", "=", " ", "f3", ";", " ", "c", "((", "1", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "2", ",)", " ", "+", " ", "t", ")", " ", "+", " ", "c", "((", "3", ",)", " ", "+", " ", "t", ")", " ", "};", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "f4", "((", "x", ",)", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "x_", "=_", "str_", "(_", "ix_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "b1_", "-_", "b0_", ")_", "/_", "(_", "ix_", "+_", "1_", ")_", "/_", "1024_", "/_", "1024.", "0_", ",_", "\"", " ", "MB", " ", "per", " ", "for", " ", "a", " ", "total", " ", "of", " ", "\"_", ",_", "(_", "TC", "Mal", "loc", "Nat", "ive_", "._", "get", "Byte", "s", "Used_", "(_", ")_", "-_", "b0_", ")_", "/_", "1024_", "/_", "1024.", "0_", ",_", "\"", " ", "MB", " ", "allocated", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b1_", "=_", "TC", "Mal", "loc", "Nat", "ive_", "._", "get", "Byte", "s", "Used_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "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", "recursion", "\\u", "on", "\\u", "tuple", "s", "\\u", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "((", "),", " ", "so", "Far", ")", " ", "{", " ", "()", " ", "}", " ", "\\", "10", ";", " ", " ", " ", " ", "(", "x", ",", " ", "so", "Far", ")", " ", "{", " ", "(", "x", "[", "0", "]+", "so", "Far", ",)", " ", "+", " ", "f", "(", "x", "[", "1", ",]", ",", " ", "so", "Far", "+", "x", "[", "0", "])", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "((", "1", ",", "2", ",", "3", "),", " ", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"(.", "..", " ", "{", "Int64", "})\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "two", "\\u", "layer", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ",", " ", "res", " ", "=", " ", "0", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "x", " ", "==", " ", "0", ")", " ", "\\", "10", ";", " ", " ", "return", " ", "res", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "g", "(", "x", "-1", ",", "res", "+", "x", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "g", " ", "=", " ", "fun", "(", "x", ",", "res", ")", " ", "{", " ", "f", "(", "x", ",", "res", ")", " ", "*", " ", "2", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "f", "(", "1000", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "same", "\\u", "function", "\\u", "call", "ed", "\\u", "with", "\\u", "different", "\\u", "arguments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "x", ")", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "2", ";", " ", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "res", ">", "0", ")", " ", "{", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "-", " ", "1", ";", " ", "\\", "10", ";", " ", " ", "x", " ", "=", " ", "x", " ", "+", " ", "x", "\\", "10", ";", " ", " ", "};", " ", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "\\", "10", ";", " ", " ", " ", " ", "};", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "f", "(", "10", "),", "f", "(\"", "asd", "f", "\"))", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "frame_", ",_", "\"(", "{", "Int64", "},{", "String", "})\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hetero", "gene", "ous", "\\u", "vec", "\\u", "of", "\\u", "vec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "[[", "0", "],[", "\"", "1.0", "\"]", "][", "0", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"{", "Vector", "([", "{", "Int64", "}]", ")}", "\"_", ",_", "\"{", "Vector", "([", "{", "String", "}]", ")}", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "vector", "\\u", "recursion", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f", " ", "=", " ", "fun", "(", "v", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "size", "(", "v", ")", " ", "==", " ", "100", ")", "\\", "10", ";", " ", " ", "return", " ", "v", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "f", "([", "v", "[", "0", "],", " ", "[", "v", "[", "0", "]]]", ")", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "f", "([", "0", "])", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"{", "Vector", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "compre", "hens", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "[", "x", " ", "for", " ", "x", " ", "in", " ", "(", "1", ",", "2", ",", "3", ")]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"{", "Vector", "([", "{", "Int64", "}]", ")}", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "switch", "\\u", "is", "\\u", "exclu", "sive", "\\u", "and", "\\u", "disj", "oint_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "(", "x", ")", " ", "with", " ", "(", "1", ")", " ", "{", " ", "1", " ", "}", " ", "(\"", "2", "\")", " ", "{", " ", "2", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"{", "Int64", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alternatives", "Work", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "(", "#", "AS", "DF", "(", "z", ":", "x", "))", " ", "with", " ", "(", "#", "AS", "DF", "(", "z", ":", "x", "))", " ", "{", " ", "x", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "\"{", "Int64", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"{", "Int64", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hetero", "gene", "ous", "\\u", "vec", "\\u", "of", "\\u", "vec", "\\u", "function", "\\u", "apply_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "ix", " ", "=", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "v", " ", "=", " ", "[[", "0", "],[", "\"", "1.0", "\"]", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "(", "ix", " ", "<", " ", "size", "(", "v", "))\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "::", " ", "v", "[", "ix", "]", "\\", "10", ";", " ", " ", " ", " ", "ix", " ", "=", " ", "ix", " ", "+", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"{", "Vector", "([", "{", "Vector", "([", "{", "Int64", "}]", ")}", ",", " ", "{", "Vector", "([", "{", "String", "}]", ")}", "])", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "function", "\\u", "iteration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f1", " ", "=", " ", "{\\u", "+", "1", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f2", " ", "=", " ", "{\\u", "+", "2", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f3", " ", "=", " ", "{\\u", "+", "3", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f4", " ", "=", " ", "{\\u", "+", "4", "};", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "fs", " ", "=", " ", "(", "f1", ",", " ", "f2", ",", " ", "f3", ",", " ", "f4", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "f", " ", "in", " ", "fs", "\\", "10", ";", " ", " ", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "f", "(", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "frame_", ",_", "\"", "14", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tuple", "\\u", "function", "\\u", "iterati", "on2", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "self_", "._", "reason", "Abo", "ut", "Expression_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f1", " ", "=", " ", "{\\u", "+", "1", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f2", " ", "=", " ", "{\\u", "+", "2", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f3", " ", "=", " ", "{\\u", "+", "3", "};", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "f4", " ", "=", " ", "{\\u", "+", "4", "};", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "fs", " ", "=", " ", "(", "f1", ",", " ", "f2", ",", " ", "f3", ",", " ", "f4", ");", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "let", " ", "res", " ", "=", " ", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "f", " ", "in", " ", "fs", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "f2", " ", "in", " ", "fs", "\\", "10", ";", " ", " ", "res", " ", "=", " ", "res", " ", "+", " ", "f", "(", "1", ")", " ", "+", " ", "f2", "(", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "res", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "unknown", "Apply", "Nodes_", "(_", ")_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Frame", "Has", "Const", "ant", "Result_", "(_", "self_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", "._", "vals_", ")_", "==_", "1_", ",_", "frame_", "._", "exits", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "exits", "_", "(_", ")_", "._", "throw", "Part_", "(_", ")_", "._", "vals_", ")_", "==_", "0_", ",_", "frame_", "._", "exits", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", "[_", "0_", "]_", "._", "constant_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Frame", "Has", "Result", "JO", "V_", "(_", "self_", ",_", "frame_", ",_", "result", "JO", "V_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "result", "JO", "V_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "JO", "V_", "=_", "FOR", "AN", "ative_", "._", "parse", "String", "To", "JO", "V_", "(_", "result", "JO", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", "._", "vals_", ")_", "==_", "1_", ",_", "frame_", "._", "exits", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", "[_", "0_", "]_", ",_", "result", "JO", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Simple", "Forward", "Rea", "son", "er_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Frame", "Has", "Result", "JO", "Vs", "_", "(_", "self_", ",_", "frame_", ",_", "*_", "result", "JO", "Vs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "len_", "(_", "frame_", "._", "unknown", "Apply", "Nodes_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jo", "vs", "To", "Find_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result", "JO", "V_", "in_", "result", "JO", "Vs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "result", "JO", "V_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "JO", "V_", "=_", "FOR", "AN", "ative_", "._", "parse", "String", "To", "JO", "V_", "(_", "result", "JO", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jo", "vs", "To", "Find_", "._", "append_", "(_", "result", "JO", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "JO", "Vs", "_", "=_", "list_", "(_", "jo", "vs", "To", "Find_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "res_", "in_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "res_", "in_", "jo", "vs", "To", "Find_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Code", " ", "produce", "d", " ", "unexpected", " ", "JO", "V", ":", " ", "%", "s", ".", " ", "Result", " ", "was", " ", "%", "s", " ", "but", " ", "expected", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "res_", ",_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", ",_", "result", "JO", "Vs", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jo", "vs", "To", "Find_", "._", "remove_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "jo", "vs", "To", "Find_", ")_", "==_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Code", " ", "did", "n", "'", "t", " ", "produce", " ", "these", " ", "jo", "vs", ":", " ", "%", "s", ".", " ", "Produce", "d", " ", "%", "s", " ", "inst", "ead", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "jo", "vs", "To", "Find_", ",_", "frame_", "._", "exits", "_", "(_", ")_", "._", "result", "Part_", "(_", ")_", ")_", "\\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,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, 2, 2, 2, 2 ]
Unused local variable
alex/django-vcs/django_vcs/diff.py
[ { "content": " def _parse_udiff(self):\n info = self._parse_info()\n\n in_header = True\n header = []\n lineiter = iter(self.lines)\n files = []\n try:\n line = lineiter.next()\n while True:\n if not line.startswith('--- '):\n if in_header:\n header.append(line)\n line = lineiter.next()\n continue\n\n if header and all(o.strip() for o in header):\n files.append({'is_header': True, 'lines': header})\n header = []\n\n in_header = []\n chunks = []\n old, new = self._extract_rev(line, lineiter.next())\n files.append({\n 'is_header': False,\n 'old_filename': old[0],\n 'old_revision': old[1],\n 'new_filename': new[0],\n 'new_revision': new[1],\n 'chunks': chunks,\n })\n\n line = lineiter.next()\n while line:\n match = self._chunk_re.match(line)\n if not match:\n in_header = False\n break\n\n lines = []\n chunks.append(lines)\n\n old_line, old_end, new_line, new_end = [int(o or 1) for o in match.groups()]\n old_line -= 1\n new_line -= 1\n old_end += old_line\n new_end += new_line\n line = lineiter.next()\n\n while old_line < old_end or new_line < new_end:\n if line:\n command, line = line[0], line[1:]\n else:\n command = ' '\n affects_old = affects_new = False\n\n if command == '+':\n affects_new = True\n action = 'add'\n elif command == '-':\n affects_old = True\n action = 'del'\n else:\n affects_old = affects_new = True\n action = 'unmod'\n\n old_line += affects_old\n new_line += affects_new\n lines.append({\n 'old_lineno': affects_old and old_line or u'',\n 'new_lineno': affects_new and new_line or u'',\n 'action': action,\n 'line': line,\n })\n line = lineiter.next()\n except StopIteration:\n pass\n\n for file in files:\n if file['is_header']:\n continue\n for chunk in file['chunks']:\n lineiter = iter(chunk)\n first = True\n try:\n while True:\n line = lineiter.next()\n if line['action'] != 'unmod':\n nextline = lineiter.next()\n if nextline['action'] == 'unmod' or nextline['action'] == line['action']:\n continue\n self._highlight_line(line, nextline)\n except StopIteration:\n pass\n\n return files, info", "metadata": "root.DiffRenderer._parse_udiff", "header": "['class', 'DiffRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def _parse_info(self):\n nlines = len(self.lines)\n if not nlines:\n return\n firstline = self.lines[0]\n info = []\n\n # todo copy the HG stuff\n\n return info", "metadata": "root.DiffRenderer._parse_info", "header": "['class', 'DiffRenderer', '(', 'object', ')', ':', '___EOS___']", "index": 118 } ]
[ { "span": "first ", "start_line": 104, "start_column": 16, "end_line": 104, "end_column": 21 }, { "span": "firstline ", "start_line": 122, "start_column": 8, "end_line": 122, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Diff", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "udi", "ff_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "self_", "._", "\\u", "parse", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "header_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "iter_", "=_", "iter_", "(_", "self_", "._", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", "._", "startswith_", "(_", "'---", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "in", "\\u", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "header_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\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_", "header_", "and_", "all_", "(_", "o_", "._", "strip_", "(_", ")_", "for_", "o_", "in_", "header_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "files_", "._", "append_", "(_", "{_", "'", "is", "\\u", "header", "'_", ":_", "True_", ",_", "'", "lines", "'_", ":_", "header_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "header_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", ",_", "new_", "=_", "self_", "._", "\\u", "extract", "\\u", "rev_", "(_", "line_", ",_", "line", "iter_", "._", "next_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "header", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "filename", "'_", ":_", "old_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "revis", "ion", "'_", ":_", "old_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "filename", "'_", ":_", "new_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "revis", "ion", "'_", ":_", "new_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "chunks", "'_", ":_", "chunks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "match_", "=_", "self_", "._", "\\u", "chunk", "\\u", "re_", "._", "match_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "in", "\\u", "header_", "=_", "False_", "\\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_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunks_", "._", "append_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "line_", ",_", "old", "\\u", "end_", ",_", "new", "\\u", "line_", ",_", "new", "\\u", "end_", "=_", "[_", "int_", "(_", "o_", "or_", "1_", ")_", "for_", "o_", "in_", "match_", "._", "groups_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "line_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "line_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "end_", "+=_", "old", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "end_", "+=_", "new", "\\u", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "old", "\\u", "line_", "<_", "old", "\\u", "end_", "or_", "new", "\\u", "line_", "<_", "new", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "command_", ",_", "line_", "=_", "line_", "[_", "0_", "]_", ",_", "line_", "[_", "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 ", " ", " _", "command_", "=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "affect", "s", "\\u", "old_", "=_", "affect", "s", "\\u", "new_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "command_", "==_", "'+'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "affect", "s", "\\u", "new_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "'", "add", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "command_", "==_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "affect", "s", "\\u", "old_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "'", "del", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "affect", "s", "\\u", "old_", "=_", "affect", "s", "\\u", "new_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "'", "unmo", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "line_", "+=_", "affect", "s", "\\u", "old_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "line_", "+=_", "affect", "s", "\\u", "new_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "linen", "o", "'_", ":_", "affect", "s", "\\u", "old_", "and_", "old", "\\u", "line_", "or_", "u", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "linen", "o", "'_", ":_", "affect", "s", "\\u", "new_", "and_", "new", "\\u", "line_", "or_", "u", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "'_", ":_", "action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "'_", ":_", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\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_", "for_", "file_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", "[_", "'", "is", "\\u", "header", "'_", "]_", ":_", "\\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_", "for_", "chunk_", "in_", "file_", "[_", "'", "chunks", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "iter_", "=_", "iter_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first_", "=_", "True_", "\\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 ", " ", " _", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "[_", "'", "action", "'_", "]_", "!=_", "'", "unmo", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "next", "line_", "=_", "line", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "line_", "[_", "'", "action", "'_", "]_", "==_", "'", "unmo", "d", "'_", "or_", "next", "line_", "[_", "'", "action", "'_", "]_", "==_", "line_", "[_", "'", "action", "'_", "]_", ":_", "\\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_", "._", "\\u", "highlight", "\\u", "line_", "(_", "line_", ",_", "next", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\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_", "return_", "files_", ",_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Diff", "Renderer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nline", "s_", "=_", "len_", "(_", "self_", "._", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "nline", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "firstl", "ine_", "=_", "self_", "._", "lines_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "[_", "]_",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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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
SteveAbb/Vestigo/Vestigo/scan.py
[ { "content": "#!/usr/bin/env python\n\nimport pexpect\nimport subprocess\nimport thread\nfrom multiprocessing.pool import ThreadPool\nimport time\nfrom settings import Settings\nimport requests\nimport json\nfrom logger import Logger\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Scanner():\n\t\n\t\t\t\n\n\t\t\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\t\n\t\t\t\t", "metadata": "root.Scanner", "header": "['module', '___EOS___']", "index": 12 }, { "content": "\tdef __init__(self,settings,logger):\n\t\tself._logger=logger\n\t\tself._bleScanProc = None\n\t\tself._scanProc=None\n\t\tself._addrToRssi={}\n\t\tself._keepScanning=True\n\t\tself._settings=settings\n\t\tself._lastFetch=None\n\t\tself._nonDiscKeepScanning=True\n\t\tself._addresses=None", "metadata": "root.Scanner.__init__", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 13 }, { "content": "\tdef log(self,data):\n\t\tself._logger.log(data)", "metadata": "root.Scanner.log", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 24 }, { "content": "\tdef getAddresses(self,type=None):\n\t\tfetchNewAssets=False\n\t\tif(self._lastFetch is not None):\n\t\t\tif((time.time()-self._lastFetch)>int(self._settings.baseServer_Recache)):\n\t\t\t\tfetchNewAssets=True\n\t\telse:\n\t\t\tfetchNewAssets=True\n\t\t\n\t\tif(fetchNewAssets):\n\t\t\ttry:\n\t\t\t\tself._lastFetch=time.time()\n\t\t\t\tself.log(\"Recaching\")\n\t\t\t\tresp=requests.get(self._settings.baseServer_URL+\"/addresses/?reader=\"+self._settings.baseServer_Reader,timeout=int(self._settings.baseServer_Timeout))\n\t\t\t\tself._addresses=resp.json()\n\t\t\t\tself.log(\"Finished recache.\")\n\t\t\t\tself._nonDiscKeepScanning=False\n\t\t\texcept Exception,error:\n\t\t\t\tself.log(\"Error rechaching addresses: \"+str(error)+\". Will retry on next recache.\")\n\t\t\n\t\tif(type is None):\t\n\t\t\treturn self._addresses\n\t\telif(type is \"all\"):\n\t\t\treturn dict(self._addresses[\"ble\"].items() + self._addresses[\"disc\"].items()+self._addresses[\"nonDisc\"].items())\n\t\telse:\n\t\t\treturn self._addresses[type]", "metadata": "root.Scanner.getAddresses", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 27 }, { "content": "\tdef send_payload(self,addr,rssi):\n\t\tif(addr in self.getAddresses(\"all\")):\n\t\t\tself._addrToRssi[addr]=rssi;\n\t\t\tif(addr in self.getAddresses(\"ble\")):\n\t\t\t\ttype=\"BLE\"\n\t\t\telif(addr in self.getAddresses(\"disc\")):\n\t\t\t\ttype=\"Discoverable\"\n\t\t\telse:\n\t\t\t\ttype=\"Non-Discoverable\"\n\t\t\n\t\t\tif((type==\"BLE\" and self._settings.scanMode_LE) or (type==\"Discoverable\" and self._settings.scanMode_Disc) or (type==\"Non-Discoverable\" and self._settings.scanMode_NonDisc)):\n\t\t\t\ttry:\n\t\t\t\t\tpayload={\"reader\":self._settings.baseServer_Reader,\"name\":self.getAddresses(\"all\")[addr][\"name\"],\"address\":addr,\"rssi\":rssi,\"type\":type}\n\t\t\t\t\tself.log(\"Sending payload to: \"+self._settings.baseServer_URL)\n\t\t\t\t\tself.log(\"Payload:\")\n\t\t\t\t\tself.log(json.dumps(payload,indent=4))\n\t\t\t\t\theaders = {'content-type': 'application/json'}\n\t\t\t\t\tresp = requests.post(self._settings.baseServer_URL, data=json.dumps(payload), headers=headers,timeout=int(self._settings.baseServer_Timeout))\n\t\t\t\t\tself.log(\"Resp: \"+str(resp.status_code))\n\t\t\t\texcept Exception, error:\n\t\t\t\t\tself.log(\"Error with request: \"+str(error))", "metadata": "root.Scanner.send_payload", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 53 }, { "content": "\tdef scanProcessSpawner(self):\n\t\twhile self._keepScanning:\n\t\t\tself._scanProc = subprocess.Popen(['hcitool', 'scan'],cwd='/usr/bin',stderr=subprocess.STDOUT, stdout=subprocess.PIPE)\n\t\t\tself._scanProc.wait()\n\t\t\tif(self._settings.readTimeout_Disc>0):\n\t\t\t\ttime.sleep(self._settings.readTimeout_Disc)", "metadata": "root.Scanner.scanProcessSpawner", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 75 }, { "content": "\tdef nonDiscScanProcessSpawner(self,addr):\n\t\twhile (self._nonDiscKeepScanning):\n\t\t\tresult=pexpect.run(\"hcitool rssi \"+addr,timeout=None)\n\t\t\tif \"RSSI return value:\" not in result:\n\t\t\t\tpexpect.run(\"hcitool cc \"+addr,timeout=None)\n\t\t\telse:\n\t\t\t\trssi=result.rstrip().split(\": \")[1]\n\t\t\t\n\t\t\t\tif(addr in self._addrToRssi):\n\t\t\t\t\tif (rssi!=self._addrToRssi[addr]):\n\t\t\t\t\t\tself.send_payload(addr,rssi)\n\t\t\t\telse:\n\t\t\t\t\tself.send_payload(addr,rssi)\n\t\t\t\tif(self._settings.readTimeout_NonDisc>0):\n\t\t\t\t\ttime.sleep(self._settings.readTimeout_NonDisc)", "metadata": "root.Scanner.nonDiscScanProcessSpawner", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 82 }, { "content": "\tdef nonDiscScanPoolInitiate(self):\n\t\tpool = ThreadPool(processes=10)\n\t\twhile self._keepScanning:\n\t\t\tself.log(\"Mapping non-discoverable addresses to thread pool executors\")\n\t\t\tself._nonDiscKeepScanning=True\n\t\t\tpool.map(self.nonDiscScanProcessSpawner, self.getAddresses(\"nonDisc\").keys())", "metadata": "root.Scanner.nonDiscScanPoolInitiate", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 98 }, { "content": "\tdef bleScanProccessSpawnerAsync(self):\n\t\tself._bleScanProc = subprocess.Popen(['hcitool', 'lescan', '--duplicates'],cwd='/usr/bin',stderr=subprocess.STDOUT, stdout=subprocess.PIPE)", "metadata": "root.Scanner.bleScanProccessSpawnerAsync", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 105 }, { "content": "\tdef parseHcidump(self):\n\t\tself.log(\"Starting parse of hcidump stdout\")\n\t\tchild=pexpect.spawn(\"hcidump\",timeout=None)\n\t\twhile self._keepScanning:\n\t\t\tchild.expect(\"(([0-9A-F]{2}[:-]){5}([0-9A-F]{2}))\",timeout=None)\n\t\t\taddr=child.after\n\t\t\tif (addr in self.getAddresses(\"nonDisc\")):\n\t\t\t\tcontinue\n\t\t\tchild.expect(\"(-\\d{2})\",timeout=None)\n\t\t\trssi=child.after\n\t\n\t\t\tif(addr in self._addrToRssi):\n\t\t\t\tif (rssi!=self._addrToRssi[addr]):\n\t\t\t\t\tself.send_payload(addr,rssi)\n\t\t\telse:\n\t\t\t\tself.send_payload(addr,rssi)", "metadata": "root.Scanner.parseHcidump", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 108 }, { "content": "\tdef StartScanning(self):\n\t\tself.log(json.dumps(self.getAddresses(), indent=4))\n\t\tif(self._settings.scanMode_LE):\n\t\t\tself.log(\"Spawning BLE scan child proccess\")\n\t\t\tself.bleScanProccessSpawnerAsync()\n\t\tif(self._settings.scanMode_Disc):\n\t\t\tself.log(\"Spawning discoverable child process\")\n\t\t\tthread.start_new_thread (self.scanProcessSpawner, ())\n\t\tif(self._settings.scanMode_NonDisc):\n\t\t\tself.log(\"Initiating thread pool for non discoverable addresses\")\n\t\t\tthread.start_new_thread (self.nonDiscScanPoolInitiate, ())\n\t\tself.parseHcidump()", "metadata": "root.Scanner.StartScanning", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 125 }, { "content": "\tdef StopScanning(self):\n\t\tself._keepScanning=False\n\t\tif(self._settings.scanMode_LE):\n\t\t\tself.log(\"Killing low energy scan child process\")\n\t\t\tself.log(self._bleScanProc.pid)\n\t\t\ttry: self._bleScanProc.terminate()\n\t\t\texcept(OSError): pass\n\t\t\tself.log(\"Killed.\")\n\t\tif(self._settings.scanMode_Disc):\n\t\t\tself.log(\"Killing normal scan child process\")\n\t\t\tself.log(self._scanProc.pid)\n\t\t\ttry: self._scanProc.terminate() \n\t\t\texcept(OSError): pass\n\t\t\tself.log(\"Killed.\")", "metadata": "root.Scanner.StopScanning", "header": "['class', 'Scanner', '(', ')', ':', '___EOS___']", "index": 138 } ]
[ { "span": "from settings import Settings", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 29 }, { "span": "from logger import Logger", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 25 } ]
[]
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_", "pexpect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multiprocessing_", "._", "pool_", "import_", "Thread", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logger_", "import_", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "settings_", ",_", "logger_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "logger_", "=_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ble", "Sca", "n", "Proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "scan", "Proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "keep", "Scann", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "settings_", "=_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "Fe", "tch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "non", "Disc", "Keep", "Scann", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addresses_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "logger_", "._", "log_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Address", "es_", "(_", "self_", ",_", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "fetch", "New", "Asset", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "last", "Fe", "tch_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "(_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "self_", "._", "\\u", "last", "Fe", "tch_", ")_", ">_", "int_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Rec", "ache_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "fetch", "New", "Asset", "s_", "=_", "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\t", "\t\t_", "fetch", "New", "Asset", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "fetch", "New", "Asset", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "\\u", "last", "Fe", "tch_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Rec", "achi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "requests_", "._", "get_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "URL_", "+_", "\"/", "addresse", "s", "/?", "reader", "=\"_", "+_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Reader_", ",_", "timeout_", "=_", "int_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Timeout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "addresses_", "=_", "resp_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Finish", "ed", " ", "reca", "che", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "non", "Disc", "Keep", "Scann", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "log_", "(_", "\"", "Error", " ", "rech", "achi", "ng", " ", "addresse", "s", ":", " ", "\"_", "+_", "str_", "(_", "error_", ")_", "+_", "\".", " ", "Wil", "l", " ", "retr", "y", " ", "on", " ", "next", " ", "reca", "che", ".\"_", ")_", "\\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_", "(_", "type_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "\\u", "addresses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "type_", "is_", "\"", "all", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "dict_", "(_", "self_", "._", "\\u", "addresses_", "[_", "\"", "ble", "\"_", "]_", "._", "items_", "(_", ")_", "+_", "self_", "._", "\\u", "addresses_", "[_", "\"", "disc", "\"_", "]_", "._", "items_", "(_", ")_", "+_", "self_", "._", "\\u", "addresses_", "[_", "\"", "non", "Disc", "\"_", "]_", "._", "items_", "(_", ")_", ")_", "\\u\\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_", "return_", "self_", "._", "\\u", "addresses_", "[_", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "payload_", "(_", "self_", ",_", "addr_", ",_", "rssi", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "(_", "addr_", "in_", "self_", "._", "get", "Address", "es_", "(_", "\"", "all", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", "[_", "addr_", "]_", "=_", "rssi", "_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "addr_", "in_", "self_", "._", "get", "Address", "es_", "(_", "\"", "ble", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "type_", "=_", "\"", "BL", "E", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "addr_", "in_", "self_", "._", "get", "Address", "es_", "(_", "\"", "disc", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "type_", "=_", "\"", "Discover", "able", "\"_", "\\u\\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_", "type_", "=_", "\"", "Non", "-", "Discover", "able", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "type_", "==_", "\"", "BL", "E", "\"_", "and_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "LE_", ")_", "or_", "(_", "type_", "==_", "\"", "Discover", "able", "\"_", "and_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "Disc", "_", ")_", "or_", "(_", "type_", "==_", "\"", "Non", "-", "Discover", "able", "\"_", "and_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "Non", "Disc", "_", ")_", ")_", ":_", "\\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_", "payload_", "=_", "{_", "\"", "reader", "\"_", ":_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Reader_", ",_", "\"", "name", "\"_", ":_", "self_", "._", "get", "Address", "es_", "(_", "\"", "all", "\"_", ")_", "[_", "addr_", "]_", "[_", "\"", "name", "\"_", "]_", ",_", "\"", "address", "\"_", ":_", "addr_", ",_", "\"", "rssi", "\"_", ":_", "rssi", "_", ",_", "\"", "type", "\"_", ":_", "type_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Sen", "ding", " ", "payload", " ", "to", ":", " ", "\"_", "+_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Pay", "load", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "json_", "._", "dumps_", "(_", "payload_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "requests_", "._", "post_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "URL_", ",_", "data_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ",_", "headers_", "=_", "headers_", ",_", "timeout_", "=_", "int_", "(_", "self_", "._", "\\u", "settings_", "._", "base", "Server", "\\u", "Timeout_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Resp", ":", " ", "\"_", "+_", "str_", "(_", "resp_", "._", "status", "\\u", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "self_", "._", "log_", "(_", "\"", "Error", " ", "with", " ", "request", ":", " ", "\"_", "+_", "str_", "(_", "error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\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_", "scan", "Process", "Spawn", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "while_", "self_", "._", "\\u", "keep", "Scann", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "\\u", "scan", "Proc_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "hc", "ito", "ol", "'_", ",_", "'", "scan", "'_", "]_", ",_", "cwd_", "=_", "'/", "usr", "/", "bin", "'_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "scan", "Proc_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "read", "Time", "out", "\\u", "Disc", "_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "time_", "._", "sleep_", "(_", "self_", "._", "\\u", "settings_", "._", "read", "Time", "out", "\\u", "Disc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\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_", "non", "Disc", "Sca", "n", "Process", "Spawn", "er_", "(_", "self_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "while_", "(_", "self_", "._", "\\u", "non", "Disc", "Keep", "Scann", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "result_", "=_", "pexpect_", "._", "run_", "(_", "\"", "hc", "ito", "ol", " ", "rssi", " ", "\"_", "+_", "addr_", ",_", "timeout_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "RSS", "I", " ", "return", " ", "value", ":\"_", "not_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pexpect_", "._", "run_", "(_", "\"", "hc", "ito", "ol", " ", "cc", " ", "\"_", "+_", "addr_", ",_", "timeout_", "=_", "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\t", "\t\t\t_", "rssi", "_", "=_", "result_", "._", "rstrip_", "(_", ")_", "._", "split_", "(_", "\":", " ", "\"_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "addr_", "in_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "(_", "rssi", "_", "!=_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", "[_", "addr_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "self_", "._", "send", "\\u", "payload_", "(_", "addr_", ",_", "rssi", "_", ")_", "\\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\t\t_", "self_", "._", "send", "\\u", "payload_", "(_", "addr_", ",_", "rssi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "read", "Time", "out", "\\u", "Non", "Disc", "_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "time_", "._", "sleep_", "(_", "self_", "._", "\\u", "settings_", "._", "read", "Time", "out", "\\u", "Non", "Disc", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\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_", "non", "Disc", "Sca", "n", "Poo", "l", "Initiat", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pool_", "=_", "Thread", "Pool_", "(_", "processes_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "keep", "Scann", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Map", "ping", " ", "non", "-", "discove", "rab", "le", " ", "addresse", "s", " ", "to", " ", "thread", " ", "pool", " ", "executors", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "non", "Disc", "Keep", "Scann", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "._", "map_", "(_", "self_", "._", "non", "Disc", "Sca", "n", "Process", "Spawn", "er_", ",_", "self_", "._", "get", "Address", "es_", "(_", "\"", "non", "Disc", "\"_", ")_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ble", "Sca", "n", "Proc", "cess", "Spawn", "er", "Async", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "ble", "Sca", "n", "Proc_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "'", "hc", "ito", "ol", "'_", ",_", "'", "les", "can", "'_", ",_", "'--", "duplicat", "es", "'_", "]_", ",_", "cwd_", "=_", "'/", "usr", "/", "bin", "'_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Hc", "id", "ump_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "log_", "(_", "\"", "Start", "ing", " ", "parse", " ", "of", " ", "hc", "id", "ump", " ", "stdout", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "=_", "pexpect_", "._", "spawn_", "(_", "\"", "hc", "id", "ump", "\"_", ",_", "timeout_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "keep", "Scann", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "child_", "._", "expect_", "(_", "\"(", "([", "0", "-", "9", "A", "-", "F", "]{", "2", "}[", ":-", "])", "{", "5", "}([", "0", "-", "9", "A", "-", "F", "]{", "2", "}))", "\"_", ",_", "timeout_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "child_", "._", "after_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "addr_", "in_", "self_", "._", "get", "Address", "es_", "(_", "\"", "non", "Disc", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child_", "._", "expect_", "(_", "\"(", "-\\\\", "d", "{", "2", "})\"_", ",_", "timeout_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rssi", "_", "=_", "child_", "._", "after_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "addr_", "in_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "(_", "rssi", "_", "!=_", "self_", "._", "\\u", "addr", "To", "Rs", "si_", "[_", "addr_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "self_", "._", "send", "\\u", "payload_", "(_", "addr_", ",_", "rssi", "_", ")_", "\\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\t_", "self_", "._", "send", "\\u", "payload_", "(_", "addr_", ",_", "rssi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\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_", "Start", "Scann", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "log_", "(_", "json_", "._", "dumps_", "(_", "self_", "._", "get", "Address", "es_", "(_", ")_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "LE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Spawn", "ing", " ", "BL", "E", " ", "scan", " ", "child", " ", "proc", "cess", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ble", "Sca", "n", "Proc", "cess", "Spawn", "er", "Async", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "Disc", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Spawn", "ing", " ", "discove", "rab", "le", " ", "child", " ", "process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "self_", "._", "scan", "Process", "Spawn", "er_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "Non", "Disc", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Initiat", "ing", " ", "thread", " ", "pool", " ", "for", " ", "non", " ", "discove", "rab", "le", " ", "addresse", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start", "\\u", "new", "\\u", "thread_", "(_", "self_", "._", "non", "Disc", "Sca", "n", "Poo", "l", "Initiat", "e_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parse", "Hc", "id", "ump_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scanner_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Sto", "p", "Scann", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "self_", "._", "\\u", "keep", "Scann", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "LE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Kill", "ing", " ", "low", " ", "energ", "y", " ", "scan", " ", "child", " ", "process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "self_", "._", "\\u", "ble", "Sca", "n", "Proc_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "self_", "._", "\\u", "ble", "Sca", "n", "Proc_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "\"", "Kill", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u", "settings_", "._", "scan", "Mode", "\\u", "Disc", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "log_", "(_", "\"", "Kill", "ing", " ", "normal", " ", "scan", " ", "child", " ", "process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "self_", "._", "\\u", "scan", "Proc_", "._", "pid_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
anandology/pyjamas/examples/funnysortedgridthing/SortedGridThing.py
[ { "content": "import pyjd # this is dummy in pyjs.\nfrom pyjamas.ui.RootPanel import RootPanel\nfrom pyjamas.ui.Button import Button\nfrom pyjamas.ui.HTML import HTML\nfrom pyjamas.ui.HorizontalPanel import HorizontalPanel\nfrom pyjamas.ui.VerticalPanel import VerticalPanel\nfrom pyjamas.ui.DockPanel import DockPanel\nfrom pyjamas.ui.ScrollPanel import ScrollPanel\nfrom pyjamas.ui.Grid import Grid\nfrom pyjamas.ui.DisclosurePanel import DisclosurePanel\n\n\ndata = [[\"hello\", \"fred\", 52],\n [\"bye\", \"joe\", 98],\n [\"greetings\", \"alien\", 0],\n [\"sayonara\", \"jun\", 1],\n [\"gutentaag\", \"volker\", 2],\n [\"bonjour\", \"francois\", 5],\n [\"au reservoir\", \"fabrice\", 8],\n [\"go away\", \"mary\", 73]\n ]\n\nif __name__ == '__main__':\n pyjd.setup(\"public/SortedGridThing.html\")\n ogw = OddGridWidget(Width=\"600px\", Height=\"200px\", StyleName=\"ogw\")\n ogw.setData(data)\n dp = DisclosurePanel(\"Click to disclose / hide\", True, Width=\"602px\")\n dp.add(ogw)\n RootPanel().add(dp)\n pyjd.run()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OddGridWidget(DockPanel):\n\n\n\n\n", "metadata": "root.OddGridWidget", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, **kwargs):\n DockPanel.__init__(self, **kwargs)\n self.grid = Grid(StyleName=\"datagrid\")\n self.sp = ScrollPanel(self.grid, Width=\"100%\", Height=\"100%\")\n self.header = Grid(Height=\"50px\")\n self.add(self.header, DockPanel.NORTH)\n self.add(self.sp, DockPanel.CENTER)\n cf = self.setCellHeight(self.header, \"50px\")\n cf = self.setCellHeight(self.sp, \"100%\")\n\n self.sortcol = 0", "metadata": "root.OddGridWidget.__init__", "header": "['class', 'OddGridWidget', '(', 'DockPanel', ')', ':', '___EOS___']", "index": 13 }, { "content": " def setData(self, data):\n self.data = data\n self.redraw()", "metadata": "root.OddGridWidget.setData", "header": "['class', 'OddGridWidget', '(', 'DockPanel', ')', ':', '___EOS___']", "index": 25 }, { "content": " def sortfn(self, row1, row2):\n return cmp(row1[self.sortcol], row2[self.sortcol])", "metadata": "root.OddGridWidget.sortfn", "header": "['class', 'OddGridWidget', '(', 'DockPanel', ')', ':', '___EOS___']", "index": 29 }, { "content": " def redraw(self):\n self.data.sort(self.sortfn)\n\n rows = len(self.data)\n cols = 0\n if rows > 0:\n cols = len(self.data[0])\n\n self.grid.resize(rows, cols)\n self.header.resize(1, cols)\n\n cf = self.grid.getCellFormatter()\n\n for (nrow, row) in enumerate(self.data):\n for (ncol, item) in enumerate(row):\n self.grid.setHTML(nrow, ncol, str(item))\n cf.setWidth(nrow, ncol, \"200px\")\n\n cf = self.header.getCellFormatter()\n self.sortbuttons = []\n for ncol in range(cols):\n sb = Button(\"sort col %d\" % ncol)\n sb.addClickListener(self)\n self.header.setWidget(0, ncol, sb)\n cf.setWidth(0, ncol, \"200px\")\n self.sortbuttons.append(sb)", "metadata": "root.OddGridWidget.redraw", "header": "['class', 'OddGridWidget', '(', 'DockPanel', ')', ':', '___EOS___']", "index": 32 }, { "content": " def onClick(self, sender):\n for (ncol, b) in enumerate(self.sortbuttons):\n if sender == b:\n self.sortcol = ncol\n self.redraw()", "metadata": "root.OddGridWidget.onClick", "header": "['class', 'OddGridWidget', '(', 'DockPanel', ')', ':', '___EOS___']", "index": 59 } ]
[ { "span": "from pyjamas.ui.HTML import HTML", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 }, { "span": "from pyjamas.ui.HorizontalPanel import HorizontalPanel", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 54 }, { "span": "from pyjamas.ui.VerticalPanel import VerticalPanel", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pyj", "d_", "#", " ", "this", " ", "is", " ", "dummy", " ", "in", " ", "pyj", "s", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Roo", "t", "Panel_", "import_", "Roo", "t", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Button_", "import_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "HTML_", "import_", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Horiz", "onta", "l", "Panel_", "import_", "Horiz", "onta", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Vertica", "l", "Panel_", "import_", "Vertica", "l", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Dock", "Panel_", "import_", "Dock", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Scroll", "Panel_", "import_", "Scroll", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Grid_", "import_", "Grid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Disc", "los", "ure", "Panel_", "import_", "Disc", "los", "ure", "Panel_", "\\u\\u\\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_", "data_", "=_", "[_", "[_", "\"", "hell", "o", "\"_", ",_", "\"", "fre", "d", "\"_", ",_", "52_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "bye", "\"_", ",_", "\"", "jo", "e", "\"_", ",_", "98_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "greeting", "s", "\"_", ",_", "\"", "alie", "n", "\"_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "say", "ona", "ra", "\"_", ",_", "\"", "jun", "\"_", ",_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "gut", "enta", "ag", "\"_", ",_", "\"", "vol", "ker", "\"_", ",_", "2_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "bon", "jou", "r", "\"_", ",_", "\"", "franc", "ois", "\"_", ",_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "au", " ", "rese", "rvo", "ir", "\"_", ",_", "\"", "fab", "rice", "\"_", ",_", "8_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "go", " ", "awa", "y", "\"_", ",_", "\"", "mar", "y", "\"_", ",_", "73_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyj", "d_", "._", "setup_", "(_", "\"", "public", "/", "Sorte", "d", "Grid", "Thin", "g", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "w_", "=_", "Od", "d", "Grid", "Widget_", "(_", "Width_", "=_", "\"", "600", "px", "\"_", ",_", "Height_", "=_", "\"", "200", "px", "\"_", ",_", "Style", "Name_", "=_", "\"", "og", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "og", "w_", "._", "set", "Data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp_", "=_", "Disc", "los", "ure", "Panel_", "(_", "\"", "Click", " ", "to", " ", "discl", "ose", " ", "/", " ", "hide", "\"_", ",_", "True_", ",_", "Width_", "=_", "\"", "602", "px", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dp_", "._", "add_", "(_", "og", "w_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Roo", "t", "Panel_", "(_", ")_", "._", "add_", "(_", "dp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "d_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\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_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Dock", "Panel_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grid_", "=_", "Grid_", "(_", "Style", "Name_", "=_", "\"", "data", "grid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sp_", "=_", "Scroll", "Panel_", "(_", "self_", "._", "grid_", ",_", "Width_", "=_", "\"", "100", "%\"_", ",_", "Height_", "=_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header_", "=_", "Grid_", "(_", "Height_", "=_", "\"", "50", "px", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "self_", "._", "header_", ",_", "Dock", "Panel_", "._", "NOR", "TH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "self_", "._", "sp_", ",_", "Dock", "Panel_", "._", "CENTER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "=_", "self_", "._", "set", "Cel", "l", "Height_", "(_", "self_", "._", "header_", ",_", "\"", "50", "px", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "=_", "self_", "._", "set", "Cel", "l", "Height_", "(_", "self_", "._", "sp_", ",_", "\"", "100", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sort", "col_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sort", "fn_", "(_", "self_", ",_", "row1", "_", ",_", "row2", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cmp_", "(_", "row1", "_", "[_", "self_", "._", "sort", "col_", "]_", ",_", "row2", "_", "[_", "self_", "._", "sort", "col_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "redraw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "sort_", "(_", "self_", "._", "sort", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rows_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cols_", "=_", "len_", "(_", "self_", "._", "data_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "grid_", "._", "resize_", "(_", "rows_", ",_", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header_", "._", "resize_", "(_", "1_", ",_", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "=_", "self_", "._", "grid_", "._", "get", "Cel", "l", "Formatter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "nrow_", ",_", "row_", ")_", "in_", "enumerate_", "(_", "self_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "ncol_", ",_", "item_", ")_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grid_", "._", "set", "HTML_", "(_", "nrow_", ",_", "ncol_", ",_", "str_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "set", "Width_", "(_", "nrow_", ",_", "ncol_", ",_", "\"", "200", "px", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cf_", "=_", "self_", "._", "header_", "._", "get", "Cel", "l", "Formatter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sort", "buttons_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ncol_", "in_", "range_", "(_", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sb_", "=_", "Button_", "(_", "\"", "sort", " ", "col", " ", "%", "d", "\"_", "%_", "ncol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sb_", "._", "add", "Click", "Listener_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "header_", "._", "set", "Widget_", "(_", "0_", ",_", "ncol_", ",_", "sb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cf_", "._", "set", "Width_", "(_", "0_", ",_", "ncol_", ",_", "\"", "200", "px", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sort", "buttons_", "._", "append_", "(_", "sb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Od", "d", "Grid", "Widget_", "(_", "Dock", "Panel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Click_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "ncol_", ",_", "b_", ")_", "in_", "enumerate_", "(_", "self_", "._", "sort", "buttons_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "==_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sort", "col_", "=_", "ncol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", ")_", "\\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, 0, 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, 2, 0, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
munki/munkiwebadmin/reports/urls.py
[ { "content": "from django.conf.urls import patterns, include, url\n\nurlpatterns = patterns('reports.views',\n url(r'^index/*$', 'index'),\n url(r'^dashboard/*$', 'dashboard'),\n url(r'^$', 'overview'),\n url(r'^overview/*$', 'overview'),\n url(r'^detail/(?P<mac>[^/]+)$', 'detail'),\n url(r'^raw/(?P<mac>[^/]+)$', 'raw'),\n url(r'^submit/(?P<submission_type>[^/]+)$', 'submit'),\n url(r'^warranty/(?P<serial>[^/]+)$', 'warranty'),\n # for compatibilty with MunkiReport scripts\n url(r'^ip$', 'lookup_ip'),\n url(r'^(?P<submission_type>[^/]+)$', 'submit'),\n)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from django.conf.urls import patterns, include, url", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "include_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "'", "report", "s", ".", "views", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "index", "/*", "$'_", ",_", "'", "index", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "dash", "board", "/*", "$'_", ",_", "'", "dash", "board", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "$'_", ",_", "'", "over", "view", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "over", "view", "/*", "$'_", ",_", "'", "over", "view", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "deta", "il", "/(", "?", "P", "<", "mac", ">[", "^", "/]+", ")$'_", ",_", "'", "deta", "il", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "raw", "/(", "?", "P", "<", "mac", ">[", "^", "/]+", ")$'_", ",_", "'", "raw", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "submit", "/(", "?", "P", "<", "subm", "ission", "\\u", "type", ">[", "^", "/]+", ")$'_", ",_", "'", "submit", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "warr", "ant", "y", "/(", "?", "P", "<", "serial", ">[", "^", "/]+", ")$'_", ",_", "'", "warr", "ant", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "compa", "tib", "ilt", "y", " ", "with", " ", "Mun", "ki", "Report", " ", "scripts_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "ip", "$'_", ",_", "'", "look", "up", "\\u", "ip", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "r", "'", "^", "(?", "P", "<", "subm", "ission", "\\u", "type", ">[", "^", "/]+", ")$'_", ",_", "'", "submit", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
acabin/docphp/docphp.py
[ { "content": " def run(self, edit, event=None, at_point=False):\n global currentView\n view = self.view\n window = view.window()\n currentView = view\n if not languageExists():\n return\n tar = getTarHandler()\n symbol = None\n\n if at_point:\n symbol = view.substr(view.word(view.sel()[0]))\n\n files = list(docphp_languages[language][\"symbolList\"].keys())\n files.sort()\n\n def show(index):\n if index != -1:\n currentView.run_command('docphp_show_definition', {\"symbol\": files[index], \"force\": True})\n\n selected_index = -1\n if event:\n pt = view.window_to_text((event[\"x\"], event[\"y\"]))\n symbol, locations = sublime_symbol.symbol_at_point(view, pt)\n for prefix in ['function.', 'book.', 'class.']:\n try:\n selected_index = files.index(prefix + symbol)\n break\n except ValueError:\n pass\n currentView.window().show_quick_panel(files, show, selected_index=selected_index)", "metadata": "root.DocphpSearchCommand.run", "header": "['class', 'DocphpSearchCommand', '(', 'sublime_plugin', '.', 'TextCommand', ')', ':', '___EOS___']", "index": 725 } ]
[ { "span": "window ", "start_line": 728, "start_column": 8, "end_line": 728, "end_column": 14 }, { "span": "tar ", "start_line": 732, "start_column": 8, "end_line": 732, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Doc", "php", "Sear", "ch", "Command_", "(_", "sublim", "e\\u", "plugin_", "._", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "edit_", ",_", "event_", "=_", "None_", ",_", "at", "\\u", "point_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "current", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "self_", "._", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "view_", "._", "window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "View_", "=_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "language", "Exists_", "(_", ")_", ":_", "\\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_", "tar_", "=_", "get", "Tar", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "at", "\\u", "point_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "view_", "._", "substr_", "(_", "view_", "._", "word_", "(_", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "=_", "list_", "(_", "doc", "php", "\\u", "languages_", "[_", "language_", "]_", "[_", "\"", "symbol", "List", "\"_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "show_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "View_", "._", "run", "\\u", "command_", "(_", "'", "doc", "php", "\\u", "show", "\\u", "definit", "ion", "'_", ",_", "{_", "\"", "symbol", "\"_", ":_", "files_", "[_", "index_", "]_", ",_", "\"", "force", "\"_", ":_", "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_", "selecte", "d\\u", "index_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pt_", "=_", "view_", "._", "window", "\\u", "to", "\\u", "text_", "(_", "(_", "event_", "[_", "\"", "x", "\"_", "]_", ",_", "event_", "[_", "\"", "y", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", ",_", "locations_", "=_", "sublim", "e\\u", "symbol_", "._", "symbol", "\\u", "at", "\\u", "point_", "(_", "view_", ",_", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prefix_", "in_", "[_", "'", "function", ".'_", ",_", "'", "book", ".'_", ",_", "'", "class", ".'_", "]_", ":_", "\\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 ", " ", "_", "selecte", "d\\u", "index_", "=_", "files_", "._", "index_", "(_", "prefix_", "+_", "symbol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "View_", "._", "window_", "(_", ")_", "._", "show", "\\u", "quick", "\\u", "panel_", "(_", "files_", ",_", "show_", ",_", "selecte", "d\\u", "index_", "=_", "selecte", "d\\u", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
NumentaCorp/agamotto/agamotto/service.py
[ { "content": "def hasRunLevel(serviceName, runLevel):\n \"\"\"Parse chkconfig output and return True if serviceName is set to run at\n that runLevel\"\"\"\n try:\n raw = execute(\"chkconfig --list %s\" % (serviceName)).split()\n except:\n # chkconfig will exit non-zero if there are no entries for serviceName\n return False\n for stanza in raw[1:]:\n level = int(stanza[:1])\n status = stanza[2:]\n if runLevel == level and status == \"on\":\n return True\n return False", "metadata": "root.hasRunLevel", "header": "['module', '___EOS___']", "index": 18 } ]
[ { "span": "except:", "start_line": 23, "start_column": 2, "end_line": 23, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "has", "Run", "Level_", "(_", "service", "Name_", ",_", "run", "Level_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "chk", "config", " ", "output", " ", "and", " ", "return", " ", "Tru", "e", " ", "if", " ", "service", "Name", " ", "is", " ", "set", " ", "to", " ", "run", " ", "at", "\\", "10", ";", " ", " ", "tha", "t", " ", "run", "Leve", "l", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw_", "=_", "execute_", "(_", "\"", "chk", "config", " ", "--", "list", " ", "%", "s", "\"_", "%_", "(_", "service", "Name_", ")_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "chk", "config", " ", "will", " ", "exit", " ", "non", "-", "zero", " ", "if", " ", "there", " ", "are", " ", "no", " ", "entri", "es", " ", "for", " ", "service", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "stanza_", "in_", "raw_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "int_", "(_", "stanza_", "[_", ":_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "stanza_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "run", "Level_", "==_", "level_", "and_", "status_", "==_", "\"", "on", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
sassoftware/conary/conary_test/rephelp.py
[ { "content": " def __openRepository(self, serverIdx, resetDir, configValues, serverCache,\n serverName, sslCertAndKey, singleWorker):\n\n if serverCache is None:\n serverCache = self.servers\n server = serverCache.getCachedServer(serverIdx)\n SQLserver = sqlharness.start()\n if server is None:\n newServer = True\n server = serverCache.startServer(\n # ServerCache\n SQLserver=SQLserver,\n key=serverIdx,\n serverName=serverName,\n singleWorker=singleWorker,\n resetDir=resetDir,\n # ConaryServer\n sslCertAndKey=sslCertAndKey,\n withCache=True,\n configValues=configValues,\n )\n # We keep this open to stop others from reusing the port; tell the\n # code which tracks fd leaks so this doesn't reported\n if getattr(server, 'socket', None):\n self._expectedFdLeak(server.socket.fileno())\n else:\n newServer = False\n server.setNeedsReset()\n\n # make sure map is up to date\n self.cfg.repositoryMap.update(serverCache.getMap())\n\n # FIXME\n #serverPath, serverClass, serverDir, proxyClass, proxyPath = \\\n # serverCache.getServerClass('CONARY_SERVER', useSSL)\n #if newServer and proxyPath:\n # # if we're using a proxy, (re)start it with the right server map\n # proxyDir = os.path.dirname(self.reposDir) + '/proxy'\n # contents = ContentStore(proxyDir + '/contents')\n # if self.proxy:\n # self.proxy.stop()\n\n # if proxies is None and _httpProxy is not None:\n # # No proxies were specified, and we have an HTTP proxy. Use it\n # # for the Conary proxy\n # d = lambda: 1\n # _httpProxy.updateConfig(d)\n # pp = d.proxy\n # else:\n # pp = proxies\n\n # self.proxy = proxyClass('proxy', None,\n # contents, proxyPath, None,\n # proxyDir, resources.get_path(),\n # self.cfg.repositoryMap,\n # None, proxies = pp)\n # self.proxy.start()\n # global _proxy\n # _proxy = self.proxy\n\n #if self.proxy:\n # self.proxy.updateConfig(self.cfg)\n #elif _httpProxy:\n # _httpProxy.updateConfig(self.cfg)\n\n client = conaryclient.ConaryClient(self.cfg)\n repos = client.getRepos()\n\n label = versions.Label(\"%s@rpl:linux\" % server.getName())\n\n ## There may be other things that were not fully started yet, like HTTP\n ## caches and so on. We'll now try an end-to-end connection.\n\n #ready = False\n #count = 0\n #while count < 500:\n # try:\n # repos.troveNames(label)\n # ready = True\n # break\n # except repo_errors.OpenError:\n # pass\n\n # time.sleep(0.01)\n # count += 1\n #if not ready:\n # #import epdb, sys\n # #epdb.post_mortem(sys.exc_info()[2])\n\n # try:\n # self.stopRepository(serverIdx)\n # except:\n # pass\n # raise RuntimeError('unable to open networked repository: %s'\n # %str(e))\n\n if server.needsPGPKey and not server.configValues.get('readOnlyRepository'):\n ascKey = open(resources.get_archive('key.asc'), 'r').read()\n repos.addNewAsciiPGPKey(label, 'test', ascKey)\n server.clearNeedsPGPKey()\n return repos", "metadata": "root.RepositoryHelper.__openRepository", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 554 }, { "content": " def rollback(self, root, num = None, replaceFiles = False, tagScript = None,\n justDatabase = False, showInfoOnly = False,\n abortOnError = False, capsuleChangesets = []):\n # hack to allow the root as the first parameter\n if num is None and type(root) == int:\n num = root\n root = self.rootDir\n\n self.cfg.root = root\n client = conaryclient.ConaryClient(self.cfg)\n repos = self.openRepository()\n try:\n ret = client.applyRollback(\"r.%d\" % num,\n replaceFiles=replaceFiles,\n tagScript = tagScript,\n justDatabase = justDatabase,\n showInfoOnly = showInfoOnly,\n abortOnError = abortOnError,\n capsuleChangesets = capsuleChangesets)\n finally:\n client.close()\n return ret", "metadata": "root.RepositoryHelper.rollback", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 838 }, { "content": " def addCollection(self, name, version=None, strongList=None,\n weakRefList=None, calcSize=False, repos=None,\n defaultFlavor=None, createComps=False,\n existsOkay=False, redirect=None,\n changeSetFile = None, buildReqs=None,\n labelPath=None, sourceName=None,\n preUpdateScript = None, postInstallScript = None,\n postUpdateScript = None,\n preRollbackScript = None, postRollbackScript = None,\n preInstallScript = None, preEraseScript = None,\n postEraseScript = None,\n compatClass = None, flavor = None,\n loadedReqs=None, metadata=None, imageGroup = None,\n pathConflicts=None):\n if not repos:\n repos = self.openRepository()\n\n if isinstance(version, (list, tuple)):\n strongList = version\n version = None\n assert(strongList or redirect)\n\n if version is None and defaultFlavor is None:\n name, version, defaultFlavor = cmdline.parseTroveSpec(name)\n if not version:\n version = '1.0'\n\n version = self._cvtVersion(version)\n assert(':' not in name and not name.startswith('fileset'))\n\n if defaultFlavor is None:\n defaultFlavor = deps.Flavor()\n elif isinstance(defaultFlavor, str):\n defaultFlavor = deps.parseFlavor(defaultFlavor)\n\n fullList = {}\n\n if weakRefList is None:\n hasWeakRefs = False\n weakRefList = []\n else:\n hasWeakRefs = True\n\n idx = 0\n for weakRef, troveList in zip((False, True), (strongList, weakRefList)):\n for info in troveList:\n idx += 1\n trvFlavor = None\n trvVersion = None\n byDefault = True\n if isinstance(info, str):\n trvName = info\n if '=' in trvName or '[' in trvName:\n (trvName, trvVersion, trvFlavor) \\\n = cmdline.parseTroveSpec(trvName)\n elif isinstance(info, trove.Trove):\n (trvName, trvVersion, trvFlavor) \\\n = info.getNameVersionFlavor()\n elif len(info) == 1:\n (trvName,) = info\n elif len(info) == 2:\n (trvName, item) = info\n if isinstance(item, bool):\n byDefault = item\n else:\n trvVersion = item\n elif len(info) == 3:\n (trvName, trvVersion, trvFlavor) = info\n elif len(info) == 4:\n (trvName, trvVersion, trvFlavor, byDefault) = info\n else:\n assert(False)\n\n if trvVersion is None and trvFlavor is None:\n (trvName, trvVersion, trvFlavor) = \\\n cmdline.parseTroveSpec(trvName)\n\n if not trvVersion:\n trvVersion = version\n else:\n trvVersion = self._cvtVersion(trvVersion)\n\n if trvFlavor is None:\n trvFlavor = defaultFlavor\n elif type(trvFlavor) == str:\n trvFlavor = deps.parseFlavor(trvFlavor)\n\n if trvName[0] == ':':\n trvName = name + trvName\n\n if createComps and ':' in trvName:\n self.addComponent(trvName, trvVersion.freeze(),\n str(trvFlavor), filePrimer=idx, sourceName=sourceName)\n\n fullList[(trvName, trvVersion, trvFlavor)] = (byDefault,\n weakRef)\n if flavor:\n flavor = deps.parseFlavor(flavor, raiseError=True)\n else:\n flavor = deps.mergeFlavorList([x[2] for x in fullList],\n deps.DEP_MERGE_TYPE_DROP_CONFLICTS)\n\n if not hasWeakRefs:\n collList = [ x for x in fullList.iteritems() if trove.troveIsCollection(x[0][0])]\n troves = repos.getTroves([x[0] for x in collList], withFiles=False)\n\n for (troveTup, (byDefault, _)), trv in itertools.izip(collList,\n troves):\n for childInfo in trv.iterTroveList(strongRefs=True,\n weakRefs=True):\n childByDefault = (trv.includeTroveByDefault(*childInfo)\n and byDefault)\n currInfo = fullList.get(childInfo, None)\n if currInfo:\n childByDefult = currInfo[0] or childByDefault\n fullList[childInfo] = (childByDefault, currInfo[1])\n else:\n fullList[childInfo] = (childByDefault, True)\n\n if redirect is not None:\n redirectList = []\n for info in redirect:\n if info is None:\n redirectList.append((None, None, None))\n continue\n if not isinstance(info, (list, tuple)):\n info = [info]\n if len(info) == 1:\n redirName = info[0]\n redirBranch = version.branch()\n redirFlavor = flavor\n elif len(info) == 2:\n redirName, redirBranch = info\n redirBranch = versions.VersionFromString(redirBranch)\n redirFlavor = deps.parseFlavor('')\n else:\n redirName, redirBranch, redirFlavor = info\n redirBranch = versions.VersionFromString(redirBranch)\n redirFlavor = deps.parseFlavor(redirFlavor)\n redirectList.append((redirName, redirBranch, redirFlavor))\n\n # add a pkg diff\n if redirect is not None:\n troveType = trove.TROVE_TYPE_REDIRECT\n else:\n troveType = trove.TROVE_TYPE_NORMAL\n\n coll = trove.Trove(name, version, flavor, None, type=troveType)\n if existsOkay and repos.hasTrove(name, version, flavor):\n return repos.getTrove(name, version, flavor)\n\n coll.setIsCollection(True)\n coll.setSize(0) # None is widely used as a shortcut\n for info, (byDefault, weakRef) in fullList.iteritems():\n coll.addTrove(*info, **dict(byDefault=byDefault, weakRef=weakRef))\n if not sourceName:\n sourceName = name + ':source'\n coll.setSourceName(sourceName)\n coll.setBuildTime(1238075164.694746)\n\n if redirect:\n for toName, toBranch, toFlavor in redirectList:\n coll.addRedirect(toName, toBranch, toFlavor)\n else:\n coll.setProvides(deps.parseDep('trove: %s' % name))\n\n if buildReqs is not None:\n buildReqs = self.makeTroveTupleList(buildReqs)\n coll.setBuildRequirements(buildReqs)\n if loadedReqs:\n loadedReqs = self.makeTroveTupleList(loadedReqs)\n coll.setLoadedTroves(loadedReqs)\n\n if pathConflicts is not None:\n for path in pathConflicts:\n coll.troveInfo.pathConflicts.append(path)\n\n if labelPath:\n coll.setLabelPath(labelPath)\n\n if compatClass:\n coll.setCompatibilityClass(compatClass)\n\n for spec, script in \\\n [ (preUpdateScript, coll.troveInfo.scripts.preUpdate),\n (postInstallScript, coll.troveInfo.scripts.postInstall),\n (postUpdateScript, coll.troveInfo.scripts.postUpdate),\n (preRollbackScript, coll.troveInfo.scripts.preRollback),\n (postRollbackScript, coll.troveInfo.scripts.postRollback),\n (preInstallScript, coll.troveInfo.scripts.preInstall),\n (preEraseScript, coll.troveInfo.scripts.preErase),\n (postEraseScript, coll.troveInfo.scripts.postErase), ]:\n if spec is None: continue\n if type(spec) == str:\n spec = TroveScript(script = spec)\n\n script.script.set(spec.script)\n\n if spec.conversions:\n assert(compatClass)\n assert(isinstance(spec, RollbackScript))\n script.conversions.addList(\n (compatClass, x) for x in spec.conversions)\n\n if calcSize:\n compList = [x for x in fullList \\\n if not trove.troveIsCollection(x[0])]\n size = (x.getSize() \\\n for x in repos.getTroves(compList, withFiles=False))\n coll.setSize(sum(x for x in size if x is not None))\n\n if metadata:\n if not isinstance(metadata, (list, tuple)):\n metadata = [metadata]\n for item in metadata:\n coll.troveInfo.metadata.addItem(item)\n\n if imageGroup is not None:\n coll.troveInfo.imageGroup.set(imageGroup)\n\n coll.computeDigests()\n assert(redirect or list(coll.iterTroveList(strongRefs=True)))\n\n # create an absolute changeset\n cs = changeset.ChangeSet()\n diff = coll.diff(None, absolute = True)[0]\n cs.newTrove(diff)\n\n if changeSetFile:\n cs.addPrimaryTrove(coll.getName(), coll.getVersion(),\n coll.getFlavor())\n cs.writeToFile(changeSetFile)\n else:\n repos.commitChangeSet(cs)\n\n return coll", "metadata": "root.RepositoryHelper.addCollection", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1024 }, { "content": " def Component(self, troveName, version=None, flavor=None,\n fileContents=None,\n provides=deps.DependencySet(),\n requires=deps.DependencySet(),\n filePrimer=0, setConfigFlags=True,\n repos=None, existsOkay=False, pathIdSalt='',\n redirect=None, sourceName=None, metadata=None,\n factory=None, capsule=None,\n versus=None, buildTime=1238075164.694746):\n\n if isinstance(flavor, list):\n fileContents = flavor\n flavor = None\n elif isinstance(version, list):\n fileContents = version\n version = None\n\n if version is None and flavor is None:\n troveName, version, flavor = cmdline.parseTroveSpec(troveName)\n if not version:\n version = '1.0'\n if flavor is None:\n flavor = ''\n\n troveVersion = self._cvtVersion(version,\n source=troveName.endswith(':source'))\n isSource = troveName.endswith(':source')\n\n assert(':' in troveName or trove.troveIsFileSet(troveName))\n\n componentDir = self.workDir + \"/component\"\n if os.path.exists(componentDir):\n shutil.rmtree(componentDir)\n util.mkdirChain(componentDir)\n if isinstance(flavor, list):\n assert(fileContents is None)\n fileContents = flavor\n flavor = ''\n flavor = deps.parseFlavor(flavor)\n\n # add a pkg diff\n if redirect is not None:\n troveType = trove.TROVE_TYPE_REDIRECT\n else:\n troveType = trove.TROVE_TYPE_NORMAL\n\n # we create the trove with the wrong flavor here and fix it later\n # (by unioning in the file flavors)\n t = trove.Trove(troveName, troveVersion, flavor, None, type=troveType)\n\n # set up a file with some contents\n fileList = []\n if redirect is not None:\n redirectList = []\n assert(fileContents is None)\n for info in redirect:\n if info is None:\n continue\n\n if not isinstance(info, (list, tuple)):\n info = [info]\n if len(info) == 1:\n redirName = info[0]\n redirBranch = troveVersion.branch()\n redirFlavor = flavor\n elif len(info) == 2:\n redirName, redirBranch = info\n redirBranch = versions.VersionFromString(redirBranch)\n redirFlavor = None\n else:\n redirName, redirBranch, redirFlavor = info\n redirBranch = versions.VersionFromString(redirBranch)\n if redirFlavor is not None:\n redirFlavor = deps.parseFlavor(redirFlavor)\n redirectList.append((redirName, redirBranch, redirFlavor))\n else:\n if capsule:\n assert(capsule.endswith('.rpm'))\n f = files.FileFromFilesystem(capsule,\n trove.CAPSULE_PATHID)\n hdr = rpmhelper.readHeader(open(capsule))\n t.addRpmCapsule(os.path.basename(capsule),\n troveVersion,\n f.fileId(), hdr)\n fileList.append((f, trove.CAPSULE_PATHID,\n filecontents.FromFilesystem(capsule)))\n elif fileContents is None:\n path = '/contents%s' % filePrimer\n contents = 'hello, world!\\n'\n\n if not filePrimer:\n filePrimer = '\\0'\n filePrimer = str(filePrimer)\n # Pad it on the left with zeros, up to 16 chars long\n pathId = filePrimer.rjust(16, '\\1')\n pathId = pathId[0:16]\n\n contents = RegularFile(contents = contents, pathId = pathId,\n config = None)\n fileContents = [(path, contents)]\n\n index = 0\n for fileInfo in fileContents:\n fileReq = None\n fileProv = None\n fileFlavor = None\n\n if isinstance(fileInfo, str):\n fileInfo = [fileInfo, 'foo']\n\n fileName, contents = fileInfo[0:2]\n if isinstance(contents, filetypes._File):\n assert(len(fileInfo) == 2)\n else:\n if len(fileInfo) > 3:\n if isinstance(fileInfo[3], (list, tuple)):\n fileReq = fileInfo[3][0]\n fileProv = fileInfo[3][1]\n else:\n fileReq = fileInfo[3]\n\n if len(fileInfo) > 2 and fileInfo[2] is not None:\n fileVersion = self._cvtVersion(fileInfo[2])\n else:\n fileVersion = troveVersion\n\n contents = RegularFile(requires = fileReq,\n provides = fileProv,\n contents = contents)\n contents.version = fileVersion\n\n cont = componentDir + '/' + fileName\n dir = os.path.dirname(cont)\n if not os.path.exists(dir):\n util.mkdirChain(dir)\n\n pathId = contents.pathId\n if pathId is None:\n pathId = sha1helper.md5String(pathIdSalt + fileName)\n else:\n pathId += '0' * (16 - len(pathId))\n f = contents.get(pathId)\n\n f.flags.isSource(isSource)\n\n if contents.config is not None:\n f.flags.isConfig(contents.config)\n elif ((setConfigFlags and fileName.startswith('/etc'))\n or troveName.endswith(':source')):\n f.flags.isConfig(True)\n index += 1\n\n if capsule and not (f.flags.isConfig() or\n getattr(contents, 'isGhost', None)):\n # RBL-5684: we force ghost files to not be marked as\n # payload\n f.flags.isEncapsulatedContent(True)\n\n if contents.version:\n fileVersion = self._cvtVersion(contents.version)\n elif (versus and versus.hasFile(pathId) and\n versus.getFile(pathId)[1] == f.fileId()):\n # reuse file version if it hasn't changed\n fileVersion = versus.getFile(pathId)[2]\n else:\n fileVersion = troveVersion\n\n if not troveName.endswith(':source'):\n if fileName[0] != '/':\n fileName = '/' + fileName\n\n assert(len(pathId) == 16)\n t.addFile(pathId, fileName, fileVersion, f.fileId())\n\n if hasattr(contents, 'contents'):\n fileList.append((f, pathId, contents.contents))\n else:\n fileList.append((f, pathId, None))\n\n # find the flavor for this trove; it depends on the flavors of the\n # files\n for f, pathId, contents in fileList:\n flavor.union(f.flavor())\n t.changeFlavor(flavor)\n\n # create an absolute changeset\n cs = changeset.ChangeSet()\n\n if existsOkay and repos.hasTrove(troveName, troveVersion, flavor):\n return repos.getTrove(troveName, troveVersion, flavor), None\n\n if factory is not None:\n t.setFactory(factory)\n\n if not redirect:\n if isinstance(requires, str):\n req = deps.parseDep(requires)\n else:\n req = requires.copy()\n\n if isinstance(provides, str):\n prov = deps.parseDep(provides)\n else:\n prov = provides.copy()\n\n prov.union(deps.parseDep('trove: %s' % t.getName()))\n\n for f, pathId, contents in fileList:\n req.union(f.requires())\n prov.union(f.provides())\n\n t.setRequires(req)\n t.setProvides(prov)\n\n if not troveName.endswith(':source'):\n if not sourceName:\n sourceName = troveName.split(\":\")[0] + \":source\"\n t.setSourceName(sourceName)\n\n t.computePathHashes()\n\n t.setBuildTime(buildTime)\n\n if redirect:\n for toName, toBranch, toFlavor in redirectList:\n t.addRedirect(toName, toBranch, toFlavor)\n\n if redirect:\n for toName, toBranch, toFlavor in redirectList:\n t.addRedirect(toName, toBranch, toFlavor)\n\n size = 0\n # add the file and file contents\n for f, pathId, contents in fileList:\n cs.addFile(None, f.fileId(), f.freeze())\n if f.hasContents and not f.flags.isEncapsulatedContent():\n cs.addFileContents(pathId, f.fileId(),\n changeset.ChangedFileTypes.file, contents,\n f.flags.isConfig())\n size += f.contents.size()\n if metadata:\n if not isinstance(metadata, (tuple, list)):\n metadata = [metadata]\n for item in metadata:\n t.troveInfo.metadata.addItem(item)\n t.setSize(size)\n t.computeDigests()\n\n diff = t.diff(None, absolute = True)[0]\n cs.newTrove(diff)\n cs.setPrimaryTroveList([t.getNameVersionFlavor()])\n\n return t, cs", "metadata": "root.RepositoryHelper.Component", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1312 }, { "content": " def verifyNoFile(self, file):\n try:\n f = open(file, \"r\")\n except IOError, err:\n if err.errno == 2:\n return\n else:\n self.fail(\"verifyNoFile returned unexpected error code: %d\" % err.errno)\n else:\n self.fail(\"file exists: %s\" % file)", "metadata": "root.RepositoryHelper.verifyNoFile", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1771 }, { "content": " def updatePkg(self, root, pkg=[], version = None, tagScript = None,\n noScripts = False, keepExisting = False, replaceFiles = None,\n resolve = False, depCheck = True, justDatabase = False,\n flavor = None, recurse = True, sync = False,\n info = False, fromFiles = [], checkPathConflicts = True,\n test = False, migrate = False, keepRequired = None,\n raiseError = False, callback = None, restartInfo = None,\n applyCriticalOnly = False, syncChildren = False,\n keepJournal = False, noRestart=False,\n exactFlavors = False, replaceManagedFiles = False,\n replaceModifiedFiles = False, replaceUnmanagedFiles = False,\n replaceModifiedConfigFiles = False, skipCapsuleOps = False,\n criticalUpdateInfo = None, modelFile = None):\n\n if not isinstance(root, str) or not root[0] == '/':\n # hack to allow passing of rootdir as first argument\n # as we used to\n if isinstance(root, list):\n pkg = root\n else:\n pkg = [root]\n root = self.rootDir\n\n newcfg = self.cfg\n newcfg.root = root\n\n if callback is None:\n callback = callbacks.UpdateCallback()\n\n if replaceFiles is not None:\n replaceManagedFiles = replaceFiles\n replaceUnmanagedFiles = replaceFiles\n replaceModifiedFiles = replaceFiles\n replaceModifiedConfigFiles = replaceFiles\n\n repos = self.openRepository()\n if isinstance(pkg, (str, list)):\n if isinstance(pkg, str):\n if version is not None:\n if type(version) is not str:\n version = version.asString()\n item = \"%s=%s\" % (pkg, version)\n else:\n item = pkg\n\n if flavor is not None:\n item += '[%s]' % flavor\n\n pkgl = [ item ]\n\n else:\n assert(version is None)\n assert(flavor is None)\n\n pkgl = list(itertools.chain(*(util.braceExpand(x) for x in pkg)))\n # For consistency's sake, if in migrate mode, fake the command\n # line to say migrate\n if migrate:\n newSysArgv = [ 'conary', 'migrate' ]\n else:\n newSysArgv = [ 'conary', 'update' ]\n oldSysArgv = sys.argv\n\n # Add the packages to handle\n newSysArgv.extend(pkgl)\n\n newcfg.autoResolve = resolve\n try:\n if keepJournal:\n k = { 'keepJournal' : True }\n else:\n k = {}\n\n try:\n sys.argv = newSysArgv\n updatecmd.doUpdate(newcfg, pkgl,\n tagScript=tagScript,\n keepExisting=keepExisting,\n replaceManagedFiles=\\\n replaceManagedFiles,\n replaceUnmanagedFiles=\\\n replaceUnmanagedFiles,\n replaceModifiedFiles=\\\n replaceModifiedFiles,\n replaceModifiedConfigFiles=\\\n replaceModifiedConfigFiles,\n depCheck=depCheck,\n justDatabase=justDatabase,\n recurse=recurse, split=True,\n sync=sync, info=info,\n fromFiles=fromFiles,\n checkPathConflicts=checkPathConflicts,\n test=test, migrate=migrate,\n keepRequired=keepRequired,\n callback=callback,\n restartInfo=restartInfo,\n applyCriticalOnly=applyCriticalOnly,\n syncChildren=syncChildren,\n forceMigrate=migrate,\n noRestart=noRestart,\n exactFlavors=exactFlavors,\n criticalUpdateInfo=criticalUpdateInfo,\n skipCapsuleOps=skipCapsuleOps,\n noScripts=noScripts,\n systemModelFile=modelFile,\n **k)\n finally:\n sys.argv = oldSysArgv\n except conaryclient.DependencyFailure, msg:\n if raiseError:\n raise\n print msg\n except errors.InternalConaryError, err:\n raise\n except errors.ConaryError, msg:\n if raiseError:\n raise\n log.error(msg)\n else:\n # we have a changeset object; mimic what updatecmd does\n assert(not info)\n assert(not fromFiles)\n assert(not test)\n assert(checkPathConflicts)\n cl = conaryclient.ConaryClient(self.cfg)\n cl.setUpdateCallback(callback)\n job = [ (x[0], (None, None), (x[1], x[2]),\n not keepExisting) for x in\n pkg.getPrimaryTroveList() ]\n try:\n try:\n updJob, suggMap = cl.updateChangeSet(job,\n keepExisting = keepExisting,\n keepRequired = keepRequired,\n recurse = recurse, split = True,\n sync = sync,\n fromChangesets = [ pkg ])\n if depCheck:\n assert(not suggMap)\n if replaceFiles is None:\n replaceFiles = False\n # old applyUpdate API doesn't support separate args\n assert(not replaceManagedFiles)\n assert(not replaceUnmanagedFiles)\n assert(not replaceModifiedFiles)\n assert(not replaceModifiedConfigFiles)\n cl.applyUpdate(updJob, replaceFiles = replaceFiles,\n tagScript = tagScript, justDatabase = justDatabase,\n keepJournal = keepJournal)\n finally:\n updJob.close()\n cl.close()\n except conaryclient.DependencyFailure, msg:\n if raiseError:\n raise\n print msg\n except errors.InternalConaryError, err:\n raise\n except errors.ConaryError, err:\n if raiseError:\n raise\n log.error(err)", "metadata": "root.RepositoryHelper.updatePkg", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1958 }, { "content": " def buildRecipe(self, theClass, theName, vars = None, prep=False,\n macros = None,\n sourceVersion = None, d = None, serverIdx = 0,\n logLevel = None, ignoreDeps=False,\n logBuild=False, repos = None, groupOptions = None,\n resume = None, branch = None):\n use.setBuildFlagsFromFlavor(theName, self.cfg.buildFlavor)\n if logLevel is None:\n logLevel = log.WARNING\n\n if vars is None:\n vars = {}\n\n if macros is None:\n macros = {}\n\n if branch is None:\n if sourceVersion is not None:\n branch = sourceVersion.branch()\n else:\n branch = versions.Branch([self.cfg.buildLabel])\n\n built = []\n\n if repos is None:\n repos = self.openRepository()\n\n\n loader = LoaderFromString(theClass, \"/test.recipe\", cfg = self.cfg,\n repos = repos, objDict = d,\n component = theName)\n\n recipe = loader.getRecipe()\n\n for name in vars.iterkeys():\n setattr(recipe, name, vars[name])\n\n level = log.getVerbosity()\n log.setVerbosity(logLevel)\n built = self.cookObject(loader, prep=prep, macros=macros,\n sourceVersion=sourceVersion,\n serverIdx = serverIdx,\n ignoreDeps = ignoreDeps,\n logBuild = logBuild,\n repos = repos, groupOptions=groupOptions,\n resume = resume)\n log.setVerbosity(level)\n\n recipe = loader.getRecipe()\n\n # the rest of this is a horrible hack to allow the recipe from this\n # load to be used as a superclass later on\n del recipe.version\n recipe.internalAbstractBaseClass = True\n\n newD = {}\n if d:\n newD.update(d)\n newD[theName] = recipe\n\n return (built, newD)", "metadata": "root.RepositoryHelper.buildRecipe", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2253 }, { "content": " def checkUpdate(self, pkgList, expectedJob, depCheck=True,\n keepExisting = False, recurse = True,\n resolve = False, sync = False, replaceFiles = False,\n exactMatch = True, apply = False, erase = False,\n fromChangesets = [], syncChildren = False,\n updateOnly = False, resolveGroupList=[],\n syncUpdate = False, keepRequired = None,\n migrate = False, removeNotByDefault = False,\n oldMigrate = False, checkPrimaryPins = True,\n client=None, resolveSource=None):\n \"\"\" Performs an update as given to doUpdate, and checks the resulting\n job for correctness. If apply is True, then the job is applied\n as well.\n\n Parameters:\n pkgList: a list of troveSpecs to attempt to update (foo=3.3[bar])\n expectedJob: a list of changeSpecs that describe the contents\n of the expected update job.\n apply: actually apply the given job if it passes the check.\n\n the rest of the parameters are as with doUpdate.\n\n Acceptable formats for items in the expectedJob list:\n\n * foo matches foo being updated or installed\n * foo=--1.0 matches foo 1.0 is installed and nothing\n is removed\n * foo=1.0--2.0 matches update from 1.0 to 2.0\n * foo=1.0-- matches removal of 1.0\n\n Flavors are accepted as well. All portions are specified in\n trove spec format.\n \"\"\"\n if client:\n assert not resolve, \\\n \"Resolve cannot be specified when passing client\"\n cl = client\n else:\n if resolve:\n newcfg = copy.deepcopy(self.cfg)\n newcfg.autoResolve = resolve\n else:\n newcfg = self.cfg\n cl = conaryclient.ConaryClient(newcfg)\n\n repos = self.openRepository()\n if oldMigrate:\n syncUpdate = removeNotByDefault = True\n\n installMissing = syncUpdate\n\n areAbsolute = not keepExisting\n if isinstance(pkgList, str):\n pkgList = [pkgList]\n if isinstance(expectedJob, str):\n expectedJob = [expectedJob]\n\n pkgList = list(itertools.chain(*(util.braceExpand(x) for x in pkgList)))\n\n applyList = cmdline.parseChangeList(pkgList, keepExisting,\n updateByDefault=not erase)\n updJob, suggMap = cl.updateChangeSet(applyList,\n keepExisting = keepExisting,\n keepRequired = keepRequired,\n recurse = recurse, split = True, sync = sync,\n updateByDefault = not erase,\n fromChangesets = fromChangesets,\n resolveDeps=depCheck, syncChildren=syncChildren,\n updateOnly=updateOnly,\n resolveGroupList=resolveGroupList,\n installMissing=installMissing,\n removeNotByDefault=removeNotByDefault,\n migrate=migrate,\n checkPrimaryPins=checkPrimaryPins,\n resolveSource=resolveSource)\n if depCheck:\n assert(not suggMap or resolve)\n\n expectedJob = list(itertools.chain(*(util.braceExpand(x) for x in expectedJob)))\n self.checkJobList(updJob.getJobs(), expectedJob, exactMatch)\n\n if apply:\n cl.applyUpdate(updJob, replaceFiles = replaceFiles)\n updJob.close()", "metadata": "root.RepositoryHelper.checkUpdate", "header": "['class', 'RepositoryHelper', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 2406 }, { "content": " def start(self):\n if not os.path.exists(self.proxyBinPath):\n return None\n # We will start the proxy on these ports\n self.port, self.authPort = testhelp.findPorts(num = 2)\n\n self.writeConfigFile()\n\n stdout = open(os.devnull, \"w+\")\n stderr = open(os.devnull, \"w+\")\n # For debugging squid, uncomment the next line\n #stderr = None\n\n # Kill any existing proxies first\n p = subprocess.Popen(self.getStopCmd(), stdout=stderr, stderr=stderr)\n ret = p.wait()\n\n # Initialize cache\n p = subprocess.Popen(self.getInitCmd(), stdout=stderr, stderr=stderr)\n ret = p.wait()\n if ret != 0:\n raise Exception(\"Unable to init squid with config file %s: %s\" %\n (self.configFile, ret))\n\n # Start it\n p = subprocess.Popen(self.getStartCmd(), stdout=stderr, stderr=stderr)\n ret = p.wait()\n if ret != 0:\n raise Exception(\"Unable to start squid with config file %s: %s\" %\n (self.configFile, ret))\n\n # Wait till we can open a connection\n sock_utils.tryConnect(\"127.0.0.1\", self.port)\n\n # Save the pid, in case the directory gets removed\n # Loop several times if squid didn't have the chance to write the pid\n # file\n for i in range(10):\n if os.path.exists(self.pidFile):\n break\n time.sleep(0.1)\n else:\n # Give it several more seconds before failing\n time.sleep(2)\n self.pid = int(open(self.pidFile).readline().strip())\n\n self.stopped = False\n proxyUri = \"127.0.0.1:%s\" % self.port\n return proxyUri", "metadata": "root.HTTPProxy.start", "header": "['class', 'HTTPProxy', '(', 'base_server', '.', 'BaseServer', ')', ':', '___EOS___']", "index": 2882 } ]
[ { "span": "newServer ", "start_line": 562, "start_column": 12, "end_line": 562, "end_column": 21 }, { "span": "newServer ", "start_line": 580, "start_column": 12, "end_line": 580, "end_column": 21 }, { "span": "repos ", "start_line": 848, "start_column": 8, "end_line": 848, "end_column": 13 }, { "span": "childByDefult ", "start_line": 1138, "start_column": 24, "end_line": 1138, "end_column": 37 }, { "span": "fileFlavor ", "start_line": 1417, "start_column": 16, "end_line": 1417, "end_column": 26 }, { "span": "f ", "start_line": 1773, "start_column": 12, "end_line": 1773, "end_column": 13 }, { "span": "repos ", "start_line": 1993, "start_column": 8, "end_line": 1993, "end_column": 13 }, { "span": "branch ", "start_line": 2271, "start_column": 16, "end_line": 2271, "end_column": 22 }, { "span": "branch ", "start_line": 2273, "start_column": 16, "end_line": 2273, "end_column": 22 }, { "span": "repos ", "start_line": 2451, "start_column": 8, "end_line": 2451, "end_column": 13 }, { "span": "areAbsolute ", "start_line": 2457, "start_column": 8, "end_line": 2457, "end_column": 19 }, { "span": "stdout ", "start_line": 2890, "start_column": 8, "end_line": 2890, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "open", "Repository_", "(_", "self_", ",_", "server", "Idx_", ",_", "reset", "Dir_", ",_", "config", "Values_", ",_", "server", "Cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Name_", ",_", "ssl", "Cert", "And", "Key_", ",_", "single", "Worker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "server", "Cache_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "Cache_", "=_", "self_", "._", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "=_", "server", "Cache_", "._", "get", "Cache", "d", "Server_", "(_", "server", "Idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SQL", "server_", "=_", "sql", "harness_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "server_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Server_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "server", "Cache_", "._", "start", "Server_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Server", "Cache_", "\\u\\u\\uNL\\u\\u\\u_", "SQL", "server_", "=_", "SQL", "server_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "server", "Idx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Name_", "=_", "server", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "single", "Worker_", "=_", "single", "Worker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reset", "Dir_", "=_", "reset", "Dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Con", "ary", "Server_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "Cert", "And", "Key_", "=_", "ssl", "Cert", "And", "Key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "with", "Cache_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "Values_", "=_", "config", "Values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "keep", " ", "this", " ", "open", " ", "to", " ", "stop", " ", "other", "s", " ", "from", " ", "reus", "ing", " ", "the", " ", "port", ";", " ", "tell", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", " ", "whi", "ch", " ", "tracks", " ", "fd", " ", "leak", "s", " ", "so", " ", "this", " ", "doe", "sn", "'", "t", " ", "reporte", "d_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "getattr_", "(_", "server_", ",_", "'", "socket", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "expected", "Fd", "Leak", "_", "(_", "server_", "._", "socket_", "._", "fileno_", "(_", ")_", ")_", "\\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 ", " _", "new", "Server_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "set", "Ne", "eds", "Reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "map", " ", "is", " ", "up", " ", "to", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cfg_", "._", "repos", "itor", "y", "Map_", "._", "update_", "(_", "server", "Cache_", "._", "get", "Map_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME_", "\\u\\u\\uNL\\u\\u\\u_", "#", "server", "Path", ",", " ", "server", "Class", ",", " ", "server", "Dir", ",", " ", "proxy", "Class", ",", " ", "proxy", "Path", " ", "=", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "server", "Cache", ".", "get", "Server", "Class", "('", "CON", "ARY", "\\u", "SERVER", "',", " ", "use", "SS", "L", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "new", "Server", " ", "and", " ", "proxy", "Path", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "if", " ", "we", "'", "re", " ", "usi", "ng", " ", "a", " ", "proxy", ",", " ", "(", "re", ")", "start", " ", "it", " ", "with", " ", "the", " ", "right", " ", "server", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "proxy", "Dir", " ", "=", " ", "os", ".", "path", ".", "dir", "name", "(", "self", ".", "repos", "Dir", ")", " ", "+", " ", "'/", "proxy", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "content", "s", " ", "=", " ", "Conten", "t", "Stor", "e", "(", "proxy", "Dir", " ", "+", " ", "'/", "content", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".", "proxy", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "proxy", ".", "stop", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "prox", "ies", " ", "is", " ", "Non", "e", " ", "and", " ", "\\u", "http", "Pro", "xy", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "No", " ", "prox", "ies", " ", "wer", "e", " ", "specified", ",", " ", "and", " ", "we", " ", "have", " ", "an", " ", "HTTP", " ", "proxy", ".", " ", "Us", "e", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "for", " ", "the", " ", "Con", "ary", " ", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "d", " ", "=", " ", "lambda", ":", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "http", "Pro", "xy", ".", "update", "Config", "(", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pp", " ", "=", " ", "d", ".", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pp", " ", "=", " ", "proxies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "proxy", " ", "=", " ", "proxy", "Class", "('", "proxy", "',", " ", "Non", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "content", "s", ",", " ", "proxy", "Path", ",", " ", "Non", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "proxy", "Dir", ",", " ", "resource", "s", ".", "get", "\\u", "path", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "self", ".", "cfg", ".", "repos", "itor", "y", "Map", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "Non", "e", ",", " ", "prox", "ies", " ", "=", " ", "pp", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "proxy", ".", "start", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "global", " ", "\\u", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "proxy", " ", "=", " ", "self", ".", "proxy_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "proxy", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "proxy", ".", "update", "Config", "(", "self", ".", "cfg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "\\u", "http", "Pro", "xy", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "http", "Pro", "xy", ".", "update", "Config", "(", "self", ".", "cfg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "cona", "ry", "client_", "._", "Con", "ary", "Client_", "(_", "self_", "._", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "=_", "client_", "._", "get", "Repos", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "versions_", "._", "Label_", "(_", "\"%", "s", "@", "rpl", ":", "linux", "\"_", "%_", "server_", "._", "get", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "There", " ", "may", " ", "be", " ", "other", " ", "thing", "s", " ", "tha", "t", " ", "wer", "e", " ", "not", " ", "full", "y", " ", "start", "ed", " ", "ye", "t", ",", " ", "like", " ", "HTTP_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "cache", "s", " ", "and", " ", "so", " ", "on", ".", " ", "We", "'", "ll", " ", "now", " ", "try", " ", "an", " ", "end", "-", "to", "-", "end", " ", "connecti", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", "y", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "#", "count", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "le", " ", "count", " ", "<", " ", "500", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "repos", ".", "trove", "Names", "(", "label", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "read", "y", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "break_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "except", " ", "repo", "\\u", "error", "s", ".", "Open", "Error", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "time", ".", "sleep", "(", "0.01", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "count", " ", "+=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "read", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "import", " ", "ep", "db", ",", " ", "sys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", "ep", "db", ".", "post", "\\u", "mort", "em", "(", "sys", ".", "exc", "\\u", "info", "()[", "2", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "stop", "Repos", "itor", "y", "(", "server", "Id", "x", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "Run", "time", "Error", "('", "una", "ble", " ", "to", " ", "open", " ", "network", "ed", " ", "repos", "itor", "y", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "%", "str", "(", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "server_", "._", "need", "s", "PGP", "Key_", "and_", "not_", "server_", "._", "config", "Values_", "._", "get_", "(_", "'", "read", "On", "ly", "Repos", "itor", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asc", "Key_", "=_", "open_", "(_", "resources_", "._", "get", "\\u", "archive_", "(_", "'", "key", ".", "asc", "'_", ")_", ",_", "'", "r", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "._", "add", "New", "Asc", "ii", "PGP", "Key_", "(_", "label_", ",_", "'", "test", "'_", ",_", "asc", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "clear", "Ne", "eds", "PGP", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "repos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rollback_", "(_", "self_", ",_", "root_", ",_", "num_", "=_", "None_", ",_", "replace", "Files_", "=_", "False_", ",_", "tag", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "just", "Database_", "=_", "False_", ",_", "show", "Info", "Only_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abort", "On", "Error_", "=_", "False_", ",_", "capsule", "Change", "sets_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hack", " ", "to", " ", "allow", " ", "the", " ", "root", " ", "as", " ", "the", " ", "first", " ", "parameter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "num_", "is_", "None_", "and_", "type_", "(_", "root_", ")_", "==_", "int_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "self_", "._", "root", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cfg_", "._", "root_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "cona", "ry", "client_", "._", "Con", "ary", "Client_", "(_", "self_", "._", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "=_", "self_", "._", "open", "Repository_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "client_", "._", "appl", "y", "Roll", "back_", "(_", "\"", "r", ".", "%", "d", "\"_", "%_", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Files_", "=_", "replace", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "Script_", "=_", "tag", "Script_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "just", "Database_", "=_", "just", "Database_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "show", "Info", "Only_", "=_", "show", "Info", "Only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abort", "On", "Error_", "=_", "abort", "On", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "capsule", "Change", "sets_", "=_", "capsule", "Change", "sets_", ")_", "\\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 ", " _", "client_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Collection_", "(_", "self_", ",_", "name_", ",_", "version_", "=_", "None_", ",_", "strong", "List_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weak", "Ref", "List_", "=_", "None_", ",_", "calc", "Size_", "=_", "False_", ",_", "repos_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "Flavor_", "=_", "None_", ",_", "create", "Comp", "s_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "s", "Ok", "ay_", "=_", "False_", ",_", "redirect_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "change", "Set", "File_", "=_", "None_", ",_", "build", "Re", "qs_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label", "Path_", "=_", "None_", ",_", "source", "Name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Update", "Script_", "=_", "None_", ",_", "post", "Install", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "Update", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Roll", "back", "Script_", "=_", "None_", ",_", "post", "Roll", "back", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pre", "Install", "Script_", "=_", "None_", ",_", "pre", "Erase", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "Erase", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "Class_", "=_", "None_", ",_", "flavor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "ed", "Re", "qs_", "=_", "None_", ",_", "metadata_", "=_", "None_", ",_", "image", "Group_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path", "Confl", "icts", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repos_", "=_", "self_", "._", "open", "Repository_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "version_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strong", "List_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "strong", "List_", "or_", "redirect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "version_", "is_", "None_", "and_", "default", "Flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "version_", ",_", "default", "Flavor_", "=_", "cmdline_", "._", "parse", "Trove", "Spec_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "'", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "self_", "._", "\\u", "cvt", "Version_", "(_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "':'_", "not_", "in_", "name_", "and_", "not_", "name_", "._", "startswith_", "(_", "'", "filese", "t", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "default", "Flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "Flavor_", "=_", "deps_", "._", "Flavor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "default", "Flavor_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "Flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "default", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "List_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "weak", "Ref", "List_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "Wea", "k", "Refs", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weak", "Ref", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "Wea", "k", "Refs", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "weak", "Ref_", ",_", "trove", "List_", "in_", "zip_", "(_", "(_", "False_", ",_", "True_", ")_", ",_", "(_", "strong", "List_", ",_", "weak", "Ref", "List_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "info_", "in_", "trove", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "v", "Flavor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr", "v", "Version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "by", "Default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "info_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Name_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'='_", "in_", "tr", "v", "Name_", "or_", "'['_", "in_", "tr", "v", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ")_", "=_", "cmdline_", "._", "parse", "Trove", "Spec_", "(_", "tr", "v", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "info_", ",_", "trove_", "._", "Trove", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ")_", "=_", "info_", "._", "get", "Name", "Version", "Flavor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", ")_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", "item_", ")_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "item_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "by", "Default_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tr", "v", "Version_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ")_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ",_", "by", "Default_", ")_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tr", "v", "Version_", "is_", "None_", "and_", "tr", "v", "Flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ")_", "=_", "cmdline_", "._", "parse", "Trove", "Spec_", "(_", "tr", "v", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "tr", "v", "Version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Version_", "=_", "self_", "._", "\\u", "cvt", "Version_", "(_", "tr", "v", "Version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tr", "v", "Flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Flavor_", "=_", "default", "Flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "tr", "v", "Flavor_", ")_", "==_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "tr", "v", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tr", "v", "Name_", "[_", "0_", "]_", "==_", "':'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tr", "v", "Name_", "=_", "name_", "+_", "tr", "v", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "create", "Comp", "s_", "and_", "':'_", "in_", "tr", "v", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "add", "Component_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", "._", "freeze_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "tr", "v", "Flavor_", ")_", ",_", "file", "Prime", "r_", "=_", "idx_", ",_", "source", "Name_", "=_", "source", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "List_", "[_", "(_", "tr", "v", "Name_", ",_", "tr", "v", "Version_", ",_", "tr", "v", "Flavor_", ")_", "]_", "=_", "(_", "by", "Default_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weak", "Ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flavor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "flavor_", ",_", "raise", "Error_", "=_", "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 ", " _", "flavor_", "=_", "deps_", "._", "merge", "Fla", "vor", "List_", "(_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "full", "List_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deps_", "._", "DEP", "\\u", "MERGE", "\\u", "TYPE", "\\u", "DROP", "\\u", "CONF", "LIC", "TS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "has", "Wea", "k", "Refs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll", "List_", "=_", "[_", "x_", "for_", "x_", "in_", "full", "List_", "._", "iteritems_", "(_", ")_", "if_", "trove_", "._", "trove", "Is", "Collection_", "(_", "x_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trove", "s_", "=_", "repos_", "._", "get", "Trove", "s_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "coll", "List_", "]_", ",_", "with", "Files_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "trove", "Tup", "_", ",_", "(_", "by", "Default_", ",_", "\\u_", ")_", ")_", ",_", "tr", "v_", "in_", "itertools_", "._", "izip_", "(_", "coll", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trove", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child", "Info_", "in_", "tr", "v_", "._", "iter", "Trove", "List_", "(_", "strong", "Refs", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weak", "Refs", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "child", "By", "Default_", "=_", "(_", "tr", "v_", "._", "include", "Trove", "By", "Default_", "(_", "*_", "child", "Info_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "by", "Default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curr", "Info_", "=_", "full", "List_", "._", "get_", "(_", "child", "Info_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "curr", "Info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "child", "By", "Def", "ult_", "=_", "curr", "Info_", "[_", "0_", "]_", "or_", "child", "By", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "List_", "[_", "child", "Info_", "]_", "=_", "(_", "child", "By", "Default_", ",_", "curr", "Info_", "[_", "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 ", " ", " _", "full", "List_", "[_", "child", "Info_", "]_", "=_", "(_", "child", "By", "Default_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "redirect_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", "in_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redirec", "t", "List_", "._", "append_", "(_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "info_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "[_", "info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "info_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redir", "Name_", "=_", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "version_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Flavor_", "=_", "flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redir", "Name_", ",_", "redir", "Branch_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "versions_", "._", "Version", "Fro", "m", "String_", "(_", "redir", "Branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redir", "Name_", ",_", "redir", "Branch_", ",_", "redir", "Flavor_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "versions_", "._", "Version", "Fro", "m", "String_", "(_", "redir", "Branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "redir", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "redirec", "t", "List_", "._", "append_", "(_", "(_", "redir", "Name_", ",_", "redir", "Branch_", ",_", "redir", "Flavor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "pkg", " ", "diff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "redirect_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trove", "Type_", "=_", "trove_", "._", "TRO", "VE", "\\u", "TYPE", "\\u", "REDIRECT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trove", "Type_", "=_", "trove_", "._", "TRO", "VE", "\\u", "TYPE", "\\u", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll_", "=_", "trove_", "._", "Trove", "_", "(_", "name_", ",_", "version_", ",_", "flavor_", ",_", "None_", ",_", "type_", "=_", "trove", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exist", "s", "Ok", "ay_", "and_", "repos_", "._", "has", "Trove", "_", "(_", "name_", ",_", "version_", ",_", "flavor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repos_", "._", "get", "Trove", "_", "(_", "name_", ",_", "version_", ",_", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll_", "._", "set", "Is", "Collection_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "._", "set", "Size_", "(_", "0_", ")_", "#", " ", "Non", "e", " ", "is", " ", "wide", "ly", " ", "used", " ", "as", " ", "a", " ", "shortcut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", ",_", "(_", "by", "Default_", ",_", "weak", "Ref_", ")_", "in_", "full", "List_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "add", "Trove", "_", "(_", "*_", "info_", ",_", "**_", "dict_", "(_", "by", "Default_", "=_", "by", "Default_", ",_", "weak", "Ref_", "=_", "weak", "Ref_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "source", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "Name_", "=_", "name_", "+_", "':", "source", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll_", "._", "set", "Sou", "rce", "Name_", "(_", "source", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "._", "set", "Build", "Time_", "(_", "123", "807", "516", "4.6", "947", "46_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", "in_", "redirec", "t", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "add", "Redirect_", "(_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", ")_", "\\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 ", " _", "coll_", "._", "set", "Prov", "ides", "_", "(_", "deps_", "._", "parse", "Dep", "_", "(_", "'", "trove", ":", " ", "%", "s", "'_", "%_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "build", "Re", "qs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "Re", "qs_", "=_", "self_", "._", "make", "Trove", "Tup", "le", "List_", "(_", "build", "Re", "qs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "._", "set", "Build", "Requirements", "_", "(_", "build", "Re", "qs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "load", "ed", "Re", "qs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load", "ed", "Re", "qs_", "=_", "self_", "._", "make", "Trove", "Tup", "le", "List_", "(_", "load", "ed", "Re", "qs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "._", "set", "Load", "ed", "Trove", "s_", "(_", "load", "ed", "Re", "qs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "path", "Confl", "icts", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "path_", "in_", "path", "Confl", "icts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "trove", "Info_", "._", "path", "Confl", "icts", "_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "label", "Path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "set", "Label", "Path_", "(_", "label", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compa", "t", "Class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "set", "Compat", "ibi", "lit", "y", "Class_", "(_", "compa", "t", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "spec_", ",_", "script_", "in_", "[_", "(_", "pre", "Update", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "pre", "Update_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "post", "Install", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "post", "Install_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "post", "Update", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "post", "Update_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "pre", "Roll", "back", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "pre", "Roll", "back_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "post", "Roll", "back", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "post", "Roll", "back_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "pre", "Install", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "pre", "Install_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "pre", "Erase", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "pre", "Erase", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "post", "Erase", "Script_", ",_", "coll_", "._", "trove", "Info_", "._", "scripts_", "._", "post", "Erase", "_", ")_", ",_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "spec_", "is_", "None_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "spec_", ")_", "==_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "=_", "Trove", "Script_", "(_", "script_", "=_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script_", "._", "script_", "._", "set_", "(_", "spec_", "._", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "spec_", "._", "conversions", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "compa", "t", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "isinstance_", "(_", "spec_", ",_", "Roll", "back", "Script_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "conversions", "_", "._", "add", "List_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "compa", "t", "Class_", ",_", "x_", ")_", "for_", "x_", "in_", "spec_", "._", "conversions", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "calc", "Size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp", "List_", "=_", "[_", "x_", "for_", "x_", "in_", "full", "List_", "if_", "not_", "trove_", "._", "trove", "Is", "Collection_", "(_", "x_", "[_", "0_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "(_", "x_", "._", "get", "Size_", "(_", ")_", "for_", "x_", "in_", "repos_", "._", "get", "Trove", "s_", "(_", "comp", "List_", ",_", "with", "Files_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "._", "set", "Size_", "(_", "sum_", "(_", "x_", "for_", "x_", "in_", "size_", "if_", "x_", "is_", "not_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "metadata_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "=_", "[_", "metadata_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "trove", "Info_", "._", "metadata_", "._", "add", "Item_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "image", "Group_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coll_", "._", "trove", "Info_", "._", "image", "Group_", "._", "set_", "(_", "image", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coll_", "._", "compute", "Dig", "ests", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "redirect_", "or_", "list_", "(_", "coll_", "._", "iter", "Trove", "List_", "(_", "strong", "Refs", "_", "=_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "an", " ", "abs", "olute", " ", "changeset_", "\\u\\u\\uNL\\u\\u\\u_", "cs_", "=_", "changeset_", "._", "Change", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff_", "=_", "coll_", "._", "diff_", "(_", "None_", ",_", "absolute_", "=_", "True_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "._", "new", "Trove", "_", "(_", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "change", "Set", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "._", "add", "Prim", "ary", "Trove", "_", "(_", "coll_", "._", "get", "Name_", "(_", ")_", ",_", "coll_", "._", "get", "Version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coll_", "._", "get", "Flavor_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "._", "write", "To", "File_", "(_", "change", "Set", "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 ", " _", "repos_", "._", "commit", "Change", "Set_", "(_", "cs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "coll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Component_", "(_", "self_", ",_", "trove", "Name_", ",_", "version_", "=_", "None_", ",_", "flavor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Contents_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "deps_", "._", "Dependenc", "y", "Set_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "deps_", "._", "Dependenc", "y", "Set_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Prime", "r_", "=_", "0_", ",_", "set", "Config", "Flags_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repos_", "=_", "None_", ",_", "exist", "s", "Ok", "ay_", "=_", "False_", ",_", "path", "Id", "Sal", "t_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "=_", "None_", ",_", "source", "Name_", "=_", "None_", ",_", "metadata_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "factory_", "=_", "None_", ",_", "capsule", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vers", "us_", "=_", "None_", ",_", "build", "Time_", "=_", "123", "807", "516", "4.6", "947", "46_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "flavor_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Contents_", "=_", "flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "version_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Contents_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "version_", "is_", "None_", "and_", "flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trove", "Name_", ",_", "version_", ",_", "flavor_", "=_", "cmdline_", "._", "parse", "Trove", "Spec_", "(_", "trove", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "'", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flavor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "trove", "Version_", "=_", "self_", "._", "\\u", "cvt", "Version_", "(_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "trove", "Name_", "._", "endswith_", "(_", "':", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Source_", "=_", "trove", "Name_", "._", "endswith_", "(_", "':", "source", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "':'_", "in_", "trove", "Name_", "or_", "trove_", "._", "trove", "Is", "File", "Set_", "(_", "trove", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "component", "Dir_", "=_", "self_", "._", "work", "Dir_", "+_", "\"/", "component", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "component", "Dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "component", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "util_", "._", "mkd", "ir", "Chain_", "(_", "component", "Dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "flavor_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "file", "Contents_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Contents_", "=_", "flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flavor_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "pkg", " ", "diff_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "redirect_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trove", "Type_", "=_", "trove_", "._", "TRO", "VE", "\\u", "TYPE", "\\u", "REDIRECT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trove", "Type_", "=_", "trove_", "._", "TRO", "VE", "\\u", "TYPE", "\\u", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "create", " ", "the", " ", "trove", " ", "with", " ", "the", " ", "wrong", " ", "flavor", " ", "here", " ", "and", " ", "fix", " ", "it", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "by", " ", "uni", "oni", "ng", " ", "in", " ", "the", " ", "file", " ", "flavor", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "trove_", "._", "Trove", "_", "(_", "trove", "Name_", ",_", "trove", "Version_", ",_", "flavor_", ",_", "None_", ",_", "type_", "=_", "trove", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "up", " ", "a", " ", "file", " ", "with", " ", "some", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "file", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "redirect_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "file", "Contents_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", "in_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "info_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "[_", "info_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "info_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redir", "Name_", "=_", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "trove", "Version_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Flavor_", "=_", "flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "info_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "redir", "Name_", ",_", "redir", "Branch_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "versions_", "._", "Version", "Fro", "m", "String_", "(_", "redir", "Branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Flavor_", "=_", "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 ", " ", "_", "redir", "Name_", ",_", "redir", "Branch_", ",_", "redir", "Flavor_", "=_", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redir", "Branch_", "=_", "versions_", "._", "Version", "Fro", "m", "String_", "(_", "redir", "Branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "redir", "Flavor_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "redir", "Flavor_", "=_", "deps_", "._", "parse", "Flavor_", "(_", "redir", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "redirec", "t", "List_", "._", "append_", "(_", "(_", "redir", "Name_", ",_", "redir", "Branch_", ",_", "redir", "Flavor_", ")_", ")_", "\\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_", "capsule", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "capsule", "_", "._", "endswith_", "(_", "'.", "rpm", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "files_", "._", "File", "Fro", "m", "Files", "ystem_", "(_", "capsule", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trove_", "._", "CAPS", "UL", "E", "\\u", "PATH", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "rpm", "helper_", "._", "read", "Header_", "(_", "open_", "(_", "capsule", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "Rp", "m", "Caps", "ule_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "capsule", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trove", "Version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "file", "Id_", "(_", ")_", ",_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "List_", "._", "append_", "(_", "(_", "f_", ",_", "trove_", "._", "CAPS", "UL", "E", "\\u", "PATH", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fileco", "ntent", "s_", "._", "Fro", "m", "Files", "ystem_", "(_", "capsule", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file", "Contents_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "'/", "content", "s", "%", "s", "'_", "%_", "file", "Prime", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "'", "hell", "o", ",", " ", "world", "!\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "file", "Prime", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "Prime", "r_", "=_", "'\\\\", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Prime", "r_", "=_", "str_", "(_", "file", "Prime", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pad", " ", "it", " ", "on", " ", "the", " ", "left", " ", "with", " ", "zero", "s", ",", " ", "up", " ", "to", " ", "16", " ", "char", "s", " ", "long_", "\\u\\u\\uNL\\u\\u\\u_", "path", "Id_", "=_", "file", "Prime", "r_", "._", "rjust_", "(_", "16_", ",_", "'\\\\", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "Id_", "=_", "path", "Id_", "[_", "0_", ":_", "16_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "Regula", "r", "File_", "(_", "contents_", "=_", "contents_", ",_", "path", "Id_", "=_", "path", "Id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Contents_", "=_", "[_", "(_", "path_", ",_", "contents_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "Info_", "in_", "file", "Contents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "Req_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Prov", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Flavor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "file", "Info_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "Info_", "=_", "[_", "file", "Info_", ",_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "Name_", ",_", "contents_", "=_", "file", "Info_", "[_", "0_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "contents_", ",_", "filetypes_", "._", "\\u", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "(_", "len_", "(_", "file", "Info_", ")_", "==_", "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 ", " ", "_", "if_", "len_", "(_", "file", "Info_", ")_", ">_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "file", "Info_", "[_", "3_", "]_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "Req_", "=_", "file", "Info_", "[_", "3_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Prov", "_", "=_", "file", "Info_", "[_", "3_", "]_", "[_", "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 ", " ", " _", "file", "Req_", "=_", "file", "Info_", "[_", "3_", "]_", "\\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_", "(_", "file", "Info_", ")_", ">_", "2_", "and_", "file", "Info_", "[_", "2_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "Version_", "=_", "self_", "._", "\\u", "cvt", "Version_", "(_", "file", "Info_", "[_", "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 ", " ", " _", "file", "Version_", "=_", "trove", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "contents_", "=_", "Regula", "r", "File_", "(_", "requires_", "=_", "file", "Req_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "file", "Prov", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "._", "version_", "=_", "file", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cont_", "=_", "component", "Dir_", "+_", "'/'_", "+_", "file", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "cont_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "util_", "._", "mkd", "ir", "Chain_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path", "Id_", "=_", "contents_", "._", "path", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path", "Id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path", "Id_", "=_", "sha1", "helper_", "._", "md5", "String_", "(_", "path", "Id", "Sal", "t_", "+_", "file", "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 ", " ", "_", "path", "Id_", "+=_", "'", "0", "'_", "*_", "(_", "16_", "-_", "len_", "(_", "path", "Id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "contents_", "._", "get_", "(_", "path", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "flags_", "._", "is", "Source_", "(_", "is", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "contents_", "._", "config_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "flags_", "._", "is", "Config_", "(_", "contents_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "set", "Config", "Flags_", "and_", "file", "Name_", "._", "startswith_", "(_", "'/", "etc", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "trove", "Name_", "._", "endswith_", "(_", "':", "source", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "flags_", "._", "is", "Config_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "capsule", "_", "and_", "not_", "(_", "f_", "._", "flags_", "._", "is", "Config_", "(_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "contents_", ",_", "'", "is", "Ghost", "'_", ",_", "None_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "RB", "L", "-", "568", "4", ":", " ", "we", " ", "force", " ", "ghost", " ", "files", " ", "to", " ", "not", " ", "be", " ", "marked", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "payload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "._", "flags_", "._", "is", "Enca", "psu", "late", "d", "Content_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contents_", "._", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "Version_", "=_", "self_", "._", "\\u", "cvt", "Version_", "(_", "contents_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "vers", "us_", "and_", "vers", "us_", "._", "has", "File_", "(_", "path", "Id_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "vers", "us_", "._", "get", "File_", "(_", "path", "Id_", ")_", "[_", "1_", "]_", "==_", "f_", "._", "file", "Id_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reus", "e", " ", "file", " ", "version", " ", "if", " ", "it", " ", "hasn", "'", "t", " ", "changed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "Version_", "=_", "vers", "us_", "._", "get", "File_", "(_", "path", "Id_", ")_", "[_", "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 ", " ", "_", "file", "Version_", "=_", "trove", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "trove", "Name_", "._", "endswith_", "(_", "':", "source", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "file", "Name_", "[_", "0_", "]_", "!=_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "file", "Name_", "=_", "'/'_", "+_", "file", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "path", "Id_", ")_", "==_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "add", "File_", "(_", "path", "Id_", ",_", "file", "Name_", ",_", "file", "Version_", ",_", "f_", "._", "file", "Id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "contents_", ",_", "'", "content", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "List_", "._", "append_", "(_", "(_", "f_", ",_", "path", "Id_", ",_", "contents_", "._", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "file", "List_", "._", "append_", "(_", "(_", "f_", ",_", "path", "Id_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "flavor", " ", "for", " ", "this", " ", "trove", ";", " ", "it", " ", "depend", "s", " ", "on", " ", "the", " ", "flavor", "s", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "files_", "\\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_", "f_", ",_", "path", "Id_", ",_", "contents_", "in_", "file", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flavor_", "._", "union_", "(_", "f_", "._", "flavor_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "change", "Flavor_", "(_", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "an", " ", "abs", "olute", " ", "changeset_", "\\u\\u\\uNL\\u\\u\\u_", "cs_", "=_", "changeset_", "._", "Change", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exist", "s", "Ok", "ay_", "and_", "repos_", "._", "has", "Trove", "_", "(_", "trove", "Name_", ",_", "trove", "Version_", ",_", "flavor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repos_", "._", "get", "Trove", "_", "(_", "trove", "Name_", ",_", "trove", "Version_", ",_", "flavor_", ")_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "factory_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "set", "Factory_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "requires_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "deps_", "._", "parse", "Dep", "_", "(_", "requires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "requires_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "provides_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prov_", "=_", "deps_", "._", "parse", "Dep", "_", "(_", "provides_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prov_", "=_", "provides_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prov_", "._", "union_", "(_", "deps_", "._", "parse", "Dep", "_", "(_", "'", "trove", ":", " ", "%", "s", "'_", "%_", "t_", "._", "get", "Name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", ",_", "path", "Id_", ",_", "contents_", "in_", "file", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "._", "union_", "(_", "f_", "._", "requires_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prov_", "._", "union_", "(_", "f_", "._", "provides_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "set", "Requ", "ires", "_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "set", "Prov", "ides", "_", "(_", "prov_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "trove", "Name_", "._", "endswith_", "(_", "':", "source", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "source", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "Name_", "=_", "trove", "Name_", "._", "split_", "(_", "\":\"_", ")_", "[_", "0_", "]_", "+_", "\":", "source", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "set", "Sou", "rce", "Name_", "(_", "source", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "compute", "Path", "Hashe", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "set", "Build", "Time_", "(_", "build", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", "in_", "redirec", "t", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "add", "Redirect_", "(_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", ")_", "\\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_", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", "in_", "redirec", "t", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "add", "Redirect_", "(_", "to", "Name_", ",_", "to", "Branch_", ",_", "to", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "file", " ", "and", " ", "file", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", ",_", "path", "Id_", ",_", "contents_", "in_", "file", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "._", "add", "File_", "(_", "None_", ",_", "f_", "._", "file", "Id_", "(_", ")_", ",_", "f_", "._", "freeze_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f_", "._", "has", "Contents_", "and_", "not_", "f_", "._", "flags_", "._", "is", "Enca", "psu", "late", "d", "Content_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "._", "add", "File", "Contents_", "(_", "path", "Id_", ",_", "f_", "._", "file", "Id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "changeset_", "._", "Change", "d", "File", "Types_", "._", "file_", ",_", "contents_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "flags_", "._", "is", "Config_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "+=_", "f_", "._", "contents_", "._", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "metadata_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "=_", "[_", "metadata_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "trove", "Info_", "._", "metadata_", "._", "add", "Item_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "._", "set", "Size_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "._", "compute", "Dig", "ests", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff_", "=_", "t_", "._", "diff_", "(_", "None_", ",_", "absolute_", "=_", "True_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "._", "new", "Trove", "_", "(_", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cs_", "._", "set", "Prim", "ary", "Trove", "List_", "(_", "[_", "t_", "._", "get", "Name", "Version", "Flavor_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "t_", ",_", "cs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "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_", "verify", "No", "File_", "(_", "self_", ",_", "file_", ")_", ":_", "\\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_", "=_", "open_", "(_", "file_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "errno_", "==_", "2_", ":_", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "verify", "No", "File", " ", "return", "ed", " ", "unexpected", " ", "error", " ", "code", ":", " ", "%", "d", "\"_", "%_", "err_", "._", "errno_", ")_", "\\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_", "._", "fail_", "(_", "\"", "file", " ", "exist", "s", ":", " ", "%", "s", "\"_", "%_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "Pk", "g_", "(_", "self_", ",_", "root_", ",_", "pkg_", "=_", "[_", "]_", ",_", "version_", "=_", "None_", ",_", "tag", "Script_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "Script", "s_", "=_", "False_", ",_", "keep", "Exist", "ing_", "=_", "False_", ",_", "replace", "Files_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve_", "=_", "False_", ",_", "dep", "Check_", "=_", "True_", ",_", "just", "Database_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor_", "=_", "None_", ",_", "recurse_", "=_", "True_", ",_", "sync_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "False_", ",_", "from", "Files_", "=_", "[_", "]_", ",_", "check", "Path", "Confl", "icts", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "=_", "False_", ",_", "migrate_", "=_", "False_", ",_", "keep", "Required_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "raise", "Error_", "=_", "False_", ",_", "callback_", "=_", "None_", ",_", "restart", "Info_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "appl", "y", "Crit", "ical", "Only_", "=_", "False_", ",_", "sync", "Children_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Journ", "al_", "=_", "False_", ",_", "no", "Restart", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exact", "Fla", "vor", "s_", "=_", "False_", ",_", "replace", "Manage", "d", "Files_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Modifie", "d", "Files_", "=_", "False_", ",_", "replace", "Unma", "nage", "d", "Files_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Modifie", "d", "Config", "Files_", "=_", "False_", ",_", "skip", "Caps", "ule", "Ops_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "critic", "al", "Update", "Info_", "=_", "None_", ",_", "model", "File_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "root_", ",_", "str_", ")_", "or_", "not_", "root_", "[_", "0_", "]_", "==_", "'/'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hack", " ", "to", " ", "allow", " ", "passi", "ng", " ", "of", " ", "root", "dir", " ", "as", " ", "first", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "we", " ", "used", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "root_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg_", "=_", "[_", "root_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "self_", "._", "root", "Dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newc", "fg_", "=_", "self_", "._", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "fg_", "._", "root_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "callback_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "=_", "callbacks_", "._", "Update", "Callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replace", "Files_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replace", "Manage", "d", "Files_", "=_", "replace", "Files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replace", "Unma", "nage", "d", "Files_", "=_", "replace", "Files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replace", "Modifie", "d", "Files_", "=_", "replace", "Files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replace", "Modifie", "d", "Config", "Files_", "=_", "replace", "Files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repos_", "=_", "self_", "._", "open", "Repository_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "pkg_", ",_", "(_", "str_", ",_", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pkg_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "type_", "(_", "version_", ")_", "is_", "not_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "version_", "=_", "version_", "._", "as", "String_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item_", "=_", "\"%", "s", "=", "%", "s", "\"_", "%_", "(_", "pkg_", ",_", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "=_", "pkg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flavor_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "+=_", "'[", "%", "s", "]'_", "%_", "flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pkg", "l_", "=_", "[_", "item_", "]_", "\\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 ", " _", "assert_", "(_", "version_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "flavor_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pkg", "l_", "=_", "list_", "(_", "itertools_", "._", "chain_", "(_", "*_", "(_", "util_", "._", "brace", "Expand", "_", "(_", "x_", ")_", "for_", "x_", "in_", "pkg_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "consiste", "nc", "y", "'", "s", " ", "sak", "e", ",", " ", "if", " ", "in", " ", "migr", "ate", " ", "mode", ",", " ", "fake", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "line", " ", "to", " ", "say", " ", "migrate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "migrate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Sys", "Arg", "v_", "=_", "[_", "'", "cona", "ry", "'_", ",_", "'", "migr", "ate", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Sys", "Arg", "v_", "=_", "[_", "'", "cona", "ry", "'_", ",_", "'", "update", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "Sys", "Arg", "v_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "package", "s", " ", "to", " ", "handle_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Sys", "Arg", "v_", "._", "extend_", "(_", "pkg", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newc", "fg_", "._", "auto", "Resolv", "e_", "=_", "resolve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keep", "Journ", "al_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "k_", "=_", "{_", "'", "keep", "Journ", "al", "'_", ":_", "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 ", " ", "_", "k_", "=_", "{_", "}_", "\\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 ", " ", "_", "sys_", "._", "argv_", "=_", "new", "Sys", "Arg", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "cmd_", "._", "do", "Update_", "(_", "newc", "fg_", ",_", "pkg", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "Script_", "=_", "tag", "Script_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Exist", "ing_", "=_", "keep", "Exist", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Manage", "d", "Files_", "=_", "replace", "Manage", "d", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Unma", "nage", "d", "Files_", "=_", "replace", "Unma", "nage", "d", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Modifie", "d", "Files_", "=_", "replace", "Modifie", "d", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "Modifie", "d", "Config", "Files_", "=_", "replace", "Modifie", "d", "Config", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dep", "Check_", "=_", "dep", "Check_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "just", "Database_", "=_", "just", "Database_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recurse_", "=_", "recurse_", ",_", "split_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sync_", "=_", "sync_", ",_", "info_", "=_", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "Files_", "=_", "from", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "Path", "Confl", "icts", "_", "=_", "check", "Path", "Confl", "icts", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test_", "=_", "test_", ",_", "migrate_", "=_", "migrate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Required_", "=_", "keep", "Required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "restart", "Info_", "=_", "restart", "Info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "appl", "y", "Crit", "ical", "Only_", "=_", "appl", "y", "Crit", "ical", "Only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sync", "Children_", "=_", "sync", "Children_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "Migrat", "e_", "=_", "migrate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "Restart", "_", "=_", "no", "Restart", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exact", "Fla", "vor", "s_", "=_", "exact", "Fla", "vor", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "critic", "al", "Update", "Info_", "=_", "critic", "al", "Update", "Info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "Caps", "ule", "Ops_", "=_", "skip", "Caps", "ule", "Ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "Script", "s_", "=_", "no", "Script", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "system", "Model", "File_", "=_", "model", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "k_", ")_", "\\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 ", " ", "_", "sys_", "._", "argv_", "=_", "old", "Sys", "Arg", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cona", "ry", "client_", "._", "Dependenc", "y", "Failure_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "raise", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Intern", "al", "Con", "ary", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Con", "ary", "Error_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "raise", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "error_", "(_", "msg_", ")_", "\\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_", "#", " ", "we", " ", "have", " ", "a", " ", "changeset", " ", "object", ";", " ", "mimic", " ", "what", " ", "update", "cmd", " ", "doe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "not_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "from", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "check", "Path", "Confl", "icts", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "=_", "cona", "ry", "client_", "._", "Con", "ary", "Client_", "(_", "self_", "._", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "._", "set", "Update", "Callback_", "(_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "[_", "(_", "x_", "[_", "0_", "]_", ",_", "(_", "None_", ",_", "None_", ")_", ",_", "(_", "x_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "keep", "Exist", "ing_", ")_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "pkg_", "._", "get", "Prim", "ary", "Trove", "List_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upd", "Job_", ",_", "su", "gg", "Map_", "=_", "cl_", "._", "update", "Change", "Set_", "(_", "job_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Exist", "ing_", "=_", "keep", "Exist", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Required_", "=_", "keep", "Required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recurse_", "=_", "recurse_", ",_", "split_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sync_", "=_", "sync_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "Change", "sets_", "=_", "[_", "pkg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dep", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "(_", "not_", "su", "gg", "Map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "replace", "Files_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "replace", "Files_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "old", " ", "appl", "y", "Update", " ", "API", " ", "doe", "sn", "'", "t", " ", "support", " ", "separate", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "not_", "replace", "Manage", "d", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "replace", "Unma", "nage", "d", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "replace", "Modifie", "d", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "replace", "Modifie", "d", "Config", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "._", "appl", "y", "Update_", "(_", "upd", "Job_", ",_", "replace", "Files_", "=_", "replace", "Files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "Script_", "=_", "tag", "Script_", ",_", "just", "Database_", "=_", "just", "Database_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Journ", "al_", "=_", "keep", "Journ", "al_", ")_", "\\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 ", " ", "_", "upd", "Job_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cona", "ry", "client_", "._", "Dependenc", "y", "Failure_", ",_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "raise", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Intern", "al", "Con", "ary", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Con", "ary", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "raise", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "Recipe_", "(_", "self_", ",_", "the", "Class_", ",_", "the", "Name_", ",_", "vars_", "=_", "None_", ",_", "prep_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "macros_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Version_", "=_", "None_", ",_", "d_", "=_", "None_", ",_", "server", "Idx_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Level_", "=_", "None_", ",_", "ignore", "Deps", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Build_", "=_", "False_", ",_", "repos_", "=_", "None_", ",_", "group", "Options_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resume_", "=_", "None_", ",_", "branch_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use_", "._", "set", "Build", "Fla", "gs", "Fro", "m", "Flavor_", "(_", "the", "Name_", ",_", "self_", "._", "cfg_", "._", "build", "Flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "log", "Level_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "Level_", "=_", "log_", "._", "WARNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vars_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "macros_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "macros_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "branch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "source", "Version_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "=_", "source", "Version_", "._", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "=_", "versions_", "._", "Branch_", "(_", "[_", "self_", "._", "cfg_", "._", "build", "Label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "built_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "repos_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repos_", "=_", "self_", "._", "open", "Repository_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loader_", "=_", "Load", "er", "Fro", "m", "String_", "(_", "the", "Class_", ",_", "\"/", "test", ".", "recip", "e", "\"_", ",_", "cfg_", "=_", "self_", "._", "cfg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repos_", "=_", "repos_", ",_", "obj", "Dict_", "=_", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "component_", "=_", "the", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recipe_", "=_", "loader_", "._", "get", "Recipe_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "vars_", "._", "iterkeys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "recipe_", ",_", "name_", ",_", "vars_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level_", "=_", "log_", "._", "get", "Verbos", "ity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "set", "Verbos", "ity_", "(_", "log", "Level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "built_", "=_", "self_", "._", "cook", "Object_", "(_", "loader_", ",_", "prep_", "=_", "prep_", ",_", "macros_", "=_", "macros_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "Version_", "=_", "source", "Version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "Idx_", "=_", "server", "Idx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "Deps", "_", "=_", "ignore", "Deps", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log", "Build_", "=_", "log", "Build_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repos_", "=_", "repos_", ",_", "group", "Options_", "=_", "group", "Options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resume_", "=_", "resume_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "set", "Verbos", "ity_", "(_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recipe_", "=_", "loader_", "._", "get", "Recipe_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "rest", " ", "of", " ", "this", " ", "is", " ", "a", " ", "hor", "rib", "le", " ", "hack", " ", "to", " ", "allow", " ", "the", " ", "recip", "e", " ", "from", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "to", " ", "be", " ", "used", " ", "as", " ", "a", " ", "superclass", " ", "late", "r", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "recipe_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recipe_", "._", "internal", "Abstract", "Base", "Class_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "D_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "D_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "D_", "[_", "the", "Name_", "]_", "=_", "recipe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "built_", ",_", "new", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repos", "itor", "y", "Helper_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Update_", "(_", "self_", ",_", "pkg", "List_", ",_", "expected", "Job_", ",_", "dep", "Check_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Exist", "ing_", "=_", "False_", ",_", "recurse_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve_", "=_", "False_", ",_", "sync_", "=_", "False_", ",_", "replace", "Files_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exact", "Match_", "=_", "True_", ",_", "apply_", "=_", "False_", ",_", "erase_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "Change", "sets_", "=_", "[_", "]_", ",_", "sync", "Children_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", "=_", "False_", ",_", "resolve", "Group", "List_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sync", "Update_", "=_", "False_", ",_", "keep", "Required_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "=_", "False_", ",_", "remove", "Not", "By", "Default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "old", "Migrat", "e_", "=_", "False_", ",_", "check", "Prim", "ary", "Pins_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "None_", ",_", "resolve", "Source_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Perform", "s", " ", "an", " ", "update", " ", "as", " ", "give", "n", " ", "to", " ", "do", "Update", ",", " ", "and", " ", "checks", " ", "the", " ", "result", "ing", "\\", "10", ";", " ", " ", " ", " ", "job", " ", "for", " ", "correct", "ness", ".", " ", " ", "If", " ", "appl", "y", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "the", " ", "job", " ", "is", " ", "applied", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "well", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "pkg", "List", ":", " ", "a", " ", "list", " ", "of", " ", "trove", "Spec", "s", " ", "to", " ", "atte", "mpt", " ", "to", " ", "update", " ", "(", "foo", "=", "3.3", "[", "bar", "])", "\\", "10", ";", " ", " ", " ", " ", "expected", "Jo", "b", ":", " ", "a", " ", "list", " ", "of", " ", "change", "Spec", "s", " ", "tha", "t", " ", "descri", "be", " ", "the", " ", "content", "s", "\\", "10", ";", " ", " ", " ", "of", " ", "the", " ", "expected", " ", "update", " ", "job", ".", "\\", "10", ";", " ", " ", " ", " ", "appl", "y", ":", " ", "actual", "ly", " ", "appl", "y", " ", "the", " ", "give", "n", " ", "job", " ", "if", " ", "it", " ", "pass", "es", " ", "the", " ", "check", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "parameter", "s", " ", "are", " ", "as", " ", "with", " ", "do", "Update", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Accepta", "ble", " ", "formats", " ", "for", " ", "items", " ", "in", " ", "the", " ", "expected", "Jo", "b", " ", "list", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "foo", " ", " ", "matche", "s", " ", "foo", " ", "bei", "ng", " ", "update", "d", " ", "or", " ", "install", "ed", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "foo", "=-", "-1", ".0", " ", " ", " ", " ", "matche", "s", " ", "foo", " ", "1.0", " ", "is", " ", "install", "ed", " ", "and", " ", "not", "hing", "\\", "10", ";", " ", " ", " ", " ", " ", "is", " ", "remove", "d", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "foo", "=", "1.0", "--", "2.0", " ", "matche", "s", " ", "update", " ", "from", " ", "1.0", " ", "to", " ", "2.0", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "foo", "=", "1.0", "--", " ", " ", " ", " ", "matche", "s", " ", "removal", " ", "of", " ", "1.0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Fla", "vor", "s", " ", "are", " ", "accept", "ed", " ", "as", " ", "well", ".", " ", " ", "All", " ", "porti", "ons", " ", "are", " ", "specified", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "trove", " ", "spec", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "not_", "resolve_", ",_", "\"", "Resolv", "e", " ", "cann", "ot", " ", "be", " ", "specified", " ", "whe", "n", " ", "passi", "ng", " ", "client", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cl_", "=_", "client_", "\\u\\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_", "resolve_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newc", "fg_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "fg_", "._", "auto", "Resolv", "e_", "=_", "resolve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newc", "fg_", "=_", "self_", "._", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cl_", "=_", "cona", "ry", "client_", "._", "Con", "ary", "Client_", "(_", "newc", "fg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repos_", "=_", "self_", "._", "open", "Repository_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "Migrat", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sync", "Update_", "=_", "remove", "Not", "By", "Default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "Missing", "_", "=_", "sync", "Update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "are", "Abs", "olute", "_", "=_", "not_", "keep", "Exist", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "pkg", "List_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "List_", "=_", "[_", "pkg", "List_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "expected", "Job_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Job_", "=_", "[_", "expected", "Job_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pkg", "List_", "=_", "list_", "(_", "itertools_", "._", "chain_", "(_", "*_", "(_", "util_", "._", "brace", "Expand", "_", "(_", "x_", ")_", "for_", "x_", "in_", "pkg", "List_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "appl", "y", "List_", "=_", "cmdline_", "._", "parse", "Change", "List_", "(_", "pkg", "List_", ",_", "keep", "Exist", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "By", "Default_", "=_", "not_", "erase_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upd", "Job_", ",_", "su", "gg", "Map_", "=_", "cl_", "._", "update", "Change", "Set_", "(_", "appl", "y", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Exist", "ing_", "=_", "keep", "Exist", "ing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "Required_", "=_", "keep", "Required_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "recurse_", "=_", "recurse_", ",_", "split_", "=_", "True_", ",_", "sync_", "=_", "sync_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "By", "Default_", "=_", "not_", "erase_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "from", "Change", "sets_", "=_", "from", "Change", "sets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve", "Deps", "_", "=_", "dep", "Check_", ",_", "sync", "Children_", "=_", "sync", "Children_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "Only_", "=_", "update", "Only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve", "Group", "List_", "=_", "resolve", "Group", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "Missing", "_", "=_", "install", "Missing", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "Not", "By", "Default_", "=_", "remove", "Not", "By", "Default_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrate_", "=_", "migrate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "Prim", "ary", "Pins_", "=_", "check", "Prim", "ary", "Pins_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve", "Source_", "=_", "resolve", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dep", "Check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "not_", "su", "gg", "Map_", "or_", "resolve_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected", "Job_", "=_", "list_", "(_", "itertools_", "._", "chain_", "(_", "*_", "(_", "util_", "._", "brace", "Expand", "_", "(_", "x_", ")_", "for_", "x_", "in_", "expected", "Job_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Jo", "b", "List_", "(_", "upd", "Job_", "._", "get", "Jobs_", "(_", ")_", ",_", "expected", "Job_", ",_", "exact", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "apply_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cl_", "._", "appl", "y", "Update_", "(_", "upd", "Job_", ",_", "replace", "Files_", "=_", "replace", "Files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upd", "Job_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "HTTP", "Proxy_", "(_", "base", "\\u", "server_", "._", "Base", "Server_", ")_", ":_", "\\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 ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "proxy", "Bin", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "will", " ", "start", " ", "the", " ", "proxy", " ", "on", " ", "these", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "port_", ",_", "self_", "._", "auth", "Port_", "=_", "testh", "elp", "_", "._", "find", "Ports_", "(_", "num_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "Config", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "open_", "(_", "os_", "._", "devnull_", ",_", "\"", "w", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stderr_", "=_", "open_", "(_", "os_", "._", "devnull_", ",_", "\"", "w", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "debugg", "ing", " ", "squi", "d", ",", " ", "uncomm", "ent", " ", "the", " ", "next", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", "std", "err", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Kill", " ", "any", " ", "exist", "ing", " ", "prox", "ies", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "self_", "._", "get", "Sto", "p", "Cmd_", "(_", ")_", ",_", "stdout_", "=_", "stderr_", ",_", "stderr_", "=_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "self_", "._", "get", "Ini", "t", "Cmd_", "(_", ")_", ",_", "stdout_", "=_", "stderr_", ",_", "stderr_", "=_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Una", "ble", " ", "to", " ", "init", " ", "squi", "d", " ", "with", " ", "config", " ", "file", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "config", "File_", ",_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "self_", "._", "get", "Start", "Cmd_", "(_", ")_", ",_", "stdout_", "=_", "stderr_", ",_", "stderr_", "=_", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Una", "ble", " ", "to", " ", "start", " ", "squi", "d", " ", "with", " ", "config", " ", "file", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "config", "File_", ",_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "till", " ", "we", " ", "can", " ", "open", " ", "a", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock", "\\u", "utils_", "._", "try", "Connect_", "(_", "\"", "127", ".0", ".0", ".1", "\"_", ",_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "pid", ",", " ", "in", " ", "case", " ", "the", " ", "director", "y", " ", "gets", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "sever", "al", " ", "times", " ", "if", " ", "squi", "d", " ", "did", "n", "'", "t", " ", "have", " ", "the", " ", "chan", "ce", " ", "to", " ", "write", " ", "the", " ", "pid_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "pid", "File_", ")_", ":_", "\\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_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Give", " ", "it", " ", "sever", "al", " ", "more", " ", "second", "s", " ", "bef", "ore", " ", "faili", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pid_", "=_", "int_", "(_", "open_", "(_", "self_", "._", "pid", "File_", ")_", "._", "readline_", "(_", ")_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stopped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proxy", "Uri_", "=_", "\"", "127", ".0", ".0", ".1", ":", "%", "s", "\"_", "%_", "self_", "._", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proxy", "Uri_", "\\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, 0, 1, 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 ]
Unused import
marcwebbie/passpie/tests/test_importers/test_pysswords_importer.py
[ { "content": "from collections import namedtuple\nimport os\nimport shutil\nimport sys\nimport tempfile\n\nimport yaml\n\nfrom passpie.importers import find_importer, BaseImporter, get_instances\nfrom passpie.importers.default_importer import DefaultImporter\nfrom passpie.importers.pysswords_importer import PysswordsImporter\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mock_open():\n try:\n from mock import mock_open as mopen\n except:\n from unittest.mock import mock_open as mopen\n return mopen()", "metadata": "root.mock_open", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def test_pysswords_returns_false_with_logging_when_not_installed(mocker):\n to_patch = 'passpie.importers.pysswords_importer.found_pysswords'\n mocker.patch(to_patch, return_value=False)\n importer = PysswordsImporter()\n importer.log = mocker.Mock()\n\n result = importer.match('filepath')\n assert result is False\n assert importer.log.called\n importer.log.assert_called_once_with('Pysswords is not installed')", "metadata": "root.test_pysswords_returns_false_with_logging_when_not_installed", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_pysswords_returns_false_with_logging_when_path_not_dir(mocker):\n to_patch = 'passpie.importers.pysswords_importer.found_pysswords'\n mocker.patch(to_patch, return_value=True)\n mock_os = mocker.patch('passpie.importers.pysswords_importer.os')\n mock_os.path.is_dir.return_value = False\n importer = PysswordsImporter()\n importer.log = mocker.Mock()\n\n result = importer.match('filepath')\n assert result is False\n assert importer.log.called\n importer.log.assert_called_once_with('.keys not found in path')", "metadata": "root.test_pysswords_returns_false_with_logging_when_path_not_dir", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def test_pysswords_returns_false_with_logging_when_keys_not_in_path(mocker):\n to_patch = 'passpie.importers.pysswords_importer.found_pysswords'\n mocker.patch(to_patch, return_value=True)\n mock_os = mocker.patch('passpie.importers.pysswords_importer.os')\n mock_os.path.is_dir.return_value = True\n mock_os.listdir.return_value = []\n importer = PysswordsImporter()\n importer.log = mocker.Mock()\n\n result = importer.match('filepath')\n assert result is False\n assert importer.log.called\n importer.log.assert_called_once_with('.keys not found in path')", "metadata": "root.test_pysswords_returns_false_with_logging_when_keys_not_in_path", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def test_pysswords_match_returns_true_when_expected_path(mocker):\n to_patch = 'passpie.importers.pysswords_importer.found_pysswords'\n mocker.patch(to_patch, return_value=True)\n mock_os = mocker.patch('passpie.importers.pysswords_importer.os')\n mock_os.path.is_dir.return_value = True\n mock_os.listdir.return_value = ['.keys']\n importer = PysswordsImporter()\n\n result = importer.match('filepath')\n assert result is True", "metadata": "root.test_pysswords_match_returns_true_when_expected_path", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def test_pysswords_handle_returns_empty_when_bad_passphrase(mocker):\n mocker.patch('passpie.importers.pysswords_importer.click')\n to_patch = 'passpie.importers.pysswords_importer.Database'\n mock_pysswords_db = mocker.patch(to_patch, create=True)()\n mock_pysswords_db.check.return_value = False\n importer = PysswordsImporter()\n\n result = importer.handle('path')\n assert result == []", "metadata": "root.test_pysswords_handle_returns_empty_when_bad_passphrase", "header": "['module', '___EOS___']", "index": 74 }, { "content": "def test_pysswords_handle_returns_pysswords_credentials(mocker):\n Cred = namedtuple('Credential', 'name login password comment')\n credentials = [\n Cred('name', 'login', 'password', 'comment')\n ]\n mocker.patch('passpie.importers.pysswords_importer.click')\n mocker.patch('passpie.importers.pysswords_importer.make_fullname')\n to_patch = 'passpie.importers.pysswords_importer.Database'\n mock_pysswords_db = mocker.patch(to_patch, create=True)()\n mock_pysswords_db.check.return_value = True\n mock_pysswords_db.credentials = credentials\n importer = PysswordsImporter()\n\n result = importer.handle('path')\n assert credentials[0].name in [c['name'] for c in result]", "metadata": "root.test_pysswords_handle_returns_pysswords_credentials", "header": "['module', '___EOS___']", "index": 85 } ]
[ { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "import shutil", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 }, { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import tempfile", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "import yaml", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 11 }, { "span": "from passpie.importers import find_importer, BaseImporter, get_instances", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 72 }, { "span": "from passpie.importers.default_importer import DefaultImporter", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 62 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "import_", "find", "\\u", "importer_", ",_", "Base", "Importer_", ",_", "get", "\\u", "instances_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "._", "default", "\\u", "importer_", "import_", "Default", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "passp", "ie_", "._", "importer", "s_", "._", "pys", "sword", "s", "\\u", "importer_", "import_", "Py", "ssword", "s", "Importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mock", "\\u", "open_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mock_", "import_", "mock", "\\u", "open_", "as_", "mop", "en_", "\\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_", "unittest_", "._", "mock_", "import_", "mock", "\\u", "open_", "as_", "mop", "en_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mop", "en_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pys", "sword", "s", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "with", "\\u", "logg", "ing", "\\u", "whe", "n", "\\u", "not", "\\u", "installed_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "found", "\\u", "pys", "sword", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "return", "\\u", "value_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "=_", "mocker_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "importer_", "._", "log_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "'", "Py", "ssword", "s", " ", "is", " ", "not", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pys", "sword", "s", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "with", "\\u", "logg", "ing", "\\u", "whe", "n", "\\u", "path", "\\u", "not", "\\u", "dir_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "found", "\\u", "pys", "sword", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "return", "\\u", "value_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "=_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "os", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "._", "path_", "._", "is", "\\u", "dir_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "=_", "mocker_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "importer_", "._", "log_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "'.", "keys", " ", "not", " ", "found", " ", "in", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pys", "sword", "s", "\\u", "return", "s", "\\u", "fal", "se", "\\u", "with", "\\u", "logg", "ing", "\\u", "whe", "n", "\\u", "keys", "\\u", "not", "\\u", "in", "\\u", "path_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "found", "\\u", "pys", "sword", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "return", "\\u", "value_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "=_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "os", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "._", "path_", "._", "is", "\\u", "dir_", "._", "return", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "._", "listdir_", "._", "return", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "=_", "mocker_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "importer_", "._", "log_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "._", "log_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "'.", "keys", " ", "not", " ", "found", " ", "in", " ", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pys", "sword", "s", "\\u", "match", "\\u", "return", "s", "\\u", "true", "\\u", "whe", "n", "\\u", "expected", "\\u", "path_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "found", "\\u", "pys", "sword", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "return", "\\u", "value_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "=_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "os", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "._", "path_", "._", "is", "\\u", "dir_", "._", "return", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "os_", "._", "listdir_", "._", "return", "\\u", "value_", "=_", "[_", "'.", "keys", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "match_", "(_", "'", "filepath", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "is_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pys", "sword", "s", "\\u", "handle", "\\u", "return", "s", "\\u", "empty", "\\u", "whe", "n", "\\u", "bad", "\\u", "passphrase_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "click", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "Databa", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "pys", "sword", "s", "\\u", "db_", "=_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "create_", "=_", "True_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "pys", "sword", "s", "\\u", "db_", "._", "check_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "handle_", "(_", "'", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "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_", "test\\u", "pys", "sword", "s", "\\u", "handle", "\\u", "return", "s", "\\u", "pys", "sword", "s", "\\u", "credentials_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cred", "_", "=_", "namedtuple_", "(_", "'", "Cred", "ential", "'_", ",_", "'", "name", " ", "login", " ", "password", " ", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credentials_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Cred", "_", "(_", "'", "name", "'_", ",_", "'", "login", "'_", ",_", "'", "password", "'_", ",_", "'", "comment", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "click", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "make", "\\u", "full", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "patch_", "=_", "'", "passp", "ie", ".", "importer", "s", ".", "pys", "sword", "s", "\\u", "importer", ".", "Databa", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "pys", "sword", "s", "\\u", "db_", "=_", "mocker_", "._", "patch_", "(_", "to", "\\u", "patch_", ",_", "create_", "=_", "True_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "pys", "sword", "s", "\\u", "db_", "._", "check_", "._", "return", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "pys", "sword", "s", "\\u", "db_", "._", "credentials_", "=_", "credentials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importer_", "=_", "Py", "ssword", "s", "Importer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "importer_", "._", "handle_", "(_", "'", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "credentials_", "[_", "0_", "]_", "._", "name_", "in_", "[_", "c_", "[_", "'", "name", "'_", "]_", "for_", "c_", "in_", "result_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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e\nfrom chainer import computational_graph as c\nfrom deel.tensor import *\nfrom deel.network import *\nimport copy\n\nfrom deel import *\nimport chainer\nimport json\nimport os\nimport multiprocessing\nimport threading\nimport time\nimport six\nimport numpy as np\nimport os.path\nfrom PIL import Image\nfrom six.moves import queue\nimport pickle\nimport hashlib\nimport datetime\nimport sys\nimport random\n\t \nfrom deel.agentServer import AgentServer\nimport deel.model.q_net\n\n\t\t\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DQN(Network):\n\t#lastAction = Action()\n\tpolicyFrozen = False\n\tepsilonDelta = 1.0 / 10 ** 4\n\tmin_eps = 0.1\n\n\tactions = None\n\treward=None\n\n\n\n\t \n\n\t\t\n\n\n", "metadata": "root.DQN", "header": "['module', '___EOS___']", "index": 29 }, { "content": "\tdef __init__(self,given_dim=(256,6,6),actions=[0,1,2],depth_image_dim=0):\t\t\n\t\tsuper(DQN,self).__init__('Deep Q-learning Network')\n\t\tself.actions = actions\n\t\tself.age = 0\n\n\t\tself.depth_image_dim = depth_image_dim\n\n\t\tself.image_feature_dim = getDim(given_dim)+depth_image_dim\n\n\t\tprint \"shape:\",self.image_feature_dim\n\n\t\tself.time = 0\n\t\tself.epsilon = 1.0 # Initial exploratoin rate\n\t\tself.func = model.q_net.QNet(Deel.gpu,self.actions,self.image_feature_dim)", "metadata": "root.DQN.__init__", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 38 }, { "content": "\tdef actionAndLearn(self,x=None):\n\t\tif x is None:\n\t\t\tx=Tensor.context\n\n\n\t\tif AgentServer.mode == 'start':\n\t\t\treturn self.start(x)\n\t\telif AgentServer.mode == 'step':\n\t\t\treturn self.step(x)\n\t\telif AgentServer.mode == 'end':\n\t\t\treturn self.end(x)", "metadata": "root.DQN.actionAndLearn", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 53 }, { "content": "\tdef start(self,x=None):\n\t\tif x is None:\n\t\t\tx=Tensor.context\n\n\n\t\tobs_array = x.content.data\n\t\t#print \"sum\",obs_array.sum()\n\n\t\t# Initialize State\n\t\tself.state = np.zeros((self.func.hist_size, self.image_feature_dim), dtype=np.uint8)\n\t\tself.state[0] = obs_array\n\t\tstate_ = np.asanyarray(self.state.reshape(1, self.func.hist_size, self.image_feature_dim), dtype=np.float32)\n\t\tif Deel.gpu >= 0:\n\t\t\tstate_ = cuda.to_gpu(state_)\n\n\t\t# Generate an Action e-greedy\n\t\taction, Q_now = self.func.e_greedy(state_, self.epsilon)\n\t\treturnAction = action\n\n\t\t# Update for next step\n\t\tself.lastAction = copy.deepcopy(returnAction)\n\t\tself.last_state = self.state.copy()\n\t\tself.last_observation = obs_array\n\n\t\treturn returnAction", "metadata": "root.DQN.start", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 66 }, { "content": "\tdef step(self,x=None):\n\t\tif x is None:\n\t\t\tx=Tensor.context\n\n\t\tobs_array = x.content.data\n\t\t#print \"sum\",obs_array.sum()\n\t\tobs_processed = np.maximum(obs_array, self.last_observation) # Take maximum from two frames\n\n\t\t# Compose State : 4-step sequential observation\n\t\tif self.func.hist_size == 4:\n\t\t\tself.state = np.asanyarray([self.state[1], self.state[2], self.state[3], obs_processed], dtype=np.uint8)\n\t\telif self.func.hist_size == 2:\n\t\t\tself.state = np.asanyarray([self.state[1], obs_processed], dtype=np.uint8)\n\t\telif self.func.hist_size == 1:\n\t\t\tself.state = np.asanyarray([obs_processed], dtype=np.uint8)\n\t\telse:\n\t\t\tprint(\"self.DQN.hist_size err\")\n\n\t\tstate_ = np.asanyarray(self.state.reshape(1, self.func.hist_size, self.image_feature_dim), dtype=np.float32)\n\t\tif Deel.gpu >= 0:\n\t\t\tstate_ = cuda.to_gpu(state_)\n\n\t\t# Exploration decays along the time sequence\n\t\tif self.policyFrozen is False: # Learning ON/OFF\n\t\t\tif self.func.initial_exploration < self.time:\n\t\t\t\tself.epsilon -= self.epsilonDelta\n\t\t\t\tif self.epsilon < self.min_eps:\n\t\t\t\t\tself.epsilon = self.min_eps\n\t\t\t\teps = self.epsilon\n\t\t\telse: # Initial Exploation Phase\n\t\t\t\tprint \"Initial Exploration : %d/%d steps\" % (self.time, self.func.initial_exploration)\n\t\t\t\teps = 1.0\n\t\telse: # Evaluation\n\t\t\tprint \"Policy is Frozen\"\n\t\t\teps = 0.05\n\n\t\t# Generate an Action by e-greedy action selection\n\t\taction, Q_now = self.func.e_greedy(state_, eps)\n\n\t\treturn self,action, eps, Q_now, obs_array", "metadata": "root.DQN.step", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 92 }, { "content": "\tdef step_after(self,reward, action, eps, q_now, obs_array):\n\n\t\t'''\n\t\tStep after\n\t\t'''\n\n\t\tself.reward = reward\n\t\t# Learning Phase\n\t\tif self.policyFrozen is False: # Learning ON/OFF\n\t\t\tself.func.stock_experience(self.time, self.last_state, self.lastAction, reward, self.state, False)\n\t\t\tself.func.experience_replay(self.time)\n\n\t\t# Target model update\n\t\tif self.func.initial_exploration < self.time and np.mod(self.time, self.func.target_model_update_freq) == 0:\n\t\t\tprint 'Model Updated'\n\t\t\tself.func.target_model_update()\n\n\t\t# Simple text based visualization\n\t\tif Deel.gpu >= 0:\n\t\t\tq_max = np.max(q_now.get())\n\t\telse:\n\t\t\tq_max = np.max(q_now)\n\t\tprint 'Step %d/ACT %d/R %.1f/EPS %.6f/Q_max %3f' % (\n\t\t\tself.time, self.func.action_to_index(action), reward, eps, q_max)\n\n\t\t# Updates for next step\n\t\tself.last_observation = obs_array\n\n\t\tif self.policyFrozen is False:\n\t\t\tself.lastAction = copy.deepcopy(action)\n\t\t\tself.last_state = self.state.copy()\n\t\t\tself.time += 1\n\n\t\t\t#if self.time % 1000 == 0:\n\t\t\t#\tpickle.dump(self.func.model, open(\"cash/qnet_%05d.pkl\"%self.time, 'wb'))", "metadata": "root.DQN.step_after", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 132 }, { "content": "\tdef end(self,x):\n\t\treward = self.reward\n\t\tprint 'episode finished: REWARD %.1f / EPSILON %.5f' % (reward, self.epsilon)\n\n\t\t# Learning Phase\n\t\tif self.policyFrozen is False: # Learning ON/OFF\n\t\t\tself.func.stock_experience(self.time, self.last_state, self.lastAction, reward, self.last_state,\n\t\t\t\t\t\t\t\t\t\tTrue)\n\t\t\tself.func.experience_replay(self.time)\n\n\t\t# Target model update\n\t\tif self.func.initial_exploration < self.time and np.mod(self.time, self.func.target_model_update_freq) == 0:\n\t\t\tprint 'Model Updated'\n\t\t\tself.func.target_model_update()\n\n\t\t# Time count\n\t\tif self.policyFrozen is False:\n\t\t\tself.time += 1\n\n\t\tself.age += 1\n\t\tif self.age % 10 ==0:\n\t\t\tself.save('dqn%04d.pkl'%self.age)\t\t\t", "metadata": "root.DQN.end", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 169 }, { "content": "\tdef save(self,filename):\n\t\tpickle.dump(self.func.model, open(filename, 'wb')) ", "metadata": "root.DQN.save", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 192 }, { "content": "\tdef load(self,filename):\n\t\tself.func.model = pickle.load(open(filename,'rb'))", "metadata": "root.DQN.load", "header": "['class', 'DQN', '(', 'Network', ')', ':', '___NEWLINE___', '#lastAction = Action()', '___NL___', '___EOS___']", "index": 195 } ]
[ { "span": "import chainer.functions as F", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 29 }, { "span": "import chainer.links as L", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 25 }, { "span": "from chainer import Variable", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 28 }, { "span": "from chainer.links import caffe", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 31 }, { "span": "from chainer import computational_graph as c", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 44 }, { "span": "import chainer", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 14 }, { "span": "import json", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 11 }, { "span": "import os", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 9 }, { "span": "import multiprocessing", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 22 }, { "span": "import threading", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 16 }, { "span": "import time", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 11 }, { "span": "import six", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 10 }, { "span": "import os.path", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 14 }, { "span": "from PIL import Image", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 21 }, { "span": "from six.moves import queue", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 27 }, { "span": "import hashlib", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 14 }, { "span": "import datetime", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 15 }, { "span": "import sys", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 10 }, { "span": "import random", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 13 }, { "span": "import deel.model.q_net", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "chainer_", "._", "functions_", "as_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "._", "links_", "as_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "import_", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "._", "links_", "import_", "caffe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chainer_", "import_", "computation", "al", "\\u", "graph_", "as_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dee", "l_", "._", "tensor_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dee", "l_", "._", "network_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dee", "l_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dee", "l_", "._", "agent", "Server_", "import_", "Agent", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dee", "l_", "._", "model_", "._", "q", "\\u", "net_", "\\u\\u\\uNEWLINE\\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_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "policy", "Fro", "zen", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eps", "ilon", "Delta_", "=_", "1.0_", "/_", "10_", "**_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "eps_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reward_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "give", "n", "\\u", "dim_", "=_", "(_", "256_", ",_", "6_", ",_", "6_", ")_", ",_", "actions_", "=_", "[_", "0_", ",_", "1_", ",_", "2_", "]_", ",_", "depth", "\\u", "image", "\\u", "dim_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "super_", "(_", "DQ", "N_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "'", "De", "ep", " ", "Q", "-", "learn", "ing", " ", "Network", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "actions_", "=_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "age_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "depth", "\\u", "image", "\\u", "dim_", "=_", "depth", "\\u", "image", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", "=_", "get", "Dim_", "(_", "give", "n", "\\u", "dim_", ")_", "+_", "depth", "\\u", "image", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "shape", ":\"_", ",_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "epsilon_", "=_", "1.0_", "#", " ", "Initial", " ", "expl", "ora", "toi", "n", " ", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "model_", "._", "q", "\\u", "net_", "._", "QN", "et_", "(_", "De", "el_", "._", "gpu_", ",_", "self_", "._", "actions_", ",_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "action", "And", "Learn", "_", "(_", "self_", ",_", "x_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "Tensor_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Agent", "Server_", "._", "mode_", "==_", "'", "start", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "start_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Agent", "Server_", "._", "mode_", "==_", "'", "step", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "step_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "Agent", "Server_", "._", "mode_", "==_", "'", "end", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "self_", "._", "end_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "start_", "(_", "self_", ",_", "x_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "Tensor_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obs", "\\u", "array_", "=_", "x_", "._", "content_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "sum", "\",", "obs", "\\u", "array", ".", "sum", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "State_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state_", "=_", "np_", "._", "zeros_", "(_", "(_", "self_", "._", "func_", "._", "hist", "\\u", "size_", ",_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", ")_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "[_", "0_", "]_", "=_", "obs", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state", "\\u_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "self_", "._", "state_", "._", "reshape_", "(_", "1_", ",_", "self_", "._", "func_", "._", "hist", "\\u", "size_", ",_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", ")_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "state", "\\u_", "=_", "cuda_", "._", "to", "\\u", "gpu_", "(_", "state", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "an", " ", "Action", " ", "e-", "greedy", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", ",_", "Q", "\\u", "now_", "=_", "self_", "._", "func_", "._", "e\\u", "greedy", "_", "(_", "state", "\\u_", ",_", "self_", "._", "epsilon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "Action_", "=_", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "for", " ", "next", " ", "step_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "Action_", "=_", "copy_", "._", "deepcopy_", "(_", "return", "Action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "state_", "=_", "self_", "._", "state_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "observation_", "=_", "obs", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "return", "Action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "step_", "(_", "self_", ",_", "x_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "x_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "x_", "=_", "Tensor_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obs", "\\u", "array_", "=_", "x_", "._", "content_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "sum", "\",", "obs", "\\u", "array", ".", "sum", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "obs", "\\u", "processed_", "=_", "np_", "._", "maximum_", "(_", "obs", "\\u", "array_", ",_", "self_", "._", "last", "\\u", "observation_", ")_", "#", " ", "Tak", "e", " ", "maxim", "um", " ", "from", " ", "two", " ", "frames_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compose", " ", "State", " ", ":", " ", "4", "-", "step", " ", "sequential", " ", "observation_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "func_", "._", "hist", "\\u", "size_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "state_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "[_", "self_", "._", "state_", "[_", "1_", "]_", ",_", "self_", "._", "state_", "[_", "2_", "]_", ",_", "self_", "._", "state_", "[_", "3_", "]_", ",_", "obs", "\\u", "processed_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "func_", "._", "hist", "\\u", "size_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "state_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "[_", "self_", "._", "state_", "[_", "1_", "]_", ",_", "obs", "\\u", "processed_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "func_", "._", "hist", "\\u", "size_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "state_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "[_", "obs", "\\u", "processed_", "]_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\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_", "print_", "(_", "\"", "self", ".", "DQ", "N", ".", "hist", "\\u", "size", " ", "err", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state", "\\u_", "=_", "np_", "._", "asan", "yar", "ray_", "(_", "self_", "._", "state_", "._", "reshape_", "(_", "1_", ",_", "self_", "._", "func_", "._", "hist", "\\u", "size_", ",_", "self_", "._", "image", "\\u", "feature", "\\u", "dim_", ")_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "state", "\\u_", "=_", "cuda_", "._", "to", "\\u", "gpu_", "(_", "state", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Explo", "ration", " ", "deca", "ys", " ", "along", " ", "the", " ", "time", " ", "sequence_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "policy", "Fro", "zen", "_", "is_", "False_", ":_", "#", " ", "Learn", "ing", " ", "ON", "/", "OFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "self_", "._", "func_", "._", "initial", "\\u", "exploration", "_", "<_", "self_", "._", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "self_", "._", "epsilon_", "-=_", "self_", "._", "eps", "ilon", "Delta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "epsilon_", "<_", "self_", "._", "min", "\\u", "eps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "self_", "._", "epsilon_", "=_", "self_", "._", "min", "\\u", "eps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eps_", "=_", "self_", "._", "epsilon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Initial", " ", "Explo", "ation", " ", "Phase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "\"", "Initial", " ", "Explo", "ration", " ", ":", " ", "%", "d", "/", "%", "d", " ", "step", "s", "\"_", "%_", "(_", "self_", "._", "time_", ",_", "self_", "._", "func_", "._", "initial", "\\u", "exploration", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eps_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "Evaluati", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "\"", "Polic", "y", " ", "is", " ", "Fro", "zen", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eps_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "an", " ", "Action", " ", "by", " ", "e-", "greedy", " ", "action", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "action_", ",_", "Q", "\\u", "now_", "=_", "self_", "._", "func_", "._", "e\\u", "greedy", "_", "(_", "state", "\\u_", ",_", "eps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", ",_", "action_", ",_", "eps_", ",_", "Q", "\\u", "now_", ",_", "obs", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "step", "\\u", "after_", "(_", "self_", ",_", "reward_", ",_", "action_", ",_", "eps_", ",_", "q", "\\u", "now_", ",_", "obs", "\\u", "array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", "\\", "10", ";", "\t", "\t", "Step", " ", "after", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reward_", "=_", "reward_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Learn", "ing", " ", "Phase_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "policy", "Fro", "zen", "_", "is_", "False_", ":_", "#", " ", "Learn", "ing", " ", "ON", "/", "OFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "func_", "._", "stock", "\\u", "experience", "_", "(_", "self_", "._", "time_", ",_", "self_", "._", "last", "\\u", "state_", ",_", "self_", "._", "last", "Action_", ",_", "reward_", ",_", "self_", "._", "state_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "experience", "\\u", "replay_", "(_", "self_", "._", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", " ", "model", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "func_", "._", "initial", "\\u", "exploration", "_", "<_", "self_", "._", "time_", "and_", "np_", "._", "mod_", "(_", "self_", "._", "time_", ",_", "self_", "._", "func_", "._", "target", "\\u", "model", "\\u", "update", "\\u", "freq_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "'", "Model", " ", "Update", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "target", "\\u", "model", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", " ", "text", " ", "based", " ", "visualization", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "De", "el_", "._", "gpu_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "q", "\\u", "max_", "=_", "np_", "._", "max_", "(_", "q", "\\u", "now_", "._", "get_", "(_", ")_", ")_", "\\u\\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_", "q", "\\u", "max_", "=_", "np_", "._", "max_", "(_", "q", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Step", " ", "%", "d", "/", "ACT", " ", "%", "d", "/", "R", " ", "%", ".1", "f", "/", "EPS", " ", "%", ".6", "f", "/", "Q", "\\u", "max", " ", "%", "3f", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", ",_", "self_", "._", "func_", "._", "action", "\\u", "to", "\\u", "index_", "(_", "action_", ")_", ",_", "reward_", ",_", "eps_", ",_", "q", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", "s", " ", "for", " ", "next", " ", "step_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "\\u", "observation_", "=_", "obs", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "policy", "Fro", "zen", "_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "last", "Action_", "=_", "copy_", "._", "deepcopy_", "(_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "state_", "=_", "self_", "._", "state_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "self", ".", "time", " ", "%", " ", "1000", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "pickle", ".", "dump", "(", "self", ".", "func", ".", "model", ",", " ", "open", "(\"", "cash", "/", "qn", "et", "\\u", "%", "05", "d", ".", "pkl", "\"%", "self", ".", "time", ",", " ", "'", "wb", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "end_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "reward_", "=_", "self_", "._", "reward_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "episode", " ", "finish", "ed", ":", " ", "RE", "WARD", " ", "%", ".1", "f", " ", "/", " ", "EPS", "ILO", "N", " ", "%", ".5", "f", "'_", "%_", "(_", "reward_", ",_", "self_", "._", "epsilon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Learn", "ing", " ", "Phase_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "policy", "Fro", "zen", "_", "is_", "False_", ":_", "#", " ", "Learn", "ing", " ", "ON", "/", "OFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "func_", "._", "stock", "\\u", "experience", "_", "(_", "self_", "._", "time_", ",_", "self_", "._", "last", "\\u", "state_", ",_", "self_", "._", "last", "Action_", ",_", "reward_", ",_", "self_", "._", "last", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "experience", "\\u", "replay_", "(_", "self_", "._", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Target", " ", "model", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "func_", "._", "initial", "\\u", "exploration", "_", "<_", "self_", "._", "time_", "and_", "np_", "._", "mod_", "(_", "self_", "._", "time_", ",_", "self_", "._", "func_", "._", "target", "\\u", "model", "\\u", "update", "\\u", "freq_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "'", "Model", " ", "Update", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "target", "\\u", "model", "\\u", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", " ", "count_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "policy", "Fro", "zen", "_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "time_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "age_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "age_", "%_", "10_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "self_", "._", "save_", "(_", "'", "dq", "n", "%", "04", "d", ".", "pkl", "'_", "%_", "self_", "._", "age_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "save_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "pickle_", "._", "dump_", "(_", "self_", "._", "func_", "._", "model_", ",_", "open_", "(_", "filename_", ",_", "'", "wb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "DQ", "N_", "(_", "Network_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "last", "Action", " ", "=", " ", "Action", "()", "_", "\\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_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
pgiri/asyncoro/py2/asyncoro/discoronode.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"This file is part of asyncoro; see http://asyncoro.sourceforge.net for\ndetails.\n\nThis program can be used to start discoro server processes so discoro scheduler\n(see 'discoro.py') can send computations to these server processes for executing\ndistributed communicating proceses (coroutines). All coroutines in a server\nexecute in the same thread, so multiple CPUs are not used by one server. If CPU\nintensive computations are to be run on systems with multiple processors, then\nthis program should be run with multiple instances (see below for '-c' option to\nthis program).\n\nSee 'discoro_client*.py' files for example use cases.\n\"\"\"\n\n__author__ = \"Giridhar Pemmasani (pgiri@yahoo.com)\"\n__copyright__ = \"Copyright (c) 2014 Giridhar Pemmasani\"\n__license__ = \"MIT\"\n__url__ = \"http://asyncoro.sourceforge.net\"\n\n\n\n\n\n\nif __name__ == '__main__':\n\n \"\"\"\n See http://asyncoro.sourceforge.net/discoro.html#node-servers for details on\n options to start this program.\n \"\"\"\n\n import sys\n import time\n import argparse\n import multiprocessing\n import socket\n import os\n import collections\n import hashlib\n import logging\n try:\n import readline\n except:\n pass\n import asyncoro.disasyncoro as asyncoro\n\n try:\n import psutil\n except ImportError:\n print('\\n \\'psutil\\' module is not available; '\n 'CPU, memory, disk status will not be sent!\\n')\n psutil = None\n else:\n psutil.cpu_percent(0.1)\n\n parser = argparse.ArgumentParser()\n parser.add_argument('-c', '--cpus', dest='cpus', type=int, default=0,\n help='number of CPUs/discoro instances to run; '\n 'if negative, that many CPUs are not used')\n parser.add_argument('-i', '--ip_addr', dest='node', default=None,\n help='IP address or host name of this node')\n parser.add_argument('--ext_ip_addr', dest='ext_ip_addr', default=None,\n help='External IP address to use (needed in case of NAT firewall/gateway)')\n parser.add_argument('-u', '--udp_port', dest='udp_port', type=int, default=51350,\n help='UDP port number to use')\n parser.add_argument('--tcp_ports', dest='tcp_ports', action='append', default=[],\n help='TCP port numbers to use')\n parser.add_argument('-n', '--name', dest='name', default=None,\n help='(symbolic) name given to AsynCoro schdulers on this node')\n parser.add_argument('--dest_path', dest='dest_path', default=None,\n help='path prefix to where files sent by peers are stored')\n parser.add_argument('--max_file_size', dest='max_file_size', default=None, type=int,\n help='maximum file size of any file transferred')\n parser.add_argument('-s', '--secret', dest='secret', default='',\n help='authentication secret for handshake with peers')\n parser.add_argument('--certfile', dest='certfile', default=None,\n help='file containing SSL certificate')\n parser.add_argument('--keyfile', dest='keyfile', default=None,\n help='file containing SSL key')\n parser.add_argument('--serve', dest='serve', default=-1, type=int,\n help='number of clients to serve before exiting')\n parser.add_argument('--min_pulse_interval', dest='min_pulse_interval', default=0, type=int,\n help='minimum pulse interval clients can use in number of seconds')\n parser.add_argument('--max_pulse_interval', dest='max_pulse_interval', default=0, type=int,\n help='maximum pulse interval clients can use in number of seconds')\n parser.add_argument('--daemon', action='store_true', dest='daemon', default=False,\n help='if given, input is not read from terminal')\n parser.add_argument('--phoenix', action='store_true', dest='phoenix', default=False,\n help='if given, server processes from previous run will be killed '\n 'and new server process started')\n parser.add_argument('--discover_peers', action='store_true', dest='discover_peers',\n default=False,\n help='if given, peers are discovered during startup')\n parser.add_argument('--peer', dest='peers', action='append', default=[],\n help='peer location (in the form node:TCPport) to communicate')\n parser.add_argument('-d', '--debug', action='store_true', dest='loglevel', default=False,\n help='if given, debug messages are printed')\n _discoro_config = vars(parser.parse_args(sys.argv[1:]))\n\n if _discoro_config['min_pulse_interval'] and _discoro_config['min_pulse_interval'] < 1:\n raise Exception('min_pulse_interval must be at least 1')\n if (_discoro_config['max_pulse_interval'] and _discoro_config['min_pulse_interval'] and\n _discoro_config['max_pulse_interval'] < _discoro_config['min_pulse_interval']):\n raise Exception('max_pulse_interval must be at least min_pulse_interval')\n\n _discoro_cpus = multiprocessing.cpu_count()\n if _discoro_config['cpus'] > 0:\n if _discoro_config['cpus'] > _discoro_cpus:\n raise Exception('CPU count must be <= %s' % _discoro_cpus)\n _discoro_cpus = _discoro_config['cpus']\n elif _discoro_config['cpus'] < 0:\n if -_discoro_config['cpus'] >= _discoro_cpus:\n raise Exception('CPU count must be > -%s' % _discoro_cpus)\n _discoro_cpus += _discoro_config['cpus']\n del _discoro_config['cpus']\n\n _discoro_tcp_ports = set()\n tcp_port = tcp_ports = None\n for tcp_port in _discoro_config.pop('tcp_ports', []):\n tcp_ports = tcp_port.split('-')\n if len(tcp_ports) == 1:\n _discoro_tcp_ports.add(int(tcp_ports[0]))\n elif len(tcp_ports) == 2:\n _discoro_tcp_ports = _discoro_tcp_ports.union(range(int(tcp_ports[0]),\n int(tcp_ports[1]) + 1))\n else:\n raise Exception('Invalid TCP port range \"%s\"' % tcp_ports)\n _discoro_tcp_ports = sorted(_discoro_tcp_ports)\n\n if _discoro_tcp_ports:\n for tcp_port in range(_discoro_tcp_ports[-1] + 1,\n _discoro_tcp_ports[-1] + 1 +\n (_discoro_cpus + 1) - len(_discoro_tcp_ports)):\n _discoro_tcp_ports.append(tcp_port)\n else:\n _discoro_tcp_ports = [0] * (_discoro_cpus + 1)\n\n _discoro_peers, _discoro_config['peers'] = _discoro_config['peers'], []\n peer = None\n for peer in _discoro_peers:\n peer = peer.split(':')\n if len(peer) != 2:\n raise Exception('peer %s is not valid' % ':'.join(peer))\n _discoro_config['peers'].append(asyncoro.Location(peer[0], peer[1]))\n del peer\n _discoro_peers = _discoro_config['peers']\n\n _discoro_name = _discoro_config['name']\n if not _discoro_name:\n _discoro_name = socket.gethostname()\n if not _discoro_name:\n _discoro_name = 'discoro_server'\n\n _discoro_daemon = _discoro_config.pop('daemon', False)\n if not _discoro_daemon:\n try:\n if os.getpgrp() != os.tcgetpgrp(sys.stdin.fileno()):\n _discoro_daemon = True\n except:\n pass\n _discoro_auth = hashlib.sha1(os.urandom(10).encode('hex')).hexdigest()\n\n _discoro_server_infos = []\n _discoro_ServerInfo = collections.namedtuple('DiscoroServerInfo', ['Proc', 'Queue'])\n _discoro_mp_queue = None\n for _discoro_server_id in range(1, _discoro_cpus+1):\n _discoro_config['name'] = '%s-%s' % (_discoro_name, _discoro_server_id)\n _discoro_config['tcp_port'] = _discoro_tcp_ports[_discoro_server_id]\n _discoro_mp_queue = multiprocessing.Queue()\n _discoro_server_info = _discoro_ServerInfo(\n multiprocessing.Process(target=_discoro_process,\n args=(dict(_discoro_config), _discoro_server_id,\n _discoro_mp_queue, _discoro_auth)),\n _discoro_mp_queue)\n _discoro_server_infos.append(_discoro_server_info)\n _discoro_server_info.Proc.start()\n\n\n _discoro_server_id = 0\n _discoro_config['name'] = '%s-%s' % (_discoro_name, _discoro_server_id)\n _discoro_config['tcp_port'] = _discoro_tcp_ports[_discoro_server_id]\n _discoro_config.pop('phoenix', False)\n _discoro_config.pop('serve', -1)\n _discoro_config.pop('peers', [])\n _discoro_config.pop('min_pulse_interval')\n _discoro_config.pop('max_pulse_interval')\n _discoro_config['discover_peers'] = False\n if _discoro_config['loglevel']:\n asyncoro.logger.setLevel(logging.DEBUG)\n else:\n asyncoro.logger.setLevel(logging.INFO)\n del _discoro_config['loglevel']\n _discoro_scheduler = asyncoro.AsynCoro(**_discoro_config)\n _discoro_timer_coro = asyncoro.Coro(_discoro_timer_proc)\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': 'start', 'auth': _discoro_auth,\n 'timer_coro': _discoro_timer_coro})\n\n # delete variables not needed anymore\n del _discoro_mp_queue, _discoro_tcp_ports, tcp_port, tcp_ports, _discoro_config\n del parser, argparse, multiprocessing, socket, collections, os\n\n if not _discoro_daemon:\n\n asyncoro.Coro(_discoro_cmd_reader)\n else:\n _discoro_cmd = None\n\n while 1:\n try:\n for _discoro_server_info in _discoro_server_infos:\n if _discoro_server_info.Proc.is_alive():\n _discoro_server_info.Proc.join()\n break\n except:\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': 'terminate', 'auth': _discoro_auth})\n\n exit(0)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _discoro_proc():\n # coroutine\n \"\"\"Server process receives computations and runs coroutines for it.\n \"\"\"\n\n import os\n import shutil\n import traceback\n import sys\n import time\n\n try:\n import psutil\n except:\n psutil = None\n\n import asyncoro.disasyncoro as asyncoro\n from asyncoro import Coro\n from asyncoro.discoro import MinPulseInterval, MaxPulseInterval, \\\n DiscoroNodeInfo, DiscoroNodeAvailInfo\n\n class Nonlocals(object):\n def __init__(self, **kwargs):\n self.__dict__.update(kwargs)\n\n _discoro_coro = asyncoro.AsynCoro.cur_coro()\n _discoro_config = yield _discoro_coro.receive()\n assert _discoro_config['req'] == 'config'\n _discoro_timer_coro = _discoro_config['timer_coro']\n yield asyncoro.AsynCoro.instance().peer(_discoro_timer_coro.location)\n\n if _discoro_config['min_pulse_interval'] > 0:\n MinPulseInterval = _discoro_config['min_pulse_interval']\n if _discoro_config['max_pulse_interval'] > 0:\n MaxPulseInterval = _discoro_config['max_pulse_interval']\n\n _discoro_coro.register('discoro_server')\n _discoro_name = asyncoro.AsynCoro.instance().name\n asyncoro.AsynCoro.instance().dest_path = os.path.join('discoro', _discoro_name)\n _discoro_dest_path = asyncoro.AsynCoro.instance().dest_path\n _discoro_pid_path = os.path.join(_discoro_dest_path, '..', '%s.pid' % _discoro_name)\n _discoro_pid_path = os.path.normpath(_discoro_pid_path)\n # TODO: is file locking necessary?\n if os.path.exists(_discoro_pid_path):\n with open(_discoro_pid_path, 'r') as _discoro_req:\n _discoro_var = _discoro_req.read()\n _discoro_var = int(_discoro_var)\n if not _discoro_config['phoenix']:\n print('\\n Another discoronode seems to be running;\\n'\n ' make sure server with PID %d quit and remove \"%s\"\\n' %\n (_discoro_var, _discoro_pid_path))\n _discoro_var = os.getpid()\n\n import signal\n try:\n os.kill(_discoro_var, signal.SIGTERM)\n except:\n pass\n else:\n time.sleep(0.1)\n try:\n if os.waitpid(_discoro_var, os.WNOHANG)[0] != _discoro_var:\n asyncoro.logger.warning('Killing process %d failed', _discoro_var)\n except:\n pass\n del signal\n if os.path.isdir(_discoro_dest_path):\n shutil.rmtree(_discoro_dest_path)\n os.makedirs(_discoro_dest_path)\n os.chdir(_discoro_dest_path)\n sys.path.insert(0, _discoro_dest_path)\n with open(_discoro_pid_path, 'w') as _discoro_var:\n _discoro_var.write('%s' % os.getpid())\n\n def _discoro_peer(peer, coro=None):\n yield asyncoro.AsynCoro.instance().peer(peer)\n\n for _discoro_var in _discoro_config.pop('peers', []):\n Coro(_discoro_peer, _discoro_var)\n del _discoro_peer\n\n for _discoro_var in ['req', 'phoenix', 'min_pulse_interval', 'max_pulse_interval']:\n del _discoro_config[_discoro_var]\n\n asyncoro.logger.info('discoro server \"%s\" started at %s; '\n 'computation files will be saved in \"%s\"',\n _discoro_name, _discoro_coro.location, _discoro_dest_path)\n _discoro_req = _discoro_client = _discoro_auth = _discoro_msg = None\n _discoro_pulse_coro = _discoro_peer_status = _discoro_zombie_timeout = None\n _discoro_monitor_coro = _discoro_monitor_proc = _discoro_schedule_coro = None\n _discoro_computation = _discoro_func = _discoro_var = None\n _discoro_job_coros = set()\n _discoro_nonlocals = Nonlocals(busy_time=time.time())\n _discoro_globals = {}\n _discoro_locals = {}\n _discoro_modules = dict(sys.modules)\n _discoro_globals.update(globals())\n _discoro_locals.update(locals())\n\n def _discoro_peer_status(coro=None):\n coro.set_daemon()\n while 1:\n status = yield coro.receive()\n if isinstance(status, asyncoro.PeerStatus) and \\\n status.status == asyncoro.PeerStatus.Offline and \\\n _discoro_pulse_coro and _discoro_pulse_coro.location == status.location:\n asyncoro.logger.debug('scheduler at %s quit; closing computation %s',\n status.location, _discoro_computation._auth)\n _discoro_coro.send({'req': 'close', 'auth': _discoro_config['auth']})\n\n def _discoro_monitor_proc(coro=None):\n coro.set_daemon()\n while 1:\n msg = yield coro.receive(timeout=_discoro_zombie_timeout)\n if isinstance(msg, asyncoro.MonitorException):\n _discoro_nonlocals.busy_time = time.time()\n asyncoro.logger.debug('job %s done', msg.args[0])\n _discoro_job_coros.discard(msg.args[0])\n elif ((not _discoro_job_coros) and _discoro_zombie_timeout and\n ((time.time() - _discoro_nonlocals.busy_time) > _discoro_zombie_timeout)):\n asyncoro.logger.debug('%s: zombie computation \"%s\"',\n coro.location, _discoro_computation._auth)\n _discoro_coro.send({'req': 'close', 'auth': _discoro_config['auth']})\n\n def _discoro_schedule_proc(client, job_coro, coro=None):\n if (yield client.deliver(job_coro, timeout=5)) == 1:\n Coro._asyncoro._add(job_coro)\n else:\n _discoro_job_coros.discard(job_coro)\n\n _discoro_monitor_coro = Coro(_discoro_monitor_proc)\n asyncoro.AsynCoro.instance().peer_status(Coro(_discoro_peer_status))\n\n while 1:\n _discoro_msg = yield _discoro_coro.receive()\n if not isinstance(_discoro_msg, dict):\n continue\n _discoro_req = _discoro_msg.get('req', None)\n\n if _discoro_req == 'run':\n _discoro_client = _discoro_msg.get('client', None)\n _discoro_auth = _discoro_msg.get('auth', None)\n _discoro_func = _discoro_msg.get('func', None)\n if not isinstance(_discoro_client, Coro) or not _discoro_computation or \\\n _discoro_auth != _discoro_computation._auth:\n asyncoro.logger.warning('invalid run: %s', type(_discoro_func))\n if isinstance(_discoro_client, Coro):\n _discoro_client.send(None)\n continue\n try:\n _discoro_func = asyncoro.unserialize(_discoro_func)\n if _discoro_func.code:\n exec(_discoro_func.code) in globals()\n job_coro = Coro(globals()[_discoro_func.name],\n *(_discoro_func.args), **(_discoro_func.kwargs))\n except:\n asyncoro.logger.debug('invalid computation to run')\n job_coro = (sys.exc_info()[0], getattr(_discoro_func, 'name', _discoro_func),\n traceback.format_exc())\n _discoro_client.send(job_coro)\n else:\n asyncoro.logger.debug('job %s created', job_coro)\n _discoro_job_coros.add(job_coro)\n job_coro.notify(_discoro_monitor_coro)\n _discoro_var = _discoro_msg.get('notify', None)\n if isinstance(_discoro_var, Coro):\n job_coro.notify(_discoro_var)\n if Coro._asyncoro._remove(job_coro) == 0:\n Coro(_discoro_schedule_proc, _discoro_client, job_coro)\n _discoro_nonlocals.busy_time = time.time()\n del job_coro\n elif _discoro_req == 'setup':\n _discoro_client = _discoro_msg.get('client', None)\n _discoro_pulse_coro = _discoro_msg.get('pulse_coro', None)\n if not isinstance(_discoro_client, Coro) or not isinstance(_discoro_pulse_coro, Coro):\n continue\n if _discoro_computation is not None:\n asyncoro.logger.debug('invalid \"setup\" - busy')\n _discoro_client.send(-1)\n continue\n os.chdir(_discoro_dest_path)\n try:\n _discoro_computation = _discoro_msg['computation']\n exec('import asyncoro.disasyncoro as asyncoro') in globals()\n if _discoro_computation._code:\n exec(_discoro_computation._code) in globals()\n except:\n _discoro_computation = None\n asyncoro.logger.warning('invalid computation')\n asyncoro.logger.debug(traceback.format_exc())\n _discoro_client.send(-1)\n continue\n if isinstance(_discoro_computation.pulse_interval, int) and \\\n MinPulseInterval <= _discoro_computation.pulse_interval <= MaxPulseInterval:\n _discoro_computation.pulse_interval = _discoro_computation.pulse_interval\n else:\n _discoro_computation.pulse_interval = MinPulseInterval\n _discoro_timer_coro.send({'pulse_coro': _discoro_pulse_coro,\n 'interval': _discoro_computation.pulse_interval,\n 'disk_path': _discoro_dest_path})\n _discoro_nonlocals.busy_time = time.time()\n _discoro_zombie_timeout = _discoro_computation.zombie_period\n asyncoro.logger.debug('computation \"%s\" from %s with zombie period %s',\n _discoro_computation._auth, _discoro_msg['client'].location,\n _discoro_zombie_timeout)\n if not _discoro_zombie_timeout:\n _discoro_zombie_timeout = None\n _discoro_monitor_coro.send(None)\n _discoro_client.send(0)\n elif _discoro_req == 'close':\n _discoro_auth = _discoro_msg.get('auth', None)\n if not _discoro_computation or (_discoro_auth != _discoro_computation._auth and\n _discoro_auth != _discoro_config['auth']):\n continue\n asyncoro.logger.debug('%s deleting computation \"%s\"',\n _discoro_coro.location, _discoro_computation._auth)\n if _discoro_auth != _discoro_computation._auth and _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerClosed',\n 'location': _discoro_coro.location})\n for _discoro_var in _discoro_job_coros:\n _discoro_var.terminate()\n _discoro_job_coros.clear()\n\n for _discoro_var in list(globals()):\n if _discoro_var not in _discoro_globals:\n globals().pop(_discoro_var, None)\n globals().update(_discoro_globals)\n\n for _discoro_var in sys.modules.keys():\n if _discoro_var not in _discoro_modules:\n sys.modules.pop(_discoro_var, None)\n sys.modules.update(_discoro_modules)\n\n for _discoro_var in os.listdir(_discoro_dest_path):\n _discoro_var = os.path.join(_discoro_dest_path, _discoro_var)\n if os.path.isdir(_discoro_var) and not os.path.islink(_discoro_var):\n shutil.rmtree(_discoro_var, ignore_errors=True)\n else:\n os.remove(_discoro_var)\n if not os.path.isdir(_discoro_dest_path):\n try:\n os.remove(_discoro_dest_path)\n except:\n pass\n os.makedirs(_discoro_dest_path)\n if not os.path.isfile(_discoro_pid_path):\n try:\n if os.path.islink(_discoro_pid_path):\n os.remove(_discoro_pid_path)\n else:\n shutil.rmtree(_discoro_pid_path)\n with open(_discoro_pid_path, 'w') as _discoro_var:\n _discoro_var.write('%s' % os.getpid())\n except:\n asyncoro.logger.warning('PID file \"%s\" is invalid', _discoro_pid_path)\n os.chdir(_discoro_dest_path)\n asyncoro.AsynCoro.instance().dest_path = _discoro_dest_path\n _discoro_computation = _discoro_client = _discoro_pulse_coro = None\n if _discoro_config['serve'] > 0:\n _discoro_config['serve'] -= 1\n if _discoro_config['serve'] == 0:\n break\n _discoro_timer_coro.send({'pulse_coro': _discoro_pulse_coro, 'interval': None,\n 'disk_path': ''})\n _discoro_zombie_timeout = None\n elif _discoro_req == 'node_info':\n if psutil:\n _discoro_var = DiscoroNodeAvailInfo(_discoro_coro.location.addr,\n 100.0 - psutil.cpu_percent(),\n psutil.virtual_memory().available,\n psutil.disk_usage(_discoro_dest_path).free,\n 100.0 - psutil.swap_memory().percent)\n else:\n _discoro_var = None\n # _discoro_name is host name followed by '-' and ID\n _discoro_var = DiscoroNodeInfo(_discoro_name[:_discoro_name.rfind('-')],\n _discoro_coro.location.addr, _discoro_var)\n _discoro_client = _discoro_msg.get('client', None)\n if isinstance(_discoro_client, Coro):\n _discoro_client.send(_discoro_var)\n elif _discoro_req == 'status':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring info: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n print(' Server \"%s\" @ %s running %d coroutines for %s' %\n (_discoro_name, _discoro_coro.location, len(_discoro_job_coros),\n _discoro_pulse_coro.location))\n else:\n print(' Server \"%s\" @ %s not used by any computation' %\n (_discoro_name, _discoro_coro.location))\n elif _discoro_req == 'quit':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring quit: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerClosed',\n 'location': _discoro_coro.location})\n break\n elif _discoro_req == 'terminate':\n if _discoro_msg.get('auth', None) != _discoro_config['auth']:\n asyncoro.logger.debug('ignoring terminate: %s', _discoro_msg.get('auth'))\n continue\n if _discoro_pulse_coro:\n _discoro_pulse_coro.send({'status': 'ServerTerminated',\n 'location': _discoro_coro.location})\n if _discoro_computation:\n msg = {'req': 'close', 'auth': _discoro_computation._auth}\n _discoro_config['serve'] = 1\n _discoro_coro.send(msg)\n else:\n break\n else:\n asyncoro.logger.warning('invalid command \"%s\" ignored', _discoro_req)\n _discoro_client = _discoro_msg.get('client', None)\n if not isinstance(_discoro_client, Coro):\n continue\n _discoro_client.send(-1)\n\n # wait until all computations are done; process only 'close'\n while _discoro_job_coros:\n _discoro_msg = yield _discoro_coro.receive()\n if not isinstance(_discoro_msg, dict):\n continue\n _discoro_req = _discoro_msg.get('req', None)\n\n if _discoro_req == 'close':\n _discoro_auth = _discoro_msg.get('auth', None)\n if not _discoro_computation or _discoro_auth != _discoro_computation._auth:\n continue\n asyncoro.logger.debug('%s deleting computation \"%s\"',\n _discoro_coro.location, _discoro_computation._auth)\n\n for _discoro_var in list(globals()):\n if _discoro_var not in _discoro_globals:\n globals().pop(_discoro_var, None)\n globals().update(_discoro_globals)\n\n break\n else:\n asyncoro.logger.warning('invalid command \"%s\" ignored', _discoro_req)\n _discoro_client = _discoro_msg.get('client', None)\n if not isinstance(_discoro_client, Coro):\n continue\n _discoro_client.send(-1)\n\n for _discoro_var in os.listdir(_discoro_dest_path):\n _discoro_var = os.path.join(_discoro_dest_path, _discoro_var)\n if os.path.isdir(_discoro_var) and not os.path.islink(_discoro_var):\n shutil.rmtree(_discoro_var, ignore_errors=True)\n else:\n os.remove(_discoro_var)\n if os.path.isfile(_discoro_pid_path):\n os.remove(_discoro_pid_path)\n _discoro_config['mp_queue'].put({'req': 'quit', 'auth': _discoro_config['auth']})\n asyncoro.logger.debug('discoro server \"%s\" @ %s terminated',\n _discoro_name, _discoro_coro.location)", "metadata": "root._discoro_proc", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def _discoro_cmd_reader(coro=None):\n coro.set_daemon()\n async_threads = asyncoro.AsyncThreadPool(1)\n while 1:\n yield coro.sleep(0.25)\n try:\n _discoro_cmd = yield async_threads.async_task(\n raw_input,\n '\\nEnter \"status\" to get status\\n'\n ' \"close\" to close current computation (kill any running jobs)\\n'\n ' \"quit\" to stop accepting new jobs and quit when done\\n'\n ' \"terminate\" to kill current jobs and quit: ')\n except:\n _discoro_cmd = 'terminate'\n else:\n _discoro_cmd = _discoro_cmd.strip().lower()\n\n print('')\n if _discoro_cmd == 'status' or _discoro_cmd == 'close':\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': _discoro_cmd, 'auth': _discoro_auth})\n elif _discoro_cmd in ('quit', 'terminate'):\n for _discoro_server_info in _discoro_server_infos:\n _discoro_server_info.Queue.put({'req': _discoro_cmd, 'auth': _discoro_auth})\n break", "metadata": "root._discoro_cmd_reader", "header": "['module', '___EOS___']", "index": 660 } ]
[ { "span": "except:", "start_line": 454, "start_column": 4, "end_line": 454, "end_column": 11 }, { "span": "except:", "start_line": 570, "start_column": 8, "end_line": 570, "end_column": 15 }, { "span": "except:", "start_line": 696, "start_column": 8, "end_line": 696, "end_column": 15 }, { "span": "except:", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 11 }, { "span": "except:", "start_line": 78, "start_column": 8, "end_line": 78, "end_column": 15 }, { "span": "except:", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 19 }, { "span": "except:", "start_line": 177, "start_column": 12, "end_line": 177, "end_column": 19 }, { "span": "except:", "start_line": 208, "start_column": 12, "end_line": 208, "end_column": 19 }, { "span": "except:", "start_line": 264, "start_column": 16, "end_line": 264, "end_column": 23 }, { "span": "except:", "start_line": 275, "start_column": 16, "end_line": 275, "end_column": 23 }, { "span": "except:", "start_line": 672, "start_column": 16, "end_line": 672, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "async", "oro", ";", " ", "see", " ", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", " ", "for", "\\", "10", ";", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "program", " ", "can", " ", "be", " ", "used", " ", "to", " ", "start", " ", "disco", "ro", " ", "server", " ", "process", "es", " ", "so", " ", "disco", "ro", " ", "schedule", "r", "\\", "10", ";", "(", "see", " ", "'", "disco", "ro", ".", "py", "')", " ", "can", " ", "send", " ", "computation", "s", " ", "to", " ", "these", " ", "server", " ", "process", "es", " ", "for", " ", "executi", "ng", "\\", "10", ";", "distributed", " ", "communicati", "ng", " ", "proce", "ses", " ", "(", "coroutine", "s", ").", " ", "All", " ", "coroutine", "s", " ", "in", " ", "a", " ", "server", "\\", "10", ";", "execute", " ", "in", " ", "the", " ", "same", " ", "thread", ",", " ", "so", " ", "multiple", " ", "CPU", "s", " ", "are", " ", "not", " ", "used", " ", "by", " ", "one", " ", "server", ".", " ", "If", " ", "CPU", "\\", "10", ";", "inten", "sive", " ", "computation", "s", " ", "are", " ", "to", " ", "be", " ", "run", " ", "on", " ", "system", "s", " ", "with", " ", "multiple", " ", "process", "ors", ",", " ", "then", "\\", "10", ";", "this", " ", "program", " ", "shou", "ld", " ", "be", " ", "run", " ", "with", " ", "multiple", " ", "instance", "s", " ", "(", "see", " ", "belo", "w", " ", "for", " ", "'-", "c", "'", " ", "option", " ", "to", "\\", "10", ";", "this", " ", "program", ").", "\\", "10", ";", "\\", "10", ";", "See", " ", "'", "disco", "ro", "\\u", "client", "*.", "py", "'", " ", "files", " ", "for", " ", "example", " ", "use", " ", "case", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Gir", "id", "har", " ", "Pe", "mma", "sani", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "MIT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "url", "\\u\\u_", "=_", "\"", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "/", "disco", "ro", ".", "html", "#", "node", "-", "server", "s", " ", "for", " ", "deta", "il", "s", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "options", " ", "to", " ", "start", " ", "this", " ", "program", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "readline_", "\\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_", "import_", "async", "oro", "_", "._", "disas", "ync", "oro", "_", "as_", "async", "oro", "_", "\\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_", "psutil_", "\\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 ", " _", "print_", "(_", "'\\\\", "n", " ", " ", " ", "\\\\'", "psu", "til", "\\\\'", " ", "module", " ", "is", " ", "not", " ", "avail", "able", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CPU", ",", " ", "memory", ",", " ", "disk", " ", "status", " ", "will", " ", "not", " ", "be", " ", "sent", "!\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psutil_", "=_", "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 ", " _", "psutil_", "._", "cpu", "\\u", "percent_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "c", "'_", ",_", "'--", "cpus", "'_", ",_", "dest_", "=_", "'", "cpus", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "CPU", "s", "/", "disco", "ro", " ", "instance", "s", " ", "to", " ", "run", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "if", " ", "negati", "ve", ",", " ", "tha", "t", " ", "many", " ", "CPU", "s", " ", "are", " ", "not", " ", "used", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "i", "'_", ",_", "'--", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "node", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "IP", " ", "address", " ", "or", " ", "host", " ", "name", " ", "of", " ", "this", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "dest_", "=_", "'", "ext", "\\u", "ip", "\\u", "addr", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Exter", "nal", " ", "IP", " ", "address", " ", "to", " ", "use", " ", "(", "need", "ed", " ", "in", " ", "case", " ", "of", " ", "NAT", " ", "firew", "all", "/", "gateway", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "u", "'_", ",_", "'--", "ud", "p", "\\u", "port", "'_", ",_", "dest_", "=_", "'", "ud", "p", "\\u", "port", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "513", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "UD", "P", " ", "port", " ", "number", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "tcp", "\\u", "port", "s", "'_", ",_", "dest_", "=_", "'", "tcp", "\\u", "port", "s", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "default_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "TC", "P", " ", "port", " ", "numbers", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "n", "'_", ",_", "'--", "name", "'_", ",_", "dest_", "=_", "'", "name", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'(", "symbolic", ")", " ", "name", " ", "give", "n", " ", "to", " ", "As", "yn", "Cor", "o", " ", "sch", "dul", "ers", " ", "on", " ", "this", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "dest", "\\u", "path", "'_", ",_", "dest_", "=_", "'", "dest", "\\u", "path", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "path", " ", "prefix", " ", "to", " ", "where", " ", "files", " ", "sent", " ", "by", " ", "peer", "s", " ", "are", " ", "store", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "\\u", "file", "\\u", "size", "'_", ",_", "dest_", "=_", "'", "max", "\\u", "file", "\\u", "size", "'_", ",_", "default_", "=_", "None_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "maxim", "um", " ", "file", " ", "size", " ", "of", " ", "any", " ", "file", " ", "transferred", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "s", "'_", ",_", "'--", "secret", "'_", ",_", "dest_", "=_", "'", "secret", "'_", ",_", "default_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "authenticat", "ion", " ", "secret", " ", "for", " ", "handshake", " ", "with", " ", "peer", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "certfile", "'_", ",_", "dest_", "=_", "'", "certfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "certifica", "te", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "keyfile", "'_", ",_", "dest_", "=_", "'", "keyfile", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "file", " ", "contain", "ing", " ", "SS", "L", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "serve", "'_", ",_", "dest_", "=_", "'", "serve", "'_", ",_", "default_", "=_", "-_", "1_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "number", " ", "of", " ", "clients", " ", "to", " ", "serve", " ", "bef", "ore", " ", "exit", "ing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "dest_", "=_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "minim", "um", " ", "pulse", " ", "interval", " ", "clients", " ", "can", " ", "use", " ", "in", " ", "number", " ", "of", " ", "second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "max", "\\u", "pulse", "\\u", "interval", "'_", ",_", "dest_", "=_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ",_", "default_", "=_", "0_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "maxim", "um", " ", "pulse", " ", "interval", " ", "clients", " ", "can", " ", "use", " ", "in", " ", "number", " ", "of", " ", "second", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "daemon", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "daemon", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "input", " ", "is", " ", "not", " ", "read", " ", "from", " ", "termina", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "phoe", "nix", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "phoe", "nix", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "server", " ", "process", "es", " ", "from", " ", "previ", "ous", " ", "run", " ", "will", " ", "be", " ", "kille", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "new", " ", "server", " ", "process", " ", "start", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "discove", "r", "\\u", "peer", "s", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "discove", "r", "\\u", "peer", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "peer", "s", " ", "are", " ", "discovere", "d", " ", "dur", "ing", " ", "start", "up", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "peer", "'_", ",_", "dest_", "=_", "'", "peer", "s", "'_", ",_", "action_", "=_", "'", "append", "'_", ",_", "default_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "peer", " ", "location", " ", "(", "in", " ", "the", " ", "form", " ", "node", ":", "TC", "Pp", "ort", ")", " ", "to", " ", "communi", "cate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'-", "d", "'_", ",_", "'--", "debug", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "dest_", "=_", "'", "logl", "evel", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "if", " ", "give", "n", ",", " ", "debug", " ", "message", "s", " ", "are", " ", "printed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "=_", "vars_", "(_", "parser_", "._", "parse", "\\u", "args_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "min", "\\u", "pulse", "\\u", "interval", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "<_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "max", "\\u", "pulse", "\\u", "interval", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "min", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "=_", "multiprocessing_", "._", "cpu", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">_", "\\u", "disco", "ro", "\\u", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", "<=", " ", "%", "s", "'_", "%_", "\\u", "disco", "ro", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "-_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", ">=_", "\\u", "disco", "ro", "\\u", "cpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "CPU", " ", "count", " ", "must", " ", "be", " ", ">", " ", "-%", "s", "'_", "%_", "\\u", "disco", "ro", "\\u", "cpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "cpus_", "+=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "cpus", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tcp", "\\u", "port_", "=_", "tcp", "\\u", "ports_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tcp", "\\u", "port_", "in_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "tcp", "\\u", "port", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tcp", "\\u", "ports_", "=_", "tcp", "\\u", "port_", "._", "split_", "(_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tcp", "\\u", "ports_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "add_", "(_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "tcp", "\\u", "ports_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "union_", "(_", "range_", "(_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "tcp", "\\u", "ports_", "[_", "1_", "]_", ")_", "+_", "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 ", " _", "raise_", "Exception_", "(_", "'", "Inva", "lid", " ", "TC", "P", " ", "port", " ", "range", " ", "\"%", "s", "\"'_", "%_", "tcp", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "sorted_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tcp", "\\u", "port_", "in_", "range_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "-_", "1_", "]_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "-_", "1_", "]_", "+_", "1_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", "-_", "len_", "(_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "._", "append_", "(_", "tcp", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "=_", "[_", "0_", "]_", "*_", "(_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "peers_", ",_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "peer_", "in_", "\\u", "disco", "ro", "\\u", "peers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "peer_", "=_", "peer_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "peer_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "peer", " ", "%", "s", " ", "is", " ", "not", " ", "valid", "'_", "%_", "':'_", "._", "join_", "(_", "peer_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "._", "append_", "(_", "async", "oro", "_", "._", "Location_", "(_", "peer_", "[_", "0_", "]_", ",_", "peer_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "peer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "peers_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "peer", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "name_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "name_", "=_", "'", "disco", "ro", "\\u", "server", "'_", "\\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", "disco", "ro", "\\u", "daemon_", "=_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "daemon", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "daemon_", ":_", "\\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_", "os_", "._", "getp", "grp_", "(_", ")_", "!=_", "os_", "._", "tc", "getp", "grp_", "(_", "sys_", "._", "stdin_", "._", "fileno_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "daemon_", "=_", "True_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "hashlib_", "._", "sha1_", "(_", "os_", "._", "urandom_", "(_", "10_", ")_", "._", "encode_", "(_", "'", "hex", "'_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "Server", "Info_", "=_", "collections_", "._", "namedtuple_", "(_", "'", "Disco", "ro", "Server", "Info", "'_", ",_", "[_", "'", "Proc", "'_", ",_", "'", "Queue", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "in_", "range_", "(_", "1_", ",_", "\\u", "disco", "ro", "\\u", "cpus_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "tcp", "\\u", "port", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", "=_", "multiprocessing_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "=_", "\\u", "disco", "ro", "\\u", "Server", "Info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "multiprocessing_", "._", "Process_", "(_", "target_", "=_", "\\u", "disco", "ro", "\\u", "process_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "(_", "dict_", "(_", "\\u", "disco", "ro", "\\u", "config_", ")_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "auth_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", "._", "append_", "(_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "start_", "(_", ")_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "name", "'_", "]_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "tcp", "\\u", "port", "'_", "]_", "=_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", "[_", "\\u", "disco", "ro", "\\u", "server", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "phoe", "nix", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "serve", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "peer", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "discove", "r", "\\u", "peer", "s", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "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 ", " _", "async", "oro", "_", "._", "logger_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "logl", "evel", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "scheduler_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "(_", "**_", "\\u", "disco", "ro", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "=_", "async", "oro", "_", "._", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "proc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "start", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timer", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "variab", "les", " ", "not", " ", "need", "ed", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "mp", "\\u", "queue_", ",_", "\\u", "disco", "ro", "\\u", "tcp", "\\u", "ports_", ",_", "tcp", "\\u", "port_", ",_", "tcp", "\\u", "ports_", ",_", "\\u", "disco", "ro", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "parser_", ",_", "argparse_", ",_", "multiprocessing_", ",_", "socket_", ",_", "collections_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "daemon_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "async", "oro", "_", "._", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "cmd", "\\u", "reader_", ")_", "\\u\\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", "disco", "ro", "\\u", "cmd_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Proc_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "terminate", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\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_", "exit_", "(_", "0_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "proc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "coroutine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Server", " ", "process", " ", "receive", "s", " ", "computation", "s", " ", "and", " ", "runs", " ", "coroutine", "s", " ", "for", " ", "it", ".", "\\", "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_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\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_", "psutil_", "\\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 ", " _", "psutil_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "async", "oro", "_", "._", "disas", "ync", "oro", "_", "as_", "async", "oro", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "oro", "_", "import_", "Cor", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "oro", "_", "._", "disco", "ro_", "import_", "Min", "Pul", "se", "Interval_", ",_", "Max", "Pul", "se", "Interval_", ",_", "Disco", "ro", "Node", "Info_", ",_", "Disco", "ro", "Node", "Avail", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Non", "locals_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "req", "'_", "]_", "==_", "'", "config", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "timer", "\\u", "coro", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer_", "(_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Min", "Pul", "se", "Interval_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Max", "Pul", "se", "Interval_", "=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "register_", "(_", "'", "disco", "ro", "\\u", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "disco", "ro", "'_", ",_", "\\u", "disco", "ro", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "=_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "'..'_", ",_", "'%", "s", ".", "pid", "'_", "%_", "\\u", "disco", "ro", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "is", " ", "file", " ", "locking", " ", "necessar", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "req_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "\\u", "disco", "ro", "\\u", "req_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "int_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "phoe", "nix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'\\\\", "n", " ", " ", " ", "Ano", "ther", " ", "disco", "ron", "ode", " ", "see", "ms", " ", "to", " ", "be", " ", "runn", "ing", ";\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", " ", "make", " ", "sure", " ", "server", " ", "with", " ", "PID", " ", "%", "d", " ", "quit", " ", "and", " ", "remove", " ", "\"%", "s", "\"\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "kill_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "signal_", "._", "SIGTERM_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "wait", "pid_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "os_", "._", "WN", "OH", "ANG", "_", ")_", "[_", "0_", "]_", "!=_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "Kill", "ing", " ", "process", " ", "%", "d", " ", "fail", "ed", "'_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "write_", "(_", "'%", "s", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "peer_", "(_", "peer_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer_", "(_", "peer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "\\u", "disco", "ro", "\\u", "config_", "._", "pop_", "(_", "'", "peer", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "peer_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "disco", "ro", "\\u", "peer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "[_", "'", "req", "'_", ",_", "'", "phoe", "nix", "'_", ",_", "'", "min", "\\u", "pulse", "\\u", "interval", "'_", ",_", "'", "max", "\\u", "pulse", "\\u", "interval", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "\\u", "disco", "ro", "\\u", "config_", "[_", "\\u", "disco", "ro", "\\u", "var_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "info_", "(_", "'", "disco", "ro", " ", "server", " ", "\"%", "s", "\"", " ", "start", "ed", " ", "at", " ", "%", "s", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "computation", " ", "files", " ", "will", " ", "be", " ", "saved", " ", "in", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", "=_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", "=_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "func_", "=_", "\\u", "disco", "ro", "\\u", "var_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "=_", "Non", "locals_", "(_", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "globals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "locals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "modules_", "=_", "dict_", "(_", "sys_", "._", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "globals_", "._", "update_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "locals_", "._", "update_", "(_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "yield_", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "status_", ",_", "async", "oro", "_", "._", "Peer", "Status_", ")_", "and_", "status_", "._", "status_", "==_", "async", "oro", "_", "._", "Peer", "Status_", "._", "Off", "line_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "location_", "==_", "status_", "._", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "schedule", "r", " ", "at", " ", "%", "s", " ", "quit", ";", " ", "clos", "ing", " ", "computation", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "yield_", "coro_", "._", "receive_", "(_", "timeout_", "=_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "msg_", ",_", "async", "oro", "_", "._", "Monitor", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "job", " ", "%", "s", " ", "don", "e", "'_", ",_", "msg_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "discard_", "(_", "msg_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "(_", "not_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ")_", "and_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", ")_", ">_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", ":", " ", "zombie", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "proc_", "(_", "client_", ",_", "job", "\\u", "coro_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "yield_", "client_", "._", "deliver", "_", "(_", "job", "\\u", "coro_", ",_", "timeout_", "=_", "5_", ")_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cor", "o_", "._", "\\u", "async", "oro", "_", "._", "\\u", "add_", "(_", "job", "\\u", "coro_", ")_", "\\u\\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", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "discard_", "(_", "job", "\\u", "coro_", ")_", "\\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", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "=_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "proc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "peer", "\\u", "status_", "(_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "peer", "\\u", "status_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "msg_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "msg_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "req", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "run", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "func_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "func", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", "or_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "run", ":", " ", "%", "s", "'_", ",_", "type_", "(_", "\\u", "disco", "ro", "\\u", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "func_", "=_", "async", "oro", "_", "._", "unse", "rial", "ize_", "(_", "\\u", "disco", "ro", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "func_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exec_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "code_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job", "\\u", "coro_", "=_", "Cor", "o_", "(_", "globals_", "(_", ")_", "[_", "\\u", "disco", "ro", "\\u", "func_", "._", "name_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "args_", ")_", ",_", "**_", "(_", "\\u", "disco", "ro", "\\u", "func_", "._", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "invalid", " ", "computation", " ", "to", " ", "run", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "coro_", "=_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ",_", "getattr_", "(_", "\\u", "disco", "ro", "\\u", "func_", ",_", "'", "name", "'_", ",_", "\\u", "disco", "ro", "\\u", "func_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "job", " ", "%", "s", " ", "created", "'_", ",_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "add_", "(_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "coro_", "._", "notify_", "(_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "notif", "y", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "job", "\\u", "coro_", "._", "notify_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Cor", "o_", "._", "\\u", "async", "oro", "_", "._", "\\u", "remove_", "(_", "job", "\\u", "coro_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "\\u", "disco", "ro", "\\u", "schedule", "\\u", "proc_", ",_", "\\u", "disco", "ro", "\\u", "client_", ",_", "job", "\\u", "coro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "job", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "setup", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "pulse", "\\u", "coro", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", "or_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "computation", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "invalid", " ", "\"", "setup", "\"", " ", "-", " ", "bus", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "[_", "'", "computation", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "'", "import", " ", "async", "oro", ".", "disas", "ync", "oro", " ", "as", " ", "async", "oro", "'_", ")_", "in_", "globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exec_", "(_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "code_", ")_", "in_", "globals_", "(_", ")_", "\\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 ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "computation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", ",_", "int_", ")_", "and_", "Min", "Pul", "se", "Interval_", "<=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "<=_", "Max", "Pul", "se", "Interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", "=_", "Min", "Pul", "se", "Interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "pulse", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", "'_", ":_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "pulse", "\\u", "interval_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "path", "'_", ":_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "nonl", "ocal", "s_", "._", "bus", "y", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "zombie", "\\u", "period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "computation", " ", "\"%", "s", "\"", " ", "from", " ", "%", "s", " ", "with", " ", "zombie", " ", "period", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "[_", "'", "client", "'_", "]_", "._", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "monit", "or", "\\u", "coro_", "._", "send_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "(_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ")_", ":_", "\\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_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", " ", "delet", "ing", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "and_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Clos", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "list_", "(_", "globals_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "globals_", "(_", ")_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "sys_", "._", "modules_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sys_", "._", "modules_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "modules_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "os_", "._", "listdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "ignore", "\\u", "errors_", "=_", "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 ", " ", "_", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\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_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\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 ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\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_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ",_", "'", "w", "'_", ")_", "as_", "\\u", "disco", "ro", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "var_", "._", "write_", "(_", "'%", "s", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\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 ", " ", "_", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "PID", " ", "file", " ", "\"%", "s", "\"", " ", "is", " ", "invalid", "'_", ",_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "._", "dest", "\\u", "path_", "=_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "computation", "_", "=_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "==_", "0_", ":_", "\\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", "disco", "ro", "\\u", "timer", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "pulse", "\\u", "coro", "'_", ":_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ",_", "'", "interval", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "path", "'_", ":_", "''_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "zombie", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "node", "\\u", "info", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "psutil_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "Disco", "ro", "Node", "Avail", "Info_", "(_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "._", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "cpu", "\\u", "percent_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "virtual", "\\u", "memory_", "(_", ")_", "._", "available_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "psutil_", "._", "disk", "\\u", "usage_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", "._", "free_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "100.0_", "-_", "psutil_", "._", "swap", "\\u", "memory_", "(_", ")_", "._", "percent_", ")_", "\\u\\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", "disco", "ro", "\\u", "var_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u", "disco", "ro", "\\u", "name", " ", "is", " ", "host", " ", "name", " ", "followe", "d", " ", "by", " ", "'-'", " ", "and", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "var_", "=_", "Disco", "ro", "Node", "Info_", "(_", "\\u", "disco", "ro", "\\u", "name_", "[_", ":_", "\\u", "disco", "ro", "\\u", "name_", "._", "rfind_", "(_", "'-'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "._", "addr_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "status", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "info", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", " ", " ", "Server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "runn", "ing", " ", "%", "d", " ", "coroutine", "s", " ", "for", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "len_", "(_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "location_", ")_", ")_", "\\u\\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_", "(_", "'", " ", " ", "Server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "not", " ", "used", " ", "by", " ", "any", " ", "computation", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "quit", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "quit", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Clos", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\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_", "elif_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "terminate", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "!=_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "ign", "orin", "g", " ", "terminate", ":", " ", "%", "s", "'_", ",_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "pulse", "\\u", "coro_", "._", "send_", "(_", "{_", "'", "status", "'_", ":_", "'", "Server", "Terminate", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "computation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "{_", "'", "req", "'_", ":_", "'", "close", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "serve", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "send_", "(_", "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 ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "command", " ", "\"%", "s", "\"", " ", "ignore", "d", "'_", ",_", "\\u", "disco", "ro", "\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", " ", "unti", "l", " ", "all", " ", "computation", "s", " ", "are", " ", "don", "e", ";", " ", "process", " ", "only", " ", "'", "close", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "\\u", "disco", "ro", "\\u", "job", "\\u", "coros", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "msg_", "=_", "yield_", "\\u", "disco", "ro", "\\u", "coro_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "msg_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "req_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "req", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "req_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "auth_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "auth", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "disco", "ro", "\\u", "computation", "_", "or_", "\\u", "disco", "ro", "\\u", "auth_", "!=_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ":_", "\\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_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'%", "s", " ", "delet", "ing", " ", "computation", " ", "\"%", "s", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ",_", "\\u", "disco", "ro", "\\u", "computation", "_", "._", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "list_", "(_", "globals_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "disco", "ro", "\\u", "var_", "not_", "in_", "\\u", "disco", "ro", "\\u", "globals_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "globals_", "(_", ")_", "._", "pop_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "globals_", "(_", ")_", "._", "update_", "(_", "\\u", "disco", "ro", "\\u", "globals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "async", "oro", "_", "._", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "command", " ", "\"%", "s", "\"", " ", "ignore", "d", "'_", ",_", "\\u", "disco", "ro", "\\u", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "=_", "\\u", "disco", "ro", "\\u", "msg_", "._", "get_", "(_", "'", "client", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "\\u", "disco", "ro", "\\u", "client_", ",_", "Cor", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "client_", "._", "send_", "(_", "-_", "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_", "for_", "\\u", "disco", "ro", "\\u", "var_", "in_", "os_", "._", "listdir_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "disco", "ro", "\\u", "var_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u", "disco", "ro", "\\u", "dest", "\\u", "path_", ",_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "\\u", "disco", "ro", "\\u", "var_", ",_", "ignore", "\\u", "errors_", "=_", "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 ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "\\u", "disco", "ro", "\\u", "pid", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "mp", "\\u", "queue", "'_", "]_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "'", "quit", "'_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "config_", "[_", "'", "auth", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "oro", "_", "._", "logger_", "._", "debug_", "(_", "'", "disco", "ro", " ", "server", " ", "\"%", "s", "\"", " ", "@", " ", "%", "s", " ", "terminate", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "disco", "ro", "\\u", "name_", ",_", "\\u", "disco", "ro", "\\u", "coro_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "disco", "ro", "\\u", "cmd", "\\u", "reader_", "(_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "set\\u", "daemon_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "async", "\\u", "threads_", "=_", "async", "oro", "_", "._", "Async", "Thread", "Pool_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "coro_", "._", "sleep_", "(_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "disco", "ro", "\\u", "cmd_", "=_", "yield_", "async", "\\u", "threads_", "._", "async", "\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "raw", "\\u", "input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "Enter", " ", "\"", "status", "\"", " ", "to", " ", "get", " ", "status", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "close", "\"", " ", "to", " ", "close", " ", "current", " ", "computation", " ", "(", "kill", " ", "any", " ", "runn", "ing", " ", "jobs", ")\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "quit", "\"", " ", "to", " ", "stop", " ", "accept", "ing", " ", "new", " ", "jobs", " ", "and", " ", "quit", " ", "whe", "n", " ", "don", "e", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "\"", "terminate", "\"", " ", "to", " ", "kill", " ", "current", " ", "jobs", " ", "and", " ", "quit", ":", " ", "'_", ")_", "\\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", "disco", "ro", "\\u", "cmd_", "=_", "'", "terminate", "'_", "\\u\\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", "disco", "ro", "\\u", "cmd_", "=_", "\\u", "disco", "ro", "\\u", "cmd_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "disco", "ro", "\\u", "cmd_", "==_", "'", "status", "'_", "or_", "\\u", "disco", "ro", "\\u", "cmd_", "==_", "'", "close", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "\\u", "disco", "ro", "\\u", "cmd_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "disco", "ro", "\\u", "cmd_", "in_", "(_", "'", "quit", "'_", ",_", "'", "terminate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "in_", "\\u", "disco", "ro", "\\u", "server", "\\u", "infos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "disco", "ro", "\\u", "server", "\\u", "info_", "._", "Queue_", "._", "put_", "(_", "{_", "'", "req", "'_", ":_", "\\u", "disco", "ro", "\\u", "cmd_", ",_", "'", "auth", "'_", ":_", "\\u", "disco", "ro", "\\u", "auth_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ImageEngine/gaffer/contrib/doc/GafferUserGuide/images/autoGenerated_source/interface_sceneInspector_figCA.py
[ { "content": "import IECore\nimport GafferUI\nimport GafferScene\nimport GafferSceneUI\nimport os\n\nfor nodeName in ['ShaderAssignmentA']:\n\tscript.selection().add( script.descendant( nodeName ) )\nscript.context()[\"ui:scene:expandedPaths\"] = GafferScene.PathMatcherData( GafferScene.PathMatcher( ['/', '/group', '/group/ballA', '/group/ballB', '/group/camera', '/group/light'] ) )\nscript.context()[\"ui:scene:selectedPaths\"] = IECore.StringVectorData( [ \"/group/ballA\" ] )\n\nscriptNode = script\nscriptWindow = GafferUI.ScriptWindow.acquire( script )\nlayout = eval( \"GafferUI.CompoundEditor( scriptNode, children = ( GafferUI.SplitContainer.Orientation.Horizontal, 0.65, ( ( GafferUI.SplitContainer.Orientation.Vertical, 0.500816, ( {'tabs': (GafferUI.Viewer( scriptNode ),), 'currentTab': 0}, {'tabs': (GafferUI.NodeGraph( scriptNode ),), 'currentTab': 0} ) ), {'tabs': (GafferSceneUI.SceneInspector( scriptNode ),), 'currentTab': 0} ) ) )\" )\nscriptWindow.setLayout( layout )\nscriptWindow._Widget__qtWidget.resize(845,645)\n\n##############################################################\n## IMAGE SPECIFIC COMMANDS BELOW #############################\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import GafferSceneUI", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 20 }, { "span": "import os", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "IE", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scene_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "Scen", "e", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Name_", "in_", "[_", "'", "Shader", "Assign", "ment", "A", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "script_", "._", "selection_", "(_", ")_", "._", "add_", "(_", "script_", "._", "descendant", "_", "(_", "node", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script_", "._", "context_", "(_", ")_", "[_", "\"", "ui", ":", "scen", "e", ":", "expand", "ed", "Path", "s", "\"_", "]_", "=_", "Ga", "ffer", "Scene_", "._", "Path", "Match", "er", "Data_", "(_", "Ga", "ffer", "Scene_", "._", "Path", "Matcher_", "(_", "[_", "'/'_", ",_", "'/", "group", "'_", ",_", "'/", "group", "/", "bal", "l", "A", "'_", ",_", "'/", "group", "/", "bal", "l", "B", "'_", ",_", "'/", "group", "/", "came", "ra", "'_", ",_", "'/", "group", "/", "light", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "._", "context_", "(_", ")_", "[_", "\"", "ui", ":", "scen", "e", ":", "selecte", "d", "Path", "s", "\"_", "]_", "=_", "IE", "Core_", "._", "String", "Vector", "Data_", "(_", "[_", "\"/", "group", "/", "bal", "l", "A", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "script", "Node_", "=_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "=_", "Ga", "ffer", "UI_", "._", "Script", "Window_", "._", "acquire_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "eval_", "(_", "\"", "Ga", "ffer", "UI", ".", "Compo", "und", "Edit", "or", "(", " ", "script", "Node", ",", " ", "child", "ren", " ", "=", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Horiz", "onta", "l", ",", " ", "0.65", ",", " ", "(", " ", "(", " ", "Ga", "ffer", "UI", ".", "Split", "Containe", "r", ".", "Orient", "ation", ".", "Vertica", "l", ",", " ", "0.50", "081", "6", ",", " ", "(", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "UI", ".", "View", "er", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "current", "Tab", "':", " ", "0", "},", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "UI", ".", "Node", "Graph", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "current", "Tab", "':", " ", "0", "}", " ", ")", " ", "),", " ", "{", "'", "tabs", "':", " ", "(", "Ga", "ffer", "Scen", "e", "UI", ".", "Scen", "e", "Inspector", "(", " ", "script", "Node", " ", "),", "),", " ", "'", "current", "Tab", "':", " ", "0", "}", " ", ")", " ", ")", " ", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "._", "set", "Layout_", "(_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script", "Window_", "._", "\\u", "Wid", "get", "\\u\\u", "qt", "Widget_", "._", "resize_", "(_", "845", "_", ",_", "645", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "IMA", "GE", " ", "SPECIFI", "C", " ", "COMMA", "NDS", " ", "BEL", "OW", " ", "###########", "###########", "######", "#", "_", "\\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 ]
Unused import
google/nogotofail/nogotofail/mitm/connection/handlers/connection/__init__.py
[ { "content": "r'''\nCopyright 2014 Google Inc. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n'''\nfrom nogotofail.mitm.connection.handlers import store\n\nhandlers = store.HandlerStore()\n\nfrom log import LoggingHandler\nfrom selfsigned import SelfSignedMITM\nfrom invalidhostname import InvalidHostnameMITM\nfrom anonserver import AnonServerMITM\nfrom heartbleed import ClientHeartbleedHandler\nfrom dropssl import DropSSL\nfrom droptls import DropTLS\nfrom ccs import EarlyCCS\nfrom serverkeyreplace import ServerKeyReplacementMITM\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from log import LoggingHandler", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 30 }, { "span": "from selfsigned import SelfSignedMITM", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 37 }, { "span": "from invalidhostname import InvalidHostnameMITM", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 47 }, { "span": "from anonserver import AnonServerMITM", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 37 }, { "span": "from heartbleed import ClientHeartbleedHandler", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 46 }, { "span": "from dropssl import DropSSL", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 27 }, { "span": "from droptls import DropTLS", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 27 }, { "span": "from ccs import EarlyCCS", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 24 }, { "span": "from serverkeyreplace import ServerKeyReplacementMITM", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "r", "'''", "\\", "10", ";", "Copy", "right", " ", "2014", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "\\", "10", ";", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", "\\", "10", ";", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", "\\", "10", ";", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", "\\", "10", ";", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nog", "oto", "fail_", "._", "mit", "m_", "._", "connection_", "._", "handlers_", "import_", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handlers_", "=_", "store_", "._", "Handle", "r", "Store_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "log_", "import_", "Log", "ging", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "self", "signed_", "import_", "Self", "Signe", "d", "MIT", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "invalid", "hostname_", "import_", "Inva", "lid", "Host", "name", "MIT", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "anon", "server_", "import_", "Ano", "n", "Server", "MIT", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heart", "ble", "ed_", "import_", "Client", "Heart", "ble", "ed", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "drops", "sl_", "import_", "Drop", "SSL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "drop", "tls_", "import_", "Drop", "TLS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ccs", "_", "import_", "Earl", "y", "CCS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "server", "key", "replace_", "import_", "Server", "Key", "Replace", "ment", "MIT", "M_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
VisTrails/VisTrails/contrib/SciPy/DSP.py
[ { "content": " def compute(self):\n mat = self.get_input(\"Signal\")\n sr = self.get_input(\"Sampling Rate\")\n\n if self.has_input(\"Window\"):\n window = self.get_input(\"Window\").matrix.toarray()\n win_size = window.shape[1]\n else:\n win_size = self.get_input(\"WindowSize\")\n window = scipy.signal.hamming(win_size)\n\n if self.has_input(\"Stride\"):\n stride = self.get_input(\"Stride\")\n else:\n stride = int(win_size / 2)\n\n signal_array = mat.matrix.transpose().toarray().ravel()\n\n samples = signal_array.shape[0]\n\n offset = 0\n sig = self.get_signal(signal_array, window, offset, win_size)\n phasors = fftpack.fft(sig).ravel()\n out_array = phasors\n offset += stride\n\n i = 1\n while 1:\n try:\n sig = self.get_signal(signal_array, window, offset, win_size)\n phasors = fftpack.fft(sig)\n offset += stride\n out_array = numpy.vstack([out_array, phasors.ravel()])\n i += 1\n except:\n break\n\n (slices, freqs) = out_array.shape\n ar = out_array[0:,0:sr*2]\n ar = ar[0:,::-1]\n\n out = SparseMatrix()\n sigout = SparseMatrix()\n sigout.matrix = sparse.csc_matrix(signal_array)\n out.matrix = sparse.csc_matrix(ar)\n self.set_output(\"Signal Output\", sigout)\n self.set_output(\"FFT Output\", out)", "metadata": "root.ShortTimeFourierTransform.compute", "header": "['class', 'ShortTimeFourierTransform', '(', 'DSP', ')', ':', '___EOS___']", "index": 103 } ]
[ { "span": "except:", "start_line": 137, "start_column": 12, "end_line": 137, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Short", "Time", "Four", "ier", "Transform_", "(_", "DS", "P_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mat_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Signal", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sr_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Sampl", "ing", " ", "Rat", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Window", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Window", "\"_", ")_", "._", "matrix_", "._", "toa", "rray_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win", "\\u", "size_", "=_", "window_", "._", "shape_", "[_", "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 ", " _", "win", "\\u", "size_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Window", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "scipy_", "._", "signal_", "._", "hamming", "_", "(_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Stri", "de", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stride_", "=_", "int_", "(_", "win", "\\u", "size_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal", "\\u", "array_", "=_", "mat_", "._", "matrix_", "._", "transpose_", "(_", ")_", "._", "toa", "rray_", "(_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "samples_", "=_", "signal", "\\u", "array_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig_", "=_", "self_", "._", "get", "\\u", "signal_", "(_", "signal", "\\u", "array_", ",_", "window_", ",_", "offset_", ",_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "sig_", ")_", "._", "ravel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "pha", "sor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sig_", "=_", "self_", "._", "get", "\\u", "signal_", "(_", "signal", "\\u", "array_", ",_", "window_", ",_", "offset_", ",_", "win", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pha", "sor", "s_", "=_", "fft", "pack_", "._", "fft_", "(_", "sig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "stride_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "array_", "=_", "numpy_", "._", "vstack_", "(_", "[_", "out", "\\u", "array_", ",_", "pha", "sor", "s_", "._", "ravel_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "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 ", " _", "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_", "(_", "slices_", ",_", "freqs_", ")_", "=_", "out", "\\u", "array_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "out", "\\u", "array_", "[_", "0_", ":_", ",_", "0_", ":_", "sr_", "*_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ar_", "=_", "ar_", "[_", "0_", ":_", ",_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "out_", "=_", "Spar", "se", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "out_", "._", "matrix_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "(_", "signal", "\\u", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "matrix_", "=_", "sparse_", "._", "csc", "\\u", "matrix_", "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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, 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 ]
Unused local variable
ask/ghettoq/setup.py
[ { "content": "def osx_install_data(install_data):\n\n def finalize_options(self):\n self.set_undefined_options(\"install\", (\"install_lib\", \"install_dir\"))\n install_data.finalize_options(self)", "metadata": "root.osx_install_data", "header": "['module', '___EOS___']", "index": 35 } ]
[ { "span": "finalize_options(", "start_line": 37, "start_column": 8, "end_line": 37, "end_column": 24 } ]
[]
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_", "def_", "os", "x", "\\u", "install", "\\u", "data_", "(_", "install", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "undefined", "\\u", "options_", "(_", "\"", "install", "\"_", ",_", "(_", "\"", "install", "\\u", "lib", "\"_", ",_", "\"", "install", "\\u", "dir", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "data_", "._", "finalize", "\\u", "options_", "(_", "self_", ")_", "\\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, 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 ]
Unused import
mozilla/inventory/vendor-local/src/django-tastypie/tests/basic/api/resources.py
[ { "content": "from django.conf.urls.defaults import url\nfrom django.contrib.auth.models import User\nfrom tastypie.bundle import Bundle\nfrom tastypie import fields\nfrom tastypie.resources import ModelResource\nfrom tastypie.authentication import SessionAuthentication\nfrom tastypie.authorization import Authorization\nfrom basic.models import Note, AnnotatedNote, SlugBasedNote\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UserResource(ModelResource):\n class Meta:\n resource_name = 'users'\n queryset = User.objects.all()\n authorization = Authorization()", "metadata": "root.UserResource", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class CachedUserResource(ModelResource):\n class Meta:\n allowed_methods = ('get', )\n queryset = User.objects.all()\n resource_name = 'cached_users'\n", "metadata": "root.CachedUserResource", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def create_response(self, *args, **kwargs):\n resp = super(CachedUserResource, self).create_response(*args, **kwargs)\n resp['Cache-Control'] = \"max-age=3600\"\n return resp", "metadata": "root.CachedUserResource.create_response", "header": "['class', 'CachedUserResource', '(', 'ModelResource', ')', ':', '___EOS___']", "index": 23 }, { "content": "class NoteResource(ModelResource):\n user = fields.ForeignKey(UserResource, 'user')\n\n class Meta:\n resource_name = 'notes'\n queryset = Note.objects.all()\n authorization = Authorization()", "metadata": "root.NoteResource", "header": "['module', '___EOS___']", "index": 29 }, { "content": "class BustedResource(ModelResource):\n class Meta:\n queryset = AnnotatedNote.objects.all()\n resource_name = 'busted'\n", "metadata": "root.BustedResource", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def get_list(self, *args, **kwargs):\n raise Exception(\"It's broke.\")", "metadata": "root.BustedResource.get_list", "header": "['class', 'BustedResource', '(', 'ModelResource', ')', ':', '___EOS___']", "index": 43 }, { "content": "class SlugBasedNoteResource(ModelResource):\n class Meta:\n queryset = SlugBasedNote.objects.all()\n resource_name = 'slugbased'\n detail_uri_name = 'slug'", "metadata": "root.SlugBasedNoteResource", "header": "['module', '___EOS___']", "index": 47 }, { "content": "class SessionUserResource(ModelResource):\n class Meta:\n resource_name = 'sessionusers'\n queryset = User.objects.all()\n authentication = SessionAuthentication()\n authorization = Authorization()", "metadata": "root.SessionUserResource", "header": "['module', '___EOS___']", "index": 54 } ]
[ { "span": "from django.conf.urls.defaults import url", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 41 }, { "span": "from tastypie.bundle import Bundle", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "conf_", "._", "urls_", "._", "defaults_", "import_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "bundle_", "import_", "Bundle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "import_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "resources_", "import_", "Model", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "authentication_", "import_", "Sess", "ion", "Authentication_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "authorization_", "import_", "Authorization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "basic_", "._", "models_", "import_", "Note_", ",_", "Annotate", "d", "Note_", ",_", "Sl", "ug", "Base", "d", "Note_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "User", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "name_", "=_", "'", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authorization_", "=_", "Authorization_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Cache", "d", "User", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "ed", "\\u", "methods_", "=_", "(_", "'", "get", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "name_", "=_", "'", "cache", "d\\u", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cache", "d", "User", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "response_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "super_", "(_", "Cache", "d", "User", "Resource_", ",_", "self_", ")_", "._", "create", "\\u", "response_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "[_", "'", "Cache", "-", "Control", "'_", "]_", "=_", "\"", "max", "-", "age", "=", "3600", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Not", "e", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "fields_", "._", "Fore", "ign", "Key_", "(_", "User", "Resource_", ",_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "name_", "=_", "'", "note", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "Note_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authorization_", "=_", "Authorization_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Bus", "ted", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queryset_", "=_", "Annotate", "d", "Note_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "name_", "=_", "'", "bust", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bus", "ted", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "list_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "It", "'", "s", " ", "bro", "ke", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sl", "ug", "Base", "d", "Not", "e", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queryset_", "=_", "Sl", "ug", "Base", "d", "Note_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "name_", "=_", "'", "slug", "based", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deta", "il", "\\u", "uri", "\\u", "name_", "=_", "'", "slug", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sess", "ion", "User", "Resource_", "(_", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "name_", "=_", "'", "session", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "User_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authentication_", "=_", "Sess", "ion", "Authentication_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authorization_", "=_", "Authorization_", "(_", ")_" ]
[ 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, 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, 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, 4, 2, 2, 2, 2, 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 ]
Module is imported with 'import' and 'import from'
RoseOu/flasky/venv/lib/python2.7/site-packages/sqlalchemy/util/compat.py
[ { "content": "# util/compat.py\n# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors\n# <see AUTHORS file>\n#\n# This module is part of SQLAlchemy and is released under\n# the MIT License: http://www.opensource.org/licenses/mit-license.php\n\n\"\"\"Handle Python version/platform incompatibilities.\"\"\"\n\nimport sys\n\ntry:\n import threading\nexcept ImportError:\n import dummy_threading as threading\n\npy33 = sys.version_info >= (3, 3)\npy32 = sys.version_info >= (3, 2)\npy3k = sys.version_info >= (3, 0)\npy2k = sys.version_info < (3, 0)\npy265 = sys.version_info >= (2, 6, 5)\njython = sys.platform.startswith('java')\npypy = hasattr(sys, 'pypy_version_info')\nwin32 = sys.platform.startswith('win')\ncpython = not pypy and not jython # TODO: something better for this ?\n\nimport collections\nnext = next\n\nif py3k:\n import pickle\nelse:\n try:\n import cPickle as pickle\n except ImportError:\n import pickle\n\n# work around http://bugs.python.org/issue2646\nif py265:\n safe_kwarg = lambda arg: arg\nelse:\n safe_kwarg = str\n\nArgSpec = collections.namedtuple(\"ArgSpec\",\n [\"args\", \"varargs\", \"keywords\", \"defaults\"])\n\nif py3k:\n import builtins\n\n from inspect import getfullargspec as inspect_getfullargspec\n from urllib.parse import (quote_plus, unquote_plus,\n parse_qsl, quote, unquote)\n import configparser\n from io import StringIO\n\n from io import BytesIO as byte_buffer\n\n\n string_types = str,\n binary_type = bytes\n text_type = str\n int_types = int,\n iterbytes = iter\n\n\n\n\n if py32:\n callable = callable\n else:\n\n\n from functools import reduce\n\n print_ = getattr(builtins, \"print\")\n\n import_ = getattr(builtins, '__import__')\n\n import itertools\n itertools_filterfalse = itertools.filterfalse\n itertools_filter = filter\n itertools_imap = map\n from itertools import zip_longest\n\n import base64\n\n\n\nelse:\n from inspect import getargspec as inspect_getfullargspec\n inspect_getargspec = inspect_getfullargspec\n from urllib import quote_plus, unquote_plus, quote, unquote\n from urlparse import parse_qsl\n import ConfigParser as configparser\n from StringIO import StringIO\n from cStringIO import StringIO as byte_buffer\n\n string_types = basestring,\n binary_type = str\n text_type = unicode\n int_types = int, long\n\n\n\n\n\n\n callable = callable\n cmp = cmp\n reduce = reduce\n\n import base64\n b64encode = base64.b64encode\n b64decode = base64.b64decode\n\n\n import itertools\n itertools_filterfalse = itertools.ifilterfalse\n itertools_filter = itertools.ifilter\n itertools_imap = itertools.imap\n from itertools import izip_longest as zip_longest\n\n\nimport time\nif win32 or jython:\n time_func = time.clock\nelse:\n time_func = time.time\n\nfrom collections import namedtuple\nfrom operator import attrgetter as dottedgetter\n\n\nif py3k:\n\nelse:\n exec(\"def reraise(tp, value, tb=None, cause=None):\\n\"\n \" raise tp, value, tb\\n\")\n\n\nif py3k:\n exec_ = getattr(builtins, 'exec')\nelse:\n\n\n\n\nfrom contextlib import contextmanager\n\ntry:\n from contextlib import nested\nexcept ImportError:\n # removed in py3k, credit to mitsuhiko for\n # workaround\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import collections", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "util", "/", "compa", "t", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2005", "-", "201", "5", " ", "the", " ", "SQL", "Al", "chem", "y", " ", "author", "s", " ", "and", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "see", " ", "AUTHOR", "S", " ", "file", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "is", " ", "part", " ", "of", " ", "SQL", "Al", "chem", "y", " ", "and", " ", "is", " ", "released", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "MIT", " ", "License", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", " ", "Pyth", "on", " ", "version", "/", "platform", " ", "incomp", "ati", "bilit", "ies", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "threading_", "\\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_", "dummy", "\\u", "threading_", "as_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "py3", "3_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py3", "2_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py3", "k_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py2", "k_", "=_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py2", "65_", "=_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "2_", ",_", "6_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jy", "tho", "n_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "java", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pypy", "_", "=_", "hasattr_", "(_", "sys_", ",_", "'", "pypy", "\\u", "version", "\\u", "info", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win32", "_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "tho", "n_", "=_", "not_", "pypy", "_", "and_", "not_", "jy", "tho", "n_", "#", " ", "TOD", "O", ":", " ", "somet", "hing", " ", "bett", "er", " ", "for", " ", "this", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\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 ", " _", "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_", "#", " ", "work", " ", "aro", "und", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "264", "6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "py2", "65_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe", "\\u", "kwarg_", "=_", "lambda_", "arg_", ":_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "safe", "\\u", "kwarg_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Arg", "Spec_", "=_", "collections_", "._", "namedtuple_", "(_", "\"", "Arg", "Spec", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "args", "\"_", ",_", "\"", "varargs", "\"_", ",_", "\"", "keywords", "\"_", ",_", "\"", "default", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "inspect_", "import_", "getf", "ull", "argspec_", "as_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "(_", "quote", "\\u", "plus_", ",_", "unqu", "ote", "\\u", "plus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parse", "\\u", "qs", "l_", ",_", "quote_", ",_", "unquote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "configparser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "as_", "byte", "\\u", "buffer_", "\\u\\u\\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_", "string", "\\u", "types_", "=_", "str_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "types_", "=_", "int_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "bytes_", "=_", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "py3", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callable_", "=_", "callable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "\"", "print", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import", "\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "'\\u", "\\u", "import", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter", "false_", "=_", "itertools_", "._", "filter", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter_", "=_", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "imap_", "=_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "zip", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "inspect_", "import_", "getargs", "pec_", "as_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inspect", "\\u", "getargs", "pec_", "=_", "inspect", "\\u", "getf", "ull", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote", "\\u", "plus_", ",_", "unqu", "ote", "\\u", "plus_", ",_", "quote_", ",_", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urlparse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "as_", "configparser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "as_", "byte", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "string", "\\u", "types_", "=_", "basestring_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "types_", "=_", "int_", ",_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "callable_", "=_", "callable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmp_", "=_", "cmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce_", "=_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b64encode_", "=_", "base64_", "._", "b64encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b64decode_", "=_", "base64_", "._", "b64decode_", "\\u\\u\\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_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter", "false_", "=_", "itertools_", "._", "ifi", "lter", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "filter_", "=_", "itertools_", "._", "ifi", "lter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "tool", "s", "\\u", "imap_", "=_", "itertools_", "._", "imap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "izi", "p", "\\u", "longest_", "as_", "zip", "\\u", "longest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "win32", "_", "or_", "jy", "tho", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "func_", "=_", "time_", "._", "clock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "func_", "=_", "time_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "attrgetter_", "as_", "dot", "ted", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "py3", "k_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "def", " ", "reraise", "(", "tp", ",", " ", "value", ",", " ", "tb", "=", "Non", "e", ",", " ", "caus", "e", "=", "Non", "e", "):", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", " ", "raise", " ", "tp", ",", " ", "value", ",", " ", "tb", "\\\\", "n", "\"_", ")_", "\\u\\u\\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_", "if_", "py3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec\\u_", "=_", "getattr_", "(_", "builtins_", ",_", "'", "exec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\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_", "contextlib_", "import_", "nested_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", "d", " ", "in", " ", "py3", "k", ",", " ", "credit", " ", "to", " ", "mit", "su", "hi", "ko", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "workar", "ound_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
lorien/grab/grab/spider/base.py
[ { "content": "from __future__ import absolute_import\nimport types\nimport logging\nimport time\ntry:\n from urlparse import urljoin\nexcept ImportError:\n from urllib.parse import urljoin\nfrom random import randint\nfrom six.moves import queue\nfrom copy import deepcopy\nimport six\nimport os\nfrom weblib import metric\nfrom contextlib import contextmanager\nfrom traceback import format_exc\nimport multiprocessing\nimport threading\nfrom datetime import datetime\nimport threading\nfrom threading import Thread\nfrom collections import deque\n\nfrom grab.base import Grab\nfrom grab.error import GrabInvalidUrl\nfrom grab.spider.error import (SpiderError, SpiderMisuseError, FatalError,\n NoTaskHandler, NoDataHandler,\n SpiderConfigurationError)\nfrom grab.spider.task import Task\nfrom grab.spider.data import Data\nfrom grab.spider.transport.multicurl import MulticurlTransport\nfrom grab.proxylist import ProxyList, BaseProxySource\nfrom grab.util.misc import camel_case_to_underscore\nfrom weblib.encoding import make_str, make_unicode\nfrom grab.base import GLOBAL_STATE\nfrom grab.stat import Stat, Timer\nfrom grab.spider.parser_pipeline import ParserPipeline\nfrom grab.spider.cache_pipeline import CachePipeline\nfrom grab.spider.deprecated import DeprecatedThingsSpiderMixin\nfrom grab.util.warning import warn\n\nDEFAULT_TASK_PRIORITY = 100\nDEFAULT_NETWORK_STREAM_NUMBER = 3\nDEFAULT_TASK_TRY_LIMIT = 5\nDEFAULT_NETWORK_TRY_LIMIT = 5\nRANDOM_TASK_PRIORITY_RANGE = (50, 100)\nNULL = object()\n\nlogger = logging.getLogger('grab.spider.base')\nlogger_verbose = logging.getLogger('grab.spider.base.verbose')\n# If you need verbose logging just\n# change logging level of that logger\nlogger_verbose.setLevel(logging.FATAL)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SpiderMetaClass(type):\n \"\"\"\n This meta class does following things::\n\n * It creates Meta attribute, if it is not defined in\n Spider descendant class, by copying parent's Meta attribute\n * It reset Meta.abstract to False if Meta is copied from parent class\n * If defined Meta does not contains `abstract`\n attribute then define it and set to False\n \"\"\"\n", "metadata": "root.SpiderMetaClass", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def __new__(cls, name, bases, namespace):\n if 'Meta' not in namespace:\n for base in bases:\n if hasattr(base, 'Meta'):\n # copy contents of base Meta\n meta = type('Meta', (object,), dict(base.Meta.__dict__))\n # reset abstract attribute\n meta.abstract = False\n namespace['Meta'] = meta\n break\n\n # Process special case (SpiderMetaClassMixin)\n if 'Meta' not in namespace:\n namespace['Meta'] = type('Meta', (object,), {})\n\n if not hasattr(namespace['Meta'], 'abstract'):\n namespace['Meta'].abstract = False\n\n return super(SpiderMetaClass, cls).__new__(cls, name, bases, namespace)", "metadata": "root.SpiderMetaClass.__new__", "header": "['class', 'SpiderMetaClass', '(', 'type', ')', ':', '___EOS___']", "index": 66 }, { "content": "@six.add_metaclass(SpiderMetaClass)\nclass Spider(DeprecatedThingsSpiderMixin):\n \"\"\"\n Asynchronous scraping framework.\n \"\"\"\n\n # You can define here some urls and initial tasks\n # with name \"initial\" will be created from these\n # urls\n # If the logic of generating initial tasks is complex\n # then consider to use `task_generator` method instead of\n # `initial_urls` attribute\n initial_urls = None\n\n class Meta:\n # Meta.abstract means that this class will not be\n # collected to spider registry by `grab crawl` CLI command.\n # The Meta is inherited by descendant classes BUT\n # Meta.abstract is reset to False in each descendant\n abstract = True\n\n # *************\n # Class Methods\n # *************\n\n\n\n # **************\n # Public Methods\n # **************\n\n\n\n\n\n\n\n\n\n\n # ********************************\n # Methods for spider customization\n # ********************************\n\n\n\n\n\n\n\n\n # ***************\n # Private Methods\n # ***************\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Spider", "header": "['module', '___EOS___']", "index": 87 }, { "content": " @classmethod\n def update_spider_config(cls, config):\n pass", "metadata": "root.Spider.update_spider_config", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 112 }, { "content": " @classmethod\n def get_spider_name(cls):\n if hasattr(cls, 'spider_name'):\n return cls.spider_name\n else:\n return camel_case_to_underscore(cls.__name__)", "metadata": "root.Spider.get_spider_name", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 116 }, { "content": " def __init__(self, thread_number=None,\n network_try_limit=None, task_try_limit=None,\n request_pause=NULL,\n priority_mode='random',\n meta=None,\n only_cache=False,\n config=None,\n slave=None,\n args=None,\n # New options start here\n taskq=None,\n # MP:\n network_result_queue=None,\n parser_result_queue=None,\n is_parser_idle=None,\n shutdown_event=None,\n mp_mode=False,\n parser_pool_size=None,\n parser_mode=False,\n parser_requests_per_process=10000,\n # http api\n http_api_port=None,\n ):\n \"\"\"\n Arguments:\n * thread-number - Number of concurrent network streams\n * network_try_limit - How many times try to send request\n again if network error was occurred, use 0 to disable\n * network_try_limit - Limit of tries to execute some task\n this is not the same as network_try_limit\n network try limit limits the number of tries which\n are performed automatically in case of network timeout\n of some other physical error\n but task_try_limit limits the number of attempts which\n are scheduled manually in the spider business logic\n * priority_mode - could be \"random\" or \"const\"\n * meta - arbitrary user data\n * retry_rebuild_user_agent - generate new random user-agent for each\n network request which is performed again due to network error\n * args - command line arguments parsed with `setup_arg_parser` method\n New options:\n * taskq=None,\n * newtork_response_queue=None,\n \"\"\"\n\n if slave is not None:\n raise SpiderConfigurtionError(\n 'Slave mode is not supported anymore. '\n 'Use `mp_mode=True` option to run multiple HTML'\n ' parser processes.')\n\n # API:\n self.http_api_port = http_api_port\n\n # MP:\n self.mp_mode = mp_mode\n if self.mp_mode:\n from multiprocessing import Process, Event, Queue\n else:\n from multiprocessing.dummy import Process, Event, Queue\n\n if network_result_queue is not None:\n self.network_result_queue = network_result_queue\n else:\n self.network_result_queue = Queue()\n self.parser_result_queue = parser_result_queue\n self.is_parser_idle = is_parser_idle\n if shutdown_event is not None:\n self.shutdown_event = shutdown_event\n else:\n self.shutdown_event = Event()\n if not self.mp_mode and parser_pool_size and parser_pool_size > 1:\n raise SpiderConfigurationError(\n 'Parser pool size could be only 1 in '\n 'non-multiprocess mode')\n self.parser_pool_size = parser_pool_size\n self.parser_mode = parser_mode\n self.parser_requests_per_process = parser_requests_per_process\n\n self.stat = Stat()\n self.timer = Timer()\n self.task_queue = taskq\n\n if args is None:\n self.args = {}\n else:\n self.args = args\n\n if config is not None:\n self.config = config\n else:\n self.config = {}\n\n if meta:\n self.meta = meta\n else:\n self.meta = {}\n\n self.thread_number = (\n thread_number or\n int(self.config.get('thread_number',\n DEFAULT_NETWORK_STREAM_NUMBER)))\n self.task_try_limit = (\n task_try_limit or\n int(self.config.get('task_try_limit', DEFAULT_TASK_TRY_LIMIT)))\n self.network_try_limit = (\n network_try_limit or\n int(self.config.get('network_try_limit',\n DEFAULT_NETWORK_TRY_LIMIT)))\n\n self._grab_config = {}\n if priority_mode not in ['random', 'const']:\n raise SpiderMisuseError('Value of priority_mode option should be '\n '\"random\" or \"const\"')\n else:\n self.priority_mode = priority_mode\n\n self.only_cache = only_cache\n self.cache_pipeline = None\n self.work_allowed = True\n if request_pause is not NULL:\n warn('Option `request_pause` is deprecated and is not '\n 'supported anymore')\n\n self.proxylist_enabled = None\n self.proxylist = None\n self.proxy = None\n self.proxy_auto_change = False\n self.interrupted = False", "metadata": "root.Spider.__init__", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 127 }, { "content": " def setup_cache(self, backend='mongo', database=None, use_compression=True,\n **kwargs):\n if database is None:\n raise SpiderMisuseError('setup_cache method requires database '\n 'option')\n self.cache_enabled = True\n mod = __import__('grab.spider.cache_backend.%s' % backend,\n globals(), locals(), ['foo'])\n cache = mod.CacheBackend(database=database,\n use_compression=use_compression,\n spider=self, **kwargs)\n self.cache_pipeline = CachePipeline(self, cache)", "metadata": "root.Spider.setup_cache", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 257 }, { "content": " def setup_queue(self, backend='memory', **kwargs):\n logger.debug('Using %s backend for task queue' % backend)\n mod = __import__('grab.spider.queue_backend.%s' % backend,\n globals(), locals(), ['foo'])\n self.task_queue = mod.QueueBackend(spider_name=self.get_spider_name(),\n **kwargs)", "metadata": "root.Spider.setup_queue", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 270 }, { "content": " def add_task(self, task, raise_error=False):\n \"\"\"\n Add task to the task queue.\n \"\"\"\n\n # MP:\n # ***\n if self.parser_mode:\n self.parser_result_queue.put((task, None))\n return\n\n if self.task_queue is None:\n raise SpiderMisuseError('You should configure task queue before '\n 'adding tasks. Use `setup_queue` method.')\n if task.priority is None or not task.priority_is_custom:\n task.priority = self.generate_task_priority()\n task.priority_is_custom = False\n else:\n task.priority_is_custom = True\n\n try:\n if not task.url.startswith(('http://', 'https://', 'ftp://',\n 'file://', 'feed://')):\n if self.base_url is None:\n msg = 'Could not resolve relative URL because base_url ' \\\n 'is not specified. Task: %s, URL: %s'\\\n % (task.name, task.url)\n raise SpiderError(msg)\n else:\n warn('Class attribute `Spider::base_url` is deprecated. '\n 'Use Task objects with absolute URLs')\n task.url = urljoin(self.base_url, task.url)\n # If task has grab_config object then update it too\n if task.grab_config:\n task.grab_config['url'] = task.url\n except Exception as ex:\n self.stat.collect('task-with-invalid-url', task.url)\n if raise_error:\n raise\n else:\n logger.error('', exc_info=ex)\n return False\n\n # TODO: keep original task priority if it was set explicitly\n self.task_queue.put(task, task.priority, schedule_time=task.schedule_time)\n return True", "metadata": "root.Spider.add_task", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 277 }, { "content": " def stop(self):\n \"\"\"\n This method set internal flag which signal spider\n to stop processing new task and shuts down.\n \"\"\"\n\n logger_verbose.debug('Method `stop` was called')\n self.work_allowed = False", "metadata": "root.Spider.stop", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 324 }, { "content": " def load_proxylist(self, source, source_type=None, proxy_type='http',\n auto_init=True, auto_change=True,\n **kwargs):\n self.proxylist = ProxyList()\n if isinstance(source, BaseProxySource):\n self.proxylist.set_source(source)\n elif isinstance(source, six.string_types):\n if source_type == 'text_file':\n self.proxylist.load_file(source, proxy_type=proxy_type)\n elif source_type == 'url':\n self.proxylist.load_url(source, proxy_type=proxy_type)\n else:\n raise SpiderMisuseError('Method `load_proxylist` received '\n 'invalid `source_type` argument: %s'\n % source_type) \n else:\n raise SpiderMisuseError('Method `load_proxylist` received '\n 'invalid `source` argument: %s'\n % source) \n\n self.proxylist_enabled = True\n self.proxy = None\n if not auto_change and auto_init:\n self.proxy = self.proxylist.get_random_proxy()\n self.proxy_auto_change = auto_change", "metadata": "root.Spider.load_proxylist", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 333 }, { "content": " def process_next_page(self, grab, task, xpath,\n resolve_base=False, **kwargs):\n \"\"\"\n Generate task for next page.\n\n :param grab: Grab instance\n :param task: Task object which should be assigned to next page url\n :param xpath: xpath expression which calculates list of URLS\n :param **kwargs: extra settings for new task object\n\n Example::\n\n self.follow_links(grab, 'topic', '//div[@class=\"topic\"]/a/@href')\n \"\"\"\n try:\n # next_url = grab.xpath_text(xpath)\n next_url = grab.doc.select(xpath).text()\n except IndexError:\n return False\n else:\n url = grab.make_url_absolute(next_url, resolve_base=resolve_base)\n page = task.get('page', 1) + 1\n grab2 = grab.clone()\n grab2.setup(url=url)\n task2 = task.clone(task_try_count=1, grab=grab2,\n page=page, **kwargs)\n self.add_task(task2)\n return True", "metadata": "root.Spider.process_next_page", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 359 }, { "content": " def render_stats(self, timing=True):\n out = ['------------ Stats: ------------']\n out.append('Counters:')\n\n # Process counters\n items = sorted(self.stat.counters.items(),\n key=lambda x: x[0], reverse=True)\n for item in items:\n out.append(' %s: %s' % item)\n out.append('')\n\n out.append('Lists:')\n # Process collections sorted by size desc\n col_sizes = [(x, len(y)) for x, y in self.stat.collections.items()]\n col_sizes = sorted(col_sizes, key=lambda x: x[1], reverse=True)\n for col_size in col_sizes:\n out.append(' %s: %d' % col_size)\n out.append('')\n\n # Process extra metrics\n if 'download-size' in self.stat.counters:\n out.append('Network download: %s' %\n metric.format_traffic_value(\n self.stat.counters['download-size']))\n out.append('Queue size: %d' % self.task_queue.size()\n if self.task_queue else 'NA')\n out.append('Network streams: %d' % self.thread_number)\n elapsed = self.timer.timers['total']\n hours, seconds = divmod(elapsed, 3600)\n minutes, seconds = divmod(seconds, 60)\n out.append('Time elapsed: %d:%d:%d (H:M:S)' % (\n hours, minutes, seconds))\n out.append('End time: %s' % \n datetime.utcnow().strftime('%d %b %Y, %H:%M:%S UTC'))\n\n if timing:\n out.append('')\n out.append(self.render_timing())\n return '\\n'.join(out) + '\\n'", "metadata": "root.Spider.render_stats", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 388 }, { "content": " def render_timing(self):\n out = ['Timers:']\n out.append(' DOM: %.3f' % GLOBAL_STATE['dom_build_time'])\n time_items = [(x, y) for x, y in self.timer.timers.items()]\n time_items = sorted(time_items, key=lambda x: x[1])\n for time_item in time_items:\n out.append(' %s: %.03f' % time_item)\n return '\\n'.join(out) + '\\n'", "metadata": "root.Spider.render_timing", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 428 }, { "content": " def prepare(self):\n \"\"\"\n You can do additional spider customization here\n before it has started working. Simply redefine\n this method in your Spider class.\n \"\"\"", "metadata": "root.Spider.prepare", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 441 }, { "content": " def prepare_parser(self):\n \"\"\"\n You can do additional spider customization here\n before it has started working. Simply redefine\n this method in your Spider class.\n\n This method is called only from Spider working in parser mode\n that, in turn, is spawned automatically by main spider proces\n working in multiprocess mode.\n \"\"\"", "metadata": "root.Spider.prepare_parser", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 449 }, { "content": " def shutdown(self):\n \"\"\"\n You can override this method to do some final actions\n after parsing has been done.\n \"\"\"\n\n pass", "metadata": "root.Spider.shutdown", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 460 }, { "content": " def update_grab_instance(self, grab):\n \"\"\"\n Use this method to automatically update config of any\n `Grab` instance created by the spider.\n \"\"\"\n pass", "metadata": "root.Spider.update_grab_instance", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 468 }, { "content": " def create_grab_instance(self, **kwargs):\n # Back-ward compatibility for deprecated `grab_config` attribute\n # Here I use `_grab_config` to not trigger warning messages\n if self._grab_config and kwargs:\n merged_config = deepcopy(self._grab_config)\n merged_config.update(kwargs)\n grab = Grab(**merged_config)\n elif self._grab_config and not kwargs:\n grab = Grab(**self._grab_config)\n else:\n grab = Grab(**kwargs)\n return grab", "metadata": "root.Spider.create_grab_instance", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 475 }, { "content": " def task_generator(self):\n \"\"\"\n You can override this method to load new tasks smoothly.\n\n It will be used each time as number of tasks\n in task queue is less then number of threads multiplied on 2\n This allows you to not overload all free memory if total number of\n tasks is big.\n \"\"\"\n\n if False:\n # Some magic to make this function empty generator\n yield ':-)'\n return", "metadata": "root.Spider.task_generator", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 488 }, { "content": " def check_task_limits(self, task):\n \"\"\"\n Check that task's network & try counters do not exceed limits.\n\n Returns:\n * if success: (True, None)\n * if error: (False, reason)\n\n \"\"\"\n\n if task.task_try_count > self.task_try_limit:\n return False, 'task-try-count'\n\n if task.network_try_count > self.network_try_limit:\n return False, 'network-try-count'\n\n return True, None", "metadata": "root.Spider.check_task_limits", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 507 }, { "content": " def generate_task_priority(self):\n if self.priority_mode == 'const':\n return DEFAULT_TASK_PRIORITY\n else:\n return randint(*RANDOM_TASK_PRIORITY_RANGE)", "metadata": "root.Spider.generate_task_priority", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 525 }, { "content": " def task_generator_thread_wrapper(self, task_generator):\n \"\"\"\n Load new tasks from `self.task_generator_object`\n Create new tasks.\n\n If task queue size is less than some value\n then load new tasks from tasks file.\n \"\"\"\n\n while True:\n with self.timer.log_time('task_generator'):\n queue_size = self.task_queue.size()\n min_limit = self.thread_number * 10\n if queue_size < min_limit:\n with self.timer.log_time('task_generator'):\n logger_verbose.debug(\n 'Task queue contains less tasks (%d) than '\n 'allowed limit (%d). Trying to add '\n 'new tasks.' % (queue_size, min_limit))\n try:\n for x in six.moves.range(min_limit - queue_size):\n item = next(task_generator)\n logger_verbose.debug('Got new item from generator. '\n 'Processing it.')\n self.process_handler_result(item)\n except StopIteration:\n # If generator have no values to yield\n # then disable it\n logger_verbose.debug('Task generator has no more tasks. '\n 'Disabling it')\n break\n else:\n time.sleep(0.1)", "metadata": "root.Spider.task_generator_thread_wrapper", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 531 }, { "content": " def start_task_generators(self):\n \"\"\"\n Process `self.initial_urls` list and `self.task_generator`\n method.\n \"\"\"\n\n logger_verbose.debug('Processing initial urls')\n if self.initial_urls:\n for url in self.initial_urls:\n self.add_task(Task('initial', url=url))\n\n self._task_generator_list = []\n th = Thread(target=self.task_generator_thread_wrapper,\n args=[self.task_generator()])\n th.daemon = True\n th.start()\n self._task_generator_list.append(th)", "metadata": "root.Spider.start_task_generators", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 565 }, { "content": " def get_task_from_queue(self):\n start = time.time()\n try:\n with self.timer.log_time('task_queue'):\n return self.task_queue.get()\n except queue.Empty:\n size = self.task_queue.size()\n if size:\n logger_verbose.debug(\n 'No ready-to-go tasks, Waiting for '\n 'scheduled tasks (%d)' % size)\n return True\n else:\n logger_verbose.debug('Task queue is empty.')\n return None", "metadata": "root.Spider.get_task_from_queue", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 583 }, { "content": " def setup_grab_for_task(self, task):\n grab = self.create_grab_instance()\n if task.grab_config:\n grab.load_config(task.grab_config)\n else:\n grab.setup(url=task.url)\n\n # Generate new common headers\n grab.config['common_headers'] = grab.common_headers()\n self.update_grab_instance(grab)\n return grab", "metadata": "root.Spider.setup_grab_for_task", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 599 }, { "content": " def is_valid_network_response_code(self, code, task):\n \"\"\"\n Answer the question: if the response could be handled via\n usual task handler or the task faield and should be processed as error.\n \"\"\"\n\n return (code < 400 or code == 404 or\n code in task.valid_status)", "metadata": "root.Spider.is_valid_network_response_code", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 611 }, { "content": " def process_handler_error(self, func_name, ex, task):\n self.stat.inc('spider:error-%s' % ex.__class__.__name__.lower())\n\n if hasattr(ex, 'tb'):\n logger.error('Error in %s function' % func_name)\n logger.error(ex.tb)\n else:\n logger.error('Error in %s function' % func_name, exc_info=ex)\n\n # Looks strange but I really have some problems with\n # serializing exception into string\n try:\n ex_str = six.text_type(ex)\n except TypeError:\n try:\n ex_str = ex.decode('utf-8', 'ignore')\n except TypeError:\n ex_str = str(ex)\n\n task_url = task.url if task is not None else None\n self.stat.collect('fatal', '%s|%s|%s|%s' % (\n func_name, ex.__class__.__name__, ex_str, task_url))\n if isinstance(ex, FatalError):\n #raise FatalError()\n #six.reraise(FatalError, ex)\n #logger.error(ex.tb)\n raise ex", "metadata": "root.Spider.process_handler_error", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 620 }, { "content": " def find_data_handler(self, data):\n try:\n return getattr(data, 'handler')\n except AttributeError:\n try:\n handler = getattr(self, 'data_%s' % data.handler_key)\n except AttributeError:\n raise NoDataHandler('No handler defined for Data %s'\n % data.handler_key)\n else:\n return handler", "metadata": "root.Spider.find_data_handler", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 648 }, { "content": " def is_valid_network_result(self, res):\n if res['task'].get('raw'):\n return True\n if res['ok']:\n res_code = res['grab'].response.code\n if self.is_valid_network_response_code(res_code, res['task']):\n return True\n return False", "metadata": "root.Spider.is_valid_network_result", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 660 }, { "content": " def run_parser(self):\n \"\"\"\n Main work cycle of spider process working in parser-mode.\n \"\"\"\n self.is_parser_idle.clear()\n # Use Stat instance that does not print any logging messages\n if self.parser_mode:\n self.stat = Stat(logging_period=None)\n self.prepare_parser()\n process_request_count = 0\n try:\n recent_task_time = time.time()\n while True:\n try:\n result = self.network_result_queue.get(block=False)\n except queue.Empty:\n self.is_parser_idle.set()\n time.sleep(0.1)\n self.is_parser_idle.clear()\n logger_verbose.debug('Network result queue is empty')\n # Set `waiting_shutdown_event` only after 1 seconds\n # of waiting for tasks to avoid\n # race-condition issues\n #if time.time() - recent_task_time > 1:\n # self.waiting_shutdown_event.set()\n if self.shutdown_event.is_set():\n logger_verbose.debug('Got shutdown event')\n return\n else:\n process_request_count += 1\n recent_task_time = time.time()\n if self.parser_mode:\n self.stat.reset()\n #if self.waiting_shutdown_event.is_set():\n # self.waiting_shutdown_event.clear()\n try:\n handler = self.find_task_handler(result['task'])\n except NoTaskHandler as ex:\n ex.tb = format_exc()\n self.parser_result_queue.put((ex, result['task']))\n self.stat.inc('parser:handler-not-found')\n else:\n self.process_network_result_with_handler(\n result, handler)\n self.stat.inc('parser:handler-processed')\n finally:\n if self.parser_mode:\n data = {\n 'type': 'stat',\n 'counters': self.stat.counters,\n 'collections': self.stat.collections,\n }\n self.parser_result_queue.put((data,\n result['task']))\n if self.parser_mode:\n if self.parser_requests_per_process:\n if (process_request_count >=\n self.parser_requests_per_process):\n break\n except Exception as ex:\n logging.error('', exc_info=ex)\n raise\n #finally:\n # self.waiting_shutdown_event.set()", "metadata": "root.Spider.run_parser", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 669 }, { "content": " def process_network_result_with_handler(self, result, handler):\n handler_name = getattr(handler, '__name__', 'NONE')\n try:\n with self.timer.log_time('response_handler'):\n with self.timer.log_time('response_handler.%s' % handler_name):\n handler_result = handler(result['grab'], result['task'])\n if handler_result is None:\n pass\n else:\n for something in handler_result:\n self.parser_result_queue.put((something,\n result['task']))\n except NoDataHandler as ex:\n ex.tb = format_exc()\n self.parser_result_queue.put((ex, result['task']))\n except Exception as ex:\n ex.tb = format_exc()\n self.parser_result_queue.put((ex, result['task']))", "metadata": "root.Spider.process_network_result_with_handler", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 735 }, { "content": " def find_task_handler(self, task):\n if task.origin_task_generator is not None:\n return self.handler_for_inline_task\n callback = task.get('callback')\n if callback:\n return callback\n else:\n try:\n handler = getattr(self, 'task_%s' % task.name)\n except AttributeError:\n raise NoTaskHandler('No handler or callback defined for '\n 'task %s' % task.name)\n else:\n return handler", "metadata": "root.Spider.find_task_handler", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 754 }, { "content": " def handler_for_inline_task(self, grab, task):\n # It can be subroutine for the first call,\n # So we should check it\n if isinstance(task, types.GeneratorType):\n coroutines_stack = []\n sendval = None\n origin_task_generator = task\n target = origin_task_generator\n else:\n coroutines_stack = task.coroutines_stack\n sendval = grab\n origin_task_generator = task.origin_task_generator\n target = origin_task_generator\n\n while True:\n try:\n result = target.send(sendval)\n # If it is subroutine we have to initialize it and\n # save coroutine in the coroutines stack\n if isinstance(result, types.GeneratorType):\n coroutines_stack.append(target)\n sendval = None\n target = result\n origin_task_generator = target\n else:\n new_task = result\n new_task.origin_task_generator = origin_task_generator\n new_task.coroutines_stack = coroutines_stack\n self.add_task(new_task)\n return\n except StopIteration:\n # If coroutine is over we should check coroutines stack,\n # may be it is subroutine\n if coroutines_stack:\n target = coroutines_stack.pop()\n origin_task_generator = target\n else:\n return", "metadata": "root.Spider.handler_for_inline_task", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 769 }, { "content": " def log_network_result_stats(self, res, from_cache=False):\n # Increase stat counters\n self.stat.inc('spider:request-processed')\n self.stat.inc('spider:task')\n self.stat.inc('spider:task-%s' % res['task'].name)\n if (res['task'].network_try_count == 1 and\n res['task'].task_try_count == 1):\n self.stat.inc('spider:task-%s-initial' % res['task'].name)\n\n # Update traffic statistics\n if res['grab'] and res['grab'].response:\n resp = res['grab'].response\n self.timer.inc_timer('network-name-lookup', resp.name_lookup_time)\n self.timer.inc_timer('network-connect', resp.connect_time)\n self.timer.inc_timer('network-total', resp.total_time)\n if from_cache:\n self.stat.inc('spider:download-size-with-cache',\n resp.download_size)\n self.stat.inc('spider:upload-size-with-cache',\n resp.upload_size)\n else:\n self.stat.inc('spider:download-size', resp.download_size)\n self.stat.inc('spider:upload-size', resp.upload_size)", "metadata": "root.Spider.log_network_result_stats", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 808 }, { "content": " def process_grab_proxy(self, task, grab):\n \"Assign new proxy from proxylist to the task\"\n\n if task.use_proxylist:\n if self.proxylist_enabled:\n # Need this to work around\n # pycurl feature/bug: \n # pycurl instance uses previously connected proxy server\n # even if `proxy` options is set with another proxy server\n grab.setup(connection_reuse=False)\n if self.proxy_auto_change:\n self.proxy = self.change_proxy(task, grab)", "metadata": "root.Spider.process_grab_proxy", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 833 }, { "content": " def change_proxy(self, task, grab):\n proxy = self.proxylist.get_random_proxy()\n grab.setup(proxy=proxy.get_address(),\n proxy_userpwd=proxy.get_userpwd(),\n proxy_type=proxy.proxy_type)\n return proxy", "metadata": "root.Spider.change_proxy", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 846 }, { "content": " def submit_task_to_transport(self, task, grab):\n if self.only_cache:\n self.stat.inc('spider:request-network-disabled-only-cache')\n else:\n grab_config_backup = grab.dump_config()\n self.process_grab_proxy(task, grab)\n self.stat.inc('spider:request-network')\n self.stat.inc('spider:task-%s-network' % task.name)\n with self.timer.log_time('network_transport'):\n logger_verbose.debug('Submitting task to the transport '\n 'layer')\n try:\n self.transport.start_task_processing(\n task, grab, grab_config_backup)\n except GrabInvalidUrl:\n logger.debug('Task %s has invalid URL: %s' % (\n task.name, task.url))\n self.stat.collect('invalid-url', task.url)", "metadata": "root.Spider.submit_task_to_transport", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 853 }, { "content": " def start_api_thread(self):\n from grab.spider.http_api import HttpApiThread\n\n proc = HttpApiThread(self)\n proc.start()\n return proc", "metadata": "root.Spider.start_api_thread", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 872 }, { "content": " def is_ready_to_shutdown(self):\n # Things should be true to shutdown spider\n # 1) No active task handlers (task_* functions)\n # 2) All task generators has completed work\n # 3) No active network threads\n # 4) Task queue is empty\n # 5) Network result queue is empty\n # 6) Cache is disabled or is in idle mode\n return (\n not self.parser_result_queue.qsize()\n and all(x['is_parser_idle'].is_set()\n for x in self.parser_pipeline.parser_pool)\n and not any(x.isAlive() for x in self._task_generator_list) # (2)\n and not self.transport.get_active_threads_number() # (3)\n and not self.task_queue.size() # (4)\n and not self.network_result_queue.qsize() # (5)\n and (self.cache_pipeline is None\n or (self.cache_pipeline.is_idle()\n and self.cache_pipeline.input_queue.qsize() == 0\n and self.cache_pipeline.result_queue.qsize() == 0))\n )", "metadata": "root.Spider.is_ready_to_shutdown", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 879 }, { "content": " def run(self):\n \"\"\"\n Main method. All work is done here.\n \"\"\"\n if self.mp_mode:\n from multiprocessing import Process, Event, Queue\n else:\n from multiprocessing.dummy import Process, Event, Queue\n\n self.timer.start('total')\n self.transport = MulticurlTransport(self.thread_number)\n\n if self.http_api_port:\n http_api_proc = self.start_api_thread()\n else:\n http_api_proc = None\n\n self.parser_result_queue = Queue()\n self.parser_pipeline = ParserPipeline(\n bot=self,\n mp_mode=self.mp_mode,\n pool_size=self.parser_pool_size,\n shutdown_event=self.shutdown_event,\n network_result_queue=self.network_result_queue,\n parser_result_queue=self.parser_result_queue,\n requests_per_process=self.parser_requests_per_process,\n )\n network_result_queue_limit = max(10, self.thread_number * 2)\n \n try:\n # Run custom things defined by this specific spider\n # By defaut it does nothing\n self.prepare()\n\n # Setup task queue if it has not been configured yet\n if self.task_queue is None:\n self.setup_queue()\n\n # Initiate task generator. Only in main process!\n with self.timer.log_time('task_generator'):\n self.start_task_generators()\n\n # Work in infinite cycle untill\n # `self.work_allowed` flag is True\n #shutdown_countdown = 0 # !!!\n pending_tasks = deque()\n while self.work_allowed:\n free_threads = self.transport.get_free_threads_number()\n # Load new task only if:\n # 1) network transport has free threads\n # 2) network result queue is not full\n # 3) cache is disabled OR cache has free resources\n if (self.transport.get_free_threads_number()\n and (self.network_result_queue.qsize()\n < network_result_queue_limit)\n and (self.cache_pipeline is None\n or self.cache_pipeline.has_free_resources())):\n if pending_tasks:\n task = pending_tasks.popleft()\n else:\n task = self.get_task_from_queue()\n if task is None:\n # If received task is None then\n # check if spider is ready to be shut down\n if not pending_tasks and self.is_ready_to_shutdown():\n #shutdown_countdown -= 1\n #time.sleep(0.02)\n #if shutdown_countdown <= 0:\n self.shutdown_event.set()\n #print('STOP!!!!!!!!!')\n self.stop()\n break # Break from `while self.work_allowed` cycle\n elif isinstance(task, bool) and (task is True):\n # If received task is True\n # and there is no active network threads then\n # take some sleep\n if not self.transport.get_active_threads_number():\n time.sleep(0.01)\n else:\n logger_verbose.debug('Got new task from task queue: %s'\n % task)\n task.network_try_count += 1\n is_valid, reason = self.check_task_limits(task)\n if is_valid:\n task_grab = self.setup_grab_for_task(task)\n if self.cache_pipeline:\n self.cache_pipeline.input_queue.put(\n ('load', (task, task_grab)),\n )\n else:\n self.submit_task_to_transport(task, task_grab)\n else:\n self.log_rejected_task(task, reason)\n handler = task.get_fallback_handler(self)\n if handler:\n handler(task)\n\n with self.timer.log_time('network_transport'):\n logger_verbose.debug('Asking transport layer to do '\n 'something')\n self.transport.process_handlers()\n\n logger_verbose.debug('Processing network results (if any).')\n\n # Collect completed network results\n # Each result could be valid or failed\n # Result is dict {ok, grab, grab_config_backup, task, emsg}\n results = [(x, False) for x in\n self.transport.iterate_results()]\n if self.cache_pipeline:\n while True:\n try:\n action, result = self.cache_pipeline\\\n .result_queue.get(False)\n except queue.Empty:\n break\n else:\n assert action in ('network_result', 'task')\n if action == 'network_result':\n results.append((result, True))\n elif action == 'task':\n task = result\n task_grab = self.setup_grab_for_task(task)\n if (self.transport.get_free_threads_number()\n and (self.network_result_queue.qsize()\n < network_result_queue_limit)):\n self.submit_task_to_transport(task, task_grab)\n else:\n pending_tasks.append(task)\n\n # Take sleep to avoid millions of iterations per second.\n # 1) If no results from network transport\n # 2) If task queue is empty (or if there are only delayed tasks)\n # 3) If no network activity\n # 4) If parser result queue is empty\n if (not results\n and (task is None or bool(task) == True)\n and not self.transport.get_active_threads_number()\n and not self.parser_result_queue.qsize()\n and (self.cache_pipeline is None\n or (self.cache_pipeline.input_queue.qsize() == 0\n and self.cache_pipeline.is_idle()\n and self.cache_pipeline.result_queue.qsize() == 0))\n ):\n time.sleep(0.001)\n\n for result, from_cache in results:\n if self.cache_pipeline and not from_cache:\n if result['ok']:\n self.cache_pipeline.input_queue.put(\n ('save', (result['task'], result['grab']))\n )\n self.log_network_result_stats(\n result, from_cache=from_cache)\n if self.is_valid_network_result(result):\n #print('!! PUT NETWORK RESULT INTO QUEUE (base.py)')\n self.network_result_queue.put(result)\n else:\n self.log_failed_network_result(result)\n # Try to do network request one more time\n if self.network_try_limit > 0:\n result['task'].refresh_cache = True\n result['task'].setup_grab_config(\n result['grab_config_backup'])\n self.add_task(result['task'])\n if from_cache:\n self.stat.inc('spider:task-%s-cache' % result['task'].name)\n self.stat.inc('spider:request')\n\n while True:\n try:\n p_res, p_task = self.parser_result_queue.get(block=False)\n except queue.Empty:\n break\n else:\n self.stat.inc('spider:parser-result')\n self.process_handler_result(p_res, p_task)\n\n if not self.shutdown_event.is_set():\n self.parser_pipeline.check_pool_health()\n\n logger_verbose.debug('Work done')\n except KeyboardInterrupt:\n logger.info('\\nGot ^C signal in process %d. Stopping.'\n % os.getpid())\n self.interrupted = True\n raise\n finally:\n # This code is executed when main cycles is breaked\n self.timer.stop('total')\n self.stat.print_progress_line()\n self.shutdown()\n\n # Stop HTTP API process\n if http_api_proc:\n http_api_proc.server.shutdown()\n http_api_proc.join()\n\n if self.task_queue:\n self.task_queue.clear()\n\n # Stop parser processes\n self.shutdown_event.set()\n self.parser_pipeline.shutdown()\n logger.debug('Main process [pid=%s]: work done' % os.getpid())", "metadata": "root.Spider.run", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 901 }, { "content": " def log_failed_network_result(self, res):\n # Log the error\n if res['ok']:\n msg = 'http-%s' % res['grab'].response.code\n else:\n msg = res['error_abbr']\n\n self.stat.inc('error:%s' % msg) \n #logger.error(u'Network error: %s' % msg)#%\n #make_unicode(msg, errors='ignore'))", "metadata": "root.Spider.log_failed_network_result", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 1107 }, { "content": " def log_rejected_task(self, task, reason):\n logger_verbose.debug('Task %s is rejected due to '\n '%s limit'\n % (task.name, reason))\n if reason == 'task-try-count':\n self.stat.collect('task-count-rejected',\n task.url)\n elif reason == 'network-try-count':\n self.stat.collect('network-count-rejected',\n task.url)\n else:\n raise SpiderError('Unknown response from '\n 'check_task_limits: %s'\n % reason)", "metadata": "root.Spider.log_rejected_task", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 1118 }, { "content": " def process_handler_result(self, result, task=None):\n \"\"\"\n Process result received from the task handler.\n\n Result could be:\n * None\n * Task instance\n * Data instance.\n \"\"\"\n\n if isinstance(result, Task):\n self.add_task(result)\n elif isinstance(result, Data):\n handler = self.find_data_handler(result)\n try:\n data_result = handler(**result.storage)\n if data_result is None:\n pass\n else:\n for something in data_result:\n self.process_handler_result(something, task)\n\n except Exception as ex:\n self.process_handler_error('data_%s' % result.handler_key, ex,\n task)\n elif result is None:\n pass\n elif isinstance(result, Exception): \n handler = self.find_task_handler(task)\n handler_name = getattr(handler, '__name__', 'NONE')\n self.process_handler_error(handler_name, result, task)\n elif isinstance(result, dict):\n if result.get('type') == 'stat':\n for name, count in result['counters'].items():\n self.stat.inc(name, count)\n for name, items in result['collections'].items():\n for item in items:\n self.stat.collect(name, item)\n else:\n raise SpiderError('Unknown result type: %s' % result)\n else:\n raise SpiderError('Unknown result type: %s' % result)", "metadata": "root.Spider.process_handler_result", "header": "['class', 'Spider', '(', 'DeprecatedThingsSpiderMixin', ')', ':', '___EOS___']", "index": 1133 } ]
[ { "span": "from contextlib import contextmanager", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 37 }, { "span": "import multiprocessing", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 22 }, { "span": "import threading", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 16 }, { "span": "import threading", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 16 }, { "span": "from weblib.encoding import make_str, make_unicode", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 50 } ]
[]
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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "urljoin_", "\\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_", "urllib_", "._", "parse_", "import_", "urljoin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "random_", "import_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "web", "lib_", "import_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traceback_", "import_", "format\\u", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "deque_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grab_", "._", "base_", "import_", "Grab", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "error_", "import_", "Grab", "Inva", "lid", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "error_", "import_", "(_", "Spi", "der", "Error_", ",_", "Spi", "der", "Mis", "use", "Error_", ",_", "Fat", "al", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "No", "Task", "Handler_", ",_", "No", "Data", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spi", "der", "Configura", "tion", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "task_", "import_", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "data_", "import_", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "transport_", "._", "multic", "url_", "import_", "Multi", "curl", "Transport_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "proxy", "list_", "import_", "Pro", "xy", "List_", ",_", "Base", "Pro", "xy", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "util_", "._", "misc_", "import_", "camel", "\\u", "case", "\\u", "to", "\\u", "underscore", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "web", "lib_", "._", "encoding_", "import_", "make", "\\u", "str_", ",_", "make", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "base_", "import_", "GLOB", "AL", "\\u", "STATE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "stat_", "import_", "Stat_", ",_", "Timer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "parser", "\\u", "pipeline_", "import_", "Parser", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "cache", "\\u", "pipeline_", "import_", "Cache", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "spider_", "._", "deprecated_", "import_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grab_", "._", "util_", "._", "warning_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "PRIORITY", "_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "STRE", "AM", "\\u", "NUMBER_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "TR", "Y", "\\u", "LIMIT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "TR", "Y", "\\u", "LIMIT_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RANDOM", "\\u", "TASK", "\\u", "PRIORITY", "\\u", "RANGE_", "=_", "(_", "50_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NULL_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "gra", "b", ".", "spider", ".", "base", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "gra", "b", ".", "spider", ".", "base", ".", "verbo", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "need", " ", "verbo", "se", " ", "logg", "ing", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "logg", "ing", " ", "level", " ", "of", " ", "tha", "t", " ", "logger_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "set", "Level_", "(_", "logging_", "._", "FATAL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Spi", "der", "Meta", "Class_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "meta", " ", "class", " ", "doe", "s", " ", "follow", "ing", " ", "thing", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "It", " ", "create", "s", " ", "Meta", " ", "attribute", ",", " ", "if", " ", "it", " ", "is", " ", "not", " ", "defin", "ed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "Spi", "der", " ", "descendant", " ", "class", ",", " ", "by", " ", "copy", "ing", " ", "parent", "'", "s", " ", "Meta", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "It", " ", "reset", " ", "Meta", ".", "abstract", " ", "to", " ", "Fal", "se", " ", "if", " ", "Meta", " ", "is", " ", "copie", "d", " ", "from", " ", "parent", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "If", " ", "defin", "ed", " ", "Meta", " ", "doe", "s", " ", "not", " ", "contain", "s", " ", "`", "abstract", "`", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "then", " ", "defin", "e", " ", "it", " ", "and", " ", "set", " ", "to", " ", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spi", "der", "Meta", "Class_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "namespace_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "Meta", "'_", "not_", "in_", "namespace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "base_", "in_", "bases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "base_", ",_", "'", "Meta", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copy", " ", "content", "s", " ", "of", " ", "base", " ", "Meta_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "meta_", "=_", "type_", "(_", "'", "Meta", "'_", ",_", "(_", "object_", ",_", ")_", ",_", "dict_", "(_", "base_", "._", "Meta_", "._", "\\u\\u", "dict\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reset", " ", "abstract", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "meta_", "._", "abstract_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespace_", "[_", "'", "Meta", "'_", "]_", "=_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "special", " ", "case", " ", "(", "Spi", "der", "Meta", "Class", "Mix", "in", ")_", "\\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_", "'", "Meta", "'_", "not_", "in_", "namespace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", "[_", "'", "Meta", "'_", "]_", "=_", "type_", "(_", "'", "Meta", "'_", ",_", "(_", "object_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "namespace_", "[_", "'", "Meta", "'_", "]_", ",_", "'", "abstract", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", "[_", "'", "Meta", "'_", "]_", "._", "abstract_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Spi", "der", "Meta", "Class_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "Spi", "der", "Meta", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "scrap", "ing", " ", "frame", "work", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "can", " ", "defin", "e", " ", "here", " ", "some", " ", "urls", " ", "and", " ", "initial", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "name", " ", "\"", "initial", "\"", " ", "will", " ", "be", " ", "created", " ", "from", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "urls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "logic", " ", "of", " ", "generat", "ing", " ", "initial", " ", "task", "s", " ", "is", " ", "complex_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "consider", " ", "to", " ", "use", " ", "`", "task", "\\u", "generat", "or", "`", " ", "method", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "initial", "\\u", "urls", "`", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "\\u", "urls_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Meta", ".", "abstract", " ", "means", " ", "tha", "t", " ", "this", " ", "class", " ", "will", " ", "not", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collected", " ", "to", " ", "spider", " ", "registr", "y", " ", "by", " ", "`", "gra", "b", " ", "crawl", "`", " ", "CLI", " ", "command", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Meta", " ", "is", " ", "inherited", " ", "by", " ", "descendant", " ", "classe", "s", " ", "BUT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meta", ".", "abstract", " ", "is", " ", "reset", " ", "to", " ", "Fal", "se", " ", "in", " ", "each", " ", "descendant", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "**_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Class", " ", "Methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "**_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "***", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Public", " ", "Methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "***", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Meth", "ods", " ", "for", " ", "spider", " ", "customization", "_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "****", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Priva", "te", " ", "Methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***********", "****", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\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_", "update", "\\u", "spider", "\\u", "config_", "(_", "cls_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "spider", "\\u", "name_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "cls_", ",_", "'", "spider", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "spider", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "camel", "\\u", "case", "\\u", "to", "\\u", "underscore", "_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "thread", "\\u", "number_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "try", "\\u", "limit_", "=_", "None_", ",_", "task", "\\u", "try", "\\u", "limit_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "pause_", "=_", "NULL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priorit", "y", "\\u", "mode_", "=_", "'", "random", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "meta_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "only", "\\u", "cache_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "slave_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "New", " ", "options", " ", "start", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "task", "q_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MP", ":_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "result", "\\u", "queue_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "result", "\\u", "queue_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "parser", "\\u", "idle_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shut", "down", "\\u", "event_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mp", "\\u", "mode_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "pool", "\\u", "size_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "mode_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", "=_", "10000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "api", "\\u", "port_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "thread", "-", "number", " ", "-", " ", "Number", " ", "of", " ", "concurrent", " ", "network", " ", "stream", "s", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "network", "\\u", "try", "\\u", "limit", " ", "-", " ", "Ho", "w", " ", "many", " ", "times", " ", "try", " ", "to", " ", "send", " ", "request", "\\", "10", ";", " ", " ", " ", " ", "again", " ", "if", " ", "network", " ", "error", " ", "was", " ", "occur", "red", ",", " ", "use", " ", "0", " ", "to", " ", "disable", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "network", "\\u", "try", "\\u", "limit", " ", "-", " ", "Limit", " ", "of", " ", "trie", "s", " ", "to", " ", "execute", " ", "some", " ", "task", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "is", " ", "not", " ", "the", " ", "same", " ", "as", " ", "network", "\\u", "try", "\\u", "limit", "\\", "10", ";", " ", " ", " ", " ", "network", " ", "try", " ", "limit", " ", "limit", "s", " ", "the", " ", "number", " ", "of", " ", "trie", "s", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "perform", "ed", " ", "automati", "call", "y", " ", "in", " ", "case", " ", "of", " ", "network", " ", "timeo", "ut", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "some", " ", "other", " ", "physical", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "task", "\\u", "try", "\\u", "limit", " ", "limit", "s", " ", "the", " ", "number", " ", "of", " ", "atte", "mpt", "s", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "schedule", "d", " ", "manu", "ally", " ", "in", " ", "the", " ", "spider", " ", "business", " ", "logic", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "priorit", "y", "\\u", "mode", " ", "-", " ", "coul", "d", " ", "be", " ", "\"", "random", "\"", " ", "or", " ", "\"", "const", "\"", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "meta", " ", "-", " ", "arbitra", "ry", " ", "user", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "retr", "y", "\\u", "rebu", "ild", "\\u", "user", "\\u", "agent", " ", "-", " ", "generat", "e", " ", "new", " ", "random", " ", "user", "-", "agent", " ", "for", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "network", " ", "request", " ", "whi", "ch", " ", "is", " ", "perform", "ed", " ", "again", " ", "due", " ", "to", " ", "network", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "args", " ", "-", " ", "command", " ", "line", " ", "argu", "ment", "s", " ", "parsed", " ", "with", " ", "`", "setup", "\\u", "arg", "\\u", "parser", "`", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "New", " ", "options", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "task", "q", "=", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "newt", "ork", "\\u", "response", "\\u", "queue", "=", "Non", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "slave_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Config", "ur", "tion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sla", "ve", " ", "mode", " ", "is", " ", "not", " ", "support", "ed", " ", "any", "more", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Us", "e", " ", "`", "mp", "\\u", "mode", "=", "Tru", "e", "`", " ", "option", " ", "to", " ", "run", " ", "multiple", " ", "HTM", "L", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "parser", " ", "process", "es", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "http", "\\u", "api", "\\u", "port_", "=_", "http", "\\u", "api", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MP", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mp", "\\u", "mode_", "=_", "mp", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "mp", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "multiprocessing_", "import_", "Process_", ",_", "Event_", ",_", "Queue_", "\\u\\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_", "multiprocessing_", "._", "dummy_", "import_", "Process_", ",_", "Event_", ",_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "network", "\\u", "result", "\\u", "queue_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "=_", "network", "\\u", "result", "\\u", "queue_", "\\u\\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_", "._", "network", "\\u", "result", "\\u", "queue_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "=_", "parser", "\\u", "result", "\\u", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "parser", "\\u", "idle_", "=_", "is", "\\u", "parser", "\\u", "idle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shut", "down", "\\u", "event_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shut", "down", "\\u", "event_", "=_", "shut", "down", "\\u", "event_", "\\u\\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_", "._", "shut", "down", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "mp", "\\u", "mode_", "and_", "parser", "\\u", "pool", "\\u", "size_", "and_", "parser", "\\u", "pool", "\\u", "size_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Configura", "tion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Parser", " ", "pool", " ", "size", " ", "coul", "d", " ", "be", " ", "only", " ", "1", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "non", "-", "multipro", "cess", " ", "mode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parser", "\\u", "pool", "\\u", "size_", "=_", "parser", "\\u", "pool", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "mode_", "=_", "parser", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", "=_", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stat_", "=_", "Stat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "=_", "Timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "\\u", "queue_", "=_", "task", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "meta_", "=_", "meta_", "\\u\\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_", "._", "meta_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "thread", "\\u", "number_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "thread", "\\u", "number_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "self_", "._", "config_", "._", "get_", "(_", "'", "thread", "\\u", "number", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "STRE", "AM", "\\u", "NUMBER_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "\\u", "try", "\\u", "limit_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "try", "\\u", "limit_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "self_", "._", "config_", "._", "get_", "(_", "'", "task", "\\u", "try", "\\u", "limit", "'_", ",_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "TR", "Y", "\\u", "LIMIT_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "network", "\\u", "try", "\\u", "limit_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "try", "\\u", "limit_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "self_", "._", "config_", "._", "get_", "(_", "'", "network", "\\u", "try", "\\u", "limit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NET", "WORK", "\\u", "TR", "Y", "\\u", "LIMIT_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "gra", "b", "\\u", "config_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "priorit", "y", "\\u", "mode_", "not_", "in_", "[_", "'", "random", "'_", ",_", "'", "const", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Mis", "use", "Error_", "(_", "'", "Value", " ", "of", " ", "priorit", "y", "\\u", "mode", " ", "option", " ", "shou", "ld", " ", "be", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "random", "\"", " ", "or", " ", "\"", "const", "\"'_", ")_", "\\u\\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_", "._", "priorit", "y", "\\u", "mode_", "=_", "priorit", "y", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "only", "\\u", "cache_", "=_", "only", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "\\u", "pipeline_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "work", "\\u", "allowed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request", "\\u", "pause_", "is_", "not_", "NULL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warn_", "(_", "'", "Optio", "n", " ", "`", "request", "\\u", "paus", "e", "`", " ", "is", " ", "depre", "cated", " ", "and", " ", "is", " ", "not", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", "ed", " ", "any", "more", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "proxy", "list", "\\u", "enabled_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy", "list_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy", "\\u", "auto", "\\u", "change_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "interrupted", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "cache_", "(_", "self_", ",_", "backend_", "=_", "'", "mongo", "'_", ",_", "database_", "=_", "None_", ",_", "use", "\\u", "compression_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "database_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Mis", "use", "Error_", "(_", "'", "setup", "\\u", "cache", " ", "method", " ", "require", "s", " ", "databa", "se", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "option", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cache", "\\u", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "gra", "b", ".", "spider", ".", "cache", "\\u", "back", "end", ".", "%", "s", "'_", "%_", "backend_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "[_", "'", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "mod_", "._", "Cache", "Backend_", "(_", "database_", "=_", "database_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "compression_", "=_", "use", "\\u", "compression_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spider_", "=_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "\\u", "pipeline_", "=_", "Cache", "Pipeline_", "(_", "self_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "queue_", "(_", "self_", ",_", "backend_", "=_", "'", "memory", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Us", "ing", " ", "%", "s", " ", "back", "end", " ", "for", " ", "task", " ", "queue", "'_", "%_", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "\\u\\u", "import\\u\\u_", "(_", "'", "gra", "b", ".", "spider", ".", "queue", "\\u", "back", "end", ".", "%", "s", "'_", "%_", "backend_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "globals_", "(_", ")_", ",_", "locals_", "(_", ")_", ",_", "[_", "'", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task", "\\u", "queue_", "=_", "mod_", "._", "Queue", "Backend_", "(_", "spider", "\\u", "name_", "=_", "self_", "._", "get", "\\u", "spider", "\\u", "name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "task_", "(_", "self_", ",_", "task_", ",_", "raise", "\\u", "error_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "task", " ", "to", " ", "the", " ", "task", " ", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MP", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "***", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parser", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "task_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "task", "\\u", "queue_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Mis", "use", "Error_", "(_", "'", "You", " ", "shou", "ld", " ", "configur", "e", " ", "task", " ", "queue", " ", "bef", "ore", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addin", "g", " ", "task", "s", ".", " ", "Us", "e", " ", "`", "setup", "\\u", "queue", "`", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task_", "._", "priority_", "is_", "None_", "or_", "not_", "task_", "._", "priorit", "y", "\\u", "is", "\\u", "custom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "._", "priority_", "=_", "self_", "._", "generat", "e\\u", "task", "\\u", "priority_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "priorit", "y", "\\u", "is", "\\u", "custom_", "=_", "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 ", " _", "task_", "._", "priorit", "y", "\\u", "is", "\\u", "custom_", "=_", "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 ", " _", "if_", "not_", "task_", "._", "url_", "._", "startswith_", "(_", "(_", "'", "http", "://'_", ",_", "'", "https", "://'_", ",_", "'", "ftp", "://'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "://'_", ",_", "'", "feed", "://'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "base", "\\u", "url_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "'", "Cou", "ld", " ", "not", " ", "resolve", " ", "relative", " ", "URL", " ", "bec", "aus", "e", " ", "base", "\\u", "url", " ", "'_", "'", "is", " ", "not", " ", "specified", ".", " ", "Task", ":", " ", "%", "s", ",", " ", "URL", ":", " ", "%", "s", "'_", "%_", "(_", "task_", "._", "name_", ",_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Spi", "der", "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 ", " ", "_", "warn_", "(_", "'", "Class", " ", "attribute", " ", "`", "Spi", "der", "::", "base", "\\u", "url", "`", " ", "is", " ", "depre", "cated", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Us", "e", " ", "Task", " ", "object", "s", " ", "with", " ", "abs", "olute", " ", "URL", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "url_", "=_", "urljoin_", "(_", "self_", "._", "base", "\\u", "url_", ",_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "task", " ", "has", " ", "gra", "b", "\\u", "config", " ", "object", " ", "then", " ", "update", " ", "it", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "._", "gra", "b", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "task_", "._", "gra", "b", "\\u", "config_", "[_", "'", "url", "'_", "]_", "=_", "task_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "collect_", "(_", "'", "task", "-", "with", "-", "invalid", "-", "url", "'_", ",_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raise", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "''_", ",_", "exc", "\\u", "info_", "=_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "keep", " ", "original", " ", "task", " ", "priorit", "y", " ", "if", " ", "it", " ", "was", " ", "set", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "task", "\\u", "queue_", "._", "put_", "(_", "task_", ",_", "task_", "._", "priority_", ",_", "schedule", "\\u", "time_", "=_", "task_", "._", "schedule", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "set", " ", "internal", " ", "flag", " ", "whi", "ch", " ", "signal", " ", "spider", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "stop", " ", "process", "ing", " ", "new", " ", "task", " ", "and", " ", "shut", "s", " ", "down", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Meth", "od", " ", "`", "stop", "`", " ", "was", " ", "call", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "work", "\\u", "allowed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "proxy", "list_", "(_", "self_", ",_", "source_", ",_", "source", "\\u", "type_", "=_", "None_", ",_", "proxy", "\\u", "type_", "=_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "init_", "=_", "True_", ",_", "auto", "\\u", "change_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy", "list_", "=_", "Pro", "xy", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "source_", ",_", "Base", "Pro", "xy", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy", "list_", "._", "set\\u", "source_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "source_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "source", "\\u", "type_", "==_", "'", "text", "\\u", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy", "list_", "._", "load", "\\u", "file_", "(_", "source_", ",_", "proxy", "\\u", "type_", "=_", "proxy", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "source", "\\u", "type_", "==_", "'", "url", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy", "list_", "._", "load", "\\u", "url_", "(_", "source_", ",_", "proxy", "\\u", "type_", "=_", "proxy", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Mis", "use", "Error_", "(_", "'", "Meth", "od", " ", "`", "load", "\\u", "proxy", "list", "`", " ", "receive", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "`", "source", "\\u", "type", "`", " ", "argu", "ment", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "source", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Mis", "use", "Error_", "(_", "'", "Meth", "od", " ", "`", "load", "\\u", "proxy", "list", "`", " ", "receive", "d", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "`", "source", "`", " ", "argu", "ment", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "proxy", "list", "\\u", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "auto", "\\u", "change_", "and_", "auto", "\\u", "init_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy_", "=_", "self_", "._", "proxy", "list_", "._", "get", "\\u", "random", "\\u", "proxy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "proxy", "\\u", "auto", "\\u", "change_", "=_", "auto", "\\u", "change_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "next", "\\u", "page_", "(_", "self_", ",_", "grab_", ",_", "task_", ",_", "xpath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolve", "\\u", "base_", "=_", "False_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "task", " ", "for", " ", "next", " ", "page", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "gra", "b", ":", " ", "Grab", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "task", ":", " ", "Task", " ", "object", " ", "whi", "ch", " ", "shou", "ld", " ", "be", " ", "assign", "ed", " ", "to", " ", "next", " ", "page", " ", "url", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "xpa", "th", ":", " ", "xpa", "th", " ", "express", "ion", " ", "whi", "ch", " ", "calcul", "ates", " ", "list", " ", "of", " ", "URL", "S", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "**", "kwarg", "s", ":", " ", "extra", " ", "settings", " ", "for", " ", "new", " ", "task", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "follow", "\\u", "link", "s", "(", "gra", "b", ",", " ", "'", "topic", "',", " ", "'//", "div", "[", "@", "class", "=\"", "topic", "\"]", "/", "a", "/", "@", "href", "')", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "next", "\\u", "url", " ", "=", " ", "gra", "b", ".", "xpa", "th", "\\u", "text", "(", "xpa", "th", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "url_", "=_", "grab_", "._", "doc_", "._", "select_", "(_", "xpath_", ")_", "._", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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 ", " _", "url_", "=_", "grab_", "._", "make", "\\u", "url", "\\u", "absolute_", "(_", "next", "\\u", "url_", ",_", "resolve", "\\u", "base_", "=_", "resolve", "\\u", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "task_", "._", "get_", "(_", "'", "page", "'_", ",_", "1_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "b2_", "=_", "grab_", "._", "clone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gra", "b2_", "._", "setup_", "(_", "url_", "=_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "2_", "=_", "task_", "._", "clone_", "(_", "task", "\\u", "try", "\\u", "count_", "=_", "1_", ",_", "grab_", "=_", "gra", "b2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "page_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "task_", "(_", "task", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "stats_", "(_", "self_", ",_", "timing_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "'-------", "-----", " ", "Stat", "s", ":", " ", "------------", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "Counter", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "counters_", "\\u\\u\\uNL\\u\\u\\u_", "items_", "=_", "sorted_", "(_", "self_", "._", "stat_", "._", "counters_", "._", "items_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "'", " ", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "List", "s", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Process", " ", "collection", "s", " ", "sorte", "d", " ", "by", " ", "size", " ", "desc_", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "sizes_", "=_", "[_", "(_", "x_", ",_", "len_", "(_", "y_", ")_", ")_", "for_", "x_", ",_", "y_", "in_", "self_", "._", "stat_", "._", "collections_", "._", "items_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "sizes_", "=_", "sorted_", "(_", "col", "\\u", "sizes_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", ",_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col", "\\u", "size_", "in_", "col", "\\u", "sizes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "'", " ", " ", "%", "s", ":", " ", "%", "d", "'_", "%_", "col", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "extra", " ", "metrics_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "download", "-", "size", "'_", "in_", "self_", "._", "stat_", "._", "counters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "'", "Network", " ", "download", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "metric_", "._", "format\\u", "traffic", "\\u", "value_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stat_", "._", "counters_", "[_", "'", "download", "-", "size", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "Queue", " ", "size", ":", " ", "%", "d", "'_", "%_", "self_", "._", "task", "\\u", "queue_", "._", "size_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "task", "\\u", "queue_", "else_", "'", "NA", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "Network", " ", "stream", "s", ":", " ", "%", "d", "'_", "%_", "self_", "._", "thread", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elapsed_", "=_", "self_", "._", "timer_", "._", "timers_", "[_", "'", "total", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hours_", ",_", "seconds_", "=_", "divmod_", "(_", "elapsed_", ",_", "3600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minutes_", ",_", "seconds_", "=_", "divmod_", "(_", "seconds_", ",_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "Time", " ", "ela", "pse", "d", ":", " ", "%", "d", ":", "%", "d", ":", "%", "d", " ", "(", "H", ":", "M", ":", "S", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hours_", ",_", "minutes_", ",_", "seconds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "'", "End", " ", "time", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "strftime_", "(_", "'%", "d", " ", "%", "b", " ", "%", "Y", ",", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "UT", "C", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "timing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "self_", "._", "render", "\\u", "timing_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "out_", ")_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render", "\\u", "timing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "[_", "'", "Time", "rs", ":'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "'", " ", " ", "DOM", ":", " ", "%", ".3", "f", "'_", "%_", "GLOB", "AL", "\\u", "STATE_", "[_", "'", "dom", "\\u", "build", "\\u", "time", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "items_", "=_", "[_", "(_", "x_", ",_", "y_", ")_", "for_", "x_", ",_", "y_", "in_", "self_", "._", "timer_", "._", "timers_", "._", "items_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "items_", "=_", "sorted_", "(_", "time", "\\u", "items_", ",_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "time", "\\u", "item_", "in_", "time", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "'", " ", " ", "%", "s", ":", " ", "%", ".03", "f", "'_", "%_", "time", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", "'_", "._", "join_", "(_", "out_", ")_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepare_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "do", " ", "addition", "al", " ", "spider", " ", "customization", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "it", " ", "has", " ", "start", "ed", " ", "working", ".", " ", "Simp", "ly", " ", "rede", "fine", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", " ", "in", " ", "your", " ", "Spi", "der", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prepar", "e\\u", "parser_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "do", " ", "addition", "al", " ", "spider", " ", "customization", " ", "here", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "it", " ", "has", " ", "start", "ed", " ", "working", ".", " ", "Simp", "ly", " ", "rede", "fine", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", " ", "in", " ", "your", " ", "Spi", "der", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "only", " ", "from", " ", "Spi", "der", " ", "working", " ", "in", " ", "parser", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", ",", " ", "in", " ", "turn", ",", " ", "is", " ", "spawne", "d", " ", "automati", "call", "y", " ", "by", " ", "main", " ", "spider", " ", "proce", "s", "\\", "10", ";", " ", " ", " ", " ", "working", " ", "in", " ", "multipro", "cess", " ", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "override", " ", "this", " ", "method", " ", "to", " ", "do", " ", "some", " ", "final", " ", "action", "s", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "pars", "ing", " ", "has", " ", "bee", "n", " ", "don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "gra", "b", "\\u", "instance_", "(_", "self_", ",_", "grab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "this", " ", "method", " ", "to", " ", "automati", "call", "y", " ", "update", " ", "config", " ", "of", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "`", "Grab", "`", " ", "instance", " ", "created", " ", "by", " ", "the", " ", "spider", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "gra", "b", "\\u", "instance_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "-", "ward", " ", "compatibility", " ", "for", " ", "depre", "cated", " ", "`", "gra", "b", "\\u", "config", "`", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", " ", "I", " ", "use", " ", "`\\u", "gra", "b", "\\u", "config", "`", " ", "to", " ", "not", " ", "trigger", " ", "warn", "ing", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "gra", "b", "\\u", "config_", "and_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge", "d\\u", "config_", "=_", "deepcopy_", "(_", "self_", "._", "\\u", "gra", "b", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "config_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grab_", "=_", "Grab", "_", "(_", "**_", "merge", "d\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "gra", "b", "\\u", "config_", "and_", "not_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "=_", "Grab", "_", "(_", "**_", "self_", "._", "\\u", "gra", "b", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "=_", "Grab", "_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "grab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "task", "\\u", "generator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "override", " ", "this", " ", "method", " ", "to", " ", "load", " ", "new", " ", "task", "s", " ", "smooth", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "be", " ", "used", " ", "each", " ", "time", " ", "as", " ", "number", " ", "of", " ", "task", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "task", " ", "queue", " ", "is", " ", "less", " ", "then", " ", "number", " ", "of", " ", "thread", "s", " ", "multiplie", "d", " ", "on", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "allow", "s", " ", "you", " ", "to", " ", "not", " ", "overload", " ", "all", " ", "free", " ", "memory", " ", "if", " ", "total", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "task", "s", " ", "is", " ", "big", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "magic", " ", "to", " ", "make", " ", "this", " ", "function", " ", "empty", " ", "generator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "':", "-)", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "task", "\\u", "limits_", "(_", "self_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "tha", "t", " ", "task", "'", "s", " ", "network", " ", "&", " ", "try", " ", "counter", "s", " ", "do", " ", "not", " ", "exceed", " ", "limit", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "if", " ", "success", ":", " ", "(", "Tru", "e", ",", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "if", " ", "error", ":", " ", "(", "Fal", "se", ",", " ", "reason", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "._", "task", "\\u", "try", "\\u", "count_", ">_", "self_", "._", "task", "\\u", "try", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "task", "-", "try", "-", "count", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task_", "._", "network", "\\u", "try", "\\u", "count_", ">_", "self_", "._", "network", "\\u", "try", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "'", "network", "-", "try", "-", "count", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "task", "\\u", "priority_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "priorit", "y", "\\u", "mode_", "==_", "'", "const", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "DEF", "AUL", "T", "\\u", "TASK", "\\u", "PRIORITY", "_", "\\u\\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_", "randint_", "(_", "*_", "RANDOM", "\\u", "TASK", "\\u", "PRIORITY", "\\u", "RANGE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "task", "\\u", "generat", "or", "\\u", "thread", "\\u", "wrapper_", "(_", "self_", ",_", "task", "\\u", "generator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "new", " ", "task", "s", " ", "from", " ", "`", "self", ".", "task", "\\u", "generat", "or", "\\u", "object", "`", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "new", " ", "task", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "task", " ", "queue", " ", "size", " ", "is", " ", "less", " ", "than", " ", "some", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "load", " ", "new", " ", "task", "s", " ", "from", " ", "task", "s", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "task", "\\u", "generat", "or", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "size_", "=_", "self_", "._", "task", "\\u", "queue_", "._", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "limit_", "=_", "self_", "._", "thread", "\\u", "number_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "queue", "\\u", "size_", "<_", "min", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "task", "\\u", "generat", "or", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Task", " ", "queue", " ", "contain", "s", " ", "less", " ", "task", "s", " ", "(%", "d", ")", " ", "than", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "ed", " ", "limit", " ", "(%", "d", ").", " ", "Tr", "ying", " ", "to", " ", "add", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", " ", "task", "s", ".'_", "%_", "(_", "queue", "\\u", "size_", ",_", "min", "\\u", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "x_", "in_", "six_", "._", "moves_", "._", "range_", "(_", "min", "\\u", "limit_", "-_", "queue", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item_", "=_", "next_", "(_", "task", "\\u", "generator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Got", " ", "new", " ", "item", " ", "from", " ", "generat", "or", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Process", "ing", " ", "it", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "handler", "\\u", "result_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "generat", "or", " ", "have", " ", "no", " ", "values", " ", "to", " ", "yield_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "disable", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Task", " ", "generat", "or", " ", "has", " ", "no", " ", "more", " ", "task", "s", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Disa", "blin", "g", " ", "it", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "task", "\\u", "generators_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Process", " ", "`", "self", ".", "initial", "\\u", "urls", "`", " ", "list", " ", "and", " ", "`", "self", ".", "task", "\\u", "generat", "or", "`", "\\", "10", ";", " ", " ", " ", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Process", "ing", " ", "initial", " ", "urls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "initial", "\\u", "urls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "self_", "._", "initial", "\\u", "urls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "task_", "(_", "Task_", "(_", "'", "initial", "'_", ",_", "url_", "=_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "task", "\\u", "generat", "or", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th_", "=_", "Thread_", "(_", "target_", "=_", "self_", "._", "task", "\\u", "generat", "or", "\\u", "thread", "\\u", "wrapper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "task", "\\u", "generator_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "th_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "task", "\\u", "generat", "or", "\\u", "list_", "._", "append_", "(_", "th_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "task", "\\u", "from", "\\u", "queue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "task", "\\u", "queue", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "task", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "self_", "._", "task", "\\u", "queue_", "._", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "No", " ", "read", "y", "-", "to", "-", "go", " ", "task", "s", ",", " ", "Wait", "ing", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "schedule", "d", " ", "task", "s", " ", "(%", "d", ")'_", "%_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Task", " ", "queue", " ", "is", " ", "empty", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "gra", "b", "\\u", "for", "\\u", "task_", "(_", "self_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "=_", "self_", "._", "create", "\\u", "gra", "b", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task_", "._", "gra", "b", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "._", "load", "\\u", "config_", "(_", "task_", "._", "gra", "b", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "._", "setup_", "(_", "url_", "=_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Generate", " ", "new", " ", "common", " ", "headers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "grab_", "._", "config_", "[_", "'", "common", "\\u", "header", "s", "'_", "]_", "=_", "grab_", "._", "common", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "gra", "b", "\\u", "instance_", "(_", "grab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "grab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "valid", "\\u", "network", "\\u", "response", "\\u", "code_", "(_", "self_", ",_", "code_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Answer", " ", "the", " ", "question", ":", " ", "if", " ", "the", " ", "response", " ", "coul", "d", " ", "be", " ", "handle", "d", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "usual", " ", "task", " ", "handler", " ", "or", " ", "the", " ", "task", " ", "fai", "eld", " ", "and", " ", "shou", "ld", " ", "be", " ", "process", "ed", " ", "as", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "code_", "<_", "400_", "or_", "code_", "==_", "404_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "in_", "task_", "._", "valid", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "handler", "\\u", "error_", "(_", "self_", ",_", "func", "\\u", "name_", ",_", "ex_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "error", "-%", "s", "'_", "%_", "ex_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "ex_", ",_", "'", "tb", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Error", " ", "in", " ", "%", "s", " ", "function", "'_", "%_", "func", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "error_", "(_", "ex_", "._", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "Error", " ", "in", " ", "%", "s", " ", "function", "'_", "%_", "func", "\\u", "name_", ",_", "exc", "\\u", "info_", "=_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", "s", " ", "stran", "ge", " ", "but", " ", "I", " ", "reall", "y", " ", "have", " ", "some", " ", "problem", "s", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serializ", "ing", " ", "exception", " ", "int", "o", " ", "string_", "\\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 ", " _", "ex", "\\u", "str_", "=_", "six_", "._", "text", "\\u", "type_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "\\u", "str_", "=_", "ex_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ",_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex", "\\u", "str_", "=_", "str_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "task", "\\u", "url_", "=_", "task_", "._", "url_", "if_", "task_", "is_", "not_", "None_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "collect_", "(_", "'", "fat", "al", "'_", ",_", "'%", "s", "|", "%", "s", "|", "%", "s", "|", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "func", "\\u", "name_", ",_", "ex_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "ex", "\\u", "str_", ",_", "task", "\\u", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "ex_", ",_", "Fat", "al", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Fat", "al", "Error", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "si", "x", ".", "reraise", "(", "Fat", "al", "Error", ",", " ", "ex", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logg", "er", ".", "error", "(", "ex", ".", "tb", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "data\\u", "handler_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "data_", ",_", "'", "handler", "'_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "getattr_", "(_", "self_", ",_", "'", "data\\u", "%", "s", "'_", "%_", "data_", "._", "handler", "\\u", "key_", ")_", "\\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 ", " _", "raise_", "No", "Data", "Handler_", "(_", "'", "No", " ", "handler", " ", "defin", "ed", " ", "for", " ", "Data", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "data_", "._", "handler", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "valid", "\\u", "network", "\\u", "result_", "(_", "self_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", "[_", "'", "task", "'_", "]_", "._", "get_", "(_", "'", "raw", "'_", ")_", ":_", "\\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_", "if_", "res_", "[_", "'", "ok", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "code_", "=_", "res_", "[_", "'", "gra", "b", "'_", "]_", "._", "response_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "valid", "\\u", "network", "\\u", "response", "\\u", "code_", "(_", "res", "\\u", "code_", ",_", "res_", "[_", "'", "task", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "parser_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Main", " ", "work", " ", "cycle", " ", "of", " ", "spider", " ", "process", " ", "working", " ", "in", " ", "parser", "-", "mode", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "parser", "\\u", "idle_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "Stat", " ", "instance", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "print", " ", "any", " ", "logg", "ing", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "parser", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "=_", "Stat_", "(_", "logg", "ing", "\\u", "period_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "prepar", "e\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "request", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recent", "\\u", "task", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "._", "get_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "is", "\\u", "parser", "\\u", "idle_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "parser", "\\u", "idle_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Network", " ", "result", " ", "queue", " ", "is", " ", "empty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "`", "wait", "ing", "\\u", "shut", "down", "\\u", "event", "`", " ", "only", " ", "after", " ", "1", " ", "seconds_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "wait", "ing", " ", "for", " ", "task", "s", " ", "to", " ", "avoid", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "race", "-", "condition", " ", "issues_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "time", ".", "time", "()", " ", "-", " ", "recent", "\\u", "task", "\\u", "time", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "wait", "ing", "\\u", "shut", "down", "\\u", "event", ".", "set", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "shut", "down", "\\u", "event_", "._", "is", "\\u", "set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Got", " ", "shut", "down", " ", "event", "'_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "process", "\\u", "request", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recent", "\\u", "task", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "parser", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "stat_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "self", ".", "wait", "ing", "\\u", "shut", "down", "\\u", "event", ".", "is", "\\u", "set", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "wait", "ing", "\\u", "shut", "down", "\\u", "event", ".", "clear", "()", "_", "\\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 ", " ", " _", "handler_", "=_", "self_", "._", "find", "\\u", "task", "\\u", "handler_", "(_", "result_", "[_", "'", "task", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Task", "Handler_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ex_", "._", "tb_", "=_", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "ex_", ",_", "result_", "[_", "'", "task", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "parser", ":", "handler", "-", "not", "-", "found", "'_", ")_", "\\u\\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_", "._", "process", "\\u", "network", "\\u", "result", "\\u", "with", "\\u", "handler_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "parser", ":", "handler", "-", "process", "ed", "'_", ")_", "\\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_", "self_", "._", "parser", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "stat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "counter", "s", "'_", ":_", "self_", "._", "stat_", "._", "counters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "s", "'_", ":_", "self_", "._", "stat_", "._", "collections_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "task", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parser", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "process", "\\u", "request", "\\u", "count_", ">=_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "''_", ",_", "exc", "\\u", "info_", "=_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "final", "ly", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "wait", "ing", "\\u", "shut", "down", "\\u", "event", ".", "set", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "network", "\\u", "result", "\\u", "with", "\\u", "handler_", "(_", "self_", ",_", "result_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler", "\\u", "name_", "=_", "getattr_", "(_", "handler_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "'", "NON", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "response", "\\u", "handler", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "response", "\\u", "handler", ".", "%", "s", "'_", "%_", "handler", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "handler", "\\u", "result_", "=_", "handler_", "(_", "result_", "[_", "'", "gra", "b", "'_", "]_", ",_", "result_", "[_", "'", "task", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handler", "\\u", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "something_", "in_", "handler", "\\u", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "something_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "task", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Data", "Handler_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "tb_", "=_", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "ex_", ",_", "result_", "[_", "'", "task", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "._", "tb_", "=_", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "(_", "ex_", ",_", "result_", "[_", "'", "task", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "task", "\\u", "handler_", "(_", "self_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "task_", "._", "orig", "in", "\\u", "task", "\\u", "generator_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "handler", "\\u", "for", "\\u", "inline", "\\u", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "callback_", "=_", "task_", "._", "get_", "(_", "'", "callback", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "getattr_", "(_", "self_", ",_", "'", "task", "\\u", "%", "s", "'_", "%_", "task_", "._", "name_", ")_", "\\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 ", " _", "raise_", "No", "Task", "Handler_", "(_", "'", "No", " ", "handler", " ", "or", " ", "callback", " ", "defin", "ed", " ", "for", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", " ", "%", "s", "'_", "%_", "task_", "._", "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 ", " _", "return_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handler", "\\u", "for", "\\u", "inline", "\\u", "task_", "(_", "self_", ",_", "grab_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "can", " ", "be", " ", "subro", "utine", " ", "for", " ", "the", " ", "first", " ", "call", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "we", " ", "shou", "ld", " ", "check", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "task_", ",_", "types_", "._", "Generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coroutine", "s", "\\u", "stack_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "task", "\\u", "generator_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "orig", "in", "\\u", "task", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coroutine", "s", "\\u", "stack_", "=_", "task_", "._", "coroutine", "s", "\\u", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "val_", "=_", "grab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "task", "\\u", "generator_", "=_", "task_", "._", "orig", "in", "\\u", "task", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "orig", "in", "\\u", "task", "\\u", "generator_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "target_", "._", "send_", "(_", "send", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "is", " ", "subro", "utine", " ", "we", " ", "have", " ", "to", " ", "initialize", " ", "it", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "coroutine", " ", "in", " ", "the", " ", "coroutine", "s", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "types_", "._", "Generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coroutine", "s", "\\u", "stack_", "._", "append_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "task", "\\u", "generator_", "=_", "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 ", " ", "_", "new", "\\u", "task_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "task_", "._", "orig", "in", "\\u", "task", "\\u", "generator_", "=_", "orig", "in", "\\u", "task", "\\u", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "task_", "._", "coroutine", "s", "\\u", "stack_", "=_", "coroutine", "s", "\\u", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "task_", "(_", "new", "\\u", "task_", ")_", "\\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_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "coroutine", " ", "is", " ", "over", " ", "we", " ", "shou", "ld", " ", "check", " ", "coroutine", "s", " ", "stack", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "be", " ", "it", " ", "is", " ", "subro", "utine", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "coroutine", "s", "\\u", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target_", "=_", "coroutine", "s", "\\u", "stack_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orig", "in", "\\u", "task", "\\u", "generator_", "=_", "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 ", " ", "_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "network", "\\u", "result", "\\u", "stats_", "(_", "self_", ",_", "res_", ",_", "from", "\\u", "cache_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Increase", " ", "stat", " ", "counters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "request", "-", "process", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "task", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "task", "-%", "s", "'_", "%_", "res_", "[_", "'", "task", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "res_", "[_", "'", "task", "'_", "]_", "._", "network", "\\u", "try", "\\u", "count_", "==_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "[_", "'", "task", "'_", "]_", "._", "task", "\\u", "try", "\\u", "count_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "task", "-%", "s", "-", "initial", "'_", "%_", "res_", "[_", "'", "task", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "traffic", " ", "statistics_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "res_", "[_", "'", "gra", "b", "'_", "]_", "and_", "res_", "[_", "'", "gra", "b", "'_", "]_", "._", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "res_", "[_", "'", "gra", "b", "'_", "]_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "inc", "\\u", "timer_", "(_", "'", "network", "-", "name", "-", "look", "up", "'_", ",_", "resp_", "._", "name", "\\u", "look", "up", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "inc", "\\u", "timer_", "(_", "'", "network", "-", "connect", "'_", ",_", "resp_", "._", "connect", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "._", "inc", "\\u", "timer_", "(_", "'", "network", "-", "total", "'_", ",_", "resp_", "._", "total", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "download", "-", "size", "-", "with", "-", "cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "._", "download", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "upload", "-", "size", "-", "with", "-", "cache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "._", "upload", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "download", "-", "size", "'_", ",_", "resp_", "._", "download", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "upload", "-", "size", "'_", ",_", "resp_", "._", "upload", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "gra", "b", "\\u", "proxy_", "(_", "self_", ",_", "task_", ",_", "grab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Assign", " ", "new", " ", "proxy", " ", "from", " ", "proxy", "list", " ", "to", " ", "the", " ", "task", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "._", "use", "\\u", "proxy", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "proxy", "list", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "this", " ", "to", " ", "work", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyc", "url", " ", "feature", "/", "bug", ":", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyc", "url", " ", "instance", " ", "use", "s", " ", "previ", "ously", " ", "connect", "ed", " ", "proxy", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "even", " ", "if", " ", "`", "proxy", "`", " ", "options", " ", "is", " ", "set", " ", "with", " ", "anot", "her", " ", "proxy", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grab_", "._", "setup_", "(_", "connecti", "on", "\\u", "reuse_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "proxy", "\\u", "auto", "\\u", "change_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "proxy_", "=_", "self_", "._", "change", "\\u", "proxy_", "(_", "task_", ",_", "grab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "\\u", "proxy_", "(_", "self_", ",_", "task_", ",_", "grab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy_", "=_", "self_", "._", "proxy", "list_", "._", "get", "\\u", "random", "\\u", "proxy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grab_", "._", "setup_", "(_", "proxy_", "=_", "proxy_", "._", "get", "\\u", "address_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proxy", "\\u", "userp", "wd_", "=_", "proxy_", "._", "get", "\\u", "userp", "wd_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proxy", "\\u", "type_", "=_", "proxy_", "._", "proxy", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "submit", "\\u", "task", "\\u", "to", "\\u", "transport_", "(_", "self_", ",_", "task_", ",_", "grab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "only", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "request", "-", "network", "-", "disable", "d", "-", "only", "-", "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 ", " _", "gra", "b", "\\u", "config", "\\u", "backup_", "=_", "grab_", "._", "dump", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "gra", "b", "\\u", "proxy_", "(_", "task_", ",_", "grab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "request", "-", "network", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "task", "-%", "s", "-", "network", "'_", "%_", "task_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "network", "\\u", "transport", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Submit", "ting", " ", "task", " ", "to", " ", "the", " ", "transport", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "layer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "transport_", "._", "start", "\\u", "task", "\\u", "processing_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task_", ",_", "grab_", ",_", "gra", "b", "\\u", "config", "\\u", "backup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Grab", "Inva", "lid", "Url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "Task", " ", "%", "s", " ", "has", " ", "invalid", " ", "URL", ":", " ", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "name_", ",_", "task_", "._", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "collect_", "(_", "'", "invalid", "-", "url", "'_", ",_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "api", "\\u", "thread_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "grab_", "._", "spider_", "._", "http", "\\u", "api_", "import_", "Http", "Ap", "i", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "Http", "Ap", "i", "Thread_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "read", "y", "\\u", "to", "\\u", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thin", "gs", " ", "shou", "ld", " ", "be", " ", "true", " ", "to", " ", "shut", "down", " ", "spider_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ")", " ", "No", " ", "active", " ", "task", " ", "handler", "s", " ", "(", "task", "\\u*", " ", "function", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ")", " ", "All", " ", "task", " ", "generat", "ors", " ", "has", " ", "complete", "d", " ", "work_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ")", " ", "No", " ", "active", " ", "network", " ", "threads_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ")", " ", "Task", " ", "queue", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "5", ")", " ", "Network", " ", "result", " ", "queue", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "6", ")", " ", "Cache", " ", "is", " ", "disable", "d", " ", "or", " ", "is", " ", "in", " ", "idle", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "all_", "(_", "x_", "[_", "'", "is", "\\u", "parser", "\\u", "idle", "'_", "]_", "._", "is", "\\u", "set_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "self_", "._", "parser", "\\u", "pipeline_", "._", "parser", "\\u", "pool_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "any_", "(_", "x_", "._", "is", "Alive_", "(_", ")_", "for_", "x_", "in_", "self_", "._", "\\u", "task", "\\u", "generat", "or", "\\u", "list_", ")_", "#", " ", "(", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "transport_", "._", "get", "\\u", "active", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", "#", " ", "(", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "task", "\\u", "queue_", "._", "size_", "(_", ")_", "#", " ", "(", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "#", " ", "(", "5", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "self_", "._", "cache", "\\u", "pipeline_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "self_", "._", "cache", "\\u", "pipeline_", "._", "is", "\\u", "idle_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "cache", "\\u", "pipeline_", "._", "input", "\\u", "queue_", "._", "qsize_", "(_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "cache", "\\u", "pipeline_", "._", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "==_", "0_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\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 ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Main", " ", "method", ".", " ", "All", " ", "work", " ", "is", " ", "don", "e", " ", "here", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "mp", "\\u", "mode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "multiprocessing_", "import_", "Process_", ",_", "Event_", ",_", "Queue_", "\\u\\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_", "multiprocessing_", "._", "dummy_", "import_", "Process_", ",_", "Event_", ",_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "timer_", "._", "start_", "(_", "'", "total", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "=_", "Multi", "curl", "Transport_", "(_", "self_", "._", "thread", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "http", "\\u", "api", "\\u", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http", "\\u", "api", "\\u", "proc_", "=_", "self_", "._", "start", "\\u", "api", "\\u", "thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http", "\\u", "api", "\\u", "proc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "pipeline_", "=_", "Parser", "Pipeline_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bot_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mp", "\\u", "mode_", "=_", "self_", "._", "mp", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pool", "\\u", "size_", "=_", "self_", "._", "parser", "\\u", "pool", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shut", "down", "\\u", "event_", "=_", "self_", "._", "shut", "down", "\\u", "event_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "result", "\\u", "queue_", "=_", "self_", "._", "network", "\\u", "result", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "result", "\\u", "queue_", "=_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "s", "\\u", "per", "\\u", "process_", "=_", "self_", "._", "parser", "\\u", "request", "s", "\\u", "per", "\\u", "process_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "result", "\\u", "queue", "\\u", "limit_", "=_", "max_", "(_", "10_", ",_", "self_", "._", "thread", "\\u", "number_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Run", " ", "custom", " ", "thing", "s", " ", "defin", "ed", " ", "by", " ", "this", " ", "specific", " ", "spider_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "def", "aut", " ", "it", " ", "doe", "s", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "task", " ", "queue", " ", "if", " ", "it", " ", "has", " ", "not", " ", "bee", "n", " ", "configur", "ed", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "task", "\\u", "queue_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "\\u", "queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initiat", "e", " ", "task", " ", "generat", "or", ".", " ", "On", "ly", " ", "in", " ", "main", " ", "process", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "task", "\\u", "generat", "or", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "task", "\\u", "generators_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Work", " ", "in", " ", "infini", "te", " ", "cycle", " ", "unti", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "self", ".", "work", "\\u", "allow", "ed", "`", " ", "flag", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shut", "down", "\\u", "countdown", " ", "=", " ", "0", " ", "#", " ", "!!!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pend", "ing", "\\u", "tasks_", "=_", "deque_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "work", "\\u", "allowed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "free", "\\u", "threads_", "=_", "self_", "._", "transport_", "._", "get", "\\u", "free", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "new", " ", "task", " ", "only", " ", "if", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ")", " ", "network", " ", "transport", " ", "has", " ", "free", " ", "threads_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ")", " ", "network", " ", "result", " ", "queue", " ", "is", " ", "not", " ", "full_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ")", " ", "cache", " ", "is", " ", "disable", "d", " ", "OR", " ", "cache", " ", "has", " ", "free", " ", "resources_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "transport_", "._", "get", "\\u", "free", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "<_", "network", "\\u", "result", "\\u", "queue", "\\u", "limit_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "self_", "._", "cache", "\\u", "pipeline_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "self_", "._", "cache", "\\u", "pipeline_", "._", "has", "\\u", "free", "\\u", "resources_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "pend", "ing", "\\u", "tasks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "task_", "=_", "pend", "ing", "\\u", "tasks_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "task_", "=_", "self_", "._", "get", "\\u", "task", "\\u", "from", "\\u", "queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "receive", "d", " ", "task", " ", "is", " ", "Non", "e", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "spider", " ", "is", " ", "read", "y", " ", "to", " ", "be", " ", "shut", " ", "down_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "pend", "ing", "\\u", "tasks_", "and_", "self_", "._", "is", "\\u", "read", "y", "\\u", "to", "\\u", "shutdown_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "shut", "down", "\\u", "countdown", " ", "-=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "time", ".", "sleep", "(", "0.02", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shut", "down", "\\u", "countdown", " ", "<=", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "shut", "down", "\\u", "event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "('", "STOP", "!!!!!!", "!!!", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "#", " ", "Break", " ", "from", " ", "`", "whi", "le", " ", "self", ".", "work", "\\u", "allow", "ed", "`", " ", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "task_", ",_", "bool_", ")_", "and_", "(_", "task_", "is_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "receive", "d", " ", "task", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "there", " ", "is", " ", "no", " ", "active", " ", "network", " ", "thread", "s", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "some", " ", "sleep_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "transport_", "._", "get", "\\u", "active", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\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 ", " ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Got", " ", "new", " ", "task", " ", "from", " ", "task", " ", "queue", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "network", "\\u", "try", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "valid_", ",_", "reason_", "=_", "self_", "._", "check", "\\u", "task", "\\u", "limits_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "task", "\\u", "grab_", "=_", "self_", "._", "setup", "\\u", "gra", "b", "\\u", "for", "\\u", "task_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "cache", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "cache", "\\u", "pipeline_", "._", "input", "\\u", "queue_", "._", "put_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "load", "'_", ",_", "(_", "task_", ",_", "task", "\\u", "grab_", ")_", ")_", ",_", "\\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 ", " ", " _", "self_", "._", "submit", "\\u", "task", "\\u", "to", "\\u", "transport_", "(_", "task_", ",_", "task", "\\u", "grab_", ")_", "\\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_", "._", "log", "\\u", "reject", "ed", "\\u", "task_", "(_", "task_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "task_", "._", "get", "\\u", "fall", "back", "\\u", "handler_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "handler_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "timer_", "._", "log", "\\u", "time_", "(_", "'", "network", "\\u", "transport", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "As", "king", " ", "transport", " ", "layer", " ", "to", " ", "do", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "somet", "hing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "process", "\\u", "handlers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Process", "ing", " ", "network", " ", "results", " ", "(", "if", " ", "any", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Collect", " ", "complete", "d", " ", "network", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "result", " ", "coul", "d", " ", "be", " ", "valid", " ", "or", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Result", " ", "is", " ", "dict", " ", "{", "ok", ",", " ", "gra", "b", ",", " ", "gra", "b", "\\u", "config", "\\u", "backup", ",", " ", "task", ",", " ", "ems", "g", "}_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "[_", "(_", "x_", ",_", "False_", ")_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "transport_", "._", "iterate", "\\u", "results_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "cache", "\\u", "pipeline_", ":_", "\\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 ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "action_", ",_", "result_", "=_", "self_", "._", "cache", "\\u", "pipeline_", "._", "result", "\\u", "queue_", "._", "get_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "assert_", "action_", "in_", "(_", "'", "network", "\\u", "result", "'_", ",_", "'", "task", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action_", "==_", "'", "network", "\\u", "result", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "results_", "._", "append_", "(_", "(_", "result_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "action_", "==_", "'", "task", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "task_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "grab_", "=_", "self_", "._", "setup", "\\u", "gra", "b", "\\u", "for", "\\u", "task_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "transport_", "._", "get", "\\u", "free", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "<_", "network", "\\u", "result", "\\u", "queue", "\\u", "limit_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "submit", "\\u", "task", "\\u", "to", "\\u", "transport_", "(_", "task_", ",_", "task", "\\u", "grab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pend", "ing", "\\u", "tasks_", "._", "append_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "sleep", " ", "to", " ", "avoid", " ", "milli", "ons", " ", "of", " ", "iterati", "ons", " ", "per", " ", "second", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ")", " ", "If", " ", "no", " ", "results", " ", "from", " ", "network", " ", "transport_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ")", " ", "If", " ", "task", " ", "queue", " ", "is", " ", "empty", " ", "(", "or", " ", "if", " ", "there", " ", "are", " ", "only", " ", "delayed", " ", "task", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ")", " ", "If", " ", "no", " ", "network", " ", "activity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ")", " ", "If", " ", "parser", " ", "result", " ", "queue", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "results_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "task_", "is_", "None_", "or_", "bool_", "(_", "task_", ")_", "==_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "transport_", "._", "get", "\\u", "active", "\\u", "thread", "s", "\\u", "number_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "self_", "._", "cache", "\\u", "pipeline_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "self_", "._", "cache", "\\u", "pipeline_", "._", "input", "\\u", "queue_", "._", "qsize_", "(_", ")_", "==_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "cache", "\\u", "pipeline_", "._", "is", "\\u", "idle_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "cache", "\\u", "pipeline_", "._", "result", "\\u", "queue_", "._", "qsize_", "(_", ")_", "==_", "0_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "time_", "._", "sleep_", "(_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "result_", ",_", "from", "\\u", "cache_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "cache", "\\u", "pipeline_", "and_", "not_", "from", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "result_", "[_", "'", "ok", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "cache", "\\u", "pipeline_", "._", "input", "\\u", "queue_", "._", "put_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "save", "'_", ",_", "(_", "result_", "[_", "'", "task", "'_", "]_", ",_", "result_", "[_", "'", "gra", "b", "'_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log", "\\u", "network", "\\u", "result", "\\u", "stats_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "from", "\\u", "cache_", "=_", "from", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "valid", "\\u", "network", "\\u", "result_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", "('", "!!", " ", "PU", "T", " ", "NET", "WORK", " ", "RESU", "LT", " ", "INT", "O", " ", "QUEUE", " ", "(", "base", ".", "py", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "network", "\\u", "result", "\\u", "queue_", "._", "put_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "log", "\\u", "fail", "ed", "\\u", "network", "\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "do", " ", "network", " ", "request", " ", "one", " ", "more", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "network", "\\u", "try", "\\u", "limit_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "[_", "'", "task", "'_", "]_", "._", "refre", "sh", "\\u", "cache_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "task", "'_", "]_", "._", "setup", "\\u", "gra", "b", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "gra", "b", "\\u", "config", "\\u", "backup", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "task_", "(_", "result_", "[_", "'", "task", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "from", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "task", "-%", "s", "-", "cache", "'_", "%_", "result_", "[_", "'", "task", "'_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "request", "'_", ")_", "\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "p", "\\u", "res_", ",_", "p", "\\u", "task_", "=_", "self_", "._", "parser", "\\u", "result", "\\u", "queue_", "._", "get_", "(_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "stat_", "._", "inc_", "(_", "'", "spider", ":", "parser", "-", "result", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "handler", "\\u", "result_", "(_", "p", "\\u", "res_", ",_", "p", "\\u", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "shut", "down", "\\u", "event_", "._", "is", "\\u", "set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "parser", "\\u", "pipeline_", "._", "check", "\\u", "pool", "\\u", "health_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Work", " ", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "'\\\\", "n", "Got", " ", "^", "C", " ", "signal", " ", "in", " ", "process", " ", "%", "d", ".", " ", "Stopp", "ing", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "interrupted", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "code", " ", "is", " ", "executed", " ", "whe", "n", " ", "main", " ", "cycle", "s", " ", "is", " ", "break", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timer_", "._", "stop_", "(_", "'", "total", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stat_", "._", "print", "\\u", "progress", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sto", "p", " ", "HTTP", " ", "API", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "http", "\\u", "api", "\\u", "proc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "http", "\\u", "api", "\\u", "proc_", "._", "server_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http", "\\u", "api", "\\u", "proc_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "task", "\\u", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "task", "\\u", "queue_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sto", "p", " ", "parser", " ", "processes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "shut", "down", "\\u", "event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parser", "\\u", "pipeline_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Main", " ", "process", " ", "[", "pid", "=", "%", "s", "]:", " ", "work", " ", "don", "e", "'_", "%_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "fail", "ed", "\\u", "network", "\\u", "result_", "(_", "self_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", " ", "the", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", "[_", "'", "ok", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "http", "-%", "s", "'_", "%_", "res_", "[_", "'", "gra", "b", "'_", "]_", "._", "response_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "res_", "[_", "'", "error", "\\u", "abb", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "stat_", "._", "inc_", "(_", "'", "error", ":", "%", "s", "'_", "%_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "error", "(", "u", "'", "Network", " ", "error", ":", " ", "%", "s", "'", " ", "%", " ", "msg", ")#", "%_", "\\u\\u\\uNL\\u\\u\\u_", "#", "make", "\\u", "unicode", "(", "msg", ",", " ", "error", "s", "='", "ignore", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "reject", "ed", "\\u", "task_", "(_", "self_", ",_", "task_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "er", "\\u", "verbose_", "._", "debug_", "(_", "'", "Task", " ", "%", "s", " ", "is", " ", "reject", "ed", " ", "due", " ", "to", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "limit", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "task_", "._", "name_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reason_", "==_", "'", "task", "-", "try", "-", "count", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "collect_", "(_", "'", "task", "-", "count", "-", "reject", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reason_", "==_", "'", "network", "-", "try", "-", "count", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stat_", "._", "collect_", "(_", "'", "network", "-", "count", "-", "reject", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Error_", "(_", "'", "Un", "know", "n", " ", "response", " ", "from", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "\\u", "task", "\\u", "limit", "s", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spider_", "(_", "Dep", "reca", "ted", "Thin", "gs", "Spi", "der", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "handler", "\\u", "result_", "(_", "self_", ",_", "result_", ",_", "task_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Process", " ", "result", " ", "receive", "d", " ", "from", " ", "the", " ", "task", " ", "handler", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Result", " ", "coul", "d", " ", "be", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Task", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Data", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "result_", ",_", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "task_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "result_", ",_", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "self_", "._", "find", "\\u", "data\\u", "handler_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "result_", "=_", "handler_", "(_", "**_", "result_", "._", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data\\u", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "something_", "in_", "data\\u", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "process", "\\u", "handler", "\\u", "result_", "(_", "something_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "process", "\\u", "handler", "\\u", "error_", "(_", "'", "data\\u", "%", "s", "'_", "%_", "result_", "._", "handler", "\\u", "key_", ",_", "ex_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "result_", ",_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "self_", "._", "find", "\\u", "task", "\\u", "handler_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "name_", "=_", "getattr_", "(_", "handler_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "'", "NON", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "handler", "\\u", "error_", "(_", "handler", "\\u", "name_", ",_", "result_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "result_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "stat", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "count_", "in_", "result_", "[_", "'", "counter", "s", "'_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "stat_", "._", "inc_", "(_", "name_", ",_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", ",_", "items_", "in_", "result_", "[_", "'", "collection", "s", "'_", "]_", "._", "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 ", " ", " _", "self_", "._", "stat_", "._", "collect_", "(_", "name_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Spi", "der", "Error_", "(_", "'", "Un", "know", "n", " ", "result", " ", "type", ":", " ", "%", "s", "'_", "%_", "result_", ")_", "\\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_", "Spi", "der", "Error_", "(_", "'", "Un", "know",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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 local variable
ejeschke/ginga/ginga/web/bokehw/ImageViewBokeh.py
[ { "content": " def reschedule_redraw(self, time_sec):\n if self.figure is not None:\n ## try:\n ## self.figure.after_cancel(self._defer_task)\n ## except:\n ## pass\n time_ms = int(time_sec * 1000)\n ## self._defer_task = self.figure.after(time_ms,\n ## self.delayed_redraw)", "metadata": "root.ImageViewBokeh2.reschedule_redraw", "header": "['class', 'ImageViewBokeh2', '(', 'ImageViewSS', ')', ':', '___EOS___']", "index": 143 }, { "content": " def onscreen_message(self, text, delay=None):\n if self.figure is None:\n return\n ## if self.msgtask:\n ## try:\n ## self.figure.after_cancel(self.msgtask)\n ## except:\n ## pass\n self.message = text\n self.redraw(whence=3)\n if delay:\n ms = int(delay * 1000.0)\n ## self.msgtask = self.figure.after(ms,\n ## lambda: self.onscreen_message(None))", "metadata": "root.ImageViewBokeh2.onscreen_message", "header": "['class', 'ImageViewBokeh2', '(', 'ImageViewSS', ')', ':', '___EOS___']", "index": 163 }, { "content": " def get_png_image_as_buffer(self, output=None):\n ibuf = output\n if ibuf is None:\n ibuf = BytesIO()\n qimg = self.figure.write_to_png(ibuf)\n return ibuf", "metadata": "root.ImageViewBokeh.get_png_image_as_buffer", "header": "['class', 'ImageViewBokeh', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 322 }, { "content": " def onscreen_message(self, text, delay=None):\n ## try:\n ## self._msg_timer.stop()\n ## except:\n ## pass\n\n self.message = text\n self.redraw(whence=3)\n\n if delay:\n time_ms = int(delay * 1000.0)\n ## self._msg_timer.interval = time_ms\n ## self._msg_timer.start()", "metadata": "root.ImageViewBokeh.onscreen_message", "header": "['class', 'ImageViewBokeh', '(', 'ImageView', '.', 'ImageViewBase', ')', ':', '___EOS___']", "index": 348 } ]
[ { "span": "time_ms ", "start_line": 149, "start_column": 12, "end_line": 149, "end_column": 19 }, { "span": "ms ", "start_line": 174, "start_column": 12, "end_line": 174, "end_column": 14 }, { "span": "qimg ", "start_line": 326, "start_column": 8, "end_line": 326, "end_column": 12 }, { "span": "time_ms ", "start_line": 358, "start_column": 12, "end_line": 358, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Image", "View", "Bo", "ke", "h2_", "(_", "Image", "View", "SS_", ")_", ":_", "\\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_", "resc", "hedule", "\\u", "redraw_", "(_", "self_", ",_", "time", "\\u", "sec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "figure_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "self", ".", "figure", ".", "after", "\\u", "cancel", "(", "self", ".\\u", "defer", "\\u", "task", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "ms_", "=_", "int_", "(_", "time", "\\u", "sec_", "*_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "self", ".\\u", "defer", "\\u", "task", " ", "=", " ", "self", ".", "figure", ".", "after", "(", "time", "\\u", "ms", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "self", ".", "delayed", "\\u", "redraw", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Bo", "ke", "h2_", "(_", "Image", "View", "SS_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ons", "creen", "\\u", "message_", "(_", "self_", ",_", "text_", ",_", "delay_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "figure_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "if", " ", "self", ".", "msgt", "ask", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "self", ".", "figure", ".", "after", "\\u", "cancel", "(", "self", ".", "msgt", "ask", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "message_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "=_", "int_", "(_", "delay_", "*_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "self", ".", "msgt", "ask", " ", "=", " ", "self", ".", "figure", ".", "after", "(", "ms", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", " ", "lambda", ":", " ", "self", ".", "ons", "creen", "\\u", "message", "(", "Non", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Bo", "ke", "h_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "png", "\\u", "image", "\\u", "as", "\\u", "buffer_", "(_", "self_", ",_", "output_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ibu", "f_", "=_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ibu", "f_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ibu", "f_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qi", "mg_", "=_", "self_", "._", "figure_", "._", "write", "\\u", "to", "\\u", "png_", "(_", "ibu", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ibu", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Image", "View", "Bo", "ke", "h_", "(_", "Image", "View_", "._", "Image", "View", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ons", "creen", "\\u", "message_", "(_", "self_", ",_", "text_", ",_", "delay_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "self", ".\\u", "msg", "\\u", "timer", ".", "stop", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "message_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "delay_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "ms_", "=_", "int_", "(_", "delay_", "*_", "1000.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_",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 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, 0, 1, 1, 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, 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 ]
Unused import
twoolie/NBT/tests/alltests.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport sys\nimport logging\n\nimport unittest\ntry:\n from unittest import skip as _skip\nexcept ImportError:\n # Python 2.6 has an older unittest API. The backported package is available from pypi.\n import unittest2 as unittest\n\ntestmodules = ['examplestests', 'nbttests', 'regiontests']\n\"\"\"Files to check for test cases. Do not include the .py extension.\"\"\"\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n logger = logging.getLogger(\"nbt.tests\")\n if len(logger.handlers) == 0:\n # Logging is not yet configured. Configure it.\n logging.basicConfig(level=logging.INFO, stream=sys.stderr, format='%(levelname)-8s %(message)s')\n testresult = unittest.TextTestRunner(verbosity=2).run(load_tests_in_modules(testmodules))\n sys.exit(0 if testresult.wasSuccessful() else 1)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_testsuites_in_module(module):\n \"\"\"\n Return a list of unittest.TestSuite subclasses defined in module.\n \"\"\"\n suites = []\n for name in dir(module):\n obj = getattr(module, name)\n if isinstance(obj, type) and issubclass(obj, unittest.TestSuite):\n suites.append(obj)\n return suites", "metadata": "root.get_testsuites_in_module", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def load_tests_in_modules(modulenames):\n \"\"\"\n Given a list of module names, import the modules, load and run the \n test cases in these modules. The modules are typically files in the \n current directory, but this is not a requirement.\n \"\"\"\n loader = unittest.TestLoader()\n suites = []\n for name in modulenames:\n module = __import__(name)\n suite = loader.loadTestsFromModule(module)\n for suiteclass in get_testsuites_in_module(module):\n # Wrap suite in TestSuite classes\n suite = suiteclass(suite)\n suites.append(suite)\n suite = unittest.TestSuite(suites)\n return suite", "metadata": "root.load_tests_in_modules", "header": "['module', '___EOS___']", "index": 29 } ]
[ { "span": "from unittest import skip as _skip", "start_line": 8, "start_column": 4, "end_line": 8, "end_column": 38 } ]
[]
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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "unittest_", "import_", "skip_", "as_", "\\u", "skip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", " ", "has", " ", "an", " ", "older", " ", "unittest", " ", "API", ".", " ", "The", " ", "backp", "orte", "d", " ", "package", " ", "is", " ", "avail", "able", " ", "from", " ", "pypi", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "testm", "odule", "s_", "=_", "[_", "'", "example", "ste", "sts", "'_", ",_", "'", "nb", "tte", "sts", "'_", ",_", "'", "region", "tests", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Files", " ", "to", " ", "check", " ", "for", " ", "test", " ", "case", "s", ".", " ", "Do", " ", "not", " ", "include", " ", "the", " ", ".", "py", " ", "extensi", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "nb", "t", ".", "tests", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "logger_", "._", "handlers_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", "ging", " ", "is", " ", "not", " ", "ye", "t", " ", "configur", "ed", ".", " ", "Configure", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "INFO_", ",_", "stream_", "=_", "sys_", "._", "stderr_", ",_", "format_", "=_", "'%", "(", "level", "name", ")-", "8s", " ", "%", "(", "message", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "testre", "sult_", "=_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "2_", ")_", "._", "run_", "(_", "load", "\\u", "tests", "\\u", "in", "\\u", "modules_", "(_", "testm", "odule", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", "if_", "testre", "sult_", "._", "was", "Success", "ful_", "(_", ")_", "else_", "1_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "testsuite", "s", "\\u", "in", "\\u", "module_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "unittest", ".", "Test", "Suit", "e", " ", "subclasses", " ", "defin", "ed", " ", "in", " ", "module", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suites_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "dir_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "module_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "type_", ")_", "and_", "issubclass_", "(_", "obj_", ",_", "unittest_", "._", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suites_", "._", "append_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "suites_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "tests", "\\u", "in", "\\u", "modules_", "(_", "modulename", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "list", " ", "of", " ", "module", " ", "names", ",", " ", "import", " ", "the", " ", "module", "s", ",", " ", "load", " ", "and", " ", "run", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "test", " ", "case", "s", " ", "in", " ", "these", " ", "module", "s", ".", " ", "The", " ", "module", "s", " ", "are", " ", "typical", "ly", " ", "files", " ", "in", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "current", " ", "director", "y", ",", " ", "but", " ", "this", " ", "is", " ", "not", " ", "a", " ", "require", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loader_", "=_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suites_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "modulename", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "\\u\\u", "import\\u\\u_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "loader_", "._", "load", "Test", "s", "Fro", "m", "Module_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "suit", "ecl", "ass_", "in_", "get", "\\u", "testsuite", "s", "\\u", "in", "\\u", "module_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wra", "p", " ", "suit", "e", " ", "in", " ", "Test", "Suit", "e", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "suit", "ecl", "ass_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suites_", "._", "append_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", "suites_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unused local variable
pgiri/asyncoro/py2/asyncoro/__init__.py
[ { "content": " def _iocp_connect(self, host_port):\n \"\"\"Internal use only; use 'connect' with 'yield' instead.\n \"\"\"\n def _connect(self, err, n):\n def _ssl_handshake(self, err, n):\n try:\n self._rsock.do_handshake()\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n err, n = win32file.WSARecv(self._fileno, self._read_result,\n self._read_overlap, 0)\n elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n err, n = win32file.WSASend(self._fileno, '', self._read_overlap, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro = self._read_coro\n self.close()\n if coro:\n coro.throw(*sys.exc_info())\n except:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro = self._read_coro\n self.close()\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_(0)\n\n if err:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n if err == winerror.ERROR_OPERATION_ABORTED:\n self._read_coro = None\n else:\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro.throw(socket.error(err))\n else:\n self._rsock.setsockopt(socket.SOL_SOCKET,\n win32file.SO_UPDATE_CONNECT_CONTEXT, '')\n if self._certfile:\n self._rsock = ssl.wrap_socket(self._rsock, ca_certs=self._certfile,\n cert_reqs=ssl.CERT_REQUIRED,\n server_side=False,\n do_handshake_on_connect=False)\n self._read_result = win32file.AllocateReadBuffer(0)\n self._read_overlap.object = functools.partial(_ssl_handshake, self)\n self._read_overlap.object(None, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_(0)\n\n # ConnectEX requires socket to be bound!\n try:\n self._rsock.bind(('0.0.0.0', 0))\n except socket.error as exc:\n if exc[0] != EINVAL:\n raise\n self._read_overlap.object = functools.partial(_connect, self)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n if self._timeout:\n self._notifier._add_timeout(self)\n err, n = win32file.ConnectEx(self._rsock, host_port, self._read_overlap)\n if err and err != winerror.ERROR_IO_PENDING:\n self._read_overlap.object = self._read_result = self._read_coro = None\n raise socket.error(err)", "metadata": "root.AsyncSocket._iocp_connect", "header": "['class', 'AsyncSocket', '(', '_AsyncSocket', ')', ':', '___EOS___']", "index": 1451 }, { "content": " def _iocp_accept(self):\n \"\"\"Internal use only; use 'accept' with 'yield'\n instead. Socket in returned pair is asynchronous\n socket (instance of AsyncSocket with blocking=False).\n \"\"\"\n def _accept(self, conn, err, n):\n def _ssl_handshake(self, conn, addr, err, n):\n try:\n conn._rsock.do_handshake()\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n err, n = win32file.WSARecv(conn._fileno, self._read_result,\n self._read_overlap, 0)\n elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n err, n = win32file.WSASend(conn._fileno, '', self._read_overlap, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n conn.close()\n if coro:\n coro.throw(*sys.exc_info())\n except:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n conn.close()\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_((conn, addr))\n\n if err:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n family, laddr, raddr = win32file.GetAcceptExSockaddrs(conn, self._read_result)\n # TODO: unpack raddr if family != AF_INET\n conn._rsock.setsockopt(socket.SOL_SOCKET, win32file.SO_UPDATE_ACCEPT_CONTEXT,\n struct.pack('P', self._fileno))\n if self._certfile:\n if not self.ssl_server_ctx and hasattr(ssl, 'create_default_context'):\n self.ssl_server_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\n self.ssl_server_ctx.load_cert_chain(certfile=self._certfile,\n keyfile=self._keyfile)\n\n if self.ssl_server_ctx:\n conn._rsock = self.ssl_server_ctx.wrap_socket(conn._rsock,\n server_side=True,\n do_handshake_on_connect=False)\n else:\n conn._rsock = ssl.wrap_socket(conn._rsock, certfile=self._certfile,\n keyfile=self._keyfile,\n server_side=True,\n ssl_version=self._ssl_version,\n do_handshake_on_connect=False)\n\n self._read_result = win32file.AllocateReadBuffer(0)\n self._read_overlap.object = functools.partial(_ssl_handshake, self,\n conn, raddr)\n self._read_overlap.object(None, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_((conn, raddr))\n\n sock = socket.socket(self._rsock.family, self._rsock.type, self._rsock.proto)\n conn = AsyncSocket(sock, keyfile=self._keyfile, certfile=self._certfile,\n ssl_version=self._ssl_version)\n self._read_result = win32file.AllocateReadBuffer(win32file.CalculateSocketEndPointSize(sock))\n self._read_overlap.object = functools.partial(_accept, self, conn)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n if self._timeout:\n self._notifier._add_timeout(self)\n err = win32file.AcceptEx(self._fileno, conn._fileno, self._read_result,\n self._read_overlap)\n if err and err != winerror.ERROR_IO_PENDING:\n self._read_overlap.object = self._read_result = self._read_coro = None\n raise socket.error(err)", "metadata": "root.AsyncSocket._iocp_accept", "header": "['class', 'AsyncSocket', '(', '_AsyncSocket', ')', ':', '___EOS___']", "index": 1533 } ]
[ { "span": "err,", "start_line": 1460, "start_column": 32, "end_line": 1460, "end_column": 35 }, { "span": "n ", "start_line": 1460, "start_column": 37, "end_line": 1460, "end_column": 38 }, { "span": "err,", "start_line": 1463, "start_column": 32, "end_line": 1463, "end_column": 35 }, { "span": "n ", "start_line": 1463, "start_column": 37, "end_line": 1463, "end_column": 38 }, { "span": "err,", "start_line": 1544, "start_column": 32, "end_line": 1544, "end_column": 35 }, { "span": "n ", "start_line": 1544, "start_column": 37, "end_line": 1544, "end_column": 38 }, { "span": "err,", "start_line": 1547, "start_column": 32, "end_line": 1547, "end_column": 35 }, { "span": "n ", "start_line": 1547, "start_column": 37, "end_line": 1547, "end_column": 38 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Async", "Socket_", "(_", "\\u", "Async", "Socket_", ")_", ":_", "\\u\\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", "ioc", "p", "\\u", "connect_", "(_", "self_", ",_", "host", "\\u", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "connect", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "connect_", "(_", "self_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AR", "ec", "v_", "(_", "self_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AS", "end_", "(_", "self_", "._", "\\u", "fileno_", ",_", "''_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "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 ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\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_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "==_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "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 ", " ", " _", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32", "file_", "._", "SO", "\\u", "UPDATE", "\\u", "CONNECT", "\\u", "CONTEXT_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "self_", "._", "\\u", "rs", "ock_", ",_", "ca", "\\u", "certs_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "\\u", "reqs_", "=_", "ssl_", "._", "CERT", "\\u", "REQUIRED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "(_", "None_", ",_", "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 ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", "EX", " ", "require", "s", " ", "socket", " ", "to", " ", "be", " ", "bound", "!", "_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "rs", "ock_", "._", "bind_", "(_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "exc_", "[_", "0_", "]_", "!=_", "EIN", "VAL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "connect_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err_", ",_", "n_", "=_", "win32", "file_", "._", "Connect", "Ex_", "(_", "self_", "._", "\\u", "rs", "ock_", ",_", "host", "\\u", "port_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "and_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "IO", "\\u", "PENDING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "socket_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Socket_", "(_", "\\u", "Async", "Socket_", ")_", ":_", "\\u\\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", "ioc", "p", "\\u", "accept_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "accept", "'", " ", "with", " ", "'", "yield", "'", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", ".", " ", "Sock", "et", " ", "in", " ", "return", "ed", " ", "pair", " ", "is", " ", "async", "hronous", "\\", "10", ";", " ", " ", " ", " ", "socket", " ", "(", "instance", " ", "of", " ", "Async", "Sock", "et", " ", "with", " ", "blockin", "g", "=", "Fal", "se", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "accept_", "(_", "self_", ",_", "conn_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ",_", "conn_", ",_", "addr_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AR", "ec", "v_", "(_", "conn_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AS", "end_", "(_", "conn_", "._", "\\u", "fileno_", ",_", "''_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "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 ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\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_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "addr_", ")_", ")_", "\\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_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\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 ", " ", " _", "family_", ",_", "lad", "dr_", ",_", "rad", "dr_", "=_", "win32", "file_", "._", "Get", "Accept", "Ex", "Sock", "addrs_", "(_", "conn_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "unpack", " ", "rad", "dr", " ", "if", " ", "famil", "y", " ", "!=", " ", "AF", "\\u", "INET_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "\\u", "rs", "ock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "win32", "file_", "._", "SO", "\\u", "UPDATE", "\\u", "ACCEPT", "\\u", "CONTEXT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'", "P", "'_", ",_", "self_", "._", "\\u", "fileno_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "and_", "hasattr_", "(_", "ssl_", ",_", "'", "create", "\\u", "default", "\\u", "context", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "=_", "ssl_", "._", "create", "\\u", "default", "\\u", "context_", "(_", "ssl_", "._", "Pur", "pose_", "._", "CLIENT", "\\u", "AUTH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "load", "\\u", "cert", "\\u", "chain_", "(_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "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 ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", ",_", "rad", "dr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "(_", "None_", ",_", "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 ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "rad", "dr_", ")_", ")_", "\\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_", "sock_", "=_", "socket_", "._", "socket_", "(_", "self_", "._", "\\u", "rs", "ock_", "._", "family_", ",_", "self_", "._", "\\u", "rs", "ock_", "._", "type_", ",_", "self_", "._", "\\u", "rs", "ock_", "._", "proto_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "Async", "Socket_", "(_", "sock_", ",_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "win32", "file_", "._", "Calculat", "e", "Sock", "et", "End", "Point", "Size_", "(_", "sock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "accept_", ",_", "self_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err_", "=_", "win32", "file_", "._", "Accept", "Ex_", "(_", "self_", "._", "\\u", "fileno_", ",_", "conn_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "and_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "IO", "\\u", "PENDING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "socket_", "._", "error_", "(_", "err_", ")_", "\\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, 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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 ]
Unused local variable
BrightcoveOS/Diamond/src/collectors/snmpinterface/test/testsnmpinterface.py
[ { "content": " def setUp(self, allowed_names=None):\n if not allowed_names:\n allowed_names = []\n config = get_collector_config('SNMPInterfaceCollector', {\n })\n self.collector = SNMPInterfaceCollector(config, None)", "metadata": "root.TestSNMPInterfaceCollector.setUp", "header": "['class', 'TestSNMPInterfaceCollector', '(', 'CollectorTestCase', ')', ':', '___EOS___']", "index": 11 } ]
[ { "span": "allowed_names ", "start_line": 13, "start_column": 12, "end_line": 13, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "SN", "MPI", "nter", "face", "Collector_", "(_", "Collect", "or", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ",_", "allow", "ed", "\\u", "names_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "allow", "ed", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "ed", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "get", "\\u", "collector\\u", "config_", "(_", "'", "SN", "MPI", "nter", "face", "Collect", "or", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collector_", "=_", "SN", "MPI", "nter", "face", "Collector_", "(_", "config_", ",_", "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, 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 ]
Except block handles 'BaseException'
jyr/opentumblr/opentumblr/photo.py
[ { "content": "class Photo(wx.Panel):\n\n\n\n\n \n if self.source or self.data:\n self.api = Api(self.api.name, self.api.email, self.api.password, self.private, self.date, self.tags)\n try:\n self.post = self.api.write_photo(self.source, self.data, self.caption, self.click)\n except:\n print \"Posteado en el primario\"\n self.OnCancel(self)\n else:\n Message('Photo is required')\n ", "metadata": "root.Photo", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "except:", "start_line": 123, "start_column": 12, "end_line": 123, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Photo_", "(_", "wx_", "._", "Panel_", ")_", ":_", "\\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_", "if_", "self_", "._", "source_", "or_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "api_", "=_", "Api_", "(_", "self_", "._", "api_", "._", "name_", ",_", "self_", "._", "api_", "._", "email_", ",_", "self_", "._", "api_", "._", "password_", ",_", "self_", "._", "private_", ",_", "self_", "._", "date_", ",_", "self_", "._", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "post_", "=_", "self_", "._", "api_", "._", "write", "\\u", "photo_", "(_", "self_", "._", "source_", ",_", "self_", "._", "data_", ",_", "self_", "._", "caption_", ",_", "self_", "._", "click_", ")_", "\\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_", "\"", "Post", "ead", "o", " ", "en", " ", "el", " ", "prima", "rio", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "On", "Cancel_", "(_", "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 ", " _", "Message_", "(_", "'", "Photo", " ", "is", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Signature mismatch in overriding method
hyperion-rt/hyperion/hyperion/sources/source.py
[ { "content": "class Source(FreezableClass):\n '''\n This class is not meant to be used directly, but forms the basis for all other source types.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Source", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n if name:\n self.name = name\n else:\n self.name = random_id(length=8)\n\n self.peeloff = peeloff\n\n # Initialize attributes\n self.luminosity = None\n self.spectrum = None\n self.temperature = None\n\n # Prevent new attributes from being created\n self._freeze()\n\n # Set attributes from remaining keyword arguments\n for kwarg in kwargs:\n self.__setattr__(kwarg, kwargs[kwarg])", "metadata": "root.Source.__init__", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 52 }, { "content": " @property\n def name(self):\n \"\"\"\n A string identifying the source (optional)\n \"\"\"\n return self._name", "metadata": "root.Source.name", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 73 }, { "content": " @name.setter\n def name(self, value):\n self._name = value", "metadata": "root.Source.name", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 80 }, { "content": " @property\n def luminosity(self):\n '''\n The bolometric luminosity of the source (ergs/s)\n '''\n return self._luminosity", "metadata": "root.Source.luminosity", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 84 }, { "content": " @luminosity.setter\n def luminosity(self, value):\n if value is not None:\n validate_scalar('luminosity', value, domain='positive')\n self._luminosity = value", "metadata": "root.Source.luminosity", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 91 }, { "content": " def _read_luminosity(self, handle):\n self.luminosity = handle.attrs['luminosity']", "metadata": "root.Source._read_luminosity", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 97 }, { "content": " def _write_luminosity(self, handle):\n handle.attrs['luminosity'] = self.luminosity", "metadata": "root.Source._write_luminosity", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 100 }, { "content": " @property\n def temperature(self):\n '''\n The temperature of the source (K)\n '''\n return self._temperature", "metadata": "root.Source.temperature", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 103 }, { "content": " @temperature.setter\n def temperature(self, value):\n if value is not None:\n if hasattr(self, '_spectrum') and self._spectrum is not None:\n raise Exception(\"A spectrum has already been set, so cannot set a temperature\")\n validate_scalar('temperature', value, domain='positive')\n self._temperature = value", "metadata": "root.Source.temperature", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 110 }, { "content": " @property\n def spectrum(self):\n '''\n The spectrum of the source, specified either as an astropy.table.Table\n instance with ``'nu'`` and ``'fnu'`` columns, or as a ``(nu, fnu)``\n tuple, where the frequency is given in Hz, and the flux is given as\n F_nu (units are unimportant since the normalization is set by the\n luminosity).\n '''\n return self._spectrum", "metadata": "root.Source.spectrum", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 118 }, { "content": " @spectrum.setter\n def spectrum(self, value):\n\n if value is not None:\n\n if hasattr(self, '_temperature') and self._temperature is not None:\n raise Exception(\"A temperature has already been set, so cannot set a spectrum\")\n\n if isinstance(value, Table):\n\n if 'nu' not in value.columns:\n raise TypeError(\"spectrum Table does not contain a\"\n \" 'nu' column\")\n\n if 'fnu' not in value.columns:\n raise TypeError(\"spectrum Table does not contain an\"\n \" 'fnu' column\")\n\n nu, fnu = value['nu'], value['fnu']\n\n elif type(value) in (tuple, list):\n\n if len(value) == 2:\n nu, fnu = value\n else:\n raise TypeError(\"spectrum tuple or list should contain\"\n \" two elements\")\n\n if type(nu) in [list, tuple]:\n nu = np.array(nu, dtype=float)\n else:\n nu = nu.astype(float)\n\n if type(fnu) in [list, tuple]:\n fnu = np.array(fnu, dtype=float)\n else:\n fnu = fnu.astype(float)\n\n if not is_numpy_array(nu) or nu.ndim != 1:\n raise TypeError(\"nu should be a 1-D sequence\")\n\n if not is_numpy_array(fnu) or fnu.ndim != 1:\n raise TypeError(\"fnu should be a 1-D sequence\")\n\n if nu.shape != fnu.shape:\n raise TypeError(\"nu and fnu should have the same shape\")\n\n else:\n\n raise TypeError('spectrum should be specified either as an '\n 'astropy.table.Table instance, or a tuple '\n 'of two 1-D Numpy arrays (nu, fnu) with the '\n 'same length')\n\n # Check if frequency array has duplicate values\n if len(np.unique(nu)) != len(nu):\n raise ValueError(\"nu sequence contains duplicate values\")\n\n # Check for any negative values\n\n if np.any(nu <= 0.):\n raise ValueError(\"nu should be strictly positive\")\n\n if np.any(fnu < 0.):\n raise ValueError(\"fnu should be positive\")\n\n # Check for any NaN or Inf values\n\n if np.any(np.isnan(nu) | np.isinf(nu)):\n raise ValueError(\"nu contains NaN/Inf values\")\n\n if np.any(np.isnan(fnu) | np.isinf(fnu)):\n raise ValueError(\"fnu contains NaN/Inf values\")\n\n # Check if spectrum needs sorting\n if not monotonically_increasing(nu):\n logger.warn(\"Spectrum is being re-sorted in order of increasing frequency\")\n order = np.argsort(nu)\n nu = nu[order]\n fnu = fnu[order]\n\n self._spectrum = {'nu': nu, 'fnu': fnu}\n\n else:\n\n self._spectrum = value", "metadata": "root.Source.spectrum", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 129 }, { "content": " def _check_all_set(self):\n if self.luminosity is None:\n raise ValueError(\"luminosity is not set\")", "metadata": "root.Source._check_all_set", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 216 }, { "content": " def get_spectrum(self, nu_range=None):\n\n self._check_all_set()\n\n if self.spectrum is not None:\n nu, fnu = self.spectrum['nu'], self.spectrum['fnu']\n if nu_range is not None:\n raise NotImplemented(\"nu_range not yet implemented for spectrum\")\n elif self.temperature is not None:\n if nu_range is None:\n raise ValueError(\"nu_range is needed for sources with Planck spectra\")\n nu = np.logspace(np.log10(nu_range[0]), np.log10(nu_range[1]))\n nu[0] = nu_range[0] # fix roundoff\n nu[-1] = nu_range[1] # fix roundoff\n fnu = B_nu(nu, self.temperature)\n else:\n raise Exception(\"Not implemented\")\n norm = integrate_loglog(nu, fnu)\n return nu, fnu / norm * self.luminosity", "metadata": "root.Source.get_spectrum", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 220 }, { "content": " @classmethod\n def read(cls, handle):\n\n self = cls()\n\n self._read_luminosity(handle)\n\n self.name = handle.attrs['name'].decode('utf-8')\n\n self.peeloff = str2bool(handle.attrs['peeloff'])\n\n if handle.attrs['spectrum'] == b'spectrum':\n self.spectrum = Table(np.array(handle['spectrum']))\n elif handle.attrs['spectrum'] == b'temperature':\n self.temperature = handle.attrs['temperature']\n elif handle.attrs['spectrum'] == b'lte':\n pass\n else:\n raise ValueError('Unexpected value for `spectrum`: %s' % handle.attrs['spectrum'])\n\n return self", "metadata": "root.Source.read", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 240 }, { "content": " def write(self, handle):\n\n self._check_all_set()\n\n self._write_luminosity(handle)\n\n handle.attrs['name'] = np.string_(self.name.encode('utf-8'))\n\n handle.attrs['peeloff'] = np.string_(bool2str(self.peeloff))\n\n if self.spectrum is not None:\n handle.attrs['spectrum'] = np.string_('spectrum'.encode('utf-8'))\n table = Table()\n table.add_column(Column(data=self.spectrum['nu'], name='nu'))\n table.add_column(Column(data=self.spectrum['fnu'], name='fnu'))\n table.write(handle, path='spectrum')\n elif self.temperature is not None:\n handle.attrs['spectrum'] = np.string_('temperature'.encode('utf-8'))\n handle.attrs['temperature'] = self.temperature\n else:\n handle.attrs['spectrum'] = np.string_('lte'.encode('utf-8'))", "metadata": "root.Source.write", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 262 }, { "content": " def has_lte_spectrum(self):\n return self.spectrum is None and self.temperature is None", "metadata": "root.Source.has_lte_spectrum", "header": "['class', 'Source', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 284 }, { "content": "class SpotSource(Source):\n\n\n\n\n", "metadata": "root.SpotSource", "header": "['module', '___EOS___']", "index": 288 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n '''\n A spot on a spherical source\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Any additional arguments are are used to initialize attributes.\n\n Attributes\n ----------\n luminosity : float\n The luminosity of the source (in ergs/s)\n spectrum : astropy.table.Table or tuple\n The spectrum of the source, specified either as:\n * an Astropy Table with ``nu`` and ``fnu`` column\n * a ``(nu, fnu)`` tuple\n ``nu`` should be in Hz, and the units for ``fnu`` are not\n important, since the luminosity determined the absolute scaling``\n temperature : float\n The temperature of the source (in K)\n longitude : float\n The longitude of the spot on the spherical source (in degrees)\n latitude : float\n The latitude of the spot on the spherical source (in degrees)\n radius : float\n The radius of the spherical source (in cm)\n '''\n\n self.longitude = None\n self.latitude = None\n self.radius = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.SpotSource.__init__", "header": "['class', 'SpotSource', '(', 'Source', ')', ':', '___EOS___']", "index": 290 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.longitude is None:\n raise ValueError(\"longitude is not set\")\n if self.latitude is None:\n raise ValueError(\"latitude is not set\")\n if self.radius is None:\n raise ValueError(\"radius is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"Spot source cannot have LTE spectrum\")", "metadata": "root.SpotSource._check_all_set", "header": "['class', 'SpotSource', '(', 'Source', ')', ':', '___EOS___']", "index": 329 }, { "content": " @classmethod\n def read(cls, handle):\n\n if not handle.attrs['type'] == b'spot':\n raise ValueError(\"Source is not a SpotSource\")\n\n self = super(SpotSource, cls).read(handle)\n\n self.longitude = handle.attrs['longitude']\n self.latitude = handle.attrs['latitude']\n self.radius = handle.attrs['radius']\n\n return self", "metadata": "root.SpotSource.read", "header": "['class', 'SpotSource', '(', 'Source', ')', ':', '___EOS___']", "index": 340 }, { "content": " def write(self, handle, name):\n self._check_all_set()\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('spot'.encode('utf-8'))\n g.attrs['longitude'] = self.longitude\n g.attrs['latitude'] = self.latitude\n g.attrs['radius'] = self.radius\n Source.write(self, g)", "metadata": "root.SpotSource.write", "header": "['class', 'SpotSource', '(', 'Source', ')', ':', '___EOS___']", "index": 354 }, { "content": " def __setattr__(self, attribute, value):\n\n if attribute == 'longitude' and value is not None:\n validate_scalar('longitude', value, domain=[0, 360])\n elif attribute == 'latitude' and value is not None:\n validate_scalar('latitude', value, domain=[-90, 90])\n elif attribute == 'radius' and value is not None:\n validate_scalar('radius', value, domain='positive')\n\n Source.__setattr__(self, attribute, value)", "metadata": "root.SpotSource.__setattr__", "header": "['class', 'SpotSource', '(', 'Source', ')', ':', '___EOS___']", "index": 363 }, { "content": "class PointSource(Source):\n '''\n A point source.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n", "metadata": "root.PointSource", "header": "['module', '___EOS___']", "index": 375 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.position = (0., 0., 0.)\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.PointSource.__init__", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 391 }, { "content": " @property\n def position(self):\n '''\n The cartesian position of the source ``(x, y, z)`` as a sequence of three floating-point values (cm)\n '''\n return self._position", "metadata": "root.PointSource.position", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 397 }, { "content": " @position.setter\n def position(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n elif is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"position should be a 1-D sequence\")\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n else:\n raise ValueError(\"position should be a tuple, list, or Numpy array\")\n self._position = value", "metadata": "root.PointSource.position", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 404 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.position is None:\n raise ValueError(\"position is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"Point source cannot have LTE spectrum\")", "metadata": "root.PointSource._check_all_set", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 419 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'point':\n raise ValueError(\"Source is not a PointSource\")\n self = super(PointSource, cls).read(handle)\n self.position = (handle.attrs['x'], handle.attrs['y'], handle.attrs['z'])\n return self", "metadata": "root.PointSource.read", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 426 }, { "content": " def write(self, handle, name):\n self._check_all_set()\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('point'.encode('utf-8'))\n g.attrs['x'] = self.position[0]\n g.attrs['y'] = self.position[1]\n g.attrs['z'] = self.position[2]\n Source.write(self, g)", "metadata": "root.PointSource.write", "header": "['class', 'PointSource', '(', 'Source', ')', ':', '___EOS___']", "index": 434 }, { "content": "class PointSourceCollection(Source):\n '''\n A point source.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PointSourceCollection", "header": "['module', '___EOS___']", "index": 443 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.position = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.PointSourceCollection.__init__", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 459 }, { "content": " @property\n def luminosity(self):\n '''\n The bolometric luminosity for the N sources as a 1-D Numpy array (ergs/s)\n '''\n return self._luminosity", "metadata": "root.PointSourceCollection.luminosity", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 465 }, { "content": " @luminosity.setter\n def luminosity(self, value):\n if value is not None:\n if is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"luminosity should be a 1-D array\")\n if not np.all(value > 0.):\n raise ValueError(\"luminosity should be positive\")\n if self.position is not None and value.shape[0] != self.position.shape[0]:\n raise ValueError(\"luminosity should be a 1-D array with the same number of rows as position\")\n else:\n raise ValueError(\"luminosity should be a Numpy array\")\n self._luminosity = value", "metadata": "root.PointSourceCollection.luminosity", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 472 }, { "content": " def _read_luminosity(self, handle):\n self.luminosity = np.array(handle['luminosity'])", "metadata": "root.PointSourceCollection._read_luminosity", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 486 }, { "content": " def _write_luminosity(self, handle):\n handle.create_dataset('luminosity', data=self.luminosity, compression=True)", "metadata": "root.PointSourceCollection._write_luminosity", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 489 }, { "content": " @property\n def position(self):\n '''\n The cartesian position of the N sources ``(x, y, z)`` as a 2-D Numpy array with shape Nx3 (cm)\n '''\n return self._position", "metadata": "root.PointSourceCollection.position", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 492 }, { "content": " @position.setter\n def position(self, value):\n if value is not None:\n if is_numpy_array(value):\n if value.ndim != 2:\n raise ValueError(\"position should be a 2-D array\")\n if value.shape[1] != 3:\n raise ValueError(\"position should be an Nx3 array\")\n if self.luminosity is not None and value.shape[0] != self.luminosity.shape[0]:\n raise ValueError(\"position should be a 1-D array with the same number of rows as luminosity\")\n else:\n raise ValueError(\"position should be a Numpy array\")\n self._position = value", "metadata": "root.PointSourceCollection.position", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 499 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.position is None:\n raise ValueError(\"position is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"Point source cannot have LTE spectrum\")", "metadata": "root.PointSourceCollection._check_all_set", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 513 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'point_collection':\n raise ValueError(\"Source is not a PointSource\")\n self = super(PointSourceCollection, cls).read(handle)\n self.position = np.array(handle['position'])\n return self", "metadata": "root.PointSourceCollection.read", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 520 }, { "content": " def write(self, handle, name):\n self._check_all_set()\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('point_collection'.encode('utf-8'))\n g.create_dataset('position', data=self.position, compression=True)\n Source.write(self, g)", "metadata": "root.PointSourceCollection.write", "header": "['class', 'PointSourceCollection', '(', 'Source', ')', ':', '___EOS___']", "index": 528 }, { "content": "class SphericalSource(Source):\n '''\n A spherical source\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SphericalSource", "header": "['module', '___EOS___']", "index": 535 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.position = (0., 0., 0.)\n self.radius = None\n self.limb = False\n self._spots = []\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.SphericalSource.__init__", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 551 }, { "content": " @property\n def radius(self):\n '''\n The radius of the source (cm)\n '''\n return self._radius", "metadata": "root.SphericalSource.radius", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 560 }, { "content": " @radius.setter\n def radius(self, value):\n if value is not None:\n validate_scalar('radius', value, domain='positive')\n self._radius = value", "metadata": "root.SphericalSource.radius", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 567 }, { "content": " @property\n def position(self):\n '''\n The cartesian position of the source ``(x, y, z)`` as a sequence of three floating-point values (cm)\n '''\n return self._position", "metadata": "root.SphericalSource.position", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 573 }, { "content": " @position.setter\n def position(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n elif is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"position should be a 1-D sequence\")\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n else:\n raise ValueError(\"position should be a tuple, list, or Numpy array\")\n self._position = value", "metadata": "root.SphericalSource.position", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 580 }, { "content": " @property\n def limb(self):\n '''\n Whether to include limb darkening\n '''\n return self._limb", "metadata": "root.SphericalSource.limb", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 595 }, { "content": " @limb.setter\n def limb(self, value):\n if value is not None:\n if not isinstance(value, bool):\n raise ValueError(\"limb should be a boolean value (True/False)\")\n self._limb = value", "metadata": "root.SphericalSource.limb", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 602 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.position is None:\n raise ValueError(\"position is not set\")\n if self.radius is None:\n raise ValueError(\"radius is not set\")\n if self.limb is None:\n raise ValueError(\"limb is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"Spherical source cannot have LTE spectrum\")", "metadata": "root.SphericalSource._check_all_set", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 609 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'sphere':\n raise ValueError(\"Source is not a SphericalSource\")\n self = super(SphericalSource, cls).read(handle)\n self.position = (handle.attrs['x'], handle.attrs['y'], handle.attrs['z'])\n self.radius = handle.attrs['r']\n self.limb = str2bool(handle.attrs['limb'])\n\n # Read in spots\n for group in handle:\n if 'Spot' in group:\n self._spots.append(SpotSource.read(handle[group]))\n\n return self", "metadata": "root.SphericalSource.read", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 620 }, { "content": " def write(self, handle, name):\n\n self._check_all_set()\n\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('sphere'.encode('utf-8'))\n g.attrs['x'] = self.position[0]\n g.attrs['y'] = self.position[1]\n g.attrs['z'] = self.position[2]\n g.attrs['r'] = self.radius\n g.attrs['limb'] = np.string_(bool2str(self.limb))\n Source.write(self, g)\n\n for i, spot in enumerate(self._spots):\n spot.write(g, 'Spot %i' % i)", "metadata": "root.SphericalSource.write", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 636 }, { "content": " def add_spot(self, *args, **kwargs):\n '''\n Add a spot to the source.\n\n All arguments are passed to :class:`~hyperion.sources.SpotSource`,\n so see that class for more details\n '''\n spot = SpotSource(*args, **kwargs)\n self._spots.append(spot)\n return spot", "metadata": "root.SphericalSource.add_spot", "header": "['class', 'SphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 652 }, { "content": "class ExternalSphericalSource(Source):\n '''\n An spherical external source.\n\n This can be used for example to simulate the interstellar radiation\n field. This source is similar to :class:`~hyperion.sources.SphericalSource`\n but emits photons *inwards*.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n\n\n", "metadata": "root.ExternalSphericalSource", "header": "['module', '___EOS___']", "index": 664 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.position = (0., 0., 0.)\n self.radius = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.ExternalSphericalSource.__init__", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 684 }, { "content": " @property\n def radius(self):\n '''\n The radius of the source (cm)\n '''\n return self._radius", "metadata": "root.ExternalSphericalSource.radius", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 691 }, { "content": " @radius.setter\n def radius(self, value):\n if value is not None:\n validate_scalar('radius', value, domain='positive')\n self._radius = value", "metadata": "root.ExternalSphericalSource.radius", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 698 }, { "content": " @property\n def position(self):\n '''\n The cartesian position of the source ``(x, y, z)`` as a sequence of three floating-point values (cm)\n '''\n return self._position", "metadata": "root.ExternalSphericalSource.position", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 704 }, { "content": " @position.setter\n def position(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n elif is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"position should be a 1-D sequence\")\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n else:\n raise ValueError(\"position should be a tuple, list, or Numpy array\")\n self._position = value", "metadata": "root.ExternalSphericalSource.position", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 711 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.position is None:\n raise ValueError(\"position is not set\")\n if self.radius is None:\n raise ValueError(\"radius is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"External spherical source cannot have LTE spectrum\")", "metadata": "root.ExternalSphericalSource._check_all_set", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 726 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'extern_sph':\n raise ValueError(\"Source is not a ExternalSphericalSource\")\n self = super(ExternalSphericalSource, cls).read(handle)\n self.position = (handle.attrs['x'], handle.attrs['y'], handle.attrs['z'])\n self.radius = handle.attrs['r']\n return self", "metadata": "root.ExternalSphericalSource.read", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 735 }, { "content": " def write(self, handle, name):\n\n self._check_all_set()\n\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('extern_sph'.encode('utf-8'))\n g.attrs['x'] = self.position[0]\n g.attrs['y'] = self.position[1]\n g.attrs['z'] = self.position[2]\n g.attrs['r'] = self.radius\n Source.write(self, g)", "metadata": "root.ExternalSphericalSource.write", "header": "['class', 'ExternalSphericalSource', '(', 'Source', ')', ':', '___EOS___']", "index": 744 }, { "content": "class ExternalBoxSource(Source):\n '''\n An rectangular external source.\n\n This can be used for example to simulate the interstellar radiation\n field. This source emits *inwards*.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n", "metadata": "root.ExternalBoxSource", "header": "['module', '___EOS___']", "index": 757 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.bounds = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.ExternalBoxSource.__init__", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 776 }, { "content": " @property\n def bounds(self):\n '''\n The cartesian boundaries of the rectangular box specified\n as ``[[xmin, xmax], [ymin, ymax], [zmin, zmax]]`` (cm).\n '''\n return self._bounds", "metadata": "root.ExternalBoxSource.bounds", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 782 }, { "content": " @bounds.setter\n def bounds(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if np.array(value).shape != (3, 2):\n raise ValueError(\"bounds should be a sequence of 3 pairs of values\")\n elif is_numpy_array(value):\n if value.ndim != 2:\n raise ValueError(\"bounds should be a 2-d array\")\n if value.shape != (3, 2):\n raise ValueError(\"bounds should have a shape of (3, 2)\")\n else:\n raise ValueError(\"bounds should be a tuple, list, or Numpy array\")\n self._bounds = value", "metadata": "root.ExternalBoxSource.bounds", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 790 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.bounds is None:\n raise ValueError(\"bounds is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"External spherical source cannot have LTE spectrum\")", "metadata": "root.ExternalBoxSource._check_all_set", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 805 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'extern_box':\n raise ValueError(\"Source is not a ExternalBoxSource\")\n self = super(ExternalBoxSource, cls).read(handle)\n self.bounds = [(handle.attrs['xmin'], handle.attrs['xmax']),\n (handle.attrs['ymin'], handle.attrs['ymax']),\n (handle.attrs['zmin'], handle.attrs['zmax'])]\n return self", "metadata": "root.ExternalBoxSource.read", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 812 }, { "content": " def write(self, handle, name):\n\n self._check_all_set()\n\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('extern_box'.encode('utf-8'))\n g.attrs['xmin'] = self.bounds[0][0]\n g.attrs['xmax'] = self.bounds[0][1]\n g.attrs['ymin'] = self.bounds[1][0]\n g.attrs['ymax'] = self.bounds[1][1]\n g.attrs['zmin'] = self.bounds[2][0]\n g.attrs['zmax'] = self.bounds[2][1]\n Source.write(self, g)", "metadata": "root.ExternalBoxSource.write", "header": "['class', 'ExternalBoxSource', '(', 'Source', ')', ':', '___EOS___']", "index": 822 }, { "content": "class MapSource(Source):\n '''\n A diffuse source.\n\n This can be used for example to simulate the interstellar radiation\n field. This source emits *inwards*.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n", "metadata": "root.MapSource", "header": "['module', '___EOS___']", "index": 837 }, { "content": " def __init__(self, name=None, peeloff=True, **kwargs):\n\n self.map = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.MapSource.__init__", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 856 }, { "content": " @property\n def map(self):\n '''\n The relative luminosity in each cell, given as a Numpy array or an AMRGridView instance\n '''\n return self._map", "metadata": "root.MapSource.map", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 862 }, { "content": " @map.setter\n def map(self, value):\n if value is not None:\n if not is_numpy_array(value) and not isinstance(value, AMRGridView):\n raise ValueError(\"map should be a Numpy array or an AMRGridView instance\")\n self._map = value", "metadata": "root.MapSource.map", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 869 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.map is None:\n raise ValueError(\"map is not set\")\n if is_numpy_array(self.map) and np.all(self.map == 0.):\n raise ValueError(\"map is zero everywhere\")", "metadata": "root.MapSource._check_all_set", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 876 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'map':\n raise ValueError(\"Source is not a MapSource\")\n self = super(MapSource, cls).read(handle)\n self.map = np.array(handle['Luminosity map'])\n return self", "metadata": "root.MapSource.read", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 883 }, { "content": " def write(self, handle, name, grid, compression=True, map_dtype=float):\n\n self._check_all_set()\n\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('map'.encode('utf-8'))\n grid.write_single_array(g, \"Luminosity map\", self.map,\n compression=compression,\n physics_dtype=map_dtype)\n Source.write(self, g)", "metadata": "root.MapSource.write", "header": "['class', 'MapSource', '(', 'Source', ')', ':', '___EOS___']", "index": 891 }, { "content": "class PlaneParallelSource(Source):\n '''\n A circular plane-parallel source.\n\n This source emits all photons in the same direction perpendicular to the\n plane of the source, and in one direction, like a beam.\n\n Parameters\n ----------\n name : str, optional\n The name of the source\n peeloff : bool, optional\n Whether to peel-off photons from this source\n\n Notes\n -----\n Any additional arguments are are used to initialize attributes.\n '''\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PlaneParallelSource", "header": "['module', '___EOS___']", "index": 903 }, { "content": " def __init__(self, name=None, peeloff=False, **kwargs):\n\n if peeloff:\n raise ValueError(\"Cannot peeloff plane parallel source\")\n\n self.position = (0., 0., 0.)\n self.radius = None\n self.direction = None\n\n Source.__init__(self, name=name, peeloff=peeloff, **kwargs)", "metadata": "root.PlaneParallelSource.__init__", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 922 }, { "content": " @property\n def radius(self):\n '''\n The radius of the source (cm)\n '''\n return self._radius", "metadata": "root.PlaneParallelSource.radius", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 933 }, { "content": " @radius.setter\n def radius(self, value):\n if value is not None:\n validate_scalar('radius', value, domain='positive')\n self._radius = value", "metadata": "root.PlaneParallelSource.radius", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 940 }, { "content": " @property\n def position(self):\n '''\n The cartesian position of the source ``(x, y, z)`` as a sequence of three floating-point values (cm)\n '''\n return self._position", "metadata": "root.PlaneParallelSource.position", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 946 }, { "content": " @position.setter\n def position(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n elif is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"position should be a 1-D sequence\")\n if len(value) != 3:\n raise ValueError(\"position should be a sequence of 3 values\")\n else:\n raise ValueError(\"position should be a tuple, list, or Numpy array\")\n self._position = value", "metadata": "root.PlaneParallelSource.position", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 953 }, { "content": " @property\n def direction(self):\n '''\n The direction the photons should be emitted in ``(theta, phi)`` where ``theta`` and ``phi`` are spherical polar angles (rad)\n '''\n return self._direction", "metadata": "root.PlaneParallelSource.direction", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 968 }, { "content": " @direction.setter\n def direction(self, value):\n if value is not None:\n if type(value) in [tuple, list]:\n if len(value) != 2:\n raise ValueError(\"direction should be a sequence of 2 values\")\n elif is_numpy_array(value):\n if value.ndim != 1:\n raise ValueError(\"direction should be a 1-D sequence\")\n if len(value) != 2:\n raise ValueError(\"direction should be a sequence of 2 values\")\n else:\n raise ValueError(\"direction should be a tuple, list, or Numpy array\")\n self._direction = value", "metadata": "root.PlaneParallelSource.direction", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 975 }, { "content": " def _check_all_set(self):\n Source._check_all_set(self)\n if self.position is None:\n raise ValueError(\"position is not set\")\n if self.radius is None:\n raise ValueError(\"radius is not set\")\n if self.direction is None:\n raise ValueError(\"direction is not set\")\n if self.has_lte_spectrum():\n raise ValueError(\"Point source cannot have LTE spectrum\")", "metadata": "root.PlaneParallelSource._check_all_set", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 990 }, { "content": " @classmethod\n def read(cls, handle):\n if not handle.attrs['type'] == b'plane_parallel':\n raise ValueError(\"Source is not a PlaneParallelSource\")\n self = super(PlaneParallelSource, cls).read(handle)\n self.position = (handle.attrs['x'], handle.attrs['y'], handle.attrs['z'])\n self.radius = handle.attrs['r']\n self.direction = (handle.attrs['theta'], handle.attrs['phi'])\n return self", "metadata": "root.PlaneParallelSource.read", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 1001 }, { "content": " def write(self, handle, name):\n self._check_all_set()\n g = handle.create_group(name)\n g.attrs['type'] = np.string_('plane_parallel'.encode('utf-8'))\n g.attrs['x'] = self.position[0]\n g.attrs['y'] = self.position[1]\n g.attrs['z'] = self.position[2]\n g.attrs['r'] = self.radius\n g.attrs['theta'] = self.direction[0]\n g.attrs['phi'] = self.direction[1]\n Source.write(self, g)", "metadata": "root.PlaneParallelSource.write", "header": "['class', 'PlaneParallelSource', '(', 'Source', ')', ':', '___EOS___']", "index": 1011 } ]
[ { "span": "def write(self, handle, name):", "start_line": 354, "start_column": 4, "end_line": 354, "end_column": 34 }, { "span": "def write(self, handle, name):", "start_line": 434, "start_column": 4, "end_line": 434, "end_column": 34 }, { "span": "def write(self, handle, name):", "start_line": 528, "start_column": 4, "end_line": 528, "end_column": 34 }, { "span": "def write(self, handle, name):", "start_line": 636, "start_column": 4, "end_line": 636, "end_column": 34 }, { "span": "def write(self, handle, name):", "start_line": 744, "start_column": 4, "end_line": 744, "end_column": 34 }, { "span": "def write(self, handle, name):", "start_line": 822, "start_column": 4, "end_line": 822, "end_column": 34 }, { "span": "def write(self, handle, name, grid, compression=True, map_dtype=float):", "start_line": 891, "start_column": 4, "end_line": 891, "end_column": 75 }, { "span": "def write(self, handle, name):", "start_line": 1011, "start_column": 4, "end_line": 1011, "end_column": 34 } ]
[ { "span": "def write(self, handle):", "start_line": 262, "start_column": 4, "end_line": 262, "end_column": 28 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\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_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "is", " ", "not", " ", "mean", "t", " ", "to", " ", "be", " ", "used", " ", "direct", "ly", ",", " ", "but", " ", "forms", " ", "the", " ", "basi", "s", " ", "for", " ", "all", " ", "other", " ", "source", " ", "types", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "random", "\\u", "id_", "(_", "length_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pee", "lof", "f_", "=_", "pee", "lof", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "lumin", "osity", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "spectrum_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temperature_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prev", "ent", " ", "new", " ", "attribute", "s", " ", "from", " ", "bei", "ng", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "freeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "attribute", "s", " ", "from", " ", "rema", "inin", "g", " ", "keyw", "ord", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "kwarg_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "kwarg_", ",_", "kwargs_", "[_", "kwarg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "identify", "ing", " ", "the", " ", "source", " ", "(", "option", "al", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "name_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "name_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\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_", "lumin", "osity", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bolo", "metric", " ", "lumin", "osity", " ", "of", " ", "the", " ", "source", " ", "(", "erg", "s", "/", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "lumin", "osity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lumin", "osity", "_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lumin", "osity", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "lumin", "osity", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lumin", "osity", "_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "read", "\\u", "lumin", "osity", "_", "(_", "self_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lumin", "osity", "_", "=_", "handle_", "._", "attrs_", "[_", "'", "lumin", "osity", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "lumin", "osity", "_", "(_", "self_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "attrs_", "[_", "'", "lumin", "osity", "'_", "]_", "=_", "self_", "._", "lumin", "osity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\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_", "temperature_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tempe", "ratur", "e", " ", "of", " ", "the", " ", "source", " ", "(", "K", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "temperature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "temperature_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "temperature_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "spectr", "um", "'_", ")_", "and_", "self_", "._", "\\u", "spectrum_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "A", " ", "spectr", "um", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "set", ",", " ", "so", " ", "cann", "ot", " ", "set", " ", "a", " ", "tempe", "ratur", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "validat", "e\\u", "scalar_", "(_", "'", "tempe", "ratur", "e", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "temperature_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\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_", "spectrum_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "spectr", "um", " ", "of", " ", "the", " ", "source", ",", " ", "specified", " ", "eit", "her", " ", "as", " ", "an", " ", "astro", "py", ".", "table", ".", "Table", "\\", "10", ";", " ", " ", " ", " ", "instance", " ", "with", " ", "``", "'", "nu", "'``", " ", "and", " ", "``", "'", "fnu", "'``", " ", "column", "s", ",", " ", "or", " ", "as", " ", "a", " ", "``", "(", "nu", ",", " ", "fnu", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "tuple", ",", " ", "where", " ", "the", " ", "freque", "nc", "y", " ", "is", " ", "give", "n", " ", "in", " ", "H", "z", ",", " ", "and", " ", "the", " ", "flux", " ", "is", " ", "give", "n", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "F", "\\u", "nu", " ", "(", "unit", "s", " ", "are", " ", "unim", "porta", "nt", " ", "sinc", "e", " ", "the", " ", "normaliza", "tion", " ", "is", " ", "set", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "lumin", "osity", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "spectrum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "spectrum_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "spectrum_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "tempe", "ratur", "e", "'_", ")_", "and_", "self_", "._", "\\u", "temperature_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "A", " ", "tempe", "ratur", "e", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "set", ",", " ", "so", " ", "cann", "ot", " ", "set", " ", "a", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "Table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "nu", "'_", "not_", "in_", "value_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "spectr", "um", " ", "Table", " ", "doe", "s", " ", "not", " ", "contain", " ", "a", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "'", "nu", "'", " ", "column", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "fnu", "'_", "not_", "in_", "value_", "._", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "spectr", "um", " ", "Table", " ", "doe", "s", " ", "not", " ", "contain", " ", "an", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "'", "fnu", "'", " ", "column", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nu_", ",_", "fnu", "_", "=_", "value_", "[_", "'", "nu", "'_", "]_", ",_", "value_", "[_", "'", "fnu", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "value_", ")_", "in_", "(_", "tuple_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nu_", ",_", "fnu", "_", "=_", "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 ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "spectr", "um", " ", "tuple", " ", "or", " ", "list", " ", "shou", "ld", " ", "contain", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "two", " ", "element", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "nu_", ")_", "in_", "[_", "list_", ",_", "tuple_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nu_", "=_", "np_", "._", "array_", "(_", "nu_", ",_", "dtype_", "=_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "nu_", "=_", "nu_", "._", "astype_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "fnu", "_", ")_", "in_", "[_", "list_", ",_", "tuple_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fnu", "_", "=_", "np_", "._", "array_", "(_", "fnu", "_", ",_", "dtype_", "=_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fnu", "_", "=_", "fnu", "_", "._", "astype_", "(_", "float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "nu_", ")_", "or_", "nu_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "nu", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "fnu", "_", ")_", "or_", "fnu", "_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "fnu", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nu_", "._", "shape_", "!=_", "fnu", "_", "._", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", "(_", "\"", "nu", " ", "and", " ", "fnu", " ", "shou", "ld", " ", "have", " ", "the", " ", "same", " ", "shape", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "spectr", "um", " ", "shou", "ld", " ", "be", " ", "specified", " ", "eit", "her", " ", "as", " ", "an", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "astro", "py", ".", "table", ".", "Table", " ", "instance", ",", " ", "or", " ", "a", " ", "tuple", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "of", " ", "two", " ", "1", "-", "D", " ", "Num", "py", " ", "arrays", " ", "(", "nu", ",", " ", "fnu", ")", " ", "with", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "same", " ", "length", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "freque", "nc", "y", " ", "array", " ", "has", " ", "duplicat", "e", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "np_", "._", "unique_", "(_", "nu_", ")_", ")_", "!=_", "len_", "(_", "nu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "nu", " ", "sequence", " ", "contain", "s", " ", "duplicat", "e", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "any", " ", "negati", "ve", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "any_", "(_", "nu_", "<=_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "nu", " ", "shou", "ld", " ", "be", " ", "strict", "ly", " ", "posit", "ive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "any_", "(_", "fnu", "_", "<_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "fnu", " ", "shou", "ld", " ", "be", " ", "posit", "ive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "any", " ", "Na", "N", " ", "or", " ", "Inf", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "any_", "(_", "np_", "._", "isnan_", "(_", "nu_", ")_", "|_", "np_", "._", "isinf", "_", "(_", "nu_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "nu", " ", "contain", "s", " ", "Na", "N", "/", "Inf", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np_", "._", "any_", "(_", "np_", "._", "isnan_", "(_", "fnu", "_", ")_", "|_", "np_", "._", "isinf", "_", "(_", "fnu", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "fnu", " ", "contain", "s", " ", "Na", "N", "/", "Inf", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "spectr", "um", " ", "need", "s", " ", "sorting", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "monotonic", "ally", "\\u", "incr", "easi", "ng_", "(_", "nu_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warn_", "(_", "\"", "Spect", "rum", " ", "is", " ", "bei", "ng", " ", "re", "-", "sorte", "d", " ", "in", " ", "order", " ", "of", " ", "incr", "easi", "ng", " ", "freque", "nc", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "np_", "._", "argsort_", "(_", "nu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu_", "=_", "nu_", "[_", "order_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fnu", "_", "=_", "fnu", "_", "[_", "order_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "spectrum_", "=_", "{_", "'", "nu", "'_", ":_", "nu_", ",_", "'", "fnu", "'_", ":_", "fnu", "_", "}_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "spectrum_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\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", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "lumin", "osity", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "lumin", "osity", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\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", "spectrum_", "(_", "self_", ",_", "nu", "\\u", "range_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "spectrum_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu_", ",_", "fnu", "_", "=_", "self_", "._", "spectrum_", "[_", "'", "nu", "'_", "]_", ",_", "self_", "._", "spectrum_", "[_", "'", "fnu", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nu", "\\u", "range_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Implemented_", "(_", "\"", "nu", "\\u", "range", " ", "not", " ", "ye", "t", " ", "implemented", " ", "for", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "temperature_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "nu", "\\u", "range_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "nu", "\\u", "range", " ", "is", " ", "need", "ed", " ", "for", " ", "source", "s", " ", "with", " ", "Plan", "ck", " ", "spectr", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nu_", "=_", "np_", "._", "logs", "pace_", "(_", "np_", "._", "log10_", "(_", "nu", "\\u", "range_", "[_", "0_", "]_", ")_", ",_", "np_", "._", "log10_", "(_", "nu", "\\u", "range_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu_", "[_", "0_", "]_", "=_", "nu", "\\u", "range_", "[_", "0_", "]_", "#", " ", "fix", " ", "round", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu_", "[_", "-_", "1_", "]_", "=_", "nu", "\\u", "range_", "[_", "1_", "]_", "#", " ", "fix", " ", "round", "off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fnu", "_", "=_", "B", "\\u", "nu_", "(_", "nu_", ",_", "self_", "._", "temperature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Not", " ", "implemented", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "norm_", "=_", "integrate", "\\u", "loglo", "g_", "(_", "nu_", ",_", "fnu", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "nu_", ",_", "fnu", "_", "/_", "norm_", "*_", "self_", "._", "lumin", "osity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "cls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "lumin", "osity", "_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "name_", "=_", "handle_", "._", "attrs_", "[_", "'", "name", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pee", "lof", "f_", "=_", "str2", "bool_", "(_", "handle_", "._", "attrs_", "[_", "'", "pee", "lof", "f", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "==_", "b", "'", "spectr", "um", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "spectrum_", "=_", "Table_", "(_", "np_", "._", "array_", "(_", "handle_", "[_", "'", "spectr", "um", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "==_", "b", "'", "tempe", "ratur", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "temperature_", "=_", "handle_", "._", "attrs_", "[_", "'", "tempe", "ratur", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "==_", "b", "'", "lte", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Une", "xpe", "cte", "d", " ", "value", " ", "for", " ", "`", "spectr", "um", "`", ":", " ", "%", "s", "'_", "%_", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "lumin", "osity", "_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", "._", "attrs_", "[_", "'", "name", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "self_", "._", "name_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handle_", "._", "attrs_", "[_", "'", "pee", "lof", "f", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "bool", "2str_", "(_", "self_", "._", "pee", "lof", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "spectrum_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "spectr", "um", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "Table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "column_", "(_", "Column_", "(_", "data_", "=_", "self_", "._", "spectrum_", "[_", "'", "nu", "'_", "]_", ",_", "name_", "=_", "'", "nu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "column_", "(_", "Column_", "(_", "data_", "=_", "self_", "._", "spectrum_", "[_", "'", "fnu", "'_", "]_", ",_", "name_", "=_", "'", "fnu", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "write_", "(_", "handle_", ",_", "path_", "=_", "'", "spectr", "um", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "temperature_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "tempe", "ratur", "e", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "attrs_", "[_", "'", "tempe", "ratur", "e", "'_", "]_", "=_", "self_", "._", "temperature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "attrs_", "[_", "'", "spectr", "um", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "lte", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Source_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\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", "lte", "\\u", "spectrum_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "spectrum_", "is_", "None_", "and_", "self_", "._", "temperature_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\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_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "spot", " ", "on", " ", "a", " ", "spherical", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "lumin", "osity", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "lumin", "osity", " ", "of", " ", "the", " ", "source", " ", "(", "in", " ", "erg", "s", "/", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "spectr", "um", " ", ":", " ", "astro", "py", ".", "table", ".", "Table", " ", "or", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "spectr", "um", " ", "of", " ", "the", " ", "source", ",", " ", "specified", " ", "eit", "her", " ", "as", ":", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "an", " ", "Astro", "py", " ", "Table", " ", "with", " ", "``", "nu", "``", " ", "and", " ", "``", "fnu", "``", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "a", " ", "``", "(", "nu", ",", " ", "fnu", ")`", "`", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "``", "nu", "``", " ", "shou", "ld", " ", "be", " ", "in", " ", "H", "z", ",", " ", "and", " ", "the", " ", "unit", "s", " ", "for", " ", "``", "fnu", "``", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "importa", "nt", ",", " ", "sinc", "e", " ", "the", " ", "lumin", "osity", " ", "dete", "rmin", "ed", " ", "the", " ", "abs", "olute", " ", "scal", "ing", "``", "\\", "10", ";", " ", " ", " ", " ", "tempe", "ratur", "e", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "tempe", "ratur", "e", " ", "of", " ", "the", " ", "source", " ", "(", "in", " ", "K", ")", "\\", "10", ";", " ", " ", " ", " ", "longitude", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "longitude", " ", "of", " ", "the", " ", "spot", " ", "on", " ", "the", " ", "spherical", " ", "source", " ", "(", "in", " ", "degr", "ees", ")", "\\", "10", ";", " ", " ", " ", " ", "latitude", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "latitude", " ", "of", " ", "the", " ", "spot", " ", "on", " ", "the", " ", "spherical", " ", "source", " ", "(", "in", " ", "degr", "ees", ")", "\\", "10", ";", " ", " ", " ", " ", "radi", "us", " ", ":", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "radi", "us", " ", "of", " ", "the", " ", "spherical", " ", "source", " ", "(", "in", " ", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "longitude_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "latitude_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "longitude_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "longitude", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "latitude_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "latitude", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "radius_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "radi", "us", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Spot", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "spot", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Spot", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Spot", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "longitude_", "=_", "handle_", "._", "attrs_", "[_", "'", "longitude", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "latitude_", "=_", "handle_", "._", "attrs_", "[_", "'", "latitude", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "handle_", "._", "attrs_", "[_", "'", "radi", "us", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "spot", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "longitude", "'_", "]_", "=_", "self_", "._", "longitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "latitude", "'_", "]_", "=_", "self_", "._", "latitude_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "radi", "us", "'_", "]_", "=_", "self_", "._", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spot", "Source_", "(_", "Source_", ")_", ":_", "\\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_", ",_", "attribute_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attribute_", "==_", "'", "longitude", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "longitude", "'_", ",_", "value_", ",_", "domain_", "=_", "[_", "0_", ",_", "360_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attribute_", "==_", "'", "latitude", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "latitude", "'_", ",_", "value_", ",_", "domain_", "=_", "[_", "-_", "90_", ",_", "90_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attribute_", "==_", "'", "radi", "us", "'_", "and_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "radi", "us", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Source_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "attribute_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "point", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "position_", "=_", "(_", "0._", ",_", "0._", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "position_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "position", " ", "of", " ", "the", " ", "source", " ", "``", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", " ", "as", " ", "a", " ", "sequence", " ", "of", " ", "three", " ", "float", "ing", "-", "point", " ", "values", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "position_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "position_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "position_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Point", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "point", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Point", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Point", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "(_", "handle_", "._", "attrs_", "[_", "'", "x", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "y", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "point", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "x", "'_", "]_", "=_", "self_", "._", "position_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "y", "'_", "]_", "=_", "self_", "._", "position_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "z", "'_", "]_", "=_", "self_", "._", "position_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "point", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "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_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "position_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\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_", "lumin", "osity", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bolo", "metric", " ", "lumin", "osity", " ", "for", " ", "the", " ", "N", " ", "source", "s", " ", "as", " ", "a", " ", "1", "-", "D", " ", "Num", "py", " ", "array", " ", "(", "erg", "s", "/", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "lumin", "osity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lumin", "osity", "_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lumin", "osity", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "lumin", "osity", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "np_", "._", "all_", "(_", "value_", ">_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "lumin", "osity", " ", "shou", "ld", " ", "be", " ", "posit", "ive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "not_", "None_", "and_", "value_", "._", "shape_", "[_", "0_", "]_", "!=_", "self_", "._", "position_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "lumin", "osity", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "array", " ", "with", " ", "the", " ", "same", " ", "number", " ", "of", " ", "rows", " ", "as", " ", "position", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "lumin", "osity", " ", "shou", "ld", " ", "be", " ", "a", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lumin", "osity", "_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "read", "\\u", "lumin", "osity", "_", "(_", "self_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lumin", "osity", "_", "=_", "np_", "._", "array_", "(_", "handle_", "[_", "'", "lumin", "osity", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "lumin", "osity", "_", "(_", "self_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "._", "create", "\\u", "dataset_", "(_", "'", "lumin", "osity", "'_", ",_", "data_", "=_", "self_", "._", "lumin", "osity", "_", ",_", "compression_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\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_", "position_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "position", " ", "of", " ", "the", " ", "N", " ", "source", "s", " ", "``", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", " ", "as", " ", "a", " ", "2", "-", "D", " ", "Num", "py", " ", "array", " ", "with", " ", "shape", " ", "Nx", "3", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "position_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "position_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "2", "-", "D", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "shape_", "[_", "1_", "]_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "an", " ", "Nx", "3", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "lumin", "osity", "_", "is_", "not_", "None_", "and_", "value_", "._", "shape_", "[_", "0_", "]_", "!=_", "self_", "._", "lumin", "osity", "_", "._", "shape_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "array", " ", "with", " ", "the", " ", "same", " ", "number", " ", "of", " ", "rows", " ", "as", " ", "lumin", "osity", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "position_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Point", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "point", "\\u", "collection", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Point", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Point", "Sou", "rce", "Collection_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "np_", "._", "array_", "(_", "handle_", "[_", "'", "position", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Point", "Sou", "rce", "Collection_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "point", "\\u", "collection", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "create", "\\u", "dataset_", "(_", "'", "position", "'_", ",_", "data_", "=_", "self_", "._", "position_", ",_", "compression_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "spherical", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "position_", "=_", "(_", "0._", ",_", "0._", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "limb", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "spots", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "radius_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "radi", "us", " ", "of", " ", "the", " ", "source", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "radius_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radius_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "radi", "us", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "radius_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "position_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "position", " ", "of", " ", "the", " ", "source", " ", "``", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", " ", "as", " ", "a", " ", "sequence", " ", "of", " ", "three", " ", "float", "ing", "-", "point", " ", "values", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "position_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "position_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "position_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "limb", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "include", " ", "limb", " ", "dark", "eni", "ng", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "limb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "limb", "_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "limb", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "limb", " ", "shou", "ld", " ", "be", " ", "a", " ", "boolean", " ", "value", " ", "(", "Tru", "e", "/", "Fal", "se", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "limb", "_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "radius_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "radi", "us", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "limb", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "limb", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sph", "eric", "al", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "sphere", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Sph", "eric", "al", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Sph", "eric", "al", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "(_", "handle_", "._", "attrs_", "[_", "'", "x", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "y", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "handle_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "limb", "_", "=_", "str2", "bool_", "(_", "handle_", "._", "attrs_", "[_", "'", "limb", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "in", " ", "spots", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "group_", "in_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "Spot", "'_", "in_", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "spots", "_", "._", "append_", "(_", "Spot", "Source_", "._", "read_", "(_", "handle_", "[_", "group_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "sphere", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "x", "'_", "]_", "=_", "self_", "._", "position_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "y", "'_", "]_", "=_", "self_", "._", "position_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "z", "'_", "]_", "=_", "self_", "._", "position_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "=_", "self_", "._", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "limb", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "bool", "2str_", "(_", "self_", "._", "limb", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "spot_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "spots", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spot_", "._", "write_", "(_", "g_", ",_", "'", "Spot", " ", "%", "i", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\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", "spot_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "spot", " ", "to", " ", "the", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "argu", "ment", "s", " ", "are", " ", "pass", "ed", " ", "to", " ", ":", "class", ":`", "~", "hyper", "ion", ".", "source", "s", ".", "Spot", "Sou", "rce", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "see", " ", "tha", "t", " ", "class", " ", "for", " ", "more", " ", "deta", "il", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spot_", "=_", "Spot", "Source_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "spots", "_", "._", "append_", "(_", "spot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "spot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "spherical", " ", "external", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "example", " ", "to", " ", "simulat", "e", " ", "the", " ", "inters", "tell", "ar", " ", "radiation", "\\", "10", ";", " ", " ", " ", " ", "field", ".", " ", "Thi", "s", " ", "source", " ", "is", " ", "similar", " ", "to", " ", ":", "class", ":`", "~", "hyper", "ion", ".", "source", "s", ".", "Sph", "eric", "al", "Sou", "rce", "`", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "emit", "s", " ", "photon", "s", " ", "*", "in", "ward", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "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_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "position_", "=_", "(_", "0._", ",_", "0._", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "radius_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "radi", "us", " ", "of", " ", "the", " ", "source", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "radius_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radius_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "radi", "us", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "radius_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "position_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "position", " ", "of", " ", "the", " ", "source", " ", "``", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", " ", "as", " ", "a", " ", "sequence", " ", "of", " ", "three", " ", "float", "ing", "-", "point", " ", "values", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "position_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "position_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "position_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "radius_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "radi", "us", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Exter", "nal", " ", "spherical", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "extern", "\\u", "sph", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Exter", "nal", "Sph", "eric", "al", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Exter", "nal", "Sph", "eric", "al", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "(_", "handle_", "._", "attrs_", "[_", "'", "x", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "y", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "handle_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Sph", "eric", "al", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "extern", "\\u", "sph", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "x", "'_", "]_", "=_", "self_", "._", "position_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "y", "'_", "]_", "=_", "self_", "._", "position_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "z", "'_", "]_", "=_", "self_", "._", "position_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "=_", "self_", "._", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "rectangular", " ", "external", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "example", " ", "to", " ", "simulat", "e", " ", "the", " ", "inters", "tell", "ar", " ", "radiation", "\\", "10", ";", " ", " ", " ", " ", "field", ".", " ", "Thi", "s", " ", "source", " ", "emit", "s", " ", "*", "in", "ward", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bounds_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "bounds_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "bound", "aries", " ", "of", " ", "the", " ", "rectangular", " ", "box", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "``[", "[", "xmi", "n", ",", " ", "xma", "x", "],", " ", "[", "ymin", ",", " ", "ymax", "],", " ", "[", "zmin", ",", " ", "zmax", "]]", "``", " ", "(", "cm", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "bounds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "bounds_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "bounds_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "np_", "._", "array_", "(_", "value_", ")_", "._", "shape_", "!=_", "(_", "3_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "bound", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "pair", "s", " ", "of", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "bound", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "2", "-", "d", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "shape_", "!=_", "(_", "3_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "bound", "s", " ", "shou", "ld", " ", "have", " ", "a", " ", "shape", " ", "of", " ", "(", "3", ",", " ", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "bound", "s", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "bounds_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "bounds_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "bound", "s", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Exter", "nal", " ", "spherical", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "extern", "\\u", "box", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Exter", "nal", "Box", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Exter", "nal", "Box", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bounds_", "=_", "[_", "(_", "handle_", "._", "attrs_", "[_", "'", "xmi", "n", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "xma", "x", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "handle_", "._", "attrs_", "[_", "'", "ymin", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "ymax", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "handle_", "._", "attrs_", "[_", "'", "zmin", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "zmax", "'_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exter", "nal", "Box", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "extern", "\\u", "box", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "xmi", "n", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "xma", "x", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "ymin", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "ymax", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "1_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "zmin", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "2_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "zmax", "'_", "]_", "=_", "self_", "._", "bounds_", "[_", "2_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "diffuse", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", " ", "used", " ", "for", " ", "example", " ", "to", " ", "simulat", "e", " ", "the", " ", "inters", "tell", "ar", " ", "radiation", "\\", "10", ";", " ", " ", " ", " ", "field", ".", " ", "Thi", "s", " ", "source", " ", "emit", "s", " ", "*", "in", "ward", "s", "*.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "map_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "relative", " ", "lumin", "osity", " ", "in", " ", "each", " ", "cell", ",", " ", "give", "n", " ", "as", " ", "a", " ", "Num", "py", " ", "array", " ", "or", " ", "an", " ", "AM", "RG", "rid", "View", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "map_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "map_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", "and_", "not_", "isinstance_", "(_", "value_", ",_", "AM", "RG", "rid", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "map", " ", "shou", "ld", " ", "be", " ", "a", " ", "Num", "py", " ", "array", " ", "or", " ", "an", " ", "AM", "RG", "rid", "View", " ", "instance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "map_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "map_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "map", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "self_", "._", "map_", ")_", "and_", "np_", "._", "all_", "(_", "self_", "._", "map_", "==_", "0._", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "map", " ", "is", " ", "zero", " ", "every", "where", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "map", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Map", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Map", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map_", "=_", "np_", "._", "array_", "(_", "handle_", "[_", "'", "Lum", "ino", "sity", " ", "map", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ",_", "grid_", ",_", "compression_", "=_", "True_", ",_", "map", "\\u", "dtype_", "=_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "map", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "write", "\\u", "single", "\\u", "array_", "(_", "g_", ",_", "\"", "Lum", "ino", "sity", " ", "map", "\"_", ",_", "self_", "._", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compression_", "=_", "compression_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "physi", "cs", "\\u", "dtype_", "=_", "map", "\\u", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "circular", " ", "plane", "-", "parall", "el", " ", "source", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "source", " ", "emit", "s", " ", "all", " ", "photon", "s", " ", "in", " ", "the", " ", "same", " ", "direction", " ", "perp", "endi", "cula", "r", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "plane", " ", "of", " ", "the", " ", "source", ",", " ", "and", " ", "in", " ", "one", " ", "direction", ",", " ", "like", " ", "a", " ", "beam", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "source", "\\", "10", ";", " ", " ", " ", " ", "pee", "lof", "f", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "pee", "l", "-", "off", " ", "photon", "s", " ", "from", " ", "this", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "es", "\\", "10", ";", " ", " ", " ", " ", "-----", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "addition", "al", " ", "argu", "ment", "s", " ", "are", " ", "are", " ", "used", " ", "to", " ", "initialize", " ", "attribute", "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_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "pee", "lof", "f_", "=_", "False_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pee", "lof", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cann", "ot", " ", "pee", "lof", "f", " ", "plane", " ", "parall", "el", " ", "source", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "position_", "=_", "(_", "0._", ",_", "0._", ",_", "0._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "direction_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Source_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "pee", "lof", "f_", "=_", "pee", "lof", "f_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "radius_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "radi", "us", " ", "of", " ", "the", " ", "source", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "radius_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "radius_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "scalar_", "(_", "'", "radi", "us", "'_", ",_", "value_", ",_", "domain_", "=_", "'", "posit", "ive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "radius_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "position_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cartesian", " ", "position", " ", "of", " ", "the", " ", "source", " ", "``", "(", "x", ",", " ", "y", ",", " ", "z", ")`", "`", " ", "as", " ", "a", " ", "sequence", " ", "of", " ", "three", " ", "float", "ing", "-", "point", " ", "values", " ", "(", "cm", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "position_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "position_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "3", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "position_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "direction_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "direction", " ", "the", " ", "photon", "s", " ", "shou", "ld", " ", "be", " ", "emitte", "d", " ", "in", " ", "``", "(", "theta", ",", " ", "phi", ")`", "`", " ", "where", " ", "``", "theta", "``", " ", "and", " ", "``", "phi", "``", " ", "are", " ", "spherical", " ", "polar", " ", "angle", "s", " ", "(", "rad", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "direction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "direction_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "direction_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "value_", ")_", "in_", "[_", "tuple_", ",_", "list_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "value_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "direction", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "2", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "\\u", "nump", "y", "\\u", "array_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "ndim_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "direction", " ", "shou", "ld", " ", "be", " ", "a", " ", "1", "-", "D", " ", "sequence", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "direction", " ", "shou", "ld", " ", "be", " ", "a", " ", "sequence", " ", "of", " ", "2", " ", "values", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "direction", " ", "shou", "ld", " ", "be", " ", "a", " ", "tuple", ",", " ", "list", ",", " ", "or", " ", "Num", "py", " ", "array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "direction_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Source_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "position_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "position", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "radius_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "radi", "us", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "direction_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "direction", " ", "is", " ", "not", " ", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "lte", "\\u", "spectrum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Point", " ", "source", " ", "cann", "ot", " ", "have", " ", "LT", "E", " ", "spectr", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\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_", "read_", "(_", "cls_", ",_", "handle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "handle_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "==_", "b", "'", "plane", "\\u", "parall", "el", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sou", "rce", " ", "is", " ", "not", " ", "a", " ", "Plan", "e", "Parallel", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "super_", "(_", "Plan", "e", "Parallel", "Source_", ",_", "cls_", ")_", "._", "read_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "position_", "=_", "(_", "handle_", "._", "attrs_", "[_", "'", "x", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "y", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "handle_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "direction_", "=_", "(_", "handle_", "._", "attrs_", "[_", "'", "theta", "'_", "]_", ",_", "handle_", "._", "attrs_", "[_", "'", "phi", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plan", "e", "Parallel", "Source_", "(_", "Source_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "handle_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "all", "\\u", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "handle_", "._", "create", "\\u", "group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "type", "'_", "]_", "=_", "np_", "._", "string", "\\u_", "(_", "'", "plane", "\\u", "parall", "el", "'_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "x", "'_", "]_", "=_", "self_", "._", "position_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "y", "'_", "]_", "=_", "self_", "._", "position_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "z", "'_", "]_", "=_", "self_", "._", "position_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "r", "'_", "]_", "=_", "self_", "._", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "theta", "'_", "]_", "=_", "self_", "._", "direction_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "attrs_", "[_", "'", "phi", "'_", "]_", "=_", "self_", "._", "direction_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Source_", "._", "write_", "(_", "self_", ",_", "g_", ")_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/traitsui/traitsui/qt4/progress_editor.py
[ { "content": "import time\n\nfrom pyface.qt import QtGui, QtCore\n\nfrom traits.api import Instance, Int, Str\nfrom traitsui.qt4.editor import Editor\nfrom pyface.ui.qt4.progress_dialog import ProgressDialog\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class _ProgressDialog(ProgressDialog):", "metadata": "root._ProgressDialog", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def close(self):\n \"\"\" Overwritten to disable closing.\n \"\"\"\n pass", "metadata": "root._ProgressDialog.close", "header": "['class', '_ProgressDialog', '(', 'ProgressDialog', ')', ':', '___EOS___']", "index": 9 }, { "content": "class SimpleEditor(Editor):\n \"\"\"\n Show a progress bar with all the optional goodies\n\n \"\"\"\n progress = Instance(_ProgressDialog)\n\n # The message to be displayed along side the progress guage\n message = Str\n\n # The starting value\n min = Int\n\n # The ending value\n max = Int\n\n #-- Editor interface ------------------------------------------------------\n\n\n\n\n\n\n", "metadata": "root.SimpleEditor", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def init ( self, parent ):\n \"\"\" Finishes initializing the editor by creating the underlying toolkit\n widget.\n \"\"\"\n self.control = self.create_control( parent )\n factory = self.factory\n self.min = factory.min\n self.max = factory.max\n self.message = factory.message\n self.sync_value( factory.min_name, 'min', 'from' )\n self.sync_value( factory.max_name, 'max', 'from' )\n self.sync_value( factory.message_name, 'message', 'from' )\n \n self.set_tooltip()", "metadata": "root.SimpleEditor.init", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 33 }, { "content": " def create_control (self, parent):\n \"\"\"\n Finishes initializing the editor by creating the underlying widget.\n \"\"\"\n\n self.progress = _ProgressDialog( title=self.factory.title,\n message=self.factory.message,\n min=self.factory.min,\n max=self.factory.max,\n can_cancel=self.factory.can_cancel,\n show_time=self.factory.show_time,\n show_percent=self.factory.show_percent)\n\n control = QtGui.QWidget()\n self.control = control\n layout = QtGui.QVBoxLayout(self.control)\n layout.setContentsMargins(0, 0, 0, 0)\n\n # The 'guts' of the dialog.\n self.progress._create_message(control, layout)\n self.progress._create_gauge(control, layout)\n self.progress._create_percent(control, layout)\n self.progress._create_timer(control, layout)\n self.progress._create_buttons(control, layout)\n return self.control", "metadata": "root.SimpleEditor.create_control", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 48 }, { "content": " def update_editor ( self ):\n \"\"\"\n Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n self.progress.min = self.min\n self.progress.max = self.max\n self.progress.message = self.message\n if self.value:\n self.progress.update(self.value)\n return", "metadata": "root.SimpleEditor.update_editor", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 75 }, { "content": " def _min_changed ( self ):\n self.update_editor()", "metadata": "root.SimpleEditor._min_changed", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 87 }, { "content": " def _max_changed ( self ):\n self.update_editor()", "metadata": "root.SimpleEditor._max_changed", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 90 }, { "content": " def _message_changed ( self ):\n self.update_editor()", "metadata": "root.SimpleEditor._message_changed", "header": "['class', 'SimpleEditor', '(', 'Editor', ')', ':', '___EOS___']", "index": 93 } ]
[ { "span": "import time", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 11 }, { "span": "from pyface.qt import QtGui, QtCore", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyf", "ace_", "._", "qt_", "import_", "Qt", "Gui_", ",_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traits_", "._", "api_", "import_", "Instance_", ",_", "Int_", ",_", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "traits", "ui_", "._", "qt", "4_", "._", "editor_", "import_", "Editor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyf", "ace_", "._", "ui_", "._", "qt", "4_", "._", "progress", "\\u", "dialog_", "import_", "Progres", "s", "Dialog_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Progres", "s", "Dialog_", "(_", "Progres", "s", "Dialog_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Progres", "s", "Dialog_", "(_", "Progres", "s", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Over", "writt", "en", " ", "to", " ", "disable", " ", "clos", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "a", " ", "progress", " ", "bar", " ", "with", " ", "all", " ", "the", " ", "option", "al", " ", "good", "ies", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "progress_", "=_", "Instance_", "(_", "\\u", "Progres", "s", "Dialog_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "message", " ", "to", " ", "be", " ", "displaye", "d", " ", "along", " ", "side", " ", "the", " ", "progress", " ", "gua", "ge_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "Str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "startin", "g", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "=_", "Int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "ending", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "=_", "Int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-", " ", "Edit", "or", " ", "interface", " ", "--------------", "--------------", "--------------", "------------", "_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "tool", "kit", "\\", "10", ";", " ", " ", " ", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "=_", "self_", "._", "create", "\\u", "control_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factory_", "=_", "self_", "._", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min_", "=_", "factory_", "._", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max_", "=_", "factory_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "factory_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "min", "\\u", "name_", ",_", "'", "min", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "max", "\\u", "name_", ",_", "'", "max", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sync", "\\u", "value_", "(_", "factory_", "._", "message", "\\u", "name_", ",_", "'", "message", "'_", ",_", "'", "from", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "tooltip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "control_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Finish", "es", " ", "initiali", "zin", "g", " ", "the", " ", "editor", " ", "by", " ", "creati", "ng", " ", "the", " ", "underl", "ying", " ", "widget", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "progress_", "=_", "\\u", "Progres", "s", "Dialog_", "(_", "title_", "=_", "self_", "._", "factory_", "._", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "self_", "._", "factory_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min_", "=_", "self_", "._", "factory_", "._", "min_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "=_", "self_", "._", "factory_", "._", "max_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "cancel_", "=_", "self_", "._", "factory_", "._", "can", "\\u", "cancel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "time_", "=_", "self_", "._", "factory_", "._", "show", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "show", "\\u", "percent_", "=_", "self_", "._", "factory_", "._", "show", "\\u", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "=_", "Qt", "Gui_", "._", "QW", "idge", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "=_", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "=_", "Qt", "Gui_", "._", "QV", "Box", "Layout_", "(_", "self_", "._", "control_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout_", "._", "set", "Conten", "ts", "Margins_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "'", "gut", "s", "'", " ", "of", " ", "the", " ", "dialog", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "progress_", "._", "\\u", "create", "\\u", "message_", "(_", "control_", ",_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "\\u", "create", "\\u", "gauge", "_", "(_", "control_", ",_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "\\u", "create", "\\u", "percent_", "(_", "control_", ",_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "\\u", "create", "\\u", "timer_", "(_", "control_", ",_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "\\u", "create", "\\u", "buttons_", "(_", "control_", ",_", "layout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", "s", " ", "the", " ", "editor", " ", "whe", "n", " ", "the", " ", "object", " ", "tra", "it", " ", "change", "s", " ", "external", "ly", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "editor", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "min_", "=_", "self_", "._", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "max_", "=_", "self_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "._", "message_", "=_", "self_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "progress_", "._", "update_", "(_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "min", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "editor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "max", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "editor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "message", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update", "\\u", "editor_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 0, 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, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
twisted/imaginary/imaginary/test/test_hit.py
[ { "content": " def testHit(self):\n self._test(\n \"hit self\",\n [E(\"Hit yourself? Stupid.\")])\n\n self._test(\n \"hit foobar\",\n [E(\"Who's that?\")])\n\n actor = iimaginary.IActor(self.player)\n actor.stamina.current = 0\n self._test(\n \"hit Observer Player\",\n [\"You're too tired!\"])\n\n actor.stamina.current = actor.stamina.max\n\n x, y = self._test(\n \"hit Observer Player\",\n [\"You hit Observer Player for (\\\\d+) hitpoints.\"],\n [\"Test Player hits you for (\\\\d+) hitpoints.\"])\n self.assertEquals(x[1].groups(), y[0].groups())\n\n actor.stamina.current = actor.stamina.max\n\n x, y = self._test(\n \"attack Observer Player\",\n [\"You hit Observer Player for (\\\\d+) hitpoints.\"],\n [\"Test Player hits you for (\\\\d+) hitpoints.\"])\n self.assertEquals(x[1].groups(), y[0].groups())\n\n\n monster = objects.Thing(store=self.store, name=u\"monster\")\n objects.Actor.createFor(monster)\n monster.moveTo(self.location)\n x, y = self._test(\n \"hit monster\",\n [\"You hit the monster for (\\\\d+) hitpoints.\"],\n [\"Test Player hits a monster.\"])\n monster.destroy()", "metadata": "root.HitTestCase.testHit", "header": "['class', 'HitTestCase', '(', 'commandutils', '.', 'CommandTestCaseMixin', ',', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 } ]
[ { "span": "x,", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 9 }, { "span": "y ", "start_line": 44, "start_column": 11, "end_line": 44, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Hit", "Test", "Case_", "(_", "command", "utils_", "._", "Command", "Test", "Case", "Mixin_", ",_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Hit", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hit", " ", "self", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "E_", "(_", "\"", "Hit", " ", "your", "self", "?", " ", " ", "Stu", "pid", ".\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hit", " ", "fooba", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "E_", "(_", "\"", "Who", "'", "s", " ", "tha", "t", "?\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actor_", "=_", "ii", "mag", "inary", "_", "._", "IA", "ctor_", "(_", "self_", "._", "player_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor_", "._", "sta", "mina", "_", "._", "current_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hit", " ", "Observer", " ", "Player", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "You", "'", "re", " ", "too", " ", "tir", "ed", "!\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actor_", "._", "sta", "mina", "_", "._", "current_", "=_", "actor_", "._", "sta", "mina", "_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", "=_", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hit", " ", "Observer", " ", "Player", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "You", " ", "hit", " ", "Observer", " ", "Player", " ", "for", " ", "(\\\\\\\\", "d", "+)", " ", "hit", "points", ".\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Test", " ", "Player", " ", "hits", " ", "you", " ", "for", " ", "(\\\\\\\\", "d", "+)", " ", "hit", "points", ".\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "x_", "[_", "1_", "]_", "._", "groups_", "(_", ")_", ",_", "y_", "[_", "0_", "]_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actor_", "._", "sta", "mina", "_", "._", "current_", "=_", "actor_", "._", "sta", "mina", "_", "._", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", "=_", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "attac", "k", " ", "Observer", " ", "Player", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "You", " ", "hit", " ", "Observer", " ", "Player", " ", "for", " ", "(\\\\\\\\", "d", "+)", " ", "hit", "points", ".\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Test", " ", "Player", " ", "hits", " ", "you", " ", "for", " ", "(\\\\\\\\", "d", "+)", " ", "hit", "points", ".\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "x_", "[_", "1_", "]_", "._", "groups_", "(_", ")_", ",_", "y_", "[_", "0_", "]_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "monster_", "=_", "objects_", "._", "Thing_", "(_", "store_", "=_", "self_", "._", "store_", ",_", "name_", "=_", "u", "\"", "monster", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "Actor_", "._", "create", "For_", "(_", "monster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monster_", "._", "move", "To_", "(_", "self_", "._", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "self_", "._", "\\u", "test_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hit", " ", "monster", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "You", " ", "hit", " ", "the", " ", "monster", " ", "for", " ", "(\\\\\\\\", "d", "+)", " ", "hit", "points", ".\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Test", " ", "Player", " ",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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, 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 ]
Unused local variable
AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/many_to_one_regress/tests.py
[ { "content": " def test_multiple_foreignkeys(self):\n # Test of multiple ForeignKeys to the same model (bug #7125).\n c1 = Category.objects.create(name='First')\n c2 = Category.objects.create(name='Second')\n c3 = Category.objects.create(name='Third')\n r1 = Record.objects.create(category=c1)\n r2 = Record.objects.create(category=c1)\n r3 = Record.objects.create(category=c2)\n r4 = Record.objects.create(category=c2)\n r5 = Record.objects.create(category=c3)\n r = Relation.objects.create(left=r1, right=r2)\n r = Relation.objects.create(left=r3, right=r4)\n r = Relation.objects.create(left=r1, right=r3)\n r = Relation.objects.create(left=r5, right=r2)\n r = Relation.objects.create(left=r3, right=r2)\n\n q1 = Relation.objects.filter(left__category__name__in=['First'], right__category__name__in=['Second'])\n self.assertQuerysetEqual(q1, [\"<Relation: First - Second>\"])\n\n q2 = Category.objects.filter(record__left_set__right__category__name='Second').order_by('name')\n self.assertQuerysetEqual(q2, [\"<Category: First>\", \"<Category: Second>\"])\n\n p = Parent.objects.create(name=\"Parent\")\n c = Child.objects.create(name=\"Child\", parent=p)\n self.assertRaises(ValueError, Child.objects.create, name=\"Grandchild\", parent=c)", "metadata": "root.ManyToOneRegressionTests.test_multiple_foreignkeys", "header": "['class', 'ManyToOneRegressionTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 77 } ]
[ { "span": "r ", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Many", "To", "One", "Regr", "ession", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "foreign", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "of", " ", "multiple", " ", "Fore", "ign", "Keys", " ", "to", " ", "the", " ", "same", " ", "model", " ", "(", "bug", " ", "#", "712", "5", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c1_", "=_", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Fi", "rst", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c2_", "=_", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Second", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c3_", "=_", "Category_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Thi", "rd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "Record_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "Record_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r3_", "=_", "Record_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r4", "_", "=_", "Record_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "5_", "=_", "Record_", "._", "objects_", "._", "create_", "(_", "category_", "=_", "c3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Relation_", "._", "objects_", "._", "create_", "(_", "left_", "=_", "r1_", ",_", "right_", "=_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Relation_", "._", "objects_", "._", "create_", "(_", "left_", "=_", "r3_", ",_", "right_", "=_", "r4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Relation_", "._", "objects_", "._", "create_", "(_", "left_", "=_", "r1_", ",_", "right_", "=_", "r3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Relation_", "._", "objects_", "._", "create_", "(_", "left_", "=_", "r", "5_", ",_", "right_", "=_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Relation_", "._", "objects_", "._", "create_", "(_", "left_", "=_", "r3_", ",_", "right_", "=_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q1_", "=_", "Relation_", "._", "objects_", "._", "filter_", "(_", "left", "\\u\\u", "category", "\\u\\u", "name", "\\u\\u", "in_", "=_", "[_", "'", "Fi", "rst", "'_", "]_", ",_", "right", "\\u\\u", "category", "\\u\\u", "name", "\\u\\u", "in_", "=_", "[_", "'", "Second", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "q1_", ",_", "[_", "\"<", "Relation", ":", " ", "Fi", "rst", " ", "-", " ", "Second", ">\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q2_", "=_", "Category_", "._", "objects_", "._", "filter_", "(_", "record", "\\u\\u", "left", "\\u", "set\\u", "\\u", "right", "\\u\\u", "category", "\\u\\u", "name_", "=_", "'", "Second", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Query", "set", "Equal_", "(_", "q2_", ",_", "[_", "\"<", "Cate", "gory", ":", " ", "Fi", "rst", ">\"_", ",_", "\"<", "Cate", "gory", ":", " ", "Second", ">\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Parent_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Parent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Child_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "\"", "Chil", "d", "\"_", ",_", "parent_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Child_", "._", "objects_", "._", "create_", ",_", "name_", "=_", "\"", "Grand", "child", "\"_", ",_", "parent_", "=_", "c_", ")_", "\\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, 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, 2, 2, 2, 2, 2 ]
Unused import
hycis/Mozi/example/voc_alexnet.py
[ { "content": "\nimport numpy as np\n\nimport theano.tensor as T\n\nfrom mozi.datasets.voc import VOC\nfrom mozi.model import Sequential\nfrom mozi.layers.alexnet import Alexnet\nfrom mozi.log import Log\nfrom mozi.train_object import TrainObject\nfrom mozi.cost import error, entropy\nfrom mozi.learning_method import SGD\nfrom mozi.env import setenv\n\nimport os\nimport theano\n\n\n\nif __name__ == '__main__':\n setenv()\n train()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def train():\n\n data = VOC(batch_size=32, train_valid_test_ratio=[5,1,1])\n model = Sequential(input_var=T.tensor4(), output_var=T.matrix())\n model.add(Alexnet(input_shape=(3,222,222), output_dim=11))\n # build learning method\n learning_method = SGD(learning_rate=0.01, momentum=0.9,\n lr_decay_factor=0.9, decay_batch=5000)\n # put everything into the train object\n train_object = TrainObject(model = model,\n log = None,\n dataset = data,\n train_cost = error,\n valid_cost = error,\n learning_method = learning_method,\n stop_criteria = {'max_epoch' : 10,\n 'epoch_look_back' : 5,\n 'percent_decrease' : 0.01}\n )\n # finally run the code\n train_object.setup()\n train_object.run()", "metadata": "root.train", "header": "['module', '___EOS___']", "index": 18 } ]
[ { "span": "import numpy as np", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 18 }, { "span": "from mozi.log import Log", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 24 }, { "span": "from mozi.cost import error, entropy", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 36 }, { "span": "import os", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import theano", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "moz", "i_", "._", "datasets_", "._", "voc", "_", "import_", "VOC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "model_", "import_", "Sequential_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "layers_", "._", "alex", "net_", "import_", "Alex", "net_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "log_", "import_", "Log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "train", "\\u", "object_", "import_", "Train", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "cost_", "import_", "error_", ",_", "entropy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "learn", "ing", "\\u", "method_", "import_", "SGD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "env_", "import_", "sete", "nv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sete", "nv_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "train_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "VOC", "_", "(_", "batch", "\\u", "size_", "=_", "32_", ",_", "train", "\\u", "valid", "\\u", "test\\u", "ratio_", "=_", "[_", "5_", ",_", "1_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Sequential_", "(_", "input", "\\u", "var_", "=_", "T_", "._", "tensor", "4_", "(_", ")_", ",_", "output", "\\u", "var_", "=_", "T_", "._", "matrix_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "add_", "(_", "Alex", "net_", "(_", "input", "\\u", "shape_", "=_", "(_", "3_", ",_", "222_", ",_", "222_", ")_", ",_", "output", "\\u", "dim_", "=_", "11_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "learn", "ing", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "\\u", "method_", "=_", "SGD", "_", "(_", "learn", "ing", "\\u", "rate_", "=_", "0.01_", ",_", "momentum_", "=_", "0.9_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lr", "\\u", "deca", "y", "\\u", "factor_", "=_", "0.9_", ",_", "deca", "y", "\\u", "batch_", "=_", "5000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "every", "thing", " ", "int", "o", " ", "the", " ", "train", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "object_", "=_", "Train", "Object_", "(_", "model_", "=_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "cost_", "=_", "error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "cost_", "=_", "error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "\\u", "method_", "=_", "learn", "ing", "\\u", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "criteria_", "=_", "{_", "'", "max", "\\u", "epoch", "'_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "epoch", "\\u", "look", "\\u", "back", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "percent", "\\u", "decrease", "'_", ":_", "0.01_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "final", "ly", " ", "run", " ", "the", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "object_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "object_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 1, 1, 1, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
openstack/wsme/wsme/tests/test_restjson.py
[ { "content": "import base64\nimport datetime\nimport decimal\n\nimport wsme.tests.protocol\n\ntry:\n import simplejson as json\nexcept:\n import json # noqa\n\nfrom wsme.rest.json import fromjson, tojson, parse\nfrom wsme.utils import parse_isodatetime, parse_isotime, parse_isodate\nfrom wsme.types import isarray, isdict, isusertype, register_type\nfrom wsme.types import UserType, ArrayType, DictType\nfrom wsme.rest import expose, validate\nfrom wsme.exc import ClientSideError, InvalidInput\n\n\nimport six\nfrom six import b, u\n\nif six.PY3:\n from urllib.parse import urlencode\nelse:\n from urllib import urlencode # noqa\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwsme.tests.protocol.WSTestRoot.crud = MiniCrud()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import six", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "wsm", "e_", "._", "tests_", "._", "protocol_", "\\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_", "simplejson_", "as_", "json_", "\\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 ", " _", "import_", "json_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "wsm", "e_", "._", "rest_", "._", "json_", "import_", "from", "json_", ",_", "to", "json_", ",_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsm", "e_", "._", "utils_", "import_", "parse", "\\u", "iso", "datetime_", ",_", "parse", "\\u", "isot", "ime_", ",_", "parse", "\\u", "iso", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsm", "e_", "._", "types_", "import_", "isa", "rray_", ",_", "isdi", "ct_", ",_", "isu", "ser", "type_", ",_", "register", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsm", "e_", "._", "types_", "import_", "User", "Type_", ",_", "Array", "Type_", ",_", "Dict", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsm", "e_", "._", "rest_", "import_", "expose_", ",_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsm", "e_", "._", "exc_", "import_", "Client", "Side", "Error_", ",_", "Inva", "lid", "Input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "b_", ",_", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "urlencode_", "\\u\\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_", "urllib_", "import_", "urlencode_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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