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
deanhiller/databus/webapp/play1.3.x/python/Lib/posixpath.py
[ { "content": "def lexists(path):\n \"\"\"Test whether a path exists. Returns True for broken symbolic links\"\"\"\n try:\n st = os.lstat(path)\n except os.error:\n return False\n return True", "metadata": "root.lexists", "header": "['module', '___EOS___']", "index": 138 } ]
[ { "span": "st ", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lexi", "sts_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "whe", "ther", " ", "a", " ", "path", " ", "exist", "s", ".", " ", " ", "Return", "s", " ", "Tru", "e", " ", "for", " ", "broken", " ", "symbolic", " ", "link", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "os_", "._", "lsta", "t_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "os_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
tucker777/QSTK/qstklearn/kdtknn.py
[ { "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 } ]
[ { "span": "dataY == None:", "start_line": 47, "start_column": 15, "end_line": 47, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[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_" ]
[ 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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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 ]
Unnecessary pass
hwaf/hwaf/py-hwaftools/find_iberty.py
[ { "content": "@conf\ndef find_iberty(ctx, **kwargs):\n \n ctx.load('hwaf-base', tooldir=_heptooldir)\n\n if not ctx.env.HWAF_FOUND_C_COMPILER:\n ctx.fatal('load a C compiler first')\n pass\n\n if not ctx.env.HWAF_FOUND_GDB:\n # gdb might have installed interesting libs (iberty, bfd)\n ctx.find_gdb(mandatory=False)\n pass\n \n extra_paths = waflib.Utils.to_list(kwargs.get('extra_paths',[]))\n if ctx.env.GDB_HOME:\n gdb = ctx.hwaf_subst_vars('${GDB_HOME}')\n extra_paths.append(gdb)\n pass\n\n # find libiberty\n ctx.check_with(\n ctx.check,\n \"iberty\",\n features='c cstlib',\n header_name=\"libiberty.h\",\n stlib='iberty',\n uselib_store='iberty',\n **kwargs\n )\n \n if ctx.env.LIBPATH_iberty and 0:\n ctx.env.STLIBPATH_iberty = ctx.env.LIBPATH_iberty\n ctx.env.STLIB_iberty = ctx.env.LIB_iberty\n ctx.env.LIB_iberty = []\n ctx.env.LIBPATH_iberty = []\n pass\n\n ctx.env.HWAF_FOUND_IBERTY = 1\n return", "metadata": "root.find_iberty", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "pass", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 12 }, { "span": "pass", "start_line": 36, "start_column": 8, "end_line": 36, "end_column": 12 }, { "span": "pass", "start_line": 42, "start_column": 8, "end_line": 42, "end_column": 12 }, { "span": "pass", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 12 } ]
[]
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_", "@_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "ibe", "rty", "_", "(_", "ctx_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "C", "\\u", "COMPILER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "fatal_", "(_", "'", "load", " ", "a", " ", "C", " ", "compiler", " ", "first", "'_", ")_", "\\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_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "GD", "B_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gdb", " ", "mig", "ht", " ", "have", " ", "install", "ed", " ", "interesting", " ", "libs", " ", "(", "ibe", "rty", ",", " ", "bf", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "find", "\\u", "gdb_", "(_", "mandatory_", "=_", "False_", ")_", "\\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_", "extra", "\\u", "paths_", "=_", "waf", "lib_", "._", "Utils_", "._", "to", "\\u", "list_", "(_", "kwargs_", "._", "get_", "(_", "'", "extra", "\\u", "path", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ctx_", "._", "env_", "._", "GD", "B", "\\u", "HOME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdb_", "=_", "ctx_", "._", "hwa", "f", "\\u", "subst", "\\u", "vars_", "(_", "'$", "{", "GD", "B", "\\u", "HOM", "E", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "paths_", "._", "append_", "(_", "gdb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "lib", "ibe", "rty", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "check", "\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "check_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ibe", "rty", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "'", "c", " ", "cst", "lib", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "header", "\\u", "name_", "=_", "\"", "lib", "ibe", "rty", ".", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stl", "ib_", "=_", "'", "ibe", "rty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usel", "ib", "\\u", "store_", "=_", "'", "ibe", "rty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "and_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "._", "STL", "IB", "PATH", "\\u", "ibe", "rty", "_", "=_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "STL", "IB", "\\u", "ibe", "rty", "_", "=_", "ctx_", "._", "env_", "._", "LIB", "\\u", "ibe", "rty", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "LIB", "\\u", "ibe", "rty", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "LIB", "PATH", "\\u", "ibe", "rty", "_", "=_", "[_", "]_", "\\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_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "IB", "ERT", "Y_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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, 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, 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, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
saltstack/salt/tests/unit/pyobjects_test.py
[ { "content": " def test_import_scope(self):\n self.write_template_file(\"map.sls\", map_template)\n self.write_template_file(\"recursive_map.sls\", recursive_map_template)\n\n def do_render():\n ret = self.render(scope_test_import_template,\n {'grains': {\n 'os_family': 'Debian',\n 'os': 'Debian'\n }})\n\n self.assertRaises(NameError, do_render)", "metadata": "root.RendererTests.test_import_scope", "header": "['class', 'RendererTests', '(', 'RendererMixin', ',', 'StateTests', ')', ':', '___EOS___']", "index": 349 }, { "content": " def test_random_password(self):\n '''Test for https://github.com/saltstack/salt/issues/21796'''\n ret = self.render(random_password_template)", "metadata": "root.RendererTests.test_random_password", "header": "['class', 'RendererTests', '(', 'RendererMixin', ',', 'StateTests', ')', ':', '___EOS___']", "index": 362 }, { "content": " def test_import_random_password(self):\n '''Import test for https://github.com/saltstack/salt/issues/21796'''\n self.write_template_file(\"password.sls\", random_password_template)\n ret = self.render(random_password_import_template)", "metadata": "root.RendererTests.test_import_random_password", "header": "['class', 'RendererTests', '(', 'RendererMixin', ',', 'StateTests', ')', ':', '___EOS___']", "index": 366 } ]
[ { "span": "ret ", "start_line": 354, "start_column": 12, "end_line": 354, "end_column": 15 }, { "span": "ret ", "start_line": 364, "start_column": 8, "end_line": 364, "end_column": 11 }, { "span": "ret ", "start_line": 369, "start_column": 8, "end_line": 369, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Render", "er", "Tests_", "(_", "Render", "er", "Mixin_", ",_", "State", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "import", "\\u", "scope_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "\\u", "template", "\\u", "file_", "(_", "\"", "map", ".", "sl", "s", "\"_", ",_", "map", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "template", "\\u", "file_", "(_", "\"", "recurs", "ive", "\\u", "map", ".", "sl", "s", "\"_", ",_", "recurs", "ive", "\\u", "map", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "do", "\\u", "render_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "render_", "(_", "scope", "\\u", "test\\u", "import", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "grains", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "os", "\\u", "famil", "y", "'_", ":_", "'", "Deb", "ian", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "os", "'_", ":_", "'", "Deb", "ian", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Name", "Error_", ",_", "do", "\\u", "render_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "er", "Tests_", "(_", "Render", "er", "Mixin_", ",_", "State", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "random", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "for", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "217", "96", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "render_", "(_", "random", "\\u", "password", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "er", "Tests_", "(_", "Render", "er", "Mixin_", ",_", "State", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "import", "\\u", "random", "\\u", "password_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Import", " ", "test", " ", "for", " ", "https", "://", "git", "hub", ".", "com", "/", "salt", "stack", "/", "salt", "/", "issue", "s", "/", "217", "96", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "\\u", "template", "\\u", "file_", "(_", "\"", "password", ".", "sl", "s", "\"_", ",_", "random", "\\u", "password", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "render_", "(_", "random", "\\u", "password", "\\u", "import", "\\u", "template_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
fp7-ofelia/ocf/expedient/doc/plugins/samples/plugin/sample_resource/controller/GUIdispatcher.py
[ { "content": "\"\"\"\nGraphical user interface functionalities for the\nSampleResource Aggregate Manager.\n\n@date: Jun 12, 2013\n@author: CarolinaFernandez\n\"\"\"\n\nfrom django.core.exceptions import ValidationError\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect, HttpResponse\nfrom django.shortcuts import get_object_or_404\nfrom expedient.clearinghouse.aggregate.models import Aggregate\nfrom expedient.clearinghouse.slice.models import Slice\nfrom expedient.common.messaging.models import DatedMessage\nfrom expedient.common.utils.plugins.plugincommunicator import *\nfrom expedient.common.utils.plugins.resources.link import Link\nfrom expedient.common.utils.plugins.resources.node import Node\nfrom expedient.common.utils.views import generic_crud\nfrom sample_resource.controller.resource import SampleResource as SampleResourceController\nfrom sample_resource.forms.SampleResource import SampleResource as SampleResourceModelForm\nfrom sample_resource.models import SampleResource as SampleResourceModel,\\\n SampleResourceAggregate as SampleResourceAggregateModel\n\nimport copy\nimport logging\nimport xmlrpclib\n\n\n\n\n###\n# Topology to show in the Expedient\n#\n\n\n\n\n\n#from expedient.common.utils.plugins.plugininterface import PluginInterface\n#\n#class Plugin(PluginInterface):\n# @staticmethod\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_resource(request, slice_id, agg_id):\n \"\"\"Show a page that allows user to add a SampleResource to the aggregate.\"\"\"\n\n if request.method == \"POST\":\n # Shows error message when aggregate unreachable, disable SampleResource creation and get back to slice detail page\n agg = Aggregate.objects.get(id = agg_id)\n if agg.check_status() == False:\n DatedMessage.objects.post_message_to_user(\n \"SampleResource Aggregate '%s' is not available\" % agg.name,\n request.user, msg_type=DatedMessage.TYPE_ERROR,)\n return HttpResponseRedirect(reverse(\"slice_detail\", args=[slice_id]))\n\n if 'create_resource' in request.POST:\n return HttpResponseRedirect(reverse(\"sample_resource_resource_crud\", args=[slice_id, agg_id]))\n else:\n return HttpResponseRedirect(reverse(\"slice_detail\", args=[slice_id]))", "metadata": "root.create_resource", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def resource_crud(request, slice_id, agg_id, resource_id = None):\n \"\"\"\n Show a page that allows user to create/edit SampleResource's to the Aggregate.\n \"\"\"\n slice = get_object_or_404(Slice, id = slice_id)\n aggregate = Aggregate.objects.get(id = agg_id)\n error_crud = \"\"\n\n def pre_save(instance, created):\n \"\"\"\n Fills SampleResource instance prior to its saving.\n Used within the scope of the generic_crud method.\n \"\"\"\n instance = SampleResourceController.fill(instance, slice, agg_id, resource_id)\n\n try:\n return generic_crud(request, obj_id=resource_id, model=SampleResourceModel,\n form_class=SampleResourceModelForm,\n template=\"sample_resource_resource_crud.html\",\n redirect=lambda inst: reverse(\"slice_detail\", args=[slice_id]),\n extra_context={\"agg\": aggregate, \"slice\": slice, \"exception\": error_crud, \"breadcrumbs\": (\n (\"Home\", reverse(\"home\")),\n (\"Project %s\" % slice.project.name, reverse(\"project_detail\", args=[slice.project.id])),\n (\"Slice %s\" % slice.name, reverse(\"slice_detail\", args=[slice_id])),\n (\"%s SampleResource\" % \"Update\" if resource_id else \"Create\", reverse(\"sample_resource_resource_crud\", args=[slice_id, agg_id])),)\n }, extra_form_params={}, template_object_name=\"object\", pre_save=pre_save,\n post_save=None, success_msg=None)\n except ValidationError as e:\n # Django exception message handling is different to Python's...\n error_crud = \";\".join(e.messages)\n except Exception as e:\n print \"[WARNING] Could not create resource in plugin 'sample_resource'. Details: %s\" % str(e)\n DatedMessage.objects.post_message_to_user(\n \"SampleResource might have been created, but some problem ocurred: %s\" % str(e),\n request.user, msg_type=DatedMessage.TYPE_ERROR)\n return HttpResponseRedirect(reverse(\"slice_detail\", args=[slice_id]))", "metadata": "root.resource_crud", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def manage_resource(request, resource_id, action_type):\n \"\"\"\n Manages the actions executed over SampleResource's.\n \"\"\"\n if action_type == \"delete\":\n SampleResourceController.delete(resource_id)\n # Go to manage resources again\n return HttpResponse(\"\")", "metadata": "root.manage_resource", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def get_sr_list(slice):\n return SampleResourceModel.objects.filter(slice_id = slice.uuid)", "metadata": "root.get_sr_list", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def get_sr_aggregates(slice):\n sr_aggs = []\n try:\n sr_aggs = slice.aggregates.filter(leaf_name=SampleResourceAggregateModel.__name__.lower())\n except:\n pass\n return sr_aggs", "metadata": "root.get_sr_aggregates", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def get_node_description(node):\n description = \"<strong>Sample Resource: \" + node.name + \"</strong><br/><br/>\"\n description += \"&#149; Temperature: %s (&#176;%s)\" % (str(node.get_temperature()), str(node.get_temperature_scale()))\n connections = \"\"\n node_connections = node.get_connections()\n for i, connection in enumerate(node_connections):\n connections += connection.name\n if i < len(node_connections)-1:\n connections += \", \"\n description += \"<br/>&#149; Connected to: %s\" % str(connections)\n return description", "metadata": "root.get_node_description", "header": "['module', '___EOS___']", "index": 106 }, { "content": "def get_nodes_links(slice, chosen_group=None):\n nodes = []\n links = []\n sr_aggs = get_sr_aggregates(slice)\n\n # Getting image for the nodes\n # FIXME: avoid to ask the user for the complete name of the method here! he should NOT know it\n try:\n image_url = reverse('img_media_sample_resource', args=(\"sensor-tiny.png\",))\n except:\n image_url = 'sensor-tiny.png'\n\n # For every SampleResource AM\n for i, sr_agg in enumerate(sr_aggs):\n sr_agg = sr_agg.sampleresourceaggregate\n # Iterates over every SampleResource contained within the slice\n for sr in sr_agg.get_resources():\n sr = sr.sampleresource\n nodes.append(Node(\n # Users shall not be left the choice to choose group/island; otherwise collision may arise\n name = sr.name, value = sr.id, aggregate = sr.aggregate, type = \"Sample resource\",\n description = get_node_description(sr), image = image_url)\n )\n for connection in sr.get_connections():\n # Two-ways link\n links.append(\n Link(\n target = str(sr.id), source = str(connection.id),\n value = \"rsc_id_%s-rsc_id_%s\" % (connection.id, sr.id)\n ),\n )\n links.append(\n Link(\n target = str(sr.id), source = str(connection.id),\n value = \"rsc_id_%s-rsc_id_%s\" % (sr.id, connection.id)\n ),\n )\n return [nodes, links]", "metadata": "root.get_nodes_links", "header": "['module', '___EOS___']", "index": 118 }, { "content": "def get_ui_data(slice):\n \"\"\"\n Hook method. Use this very same name so Expedient can get the resources for every plugin.\n \"\"\"\n ui_context = dict()\n try:\n ui_context['sr_list'] = get_sr_list(slice)\n ui_context['sr_aggs'] = get_sr_aggregates(slice)\n ui_context['nodes'], ui_context['links'] = get_nodes_links(slice)\n except Exception as e:\n print \"[ERROR] Problem loading UI data for plugin 'sample_resource'. Details: %s\" % str(e)\n return ui_context", "metadata": "root.get_ui_data", "header": "['module', '___EOS___']", "index": 161 } ]
[ { "span": "import copy", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 11 }, { "span": "import logging", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 14 }, { "span": "import xmlrpclib", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Graphic", "al", " ", "user", " ", "interface", " ", "functional", "iti", "es", " ", "for", " ", "the", "\\", "10", ";", "Sampl", "e", "Reso", "urc", "e", " ", "Aggregate", " ", "Manager", ".", "\\", "10", ";", "\\", "10", ";", "@", "date", ":", " ", "Jun", " ", "1", "2", ",", " ", "2013", "\\", "10", ";", "@", "author", ":", " ", "Carol", "ina", "Fer", "nand", "ez", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "clear", "ing", "house_", "._", "aggregate_", "._", "models_", "import_", "Aggregate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "clear", "ing", "house_", "._", "slice_", "._", "models_", "import_", "Slice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "messaging_", "._", "models_", "import_", "Date", "d", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "utils_", "._", "plugins_", "._", "plugin", "communicator", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "utils_", "._", "plugins_", "._", "resources_", "._", "link_", "import_", "Link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "utils_", "._", "plugins_", "._", "resources_", "._", "node_", "import_", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "expe", "die", "nt_", "._", "common_", "._", "utils_", "._", "views_", "import_", "gener", "ic", "\\u", "crud", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sample", "\\u", "resource_", "._", "controller_", "._", "resource_", "import_", "Sampl", "e", "Resource_", "as_", "Sampl", "e", "Reso", "urc", "e", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sample", "\\u", "resource_", "._", "forms_", "._", "Sampl", "e", "Resource_", "import_", "Sampl", "e", "Resource_", "as_", "Sampl", "e", "Reso", "urc", "e", "Model", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sample", "\\u", "resource_", "._", "models_", "import_", "Sampl", "e", "Resource_", "as_", "Sampl", "e", "Reso", "urc", "e", "Model_", ",_", "Sampl", "e", "Reso", "urc", "e", "Aggregate", "_", "as_", "Sampl", "e", "Reso", "urc", "e", "Aggregate", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xmlrpclib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Topology", " ", "to", " ", "show", " ", "in", " ", "the", " ", "Expe", "die", "nt_", "\\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_", "#", "from", " ", "expe", "die", "nt", ".", "common", ".", "util", "s", ".", "plugin", "s", ".", "plugin", "interface", " ", "import", " ", "Plug", "in", "Interface_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "class", " ", "Plug", "in", "(", "Plug", "in", "Interface", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "@", "staticmethod_", "\\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_", "create", "\\u", "resource_", "(_", "request_", ",_", "slice", "\\u", "id_", ",_", "agg", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "a", " ", "page", " ", "tha", "t", " ", "allow", "s", " ", "user", " ", "to", " ", "add", " ", "a", " ", "Sampl", "e", "Reso", "urc", "e", " ", "to", " ", "the", " ", "aggre", "gate", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Show", "s", " ", "error", " ", "message", " ", "whe", "n", " ", "aggre", "gate", " ", "unreachable", ",", " ", "disable", " ", "Sampl", "e", "Reso", "urc", "e", " ", "creati", "on", " ", "and", " ", "get", " ", "back", " ", "to", " ", "slice", " ", "deta", "il", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agg_", "=_", "Aggregate", "_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "agg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "agg_", "._", "check", "\\u", "status_", "(_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Date", "d", "Message_", "._", "objects_", "._", "post", "\\u", "message", "\\u", "to", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sampl", "e", "Reso", "urc", "e", " ", "Aggregate", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "avail", "able", "\"_", "%_", "agg_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "msg", "\\u", "type_", "=_", "Date", "d", "Message_", "._", "TYPE", "\\u", "ERROR_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "\"", "slice", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "create", "\\u", "resource", "'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "\"", "sample", "\\u", "resource", "\\u", "resource", "\\u", "crud", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", ",_", "agg", "\\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 ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "\"", "slice", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resource", "\\u", "crud", "_", "(_", "request_", ",_", "slice", "\\u", "id_", ",_", "agg", "\\u", "id_", ",_", "resource", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "a", " ", "page", " ", "tha", "t", " ", "allow", "s", " ", "user", " ", "to", " ", "create", "/", "edit", " ", "Sampl", "e", "Reso", "urc", "e", "'", "s", " ", "to", " ", "the", " ", "Aggregate", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Slice_", ",_", "id_", "=_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggregate_", "=_", "Aggregate", "_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "agg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "crud", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pre", "\\u", "save_", "(_", "instance_", ",_", "created_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fil", "ls", " ", "Sampl", "e", "Reso", "urc", "e", " ", "instance", " ", "prior", " ", "to", " ", "its", " ", "saving", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "within", " ", "the", " ", "scope", " ", "of", " ", "the", " ", "gener", "ic", "\\u", "crud", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "Sampl", "e", "Reso", "urc", "e", "Controller_", "._", "fill_", "(_", "instance_", ",_", "slice_", ",_", "agg", "\\u", "id_", ",_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gener", "ic", "\\u", "crud", "_", "(_", "request_", ",_", "obj", "\\u", "id_", "=_", "resource", "\\u", "id_", ",_", "model_", "=_", "Sampl", "e", "Reso", "urc", "e", "Model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form", "\\u", "class_", "=_", "Sampl", "e", "Reso", "urc", "e", "Model", "Form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "\"", "sample", "\\u", "resource", "\\u", "resource", "\\u", "crud", ".", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "=_", "lambda_", "inst_", ":_", "reverse_", "(_", "\"", "slice", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "context_", "=_", "{_", "\"", "agg", "\"_", ":_", "aggregate_", ",_", "\"", "slice", "\"_", ":_", "slice_", ",_", "\"", "exception", "\"_", ":_", "error", "\\u", "crud", "_", ",_", "\"", "breadcrumb", "s", "\"_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Home", "\"_", ",_", "reverse_", "(_", "\"", "home", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Project", " ", "%", "s", "\"_", "%_", "slice_", "._", "project_", "._", "name_", ",_", "reverse_", "(_", "\"", "project", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice_", "._", "project_", "._", "id_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Slice", " ", "%", "s", "\"_", "%_", "slice_", "._", "name_", ",_", "reverse_", "(_", "\"", "slice", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"%", "s", " ", "Sampl", "e", "Reso", "urc", "e", "\"_", "%_", "\"", "Update", "\"_", "if_", "resource", "\\u", "id_", "else_", "\"", "Creat", "e", "\"_", ",_", "reverse_", "(_", "\"", "sample", "\\u", "resource", "\\u", "resource", "\\u", "crud", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", ",_", "agg", "\\u", "id_", "]_", ")_", ")_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "extra", "\\u", "form", "\\u", "params_", "=_", "{_", "}_", ",_", "template", "\\u", "object\\u", "name_", "=_", "\"", "object", "\"_", ",_", "pre", "\\u", "save_", "=_", "pre", "\\u", "save_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "save_", "=_", "None_", ",_", "success", "\\u", "msg_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "exception", " ", "message", " ", "handling", " ", "is", " ", "different", " ", "to", " ", "Pyth", "on", "'", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "crud", "_", "=_", "\";\"_", "._", "join_", "(_", "e_", "._", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "WARN", "ING", "]", " ", "Cou", "ld", " ", "not", " ", "create", " ", "resource", " ", "in", " ", "plugin", " ", "'", "sample", "\\u", "resource", "'.", " ", "Det", "ail", "s", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Date", "d", "Message_", "._", "objects_", "._", "post", "\\u", "message", "\\u", "to", "\\u", "user_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Sampl", "e", "Reso", "urc", "e", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "created", ",", " ", "but", " ", "some", " ", "problem", " ", "ocu", "rre", "d", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "msg", "\\u", "type_", "=_", "Date", "d", "Message_", "._", "TYPE", "\\u", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "\"", "slice", "\\u", "deta", "il", "\"_", ",_", "args_", "=_", "[_", "slice", "\\u", "id_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "manage", "\\u", "resource_", "(_", "request_", ",_", "resource", "\\u", "id_", ",_", "action", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Manage", "s", " ", "the", " ", "action", "s", " ", "executed", " ", "over", " ", "Sampl", "e", "Reso", "urc", "e", "'", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "action", "\\u", "type_", "==_", "\"", "delete", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sampl", "e", "Reso", "urc", "e", "Controller_", "._", "delete_", "(_", "resource", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Go", " ", "to", " ", "manage", " ", "resource", "s", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "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_", "def_", "get", "\\u", "sr", "\\u", "list_", "(_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Sampl", "e", "Reso", "urc", "e", "Model_", "._", "objects_", "._", "filter_", "(_", "slice", "\\u", "id_", "=_", "slice_", "._", "uuid_", ")_", "\\u\\u\\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", "sr", "\\u", "aggregates", "_", "(_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr", "\\u", "aggs", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr", "\\u", "aggs", "_", "=_", "slice_", "._", "aggregates", "_", "._", "filter_", "(_", "leaf", "\\u", "name_", "=_", "Sampl", "e", "Reso", "urc", "e", "Aggregate", "Model_", "._", "\\u\\u", "name\\u\\u_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sr", "\\u", "aggs", "_", "\\u\\u\\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", "node", "\\u", "description_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "\"<", "strong", ">", "Sampl", "e", " ", "Reso", "urc", "e", ":", " ", "\"_", "+_", "node_", "._", "name_", "+_", "\"<", "/", "strong", "><", "br", "/>", "<", "br", "/>\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "+=_", "\"&", "#", "149", ";", " ", "Tempe", "ratur", "e", ":", " ", "%", "s", " ", "(", "&", "#", "176", ";", "%", "s", ")\"_", "%_", "(_", "str_", "(_", "node_", "._", "get", "\\u", "temperature_", "(_", ")_", ")_", ",_", "str_", "(_", "node_", "._", "get", "\\u", "tempe", "ratur", "e\\u", "scale_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connections_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "connections_", "=_", "node_", "._", "get", "\\u", "connections_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "connection_", "in_", "enumerate_", "(_", "node", "\\u", "connections_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connections_", "+=_", "connection_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "<_", "len_", "(_", "node", "\\u", "connections_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connections_", "+=_", "\",", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "description_", "+=_", "\"<", "br", "/>", "&", "#", "149", ";", " ", "Connect", "ed", " ", "to", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "description_", "\\u\\u\\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", "nodes", "\\u", "links_", "(_", "slice_", ",_", "chosen", "\\u", "group_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sr", "\\u", "aggs", "_", "=_", "get", "\\u", "sr", "\\u", "aggregates", "_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "ting", " ", "image", " ", "for", " ", "the", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "avoid", " ", "to", " ", "ask", " ", "the", " ", "user", " ", "for", " ", "the", " ", "complete", " ", "name", " ", "of", " ", "the", " ", "method", " ", "here", "!", " ", "he", " ", "shou", "ld", " ", "NOT", " ", "know", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "url_", "=_", "reverse_", "(_", "'", "img", "\\u", "media", "\\u", "sample", "\\u", "resource", "'_", ",_", "args_", "=_", "(_", "\"", "sensor", "-", "tiny", ".", "png", "\"_", ",_", ")_", ")_", "\\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 ", " _", "image", "\\u", "url_", "=_", "'", "sensor", "-", "tiny", ".", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "every", " ", "Sampl", "e", "Reso", "urc", "e", " ", "AM", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "sr", "\\u", "agg_", "in_", "enumerate_", "(_", "sr", "\\u", "aggs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr", "\\u", "agg_", "=_", "sr", "\\u", "agg_", "._", "sampler", "esource", "aggregate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Iterat", "es", " ", "over", " ", "every", " ", "Sampl", "e", "Reso", "urc", "e", " ", "contain", "ed", " ", "within", " ", "the", " ", "slice_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sr_", "in_", "sr", "\\u", "agg_", "._", "get", "\\u", "resources_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr_", "=_", "sr_", "._", "sampler", "esource", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "._", "append_", "(_", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", "s", " ", "sha", "ll", " ", "not", " ", "be", " ", "left", " ", "the", " ", "choice", " ", "to", " ", "choose", " ", "group", "/", "island", ";", " ", "other", "wis", "e", " ", "colli", "sion", " ", "may", " ", "aris", "e_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "sr_", "._", "name_", ",_", "value_", "=_", "sr_", "._", "id_", ",_", "aggregate_", "=_", "sr_", "._", "aggregate_", ",_", "type_", "=_", "\"", "Sampl", "e", " ", "resource", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "get", "\\u", "node", "\\u", "description_", "(_", "sr_", ")_", ",_", "image_", "=_", "image", "\\u", "url_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "connection_", "in_", "sr_", "._", "get", "\\u", "connections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tw", "o", "-", "way", "s", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "links_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Link_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "str_", "(_", "sr_", "._", "id_", ")_", ",_", "source_", "=_", "str_", "(_", "connection_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "\"", "rsc", "\\u", "id", "\\u", "%", "s", "-", "rsc", "\\u", "id", "\\u", "%", "s", "\"_", "%_", "(_", "connection_", "._", "id_", ",_", "sr_", "._", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Link_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "str_", "(_", "sr_", "._", "id_", ")_", ",_", "source_", "=_", "str_", "(_", "connection_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "\"", "rsc", "\\u", "id", "\\u", "%", "s", "-", "rsc", "\\u", "id", "\\u", "%", "s", "\"_", "%_", "(_", "sr_", "._", "id_", ",_", "connection_", "._", "id_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "nodes_", ",_", "links_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ui", "\\u", "data_", "(_", "slice_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hook", " ", "method", ".", " ", "Us", "e", " ", "this", " ", "very", " ", "same", " ", "name", " ", "so", " ", "Expe", "die", "nt", " ", "can", " ", "get", " ", "the", " ", "resource", "s", " ", "for", " ", "every", " ", "plugin", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui", "\\u", "context_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui", "\\u", "context_", "[_", "'", "sr", "\\u", "list", "'_", "]_", "=_", "get", "\\u", "sr", "\\u", "list_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui", "\\u", "context_", "[_", "'", "sr", "\\u", "aggs", "'_", "]_", "=_", "get", "\\u", "sr", "\\u", "aggregates", "_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui", "\\u", "context_", "[_", "'", "nodes", "'_", "]_", ",_", "ui", "\\u", "context_", "[_", "'", "link", "s", "'_", "]_", "=_", "get", "\\u", "nodes", "\\u", "links_", "(_", "slice_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"[", "ERROR", "]", " ", "Prob", "lem", " ", "load", "ing", " ", "UI", " ", "data", " ", "for", " ", "plugin", " ", "'", "sample", "\\u", "resource", "'.", " ", "Det", "ail", "s", ":", " ", "%", "s", "\"_", "%_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ui", "\\u", "context_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
adlnet/ADL_LRS/lrs/tests/test_AgentManager.py
[ { "content": " def test_agent_format(self):\n ot_s = \"Agent\"\n name_s = \"superman\"\n mbox_s = \"mailto:[email protected]\"\n kwargs_s = {\"objectType\":ot_s,\"name\":name_s,\"mbox\":mbox_s}\n clark, created = Agent.objects.retrieve_or_create(**kwargs_s)\n self.assertTrue(created)\n clark.save()\n self.assertEquals(clark.objectType, ot_s)\n self.assertEquals(clark.name, name_s)\n self.assertEquals(clark.mbox, mbox_s)\n\n clark_exact = clark.to_dict()\n self.assertEquals(clark_exact['objectType'], ot_s)\n self.assertEquals(clark_exact['name'], name_s)\n self.assertEquals(clark_exact['mbox'], mbox_s)\n\n clark_ids = clark.to_dict(ids_only=True)\n self.assertFalse('objectType' in str(clark_ids), \"object type was found in agent json\")\n self.assertFalse('name' in str(clark_ids), \"name was found in agent json\")\n self.assertEquals(clark_ids['mbox'], mbox_s)\n\n ot_ww = \"Agent\"\n name_ww = \"wonder woman\"\n mbox_sha1sum_ww = hashlib.sha1(\"mailto:[email protected]\").hexdigest()\n kwargs_ww = {\"objectType\":ot_ww,\"name\":name_ww,\"mbox_sha1sum\":mbox_sha1sum_ww}\n diana, created = Agent.objects.retrieve_or_create(**kwargs_ww)\n self.assertTrue(created)\n diana.save()\n self.assertEquals(diana.objectType, ot_ww)\n self.assertEquals(diana.name, name_ww)\n self.assertEquals(diana.mbox_sha1sum, mbox_sha1sum_ww)\n\n diana_exact = diana.to_dict()\n self.assertEquals(diana_exact['objectType'], ot_ww)\n self.assertEquals(diana_exact['name'], name_ww)\n self.assertEquals(diana_exact['mbox_sha1sum'], mbox_sha1sum_ww)\n\n diana_ids = diana.to_dict(ids_only=True)\n self.assertFalse('objectType' in str(diana_ids), \"object type was found in agent json\")\n self.assertFalse('name' in str(diana_ids), \"name was found in agent json\")\n self.assertFalse('mbox' in diana_ids.items(), \"mbox was found in agent json\")\n self.assertEquals(diana_ids['mbox_sha1sum'], mbox_sha1sum_ww)\n\n ot_b = \"Agent\"\n name_b = \"batman\"\n openid_b = \"id:batman\"\n kwargs_b = {\"objectType\":ot_b,\"name\":name_b,\"openid\":openid_b}\n bruce, created = Agent.objects.retrieve_or_create(**kwargs_b)\n self.assertTrue(created)\n bruce.save()\n self.assertEquals(bruce.objectType, ot_b)\n self.assertEquals(bruce.name, name_b)\n self.assertEquals(bruce.openid, openid_b)\n\n bruce_exact = bruce.to_dict()\n self.assertEquals(bruce_exact['objectType'], ot_b)\n self.assertEquals(bruce_exact['name'], name_b)\n self.assertEquals(bruce_exact['openid'], openid_b)\n\n bruce_ids = bruce.to_dict(ids_only=True)\n self.assertFalse('objectType' in str(bruce_ids), \"object type was found in agent json\")\n self.assertFalse('name' in str(bruce_ids), \"name was found in agent json\")\n self.assertFalse('mbox' in str(bruce_ids), \"mbox was found in agent json\")\n self.assertFalse('mbox_sha1sum' in str(bruce_ids), \"mbox_sha1sum was found in agent json\")\n self.assertEquals(bruce_ids['openid'], openid_b)\n\n ot_f = \"Agent\"\n name_f = \"the flash\"\n account_f = {\"homePage\":\"http://ultrasecret.justiceleague.com/accounts/\", \"name\":\"theflash\"}\n kwargs_f = {\"objectType\":ot_f,\"name\":name_f,\"account\":account_f}\n barry, created = Agent.objects.retrieve_or_create(**kwargs_f)\n self.assertTrue(created)\n barry.save()\n self.assertEquals(barry.objectType, ot_f)\n self.assertEquals(barry.name, name_f)\n self.assertEquals(barry.account_homePage, account_f['homePage'])\n self.assertEquals(barry.account_name, account_f['name'])\n\n barry_exact = barry.to_dict()\n self.assertEquals(barry_exact['objectType'], ot_f)\n self.assertEquals(barry_exact['name'], name_f)\n self.assertEquals(barry_exact['account']['homePage'], account_f['homePage'])\n self.assertEquals(barry_exact['account']['name'], account_f['name'])\n\n barry_ids = barry.to_dict(ids_only=True)\n self.assertFalse('objectType' in str(barry_ids), \"object type was found in agent json\")\n self.assertFalse('name' in barry_ids.items(), \"name was found in agent json\")\n self.assertFalse('mbox' in barry_ids.items(), \"mbox was found in agent json\")\n self.assertFalse('mbox_sha1sum' in str(barry_ids), \"mbox_sha1sum was found in agent json\")\n self.assertFalse('openid' in str(barry_ids), \"openid was found in agent json\")\n self.assertEquals(barry_ids['account']['homePage'], account_f['homePage'])\n self.assertEquals(barry_ids['account']['name'], account_f['name'])\n\n ot_j = \"Group\"\n name_j = \"Justice League\"\n mbox_j = \"mailto:[email protected]\"\n kwargs_j = {\"objectType\":ot_j,\"name\":name_j,\"mbox\":mbox_j, \"member\":[kwargs_s,kwargs_ww,kwargs_f,kwargs_b]}\n justiceleague, created = Agent.objects.retrieve_or_create(**kwargs_j)\n self.assertTrue(created)\n justiceleague.save()\n self.assertEquals(justiceleague.objectType, ot_j)\n self.assertEquals(justiceleague.name, name_j)\n self.assertEquals(justiceleague.mbox, mbox_j)\n\n justiceleague_exact = justiceleague.to_dict()\n self.assertEquals(justiceleague_exact['objectType'], ot_j)\n self.assertEquals(justiceleague_exact['name'], name_j)\n self.assertEquals(justiceleague_exact['mbox'], mbox_j)\n\n justiceleague_ids = justiceleague.to_dict(ids_only=True)\n self.assertTrue('objectType' in str(justiceleague_ids), \"object type was not found in group json\")\n self.assertFalse('name' in str(justiceleague_ids), \"name was found in agent json\")\n self.assertEquals(justiceleague_ids['mbox'], mbox_j)\n\n badguy_ds = {\"objectType\":\"Agent\", \"mbox\":\"mailto:[email protected]\", \"name\":\"Darkseid\"}\n badguy_m = {\"objectType\":\"Agent\", \"mbox\":\"mailto:[email protected]\", \"name\":\"Mantis\"}\n\n ot_bg = \"Group\"\n members_bg = [badguy_ds, badguy_m]\n kwargs_bg = {\"objectType\":ot_bg,\"member\":members_bg}\n badguys, created = Agent.objects.retrieve_or_create(**kwargs_bg)\n self.assertTrue(created)\n badguys.save()\n self.assertEquals(badguys.objectType, ot_bg)\n bg_members = badguys.member.all()\n self.assertEquals(len(bg_members), 2)\n for bg in bg_members:\n self.assertTrue(bg.name in str(kwargs_bg['member']))\n\n badguys_exact = badguys.to_dict()\n self.assertEquals(badguys_exact['objectType'], ot_bg)\n for m in badguys_exact['member']:\n if m['name'] == badguy_ds['name']:\n self.assertEquals(m['objectType'], badguy_ds['objectType'])\n self.assertEquals(m['mbox'], badguy_ds['mbox'])\n elif m['name'] == badguy_m['name']:\n self.assertEquals(m['objectType'], badguy_m['objectType'])\n self.assertEquals(m['mbox'], badguy_m['mbox'])\n else:\n self.fail(\"got an unexpected name: \" % m['name'])\n\n badguys_ids = badguys.to_dict(ids_only=True)\n self.assertTrue('objectType' in str(badguys_ids), \"object type was not found in group json\")\n for m in badguys_ids['member']:\n self.assertFalse('objectType' in str(m), \"object type was found in member agent\")\n self.assertFalse('name' in str(m), \"name was found in member agent\")\n if m['mbox'] == badguy_ds['mbox']:\n self.assertEquals(m['mbox'], badguy_ds['mbox'])\n elif m['mbox'] == badguy_m['mbox']:\n self.assertEquals(m['mbox'], badguy_m['mbox'])\n else:\n self.fail(\"got an unexpected mbox: \" % m['mbox'])", "metadata": "root.AgentManagerTests.test_agent_format", "header": "['class', 'AgentManagerTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 253 } ]
[ { "span": "self.assertTrue(bg.name in str(kwargs_bg['member']))", "start_line": 381, "start_column": 12, "end_line": 381, "end_column": 64 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Agent", "Manager", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "agent", "\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ot", "\\u", "s_", "=_", "\"", "Agent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "s_", "=_", "\"", "super", "man", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mbox", "\\u", "s_", "=_", "\"", "mail", "to", ":", "super", "man", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "s_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "s_", ",_", "\"", "name", "\"_", ":_", "name", "\\u", "s_", ",_", "\"", "mbox", "\"_", ":_", "mbox", "\\u", "s_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clar", "k_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clar", "k_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k_", "._", "object", "Type_", ",_", "ot", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k_", "._", "name_", ",_", "name", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k_", "._", "mbox", "_", ",_", "mbox", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clar", "k", "\\u", "exact_", "=_", "clar", "k_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k", "\\u", "exact_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k", "\\u", "exact_", "[_", "'", "mbox", "'_", "]_", ",_", "mbox", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clar", "k", "\\u", "ids_", "=_", "clar", "k_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "clar", "k", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "str_", "(_", "clar", "k", "\\u", "ids_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "clar", "k", "\\u", "ids_", "[_", "'", "mbox", "'_", "]_", ",_", "mbox", "\\u", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "\\u", "ww_", "=_", "\"", "Agent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "ww_", "=_", "\"", "won", "der", " ", "wo", "man", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mbox", "\\u", "sha1", "sum", "\\u", "ww_", "=_", "hashlib_", "._", "sha1_", "(_", "\"", "mail", "to", ":", "won", "der", "wo", "man", "@", "example", ".", "com", "\"_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "ww_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "ww_", ",_", "\"", "name", "\"_", ":_", "name", "\\u", "ww_", ",_", "\"", "mbox", "\\u", "sha1", "sum", "\"_", ":_", "mbox", "\\u", "sha1", "sum", "\\u", "ww_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dian", "a_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dian", "a_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a_", "._", "object", "Type_", ",_", "ot", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a_", "._", "name_", ",_", "name", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a_", "._", "mbox", "\\u", "sha1", "sum_", ",_", "mbox", "\\u", "sha1", "sum", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dian", "a", "\\u", "exact_", "=_", "dian", "a_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a", "\\u", "exact_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a", "\\u", "exact_", "[_", "'", "mbox", "\\u", "sha1", "sum", "'_", "]_", ",_", "mbox", "\\u", "sha1", "sum", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dian", "a", "\\u", "ids_", "=_", "dian", "a_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "dian", "a", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "str_", "(_", "dian", "a", "\\u", "ids_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "mbox", "'_", "in_", "dian", "a", "\\u", "ids_", "._", "items_", "(_", ")_", ",_", "\"", "mbox", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "dian", "a", "\\u", "ids_", "[_", "'", "mbox", "\\u", "sha1", "sum", "'_", "]_", ",_", "mbox", "\\u", "sha1", "sum", "\\u", "ww_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "\\u", "b_", "=_", "\"", "Agent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "b_", "=_", "\"", "bat", "man", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "openid", "\\u", "b_", "=_", "\"", "id", ":", "bat", "man", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "b_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "b_", ",_", "\"", "name", "\"_", ":_", "name", "\\u", "b_", ",_", "\"", "openid", "\"_", ":_", "openid", "\\u", "b_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bru", "ce_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bru", "ce_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce_", "._", "object", "Type_", ",_", "ot", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce_", "._", "name_", ",_", "name", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce_", "._", "openid", "_", ",_", "openid", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bru", "ce", "\\u", "exact_", "=_", "bru", "ce_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce", "\\u", "exact_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce", "\\u", "exact_", "[_", "'", "openid", "'_", "]_", ",_", "openid", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bru", "ce", "\\u", "ids_", "=_", "bru", "ce_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "bru", "ce", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "str_", "(_", "bru", "ce", "\\u", "ids_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "mbox", "'_", "in_", "str_", "(_", "bru", "ce", "\\u", "ids_", ")_", ",_", "\"", "mbox", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "mbox", "\\u", "sha1", "sum", "'_", "in_", "str_", "(_", "bru", "ce", "\\u", "ids_", ")_", ",_", "\"", "mbox", "\\u", "sha1", "sum", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bru", "ce", "\\u", "ids_", "[_", "'", "openid", "'_", "]_", ",_", "openid", "\\u", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "\\u", "f_", "=_", "\"", "Agent", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "f_", "=_", "\"", "the", " ", "flash", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account", "\\u", "f_", "=_", "{_", "\"", "home", "Page", "\"_", ":_", "\"", "http", "://", "ultr", "ase", "cre", "t", ".", "just", "ice", "league", ".", "com", "/", "account", "s", "/\"_", ",_", "\"", "name", "\"_", ":_", "\"", "thef", "lash", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "f_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "f_", ",_", "\"", "name", "\"_", ":_", "name", "\\u", "f_", ",_", "\"", "account", "\"_", ":_", "account", "\\u", "f_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "barr", "y_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "barr", "y_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y_", "._", "object", "Type_", ",_", "ot", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y_", "._", "name_", ",_", "name", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y_", "._", "account", "\\u", "home", "Page_", ",_", "account", "\\u", "f_", "[_", "'", "home", "Page", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y_", "._", "account", "\\u", "name_", ",_", "account", "\\u", "f_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "barr", "y", "\\u", "exact_", "=_", "barr", "y_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "exact_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "exact_", "[_", "'", "account", "'_", "]_", "[_", "'", "home", "Page", "'_", "]_", ",_", "account", "\\u", "f_", "[_", "'", "home", "Page", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "exact_", "[_", "'", "account", "'_", "]_", "[_", "'", "name", "'_", "]_", ",_", "account", "\\u", "f_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "barr", "y", "\\u", "ids_", "=_", "barr", "y_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "barr", "y", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "barr", "y", "\\u", "ids_", "._", "items_", "(_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "mbox", "'_", "in_", "barr", "y", "\\u", "ids_", "._", "items_", "(_", ")_", ",_", "\"", "mbox", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "mbox", "\\u", "sha1", "sum", "'_", "in_", "str_", "(_", "barr", "y", "\\u", "ids_", ")_", ",_", "\"", "mbox", "\\u", "sha1", "sum", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "openid", "'_", "in_", "str_", "(_", "barr", "y", "\\u", "ids_", ")_", ",_", "\"", "openid", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "ids_", "[_", "'", "account", "'_", "]_", "[_", "'", "home", "Page", "'_", "]_", ",_", "account", "\\u", "f_", "[_", "'", "home", "Page", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "barr", "y", "\\u", "ids_", "[_", "'", "account", "'_", "]_", "[_", "'", "name", "'_", "]_", ",_", "account", "\\u", "f_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "\\u", "j_", "=_", "\"", "Group", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "j_", "=_", "\"", "Justi", "ce", " ", "League", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mbox", "\\u", "j_", "=_", "\"", "mail", "to", ":", "just", "ice", "league", "@", "example", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "j_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "j_", ",_", "\"", "name", "\"_", ":_", "name", "\\u", "j_", ",_", "\"", "mbox", "\"_", ":_", "mbox", "\\u", "j_", ",_", "\"", "member", "\"_", ":_", "[_", "kwarg", "s", "\\u", "s_", ",_", "kwarg", "s", "\\u", "ww_", ",_", "kwarg", "s", "\\u", "f_", ",_", "kwarg", "s", "\\u", "b_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "ice", "league_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "ice", "league_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league_", "._", "object", "Type_", ",_", "ot", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league_", "._", "name_", ",_", "name", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league_", "._", "mbox", "_", ",_", "mbox", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "just", "ice", "league", "\\u", "exact_", "=_", "just", "ice", "league_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league", "\\u", "exact_", "[_", "'", "name", "'_", "]_", ",_", "name", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league", "\\u", "exact_", "[_", "'", "mbox", "'_", "]_", ",_", "mbox", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "just", "ice", "league", "\\u", "ids_", "=_", "just", "ice", "league_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "just", "ice", "league", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "not", " ", "found", " ", "in", " ", "group", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "str_", "(_", "just", "ice", "league", "\\u", "ids_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "agent", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "just", "ice", "league", "\\u", "ids_", "[_", "'", "mbox", "'_", "]_", ",_", "mbox", "\\u", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "guy", "\\u", "ds_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "\"", "Agent", "\"_", ",_", "\"", "mbox", "\"_", ":_", "\"", "mail", "to", ":", "dark", "sei", "d", "@", "example", ".", "com", "\"_", ",_", "\"", "name", "\"_", ":_", "\"", "Dar", "kse", "id", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "guy", "\\u", "m_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "\"", "Agent", "\"_", ",_", "\"", "mbox", "\"_", ":_", "\"", "mail", "to", ":", "mant", "is", "@", "example", ".", "com", "\"_", ",_", "\"", "name", "\"_", ":_", "\"", "Man", "tis", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ot", "\\u", "bg_", "=_", "\"", "Group", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "member", "s", "\\u", "bg_", "=_", "[_", "bad", "guy", "\\u", "ds_", ",_", "bad", "guy", "\\u", "m_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "bg_", "=_", "{_", "\"", "object", "Type", "\"_", ":_", "ot", "\\u", "bg_", ",_", "\"", "member", "\"_", ":_", "member", "s", "\\u", "bg_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "guy", "s_", ",_", "created_", "=_", "Agent_", "._", "objects_", "._", "retrieve", "\\u", "or", "\\u", "create_", "(_", "**_", "kwarg", "s", "\\u", "bg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "guy", "s_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bad", "guy", "s_", "._", "object", "Type_", ",_", "ot", "\\u", "bg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "members_", "=_", "bad", "guy", "s_", "._", "member_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "bg", "\\u", "members_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bg_", "in_", "bg", "\\u", "members_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "bg_", "._", "name_", "in_", "str_", "(_", "kwarg", "s", "\\u", "bg_", "[_", "'", "member", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bad", "guy", "s", "\\u", "exact_", "=_", "bad", "guy", "s_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bad", "guy", "s", "\\u", "exact_", "[_", "'", "object", "Type", "'_", "]_", ",_", "ot", "\\u", "bg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "bad", "guy", "s", "\\u", "exact_", "[_", "'", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "m_", "[_", "'", "name", "'_", "]_", "==_", "bad", "guy", "\\u", "ds_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "object", "Type", "'_", "]_", ",_", "bad", "guy", "\\u", "ds_", "[_", "'", "object", "Type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "mbox", "'_", "]_", ",_", "bad", "guy", "\\u", "ds_", "[_", "'", "mbox", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "[_", "'", "name", "'_", "]_", "==_", "bad", "guy", "\\u", "m_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "object", "Type", "'_", "]_", ",_", "bad", "guy", "\\u", "m_", "[_", "'", "object", "Type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "mbox", "'_", "]_", ",_", "bad", "guy", "\\u", "m_", "[_", "'", "mbox", "'_", "]_", ")_", "\\u\\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_", "(_", "\"", "got", " ", "an", " ", "unexpected", " ", "name", ":", " ", "\"_", "%_", "m_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bad", "guy", "s", "\\u", "ids_", "=_", "bad", "guy", "s_", "._", "to", "\\u", "dict_", "(_", "ids", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "bad", "guy", "s", "\\u", "ids_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "not", " ", "found", " ", "in", " ", "group", " ", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "bad", "guy", "s", "\\u", "ids_", "[_", "'", "member", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "False_", "(_", "'", "object", "Type", "'_", "in_", "str_", "(_", "m_", ")_", ",_", "\"", "object", " ", "type", " ", "was", " ", "found", " ", "in", " ", "member", " ", "agent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "name", "'_", "in_", "str_", "(_", "m_", ")_", ",_", "\"", "name", " ", "was", " ", "found", " ", "in", " ", "member", " ", "agent", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "[_", "'", "mbox", "'_", "]_", "==_", "bad", "guy", "\\u", "ds_", "[_", "'", "mbox", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "mbox", "'_", "]_", ",_", "bad", "guy", "\\u", "ds_", "[_", "'", "mbox", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "m_", "[_", "'", "mbox", "'_", "]_", "==_", "bad", "guy", "\\u", "m_", "[_", "'", "mbox", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "m_", "[_", "'", "mbox", "'_", "]_", ",_", "bad", "guy", "\\u", "m_", "[_", "'", "mbox", "'_", "]_", ")_", "\\u\\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_", "(_", "\"", "got", " ", "an", " ", "unexpected", " ", "mbox", ":", " ", "\"_", "%_", "m_", "[_", "'", "mbox", "'_", "]_", ")_" ]
[ 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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
cloudera/hue/apps/beeswax/src/beeswax/server/hive_server2_lib.py
[ { "content": " @property\n def partition_keys(self):\n try:\n return [PartitionKeyCompatible(row['col_name'], row['data_type'], row['comment']) for row in self._get_partition_column()]\n except:\n LOG.exception('failed to get partition keys')\n return []", "metadata": "root.HiveServerTable.partition_keys", "header": "['class', 'HiveServerTable', '(', 'Table', ')', ':', '___EOS___']", "index": 83 }, { "content": " @property\n def path_location(self):\n try:\n rows = self.describe\n rows = [row for row in rows if row['col_name'].startswith('Location:')]\n if rows:\n return rows[0]['data_type']\n except:\n LOG.exception('failed to get path location')\n return None", "metadata": "root.HiveServerTable.path_location", "header": "['class', 'HiveServerTable', '(', 'Table', ')', ':', '___EOS___']", "index": 91 }, { "content": " @property\n def cols(self):\n rows = self.describe\n col_row_index = 2\n try:\n end_cols_index = map(itemgetter('col_name'), rows[col_row_index:]).index('')\n return rows[col_row_index:][:end_cols_index] + self._get_partition_column()\n except ValueError: # DESCRIBE on columns and nested columns does not contain add'l rows beyond cols\n return rows[col_row_index:]\n except:\n # Impala does not have it\n return rows", "metadata": "root.HiveServerTable.cols", "header": "['class', 'HiveServerTable', '(', 'Table', ')', ':', '___EOS___']", "index": 102 }, { "content": " def _get_partition_column(self):\n rows = self.describe\n try:\n col_row_index = map(itemgetter('col_name'), rows).index('# Partition Information') + 3\n end_cols_index = map(itemgetter('col_name'), rows[col_row_index:]).index('')\n return rows[col_row_index:][:end_cols_index]\n except:\n # Impala does not have it\n return []", "metadata": "root.HiveServerTable._get_partition_column", "header": "['class', 'HiveServerTable', '(', 'Table', ')', ':', '___EOS___']", "index": 115 }, { "content": " def cols(self):\n try:\n return HiveServerTRowSet(self.columns, self.schema).cols(('col_name', 'data_type', 'comment'))\n except:\n # Impala API is different\n cols = HiveServerTRowSet(self.columns, self.schema).cols(('name', 'type', 'comment'))\n for col in cols:\n col['col_name'] = col.pop('name')\n col['data_type'] = col.pop('type')\n return cols", "metadata": "root.HiveServerTTableSchema.cols", "header": "['class', 'HiveServerTTableSchema', ':', '___EOS___']", "index": 326 }, { "content": " def get_log(self, operation_handle):\n try:\n req = TGetLogReq(operationHandle=operation_handle)\n res = self.call(self._client.GetLog, req)\n return res.log\n except:\n LOG.exception('server does not support GetLog')\n\n return 'Server does not support GetLog()'", "metadata": "root.HiveServerClient.get_log", "header": "['class', 'HiveServerClient', ':', '___EOS___']", "index": 850 } ]
[ { "span": "except:", "start_line": 87, "start_column": 4, "end_line": 87, "end_column": 11 }, { "span": "except:", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 11 }, { "span": "except:", "start_line": 111, "start_column": 4, "end_line": 111, "end_column": 11 }, { "span": "except:", "start_line": 121, "start_column": 4, "end_line": 121, "end_column": 11 }, { "span": "except:", "start_line": 329, "start_column": 4, "end_line": 329, "end_column": 11 }, { "span": "except:", "start_line": 855, "start_column": 4, "end_line": 855, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Hi", "ve", "Server", "Table_", "(_", "Table_", ")_", ":_", "\\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_", "partit", "ion", "\\u", "keys_", "(_", "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_", "[_", "Partition", "Key", "Compatible", "_", "(_", "row_", "[_", "'", "col", "\\u", "name", "'_", "]_", ",_", "row_", "[_", "'", "data\\u", "type", "'_", "]_", ",_", "row_", "[_", "'", "comment", "'_", "]_", ")_", "for_", "row_", "in_", "self_", "._", "\\u", "get", "\\u", "partit", "ion", "\\u", "column_", "(_", ")_", "]_", "\\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_", "._", "exception_", "(_", "'", "fail", "ed", " ", "to", " ", "get", " ", "partit", "ion", " ", "keys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "ve", "Server", "Table_", "(_", "Table_", ")_", ":_", "\\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_", "path", "\\u", "location_", "(_", "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 ", " _", "rows_", "=_", "self_", "._", "describe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "row_", "for_", "row_", "in_", "rows_", "if_", "row_", "[_", "'", "col", "\\u", "name", "'_", "]_", "._", "startswith_", "(_", "'", "Locat", "ion", ":'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rows_", "[_", "0_", "]_", "[_", "'", "data\\u", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "'", "fail", "ed", " ", "to", " ", "get", " ", "path", " ", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "ve", "Server", "Table_", "(_", "Table_", ")_", ":_", "\\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_", "cols_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "self_", "._", "describe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "row", "\\u", "index_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "cols", "\\u", "index_", "=_", "map_", "(_", "itemgetter_", "(_", "'", "col", "\\u", "name", "'_", ")_", ",_", "rows_", "[_", "col", "\\u", "row", "\\u", "index_", ":_", "]_", ")_", "._", "index_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rows_", "[_", "col", "\\u", "row", "\\u", "index_", ":_", "]_", "[_", ":_", "end", "\\u", "cols", "\\u", "index_", "]_", "+_", "self_", "._", "\\u", "get", "\\u", "partit", "ion", "\\u", "column_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "#", " ", "DESC", "RIB", "E", " ", "on", " ", "column", "s", " ", "and", " ", "nest", "ed", " ", "column", "s", " ", "doe", "s", " ", "not", " ", "contain", " ", "add", "'", "l", " ", "rows", " ", "be", "yon", "d", " ", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rows_", "[_", "col", "\\u", "row", "\\u", "index_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Imp", "ala", " ", "doe", "s", " ", "not", " ", "have", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "ve", "Server", "Table_", "(_", "Table_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "partit", "ion", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "self_", "._", "describe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "row", "\\u", "index_", "=_", "map_", "(_", "itemgetter_", "(_", "'", "col", "\\u", "name", "'_", ")_", ",_", "rows_", ")_", "._", "index_", "(_", "'#", " ", "Partition", " ", "Information", "'_", ")_", "+_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "cols", "\\u", "index_", "=_", "map_", "(_", "itemgetter_", "(_", "'", "col", "\\u", "name", "'_", ")_", ",_", "rows_", "[_", "col", "\\u", "row", "\\u", "index_", ":_", "]_", ")_", "._", "index_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rows_", "[_", "col", "\\u", "row", "\\u", "index_", ":_", "]_", "[_", ":_", "end", "\\u", "cols", "\\u", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Imp", "ala", " ", "doe", "s", " ", "not", " ", "have", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "ve", "Server", "TT", "able", "Schema_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cols_", "(_", "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_", "Hi", "ve", "Server", "TR", "ow", "Set_", "(_", "self_", "._", "columns_", ",_", "self_", "._", "schema_", ")_", "._", "cols_", "(_", "(_", "'", "col", "\\u", "name", "'_", ",_", "'", "data\\u", "type", "'_", ",_", "'", "comment", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Imp", "ala", " ", "API", " ", "is", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cols_", "=_", "Hi", "ve", "Server", "TR", "ow", "Set_", "(_", "self_", "._", "columns_", ",_", "self_", "._", "schema_", ")_", "._", "cols_", "(_", "(_", "'", "name", "'_", ",_", "'", "type", "'_", ",_", "'", "comment", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "col_", "in_", "cols_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "[_", "'", "col", "\\u", "name", "'_", "]_", "=_", "col_", "._", "pop_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "[_", "'", "data\\u", "type", "'_", "]_", "=_", "col_", "._", "pop_", "(_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hi", "ve", "Server", "Client_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "log_", "(_", "self_", ",_", "operati", "on", "\\u", "handle_", ")_", ":_", "\\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 ", " _", "req_", "=_", "TG", "et", "Log", "Req_", "(_", "operati", "on", "Handle_", "=_", "operati", "on", "\\u", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "call_", "(_", "self_", "._", "\\u", "client_", "._", "Get", "Log_", ",_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "._", "log_", "\\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_", "._", "exception_", "(_", "'", "server", " ", "doe", "s", " ", "not", " ", "support", " ", "Get", "Log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
spaceboats/busbus/tests/test_util_rate_limit_requests.py
[ { "content": "def test_get_interval(url_prefix):\n session = RateLimitRequests(interval=0.2)\n resp1 = session.get(url_prefix + '/get')\n t = datetime.now()\n resp2 = session.get(url_prefix + '/ip')\n assert datetime.now() - t > timedelta(seconds=0.1)", "metadata": "root.test_get_interval", "header": "['module', '___EOS___']", "index": 37 } ]
[ { "span": "resp1 ", "start_line": 39, "start_column": 4, "end_line": 39, "end_column": 9 }, { "span": "resp2 ", "start_line": 41, "start_column": 4, "end_line": 41, "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", "get", "\\u", "interval_", "(_", "url", "\\u", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "Rat", "e", "Limit", "Requests_", "(_", "interval_", "=_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "1_", "=_", "session_", "._", "get_", "(_", "url", "\\u", "prefix_", "+_", "'/", "get", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp", "2_", "=_", "session_", "._", "get_", "(_", "url", "\\u", "prefix_", "+_", "'/", "ip", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "datetime_", "._", "now_", "(_", ")_", "-_", "t_", ">_", "timedelta_", "(_", "seconds_", "=_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/writer/styles.py
[ { "content": "from __future__ import absolute_import\n# Copyright (c) 2010-2015 openpyxl\n\n\"\"\"Write the shared style table.\"\"\"\n\n# package imports\n\nfrom openpyxl.compat import safe_string\nfrom openpyxl.utils.indexed_list import IndexedList\nfrom openpyxl.xml.functions import (\n Element,\n SubElement,\n ConditionalElement,\n tostring,\n )\nfrom openpyxl.xml.constants import SHEET_MAIN_NS\n\nfrom openpyxl.styles.colors import COLOR_INDEX\nfrom openpyxl.styles import DEFAULTS\nfrom openpyxl.styles.numbers import BUILTIN_FORMATS_REVERSE\nfrom openpyxl.styles.fills import GradientFill, PatternFill\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class StyleWriter(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.StyleWriter", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, workbook):\n self.wb = workbook\n self._root = Element('styleSheet', {'xmlns': SHEET_MAIN_NS})", "metadata": "root.StyleWriter.__init__", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 25 }, { "content": " def write_table(self):\n self._write_number_formats()\n self._write_fonts()\n self._write_fills()\n self._write_borders()\n\n self._write_named_styles()\n self._write_cell_styles()\n self._write_style_names()\n self._write_differential_styles()\n self._write_table_styles()\n self._write_colors()\n\n return tostring(self._root)", "metadata": "root.StyleWriter.write_table", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": " def _write_number_formats(self):\n node = SubElement(self._root, 'numFmts', count= \"%d\" % len(self.wb._number_formats))\n for idx, nf in enumerate(self.wb._number_formats, 164):\n SubElement(node, 'numFmt', {'numFmtId':'%d' % idx,\n 'formatCode':'%s' % nf}\n )", "metadata": "root.StyleWriter._write_number_formats", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def _write_fonts(self):\n fonts_node = SubElement(self._root, 'fonts', count=\"%d\" % len(self.wb._fonts))\n for font in self.wb._fonts:\n fonts_node.append(font.to_tree())", "metadata": "root.StyleWriter._write_fonts", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def _write_fills(self):\n fills_node = SubElement(self._root, 'fills', count=\"%d\" % len(self.wb._fills))\n for fill in self.wb._fills:\n fills_node.append(fill.to_tree())", "metadata": "root.StyleWriter._write_fills", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def _write_borders(self):\n \"\"\"Write the child elements for an individual border section\"\"\"\n borders_node = SubElement(self._root, 'borders', count=\"%d\" % len(self.wb._borders))\n for border in self.wb._borders:\n borders_node.append(border.to_tree())", "metadata": "root.StyleWriter._write_borders", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def _write_named_styles(self):\n styles = self.wb._named_styles\n cell_style_xfs = SubElement(self._root, 'cellStyleXfs', count=\"%d\" % len(styles))\n\n for style in self.wb._named_styles.values():\n attrs = {}\n\n attrs['fontId'] = str(self.wb._fonts.add(style.font))\n attrs['borderId'] = str(self.wb._borders.add(style.border))\n attrs['fillId'] = str(self.wb._fills.add(style.fill))\n fmt = style.number_format\n if fmt in BUILTIN_FORMATS_REVERSE:\n fmt = BUILTIN_FORMATS_REVERSE[fmt]\n else:\n fmt = self.wb._number_formats.add(style.number_format) + 164\n attrs['numFmtId'] = str(fmt)\n\n SubElement(cell_style_xfs, 'xf', attrs)", "metadata": "root.StyleWriter._write_named_styles", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def _write_cell_styles(self):\n \"\"\" write styles combinations based on ids found in tables \"\"\"\n # writing the cellXfs\n cell_xfs = SubElement(self._root, 'cellXfs',\n count='%d' % len(self.wb._cell_styles))\n\n for style in self.wb._cell_styles:\n\n node = style.to_tree()\n cell_xfs.append(node)\n\n if style.applyAlignment:\n al = self.wb._alignments[style.alignmentId]\n el = al.to_tree()\n node.append(el)\n\n if style.applyProtection:\n prot = self.wb._protections[style.protectionId]\n el = prot.to_tree()\n node.append(el)", "metadata": "root.StyleWriter._write_cell_styles", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": " def _write_style_names(self):\n styles = self.wb._named_styles\n\n cell_styles = SubElement(self._root, 'cellStyles', count=str(len(styles)))\n\n for idx, style in enumerate(styles.values()):\n attrs = dict(style)\n attrs['xfId'] = str(idx)\n SubElement(cell_styles, 'cellStyle', attrs)", "metadata": "root.StyleWriter._write_style_names", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 110 }, { "content": " def _write_differential_styles(self):\n dxfs = SubElement(self._root, \"dxfs\", count=str(len(self.wb._differential_styles)))\n for fmt in self.wb._differential_styles:\n dxfs.append(fmt.to_tree())\n return dxfs", "metadata": "root.StyleWriter._write_differential_styles", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 121 }, { "content": " def _write_table_styles(self):\n\n SubElement(self._root, 'tableStyles',\n {'count':'0', 'defaultTableStyle':'TableStyleMedium9',\n 'defaultPivotStyle':'PivotStyleLight16'})", "metadata": "root.StyleWriter._write_table_styles", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 128 }, { "content": " def _write_colors(self):\n \"\"\"\n Workbook contains a different colour index.\n \"\"\"\n\n if self.wb._colors == COLOR_INDEX:\n return\n\n cols = SubElement(self._root, \"colors\")\n rgb = SubElement(cols, \"indexedColors\")\n for color in self.wb._colors:\n SubElement(rgb, \"rgbColor\", rgb=color)", "metadata": "root.StyleWriter._write_colors", "header": "['class', 'StyleWriter', '(', 'object', ')', ':', '___EOS___']", "index": 134 } ]
[ { "span": "from openpyxl.compat import safe_string", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 39 }, { "span": "from openpyxl.utils.indexed_list import IndexedList", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 51 }, { "span": "from openpyxl.xml.functions import (\n Element,\n SubElement,\n ConditionalElement,\n tostring,\n )", "start_line": 9, "start_column": 0, "end_line": 14, "end_column": 5 }, { "span": "from openpyxl.styles import DEFAULTS", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 36 }, { "span": "from openpyxl.styles.fills import GradientFill, PatternFill", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 59 } ]
[]
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_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", "-", "201", "5", " ", "openp", "yx", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Write", " ", "the", " ", "shared", " ", "style", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "package", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "compat_", "import_", "safe", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "utils_", "._", "indexe", "d\\u", "list_", "import_", "Indexe", "d", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "functions_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sub", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cond", "itional", "Element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tostring_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "xml_", "._", "constants_", "import_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "styles_", "._", "colors_", "import_", "COLOR", "\\u", "INDEX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "styles_", "import_", "DEFAULTS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "styles_", "._", "numbers_", "import_", "BUILT", "IN", "\\u", "FORMAT", "S", "\\u", "REVERSE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openp", "yx", "l_", "._", "styles_", "._", "fills", "_", "import_", "Grad", "ient", "Fill_", ",_", "Pat", "tern", "Fill_", "\\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_", "Style", "Writer_", "(_", "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\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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_", ",_", "workbook_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wb_", "=_", "workbook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "root_", "=_", "Element_", "(_", "'", "style", "She", "et", "'_", ",_", "{_", "'", "xml", "ns", "'_", ":_", "SHE", "ET", "\\u", "MAIN", "\\u", "NS_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "number", "\\u", "formats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "fonts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "fills", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "borders_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "named", "\\u", "styles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "cell", "\\u", "styles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "style", "\\u", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "differential", "\\u", "styles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "table", "\\u", "styles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "colors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tostring_", "(_", "self_", "._", "\\u", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "number", "\\u", "formats_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "num", "Fmt", "s", "'_", ",_", "count_", "=_", "\"%", "d", "\"_", "%_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "number", "\\u", "formats_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "nf_", "in_", "enumerate_", "(_", "self_", "._", "wb_", "._", "\\u", "number", "\\u", "formats_", ",_", "164_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sub", "Element_", "(_", "node_", ",_", "'", "num", "Fmt", "'_", ",_", "{_", "'", "num", "Fmt", "Id", "'_", ":_", "'%", "d", "'_", "%_", "idx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "Code", "'_", ":_", "'%", "s", "'_", "%_", "nf_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "fonts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "s", "\\u", "node_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "font", "s", "'_", ",_", "count_", "=_", "\"%", "d", "\"_", "%_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "fonts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "font_", "in_", "self_", "._", "wb_", "._", "\\u", "fonts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font", "s", "\\u", "node_", "._", "append_", "(_", "font_", "._", "to", "\\u", "tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "fills", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fills", "\\u", "node_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "fills", "'_", ",_", "count_", "=_", "\"%", "d", "\"_", "%_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "fills", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fill_", "in_", "self_", "._", "wb_", "._", "\\u", "fills", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fills", "\\u", "node_", "._", "append_", "(_", "fill_", "._", "to", "\\u", "tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "borders_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", " ", "the", " ", "child", " ", "element", "s", " ", "for", " ", "an", " ", "individual", " ", "border", " ", "section", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "border", "s", "\\u", "node_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "border", "s", "'_", ",_", "count_", "=_", "\"%", "d", "\"_", "%_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "borders_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "border_", "in_", "self_", "._", "wb_", "._", "\\u", "borders_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "border", "s", "\\u", "node_", "._", "append_", "(_", "border_", "._", "to", "\\u", "tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "named", "\\u", "styles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "styles_", "=_", "self_", "._", "wb_", "._", "\\u", "named", "\\u", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "style", "\\u", "xf", "s_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "cell", "Style", "Xf", "s", "'_", ",_", "count_", "=_", "\"%", "d", "\"_", "%_", "len_", "(_", "styles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "style_", "in_", "self_", "._", "wb_", "._", "\\u", "named", "\\u", "styles_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attrs_", "[_", "'", "font", "Id", "'_", "]_", "=_", "str_", "(_", "self_", "._", "wb_", "._", "\\u", "fonts_", "._", "add_", "(_", "style_", "._", "font_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "border", "Id", "'_", "]_", "=_", "str_", "(_", "self_", "._", "wb_", "._", "\\u", "borders_", "._", "add_", "(_", "style_", "._", "border_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "fill", "Id", "'_", "]_", "=_", "str_", "(_", "self_", "._", "wb_", "._", "\\u", "fills", "_", "._", "add_", "(_", "style_", "._", "fill_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "style_", "._", "number", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fmt_", "in_", "BUILT", "IN", "\\u", "FORMAT", "S", "\\u", "REVERSE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "BUILT", "IN", "\\u", "FORMAT", "S", "\\u", "REVERSE", "_", "[_", "fmt_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "self_", "._", "wb_", "._", "\\u", "number", "\\u", "formats_", "._", "add_", "(_", "style_", "._", "number", "\\u", "format_", ")_", "+_", "164_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attrs_", "[_", "'", "num", "Fmt", "Id", "'_", "]_", "=_", "str_", "(_", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Sub", "Element_", "(_", "cell", "\\u", "style", "\\u", "xf", "s_", ",_", "'", "xf", "'_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "cell", "\\u", "styles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "write", " ", "style", "s", " ", "combinat", "ion", "s", " ", "based", " ", "on", " ", "ids", " ", "found", " ", "in", " ", "tables", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "writ", "ing", " ", "the", " ", "cell", "Xf", "s_", "\\u\\u\\uNL\\u\\u\\u_", "cell", "\\u", "xf", "s_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "cell", "Xf", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "'%", "d", "'_", "%_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "cell", "\\u", "styles_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "style_", "in_", "self_", "._", "wb_", "._", "\\u", "cell", "\\u", "styles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "style_", "._", "to", "\\u", "tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell", "\\u", "xf", "s_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "style_", "._", "appl", "y", "Alignment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "al_", "=_", "self_", "._", "wb_", "._", "\\u", "alignments_", "[_", "style_", "._", "alignme", "nt", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el_", "=_", "al_", "._", "to", "\\u", "tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "append_", "(_", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "style_", "._", "appl", "y", "Protect", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prot_", "=_", "self_", "._", "wb_", "._", "\\u", "protection", "s_", "[_", "style_", "._", "protection", "Id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "el_", "=_", "prot_", "._", "to", "\\u", "tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "append_", "(_", "el_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "style", "\\u", "names_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "styles_", "=_", "self_", "._", "wb_", "._", "\\u", "named", "\\u", "styles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cell", "\\u", "styles_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "cell", "Styles", "'_", ",_", "count_", "=_", "str_", "(_", "len_", "(_", "styles_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "style_", "in_", "enumerate_", "(_", "styles_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "dict_", "(_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "xf", "Id", "'_", "]_", "=_", "str_", "(_", "idx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sub", "Element_", "(_", "cell", "\\u", "styles_", ",_", "'", "cell", "Style", "'_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "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", "write", "\\u", "differential", "\\u", "styles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dxf", "s_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "\"", "dxf", "s", "\"_", ",_", "count_", "=_", "str_", "(_", "len_", "(_", "self_", "._", "wb_", "._", "\\u", "differential", "\\u", "styles_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fmt_", "in_", "self_", "._", "wb_", "._", "\\u", "differential", "\\u", "styles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dxf", "s_", "._", "append_", "(_", "fmt_", "._", "to", "\\u", "tree_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dxf", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "table", "\\u", "styles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "'", "table", "Styles", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "count", "'_", ":_", "'", "0", "'_", ",_", "'", "default", "Table", "Style", "'_", ":_", "'", "Table", "Style", "Medi", "um", "9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "Pivot", "Style", "'_", ":_", "'", "Pivot", "Style", "Light", "16", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Style", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "colors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Workbook", " ", "contain", "s", " ", "a", " ", "different", " ", "colour", " ", "index", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "wb_", "._", "\\u", "colors_", "==_", "COLOR", "\\u", "INDEX_", ":_", "\\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_", "cols_", "=_", "Sub", "Element_", "(_", "self_", "._", "\\u", "root_", ",_", "\"", "colors", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rgb_", "=_", "Sub", "Element_", "(_", "cols_", ",_", "\"", "indexe", "d", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "color_", "in_", "self_", "._", "wb_", "._", "\\u", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Sub", "Element_", "(_", "rgb_", ",_", "\"", "rgb", "Color", "\"_", ",_", "rgb_", "=_", "color_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
testing-cabal/mock/mock/mock.py
[ { "content": "# mock.py\n# Test tools for mocking and patching.\n# E-mail: fuzzyman AT voidspace DOT org DOT uk\n#\n# mock 1.0.1\n# http://www.voidspace.org.uk/python/mock/\n#\n# Copyright (c) 2007-2013, Michael Foord & the mock team\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided\n# with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nfrom __future__ import absolute_import\n\n__all__ = (\n '__version__',\n 'version_info',\n 'Mock',\n 'MagicMock',\n 'patch',\n 'sentinel',\n 'DEFAULT',\n 'ANY',\n 'call',\n 'create_autospec',\n 'FILTER_DIR',\n 'CallableMixin',\n 'NonCallableMock',\n 'NonCallableMagicMock',\n 'mock_open',\n 'PropertyMock',\n)\n\n\nfrom functools import partial\nimport inspect\nimport pprint\nimport sys\ntry:\n import builtins\nexcept ImportError:\n import __builtin__ as builtins\nfrom types import ModuleType\n\nimport six\nfrom six import wraps\nfrom pbr.version import VersionInfo\n\n_v = VersionInfo('mock').semantic_version()\n__version__ = _v.release_string()\nversion_info = _v.version_tuple()\n\nimport mock\n\ntry:\n inspectsignature = inspect.signature\nexcept AttributeError:\n import funcsigs\n inspectsignature = funcsigs.signature\n\n\n# TODO: use six.\ntry:\n unicode\nexcept NameError:\n # Python 3\n basestring = unicode = str\n\ntry:\n long\nexcept NameError:\n # Python 3\n long = int\n\ntry:\n BaseException\nexcept NameError:\n # Python 2.4 compatibility\n BaseException = Exception\n\nif six.PY2:\n # Python 2's next() can't handle a non-iterator with a __next__ method.\n _next = next\n\n del _next\n\n\n_builtins = set(name for name in dir(builtins) if not name.startswith('_'))\n\nBaseExceptions = (BaseException,)\nif 'java' in sys.platform:\n # jython\n import java\n BaseExceptions = (BaseException, java.lang.Throwable)\n\ntry:\n _isidentifier = str.isidentifier\nexcept AttributeError:\n # Python 2.X\n import keyword\n import re\n regex = re.compile(r'^[a-z_][a-z0-9_]*$', re.I)\n\nself = 'im_self'\nbuiltin = '__builtin__'\nif six.PY3:\n self = '__self__'\n builtin = 'builtins'\n\n# NOTE: This FILTER_DIR is not used. The binding in mock.FILTER_DIR is.\nFILTER_DIR = True\n\n# Workaround for Python issue #12370\n# Without this, the __class__ properties wouldn't be set correctly\n_safe_super = super\n\n\n\n\n\n\n\nDescriptorTypes = (\n type(_slotted.a),\n property,\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\nsentinel = _Sentinel()\n\nDEFAULT = sentinel.DEFAULT\n_missing = sentinel.MISSING\n_deleted = sentinel.DELETED\n\n\nClassType = type(OldStyleClass)\n\n\n\n\nClassTypes = (type,)\nif six.PY2:\n ClassTypes = (type, ClassType)\n\n_allowed_names = set((\n 'return_value', '_mock_return_value', 'side_effect',\n '_mock_side_effect', '_mock_parent', '_mock_new_parent',\n '_mock_name', '_mock_new_name'\n))\n\n\n\n\n\n\n\n\n# Internal class to identify if we wrapped an iterator object or not.\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\npatch.object = _patch_object\npatch.dict = _patch_dict\npatch.multiple = _patch_multiple\npatch.stopall = _patch_stopall\npatch.TEST_PREFIX = 'test'\n\nmagic_methods = (\n \"lt le gt ge eq ne \"\n \"getitem setitem delitem \"\n \"len contains iter \"\n \"hash str sizeof \"\n \"enter exit \"\n # we added divmod and rdivmod here instead of numerics\n # because there is no idivmod\n \"divmod rdivmod neg pos abs invert \"\n \"complex int float index \"\n \"trunc floor ceil \"\n)\n\nnumerics = (\n \"add sub mul matmul div floordiv mod lshift rshift and xor or pow\"\n)\nif six.PY3:\n numerics += ' truediv'\ninplace = ' '.join('i%s' % n for n in numerics.split())\nright = ' '.join('r%s' % n for n in numerics.split())\nextra = ''\nif six.PY3:\n extra = 'bool next '\nelse:\n extra = 'unicode long nonzero oct hex truediv rtruediv '\n\n# not including __prepare__, __instancecheck__, __subclasscheck__\n# (as they are metaclass methods)\n# __del__ is not supported at all as it causes problems if it exists\n\n_non_defaults = set((\n '__cmp__', '__getslice__', '__setslice__', '__coerce__', # <3.x\n '__get__', '__set__', '__delete__', '__reversed__', '__missing__',\n '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__',\n '__getstate__', '__setstate__', '__getformat__', '__setformat__',\n '__repr__', '__dir__', '__subclasses__', '__format__',\n))\n\n\n\n\n_magics = set(\n '__%s__' % method for method in\n ' '.join([magic_methods, numerics, inplace, right, extra]).split()\n)\n\n_all_magics = _magics | _non_defaults\n\n_unsupported_magics = set((\n '__getattr__', '__setattr__',\n '__init__', '__new__', '__prepare__'\n '__instancecheck__', '__subclasscheck__',\n '__del__'\n))\n\n_calculate_return_value = {\n '__hash__': lambda self: object.__hash__(self),\n '__str__': lambda self: object.__str__(self),\n '__sizeof__': lambda self: object.__sizeof__(self),\n '__unicode__': lambda self: unicode(object.__str__(self)),\n}\n\n_return_values = {\n '__lt__': NotImplemented,\n '__gt__': NotImplemented,\n '__le__': NotImplemented,\n '__ge__': NotImplemented,\n '__int__': 1,\n '__contains__': False,\n '__len__': 0,\n '__exit__': False,\n '__complex__': 1j,\n '__float__': 1.0,\n '__bool__': True,\n '__nonzero__': True,\n '__oct__': '1',\n '__hex__': '0x1',\n '__long__': long(1),\n '__index__': 1,\n}\n\n\n\n\n\n_side_effect_methods = {\n '__eq__': _get_eq,\n '__ne__': _get_ne,\n '__iter__': _get_iter,\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nANY = _ANY()\n\n\n\n\n\n\n\n\ncall = _Call(from_kall=False)\n\n\n\n\n\n\n\n\n\n\n\nFunctionTypes = (\n # python function\n type(create_autospec),\n # instance method\n type(ANY.__eq__),\n)\n\nMethodWrapperTypes = (\n type(ANY.__eq__.__get__),\n)\n\n\nfile_spec = None\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except NameError:", "start_line": 98, "start_column": 0, "end_line": 98, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "mock", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tool", "s", " ", "for", " ", "mock", "ing", " ", "and", " ", "patch", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "E-", "mail", ":", " ", "fuzz", "yma", "n", " ", "AT", " ", "voi", "dsp", "ace", " ", "DOT", " ", "org", " ", "DOT", " ", "uk", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mock", " ", "1.0", ".1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "voi", "dsp", "ace", ".", "org", ".", "uk", "/", "python", "/", "mock", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2007", "-", "2013", ",", " ", "Mich", "ael", " ", "Foo", "rd", " ", "&", " ", "the", " ", "mock", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "version", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "\\u", "info", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mag", "ic", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "patch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sentinel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEF", "AUL", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ANY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "call", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "\\u", "autos", "pec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FILTER", "\\u", "DIR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Call", "able", "Mix", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Non", "Call", "able", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Non", "Call", "able", "Mag", "ic", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mock", "\\u", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Proper", "ty", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "builtin\\u\\u_", "as_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "types_", "import_", "Modul", "e", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pb", "r_", "._", "version_", "import_", "Version", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "v_", "=_", "Version", "Info_", "(_", "'", "mock", "'_", ")_", "._", "sema", "ntic", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\\u", "v_", "._", "release", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "\\u", "info_", "=_", "\\u", "v_", "._", "version", "\\u", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inspect", "signature_", "=_", "inspect_", "._", "signature_", "\\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 ", " _", "import_", "funcs", "ig", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inspect", "signature_", "=_", "funcs", "ig", "s_", "._", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "use", " ", "si", "x", "._", "\\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 ", " _", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "=_", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "=_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.4", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Exception_", "=_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", "'", "s", " ", "next", "()", " ", "can", "'", "t", " ", "handle", " ", "a", " ", "non", "-", "iter", "ator", " ", "with", " ", "a", " ", "\\u\\u", "next", "\\u\\u", " ", "method", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "next_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "next_", "\\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", "builtins_", "=_", "set_", "(_", "name_", "for_", "name_", "in_", "dir_", "(_", "builtins_", ")_", "if_", "not_", "name_", "._", "startswith_", "(_", "'\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Exceptions_", "=_", "(_", "Base", "Exception_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "java", "'_", "in_", "sys_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "jy", "tho", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "java_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Exceptions_", "=_", "(_", "Base", "Exception_", ",_", "java_", "._", "lang_", "._", "Throw", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "isi", "denti", "fier", "_", "=_", "str_", "._", "isi", "denti", "fier", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", ".", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "[", "a", "-", "z", "\\u]", "[", "a", "-", "z", "0", "-", "9", "\\u]*", "$'_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "=_", "'", "im", "\\u", "self", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "'\\u", "\\u", "self", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'", "bui", "lti", "ns", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "FILTER", "\\u", "DIR", " ", "is", " ", "not", " ", "used", ".", " ", "The", " ", "bindi", "ng", " ", "in", " ", "mock", ".", "FILTER", "\\u", "DIR", " ", "is", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "FILTER", "\\u", "DIR_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Work", "aro", "und", " ", "for", " ", "Pyth", "on", " ", "issue", " ", "#", "123", "70_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "With", "out", " ", "this", ",", " ", "the", " ", "\\u\\u", "class", "\\u\\u", " ", "proper", "ties", " ", "wou", "ld", "n", "'", "t", " ", "be", " ", "set", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "safe", "\\u", "super_", "=_", "super_", "\\u\\u\\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_", "Descrip", "tor", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "\\u", "slot", "ted_", "._", "a_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "property_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sentinel_", "=_", "\\u", "Senti", "nel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEFAULT_", "=_", "sentinel_", "._", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "missing_", "=_", "sentinel_", "._", "MISSING", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "deleted_", "=_", "sentinel_", "._", "DELETED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Class", "Type_", "=_", "type_", "(_", "Old", "Style", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Class", "Types_", "=_", "(_", "type_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Class", "Types_", "=_", "(_", "type_", ",_", "Class", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "names_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "\\u", "value", "'_", ",_", "'\\u", "mock", "\\u", "return", "\\u", "value", "'_", ",_", "'", "side", "\\u", "effect", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "mock", "\\u", "side", "\\u", "effect", "'_", ",_", "'\\u", "mock", "\\u", "parent", "'_", ",_", "'\\u", "mock", "\\u", "new", "\\u", "parent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "mock", "\\u", "name", "'_", ",_", "'\\u", "mock", "\\u", "new", "\\u", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Intern", "al", " ", "class", " ", "to", " ", "identify", " ", "if", " ", "we", " ", "wrapp", "ed", " ", "an", " ", "iter", "ator", " ", "object", " ", "or", " ", "not", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "patch_", "._", "object_", "=_", "\\u", "patch", "\\u", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "dict_", "=_", "\\u", "patch", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "multiple_", "=_", "\\u", "patch", "\\u", "multiple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "stop", "all_", "=_", "\\u", "patch", "\\u", "stop", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "TEST", "\\u", "PREFIX_", "=_", "'", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "methods_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lt", " ", "le", " ", "gt", " ", "ge", " ", "eq", " ", "ne", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "getitem", " ", "setitem", " ", "deli", "tem", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "len", " ", "contain", "s", " ", "iter", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hash", " ", "str", " ", "size", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enter", " ", "exit", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "adde", "d", " ", "div", "mod", " ", "and", " ", "rdi", "vmo", "d", " ", "here", " ", "inst", "ead", " ", "of", " ", "numeri", "cs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "there", " ", "is", " ", "no", " ", "idi", "vmo", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "div", "mod", " ", "rdi", "vmo", "d", " ", "neg", " ", "pos", " ", "abs", " ", "invert", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "complex", " ", "int", " ", "float", " ", "index", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trunc", " ", "floor", " ", "ceil", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numeri", "cs_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", " ", "sub", " ", "mul", " ", "mat", "mul", " ", "div", " ", "floor", "div", " ", "mod", " ", "lsh", "ift", " ", "rshi", "ft", " ", "and", " ", "xor", " ", "or", " ", "pow", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "numeri", "cs_", "+=_", "'", " ", "true", "div", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inplace_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "i", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "r", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "'", "bool", " ", "next", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "'", "unicode", " ", "long", " ", "nonzero", " ", "oct", " ", "hex", " ", "true", "div", " ", "rtr", "ued", "iv", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "inclu", "ding", " ", "\\u\\u", "prepar", "e\\u", "\\u", ",", " ", "\\u\\u", "instance", "check", "\\u\\u", ",", " ", "\\u\\u", "subclass", "check", "\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "as", " ", "the", "y", " ", "are", " ", "metaclass", " ", "method", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "del", "\\u\\u", " ", "is", " ", "not", " ", "support", "ed", " ", "at", " ", "all", " ", "as", " ", "it", " ", "caus", "es", " ", "problem", "s", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "non", "\\u", "defaults_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "cmp", "\\u\\u'_", ",_", "'\\u", "\\u", "gets", "lice", "\\u\\u'_", ",_", "'\\u", "\\u", "sets", "lice", "\\u\\u'_", ",_", "'\\u", "\\u", "coerce", "\\u\\u'_", ",_", "#", " ", "<", "3", ".", "x_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "get", "\\u\\u'_", ",_", "'\\u", "\\u", "set\\u", "\\u'_", ",_", "'\\u", "\\u", "delete", "\\u\\u'_", ",_", "'\\u", "\\u", "reverse", "d\\u", "\\u'_", ",_", "'\\u", "\\u", "missi", "ng", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "reduce", "\\u\\u'_", ",_", "'\\u", "\\u", "reduce", "\\u", "ex", "\\u\\u'_", ",_", "'\\u", "\\u", "getin", "ita", "rg", "s", "\\u\\u'_", ",_", "'\\u", "\\u", "getne", "war", "gs", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "getstate", "\\u\\u'_", ",_", "'\\u", "\\u", "setstate", "\\u\\u'_", ",_", "'\\u", "\\u", "getf", "ormat", "\\u\\u'_", ",_", "'\\u", "\\u", "setf", "ormat", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "repr", "\\u\\u'_", ",_", "'\\u", "\\u", "dir\\u", "\\u'_", ",_", "'\\u", "\\u", "subclasses", "\\u\\u'_", ",_", "'\\u", "\\u", "format\\u", "\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "magic", "s_", "=_", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "%", "s", "\\u\\u'_", "%_", "method_", "for_", "method_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "._", "join_", "(_", "[_", "magic", "\\u", "methods_", ",_", "numeri", "cs_", ",_", "inplace_", ",_", "right_", ",_", "extra_", "]_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "all", "\\u", "magic", "s_", "=_", "\\u", "magic", "s_", "|_", "\\u", "non", "\\u", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "unsup", "porte", "d\\u", "magic", "s_", "=_", "set_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "getattr", "\\u\\u'_", ",_", "'\\u", "\\u", "setattr", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "init", "\\u\\u'_", ",_", "'\\u", "\\u", "new", "\\u\\u'_", ",_", "'\\u", "\\u", "prepar", "e\\u", "\\u'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "instance", "check", "\\u\\u'_", ",_", "'\\u", "\\u", "subclass", "check", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "del", "\\u\\u'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "calcul", "ate", "\\u", "return", "\\u", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hash", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "str", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "size", "of", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "size", "of", "\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "unicode", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "unicode_", "(_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "return", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "lt", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "gt", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "le", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ge", "\\u\\u'_", ":_", "Not", "Implemented_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "int\\u", "\\u'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "len", "\\u\\u'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "exit", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "complex", "\\u\\u'_", ":_", "1j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "float", "\\u\\u'_", ":_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "bool\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "nonzero\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "oct", "\\u\\u'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hex", "\\u\\u'_", ":_", "'", "0x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "long", "\\u\\u'_", ":_", "long_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "index", "\\u\\u'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "side", "\\u", "effect", "\\u", "methods_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "eq", "\\u\\u'_", ":_", "\\u", "get", "\\u", "eq_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ne", "\\u\\u'_", ":_", "\\u", "get", "\\u", "ne_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "iter", "\\u\\u'_", ":_", "\\u", "get", "\\u", "iter_", ",_", "\\u\\u\\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\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ANY_", "=_", "\\u", "ANY_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "call_", "=_", "\\u", "Call_", "(_", "from", "\\u", "kal", "l_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Function", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "create", "\\u", "autospec_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "ANY_", "._", "\\u\\u", "eq\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Meth", "od", "Wrapper", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "ANY_", "._", "\\u\\u", "eq\\u\\u_", "._", "\\u\\u", "get\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "spec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ZoomerAnalytics/xlwings/xlwings/__init__.py
[ { "content": "from __future__ import absolute_import\nimport sys\n\n__version__ = '0.7.1'\n\n# Python 2 vs 3\nPY3 = sys.version_info[0] == 3\n\nif PY3:\n string_types = str\n xrange = range\n from builtins import map\n import builtins\nelse:\n string_types = basestring\n xrange = xrange\n from future_builtins import map\n builtins = __builtins__\n\n# Platform specifics\nif sys.platform.startswith('win'):\n from . import _xlwindows as xlplatform\nelse:\n from . import _xlmac as xlplatform\n\ntime_types = xlplatform.time_types\n\n# Errors\n\n# API\nfrom .main import Application, Workbook, Range, Chart, Sheet, Picture, Shape, Plot, view\nfrom .constants import *\n\n# UDFs\nif sys.platform.startswith('win'):\n from .udfs import xlfunc as func, xlsub as sub, xlret as ret, xlarg as arg, get_udf_module, import_udfs\n\n\n\n\n\n\n\n\n\n\n# Server\nif sys.platform.startswith('win'):\n from .server import serve", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ShapeAlreadyExists(Exception):\n pass", "metadata": "root.ShapeAlreadyExists", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def xlfunc(*args, **kwargs):\n raise Exception(\"Deprecation: 'xlfunc' has been renamed to 'func' - use 'import xlwings as xw' and decorate your function with '@xw.func'.\")", "metadata": "root.xlfunc", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def xlsub(*args, **kwargs):\n raise Exception(\"Deprecation: 'xlsub' has been renamed to 'sub' - use 'import xlwings as xw' and decorate your function with '@xw.sub'.\")", "metadata": "root.xlsub", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def xlret(*args, **kwargs):\n raise Exception(\"Deprecation: 'xlret' has been renamed to 'ret' - use 'import xlwings as xw' and decorate your function with '@xw.ret'.\")", "metadata": "root.xlret", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def xlarg(*args, **kwargs):\n raise Exception(\"Deprecation: 'xlarg' has been renamed to 'arg' - use 'import xlwings as xw' and decorate your function with '@xw.arg'.\")", "metadata": "root.xlarg", "header": "['module', '___EOS___']", "index": 52 } ]
[ { "span": "from builtins import map", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 28 }, { "span": "import builtins", "start_line": 12, "start_column": 4, "end_line": 12, "end_column": 19 } ]
[]
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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "7.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", " ", "vs", " ", "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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "types_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xrange_", "=_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "builtins_", "import_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "builtins_", "\\u\\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_", "xrange_", "=_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future", "\\u", "builtins_", "import_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtins_", "=_", "\\u\\u", "bui", "lti", "ns", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plat", "form", " ", "specific", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "import_", "\\u", "xl", "windows_", "as_", "xl", "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 ", " _", "from_", "._", "import_", "\\u", "xl", "mac_", "as_", "xl", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time", "\\u", "types_", "=_", "xl", "platform_", "._", "time", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "main_", "import_", "Application_", ",_", "Workbook", "_", ",_", "Range_", ",_", "Chart_", ",_", "Sheet_", ",_", "Picture", "_", ",_", "Shape_", ",_", "Plot_", ",_", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "UD", "Fs_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "udf", "s_", "import_", "xl", "func_", "as_", "func_", ",_", "xls", "ub_", "as_", "sub_", ",_", "xlr", "et_", "as_", "ret_", ",_", "xla", "rg_", "as_", "arg_", ",_", "get", "\\u", "udf", "\\u", "module_", ",_", "import", "\\u", "udf", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "server_", "import_", "serve_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Shape", "Al", "read", "y", "Exists_", "(_", "Exception_", ")_", ":_", "\\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_", "def_", "xl", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Dep", "reca", "tion", ":", " ", "'", "xl", "func", "'", " ", "has", " ", "bee", "n", " ", "renamed", " ", "to", " ", "'", "func", "'", " ", "-", " ", "use", " ", "'", "import", " ", "xl", "wing", "s", " ", "as", " ", "xw", "'", " ", "and", " ", "decorate", " ", "your", " ", "function", " ", "with", " ", "'@", "xw", ".", "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_", "xls", "ub_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Dep", "reca", "tion", ":", " ", "'", "xls", "ub", "'", " ", "has", " ", "bee", "n", " ", "renamed", " ", "to", " ", "'", "sub", "'", " ", "-", " ", "use", " ", "'", "import", " ", "xl", "wing", "s", " ", "as", " ", "xw", "'", " ", "and", " ", "decorate", " ", "your", " ", "function", " ", "with", " ", "'@", "xw", ".", "sub", "'.\"_", ")_", "\\u\\u\\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_", "xlr", "et_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Dep", "reca", "tion", ":", " ", "'", "xlr", "et", "'", " ", "has", " ", "bee", "n", " ", "renamed", " ", "to", " ", "'", "ret", "'", " ", "-", " ", "use", " ", "'", "import", " ", "xl", "wing", "s", " ", "as", " ", "xw", "'", " ", "and", " ", "decorate", " ", "your", " ", "function", " ", "with", " ", "'@", "xw", ".", "ret", "'.\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "xla", "rg_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Dep", "reca", "tion", ":", " ", "'", "xla", "rg", "'", " ", "has", " ", "bee", "n", " ", "renamed", " ", "to", " ", "'", "arg", "'", " ", "-", " ", "use", " ", "'", "import", " ", "xl", "wing", "s", " ", "as", " ", "xw", "'", " ", "and", " ", "decorate", " ", "your", " ", "function", " ", "with", " ", "'@", "xw", ".", "arg", "'.\"_", ")_", "\\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, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Modification of parameter with default
openelections/openelections-core/openelex/lib/__init__.py
[ { "content": "def standardized_filename(state, start_date, extension,\n party=None, special=False, race_type=None, reporting_level=None,\n jurisdiction=None, office=None, office_district=None,\n prefix_bits=[], suffix_bits=[], sep=\"__\"):\n \"\"\"\n Standardize an election-related filename.\n\n For more on filename standardization conventions, see\n http://docs.openelections.net/archive-standardization/.\n\n Args:\n state (string): State abbreviation, for example \"md\".\n start_date (string): String representing the election's start date\n in YYYY-MM-DD format.\n extension (string): Filename extension, including the leading '.'. For\n example, \".csv\".\n party (string, optional): Slug representing the political party of\n information in the file.\n special (boolean, optional): Whether the file contains data related to a\n special election. Default is False.\n race_type (string, optional): Slug representing the type of election\n contest. For example, \"general\", \"primary\", etc.\n reporting_level (string, optional): Slug representing the reporting level of\n the data file. This could be something like 'county' or\n 'precinct'.\n jurisdiction (string, optional): The jurisdiction of the data\n covered in the file.\n office (string, optional): Office if results are for a single office.\n office_district (string, optional): Office district number if\n the data in the file are for a single office.\n prefix_bits (list, optional): List of strings that will be prepended to\n the generated filename and separated by the value of ``sep``.\n suffix_bits (list, optional): List of strings that will be appended\n to the generated filename and separated by the value of ``sep``.\n sep (string, optional): Separator between filename elements. Default\n is \"__\".\n\n Returns:\n A string representing the standardized filename for\n election-related data.\n\n \"\"\"\n # Store filename components in a list that we'll eventually join together\n bits = []\n\n # Filename starts with the prefix bits, if any\n bits.extend(prefix_bits)\n\n # All filenames need a date and a state\n bits.extend([\n start_date.replace('-', ''),\n state.lower(),\n ])\n\n if special:\n bits.append('special')\n\n if party:\n bits.append(slugify(party))\n\n if race_type:\n bits.append(race_type.replace('-', '_'))\n\n if jurisdiction:\n bits.append(slugify(jurisdiction))\n\n if office:\n bits.append(slugify(office))\n\n if office_district:\n bits.append(slugify(office_district))\n\n if reporting_level:\n bits.append(reporting_level)\n\n bits.extend(suffix_bits)\n\n return sep.join(bits) + extension", "metadata": "root.standardized_filename", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "bits.", "start_line": 82, "start_column": 4, "end_line": 82, "end_column": 8 }, { "span": "bits.", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 12 }, { "span": "bits.", "start_line": 91, "start_column": 8, "end_line": 91, "end_column": 12 }, { "span": "bits.", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 12 }, { "span": "bits.", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 12 }, { "span": "bits.", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 12 }, { "span": "bits.", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 12 }, { "span": "bits.", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 12 }, { "span": "bits.", "start_line": 108, "start_column": 4, "end_line": 108, "end_column": 8 } ]
[ { "span": "prefix_bits=", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 15 } ]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "standardize", "d\\u", "filename_", "(_", "state_", ",_", "start", "\\u", "date_", ",_", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "party_", "=_", "None_", ",_", "special_", "=_", "False_", ",_", "race", "\\u", "type_", "=_", "None_", ",_", "reporting", "\\u", "level_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jur", "isdi", "ction_", "=_", "None_", ",_", "office", "_", "=_", "None_", ",_", "office", "\\u", "district_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix", "\\u", "bits_", "=_", "[_", "]_", ",_", "suff", "ix", "\\u", "bits_", "=_", "[_", "]_", ",_", "sep_", "=_", "\"\\u\\u", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Standard", "ize", " ", "an", " ", "election", "-", "relate", "d", " ", "filename", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "on", " ", "filename", " ", "standard", "izatio", "n", " ", "convention", "s", ",", " ", "see", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "docs", ".", "opene", "lection", "s", ".", "net", "/", "archive", "-", "standard", "izatio", "n", "/.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "state", " ", "(", "string", "):", " ", "State", " ", "abbreviation", ",", " ", "for", " ", "example", " ", "\"", "md", "\".\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "date", " ", "(", "string", "):", " ", "String", " ", "represent", "ing", " ", "the", " ", "election", "'", "s", " ", "start", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "YYY", "Y", "-", "MM", "-", "DD", " ", "format", ".", "\\", "10", ";", " ", " ", " ", " ", "extensi", "on", " ", "(", "string", "):", " ", "File", "name", " ", "extensi", "on", ",", " ", "inclu", "ding", " ", "the", " ", "lead", "ing", " ", "'.'", ".", " ", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "example", ",", " ", "\".", "csv", "\".\\", "10", ";", " ", " ", " ", " ", "part", "y", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Sl", "ug", " ", "represent", "ing", " ", "the", " ", "politic", "al", " ", "part", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "in", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "special", " ", "(", "boolean", ",", " ", "option", "al", "):", " ", "Whe", "ther", " ", "the", " ", "file", " ", "contain", "s", " ", "data", " ", "relate", "d", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "special", " ", "election", ".", " ", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "race", "\\u", "type", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Sl", "ug", " ", "represent", "ing", " ", "the", " ", "type", " ", "of", " ", "election", "\\", "10", ";", " ", " ", " ", " ", "contest", ".", " ", " ", "For", " ", "example", ",", " ", "\"", "genera", "l", "\",", " ", "\"", "primary", "\",", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "reporting", "\\u", "level", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Sl", "ug", " ", "represent", "ing", " ", "the", " ", "reporting", " ", "level", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "data", " ", "file", ".", " ", " ", "Thi", "s", " ", "coul", "d", " ", "be", " ", "somet", "hing", " ", "like", " ", "'", "county", "'", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "'", "preci", "nct", "'.", "\\", "10", ";", " ", " ", " ", " ", "jur", "isdi", "ction", " ", "(", "string", ",", " ", "option", "al", "):", " ", "The", " ", "jur", "isdi", "ction", " ", "of", " ", "the", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "covered", " ", "in", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "office", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Office", " ", "if", " ", "results", " ", "are", " ", "for", " ", "a", " ", "single", " ", "office", ".", "\\", "10", ";", " ", " ", " ", " ", "office", "\\u", "district", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Office", " ", "district", " ", "number", " ", "if", "\\", "10", ";", " ", " ", " ", "the", " ", "data", " ", "in", " ", "the", " ", "file", " ", "are", " ", "for", " ", "a", " ", "single", " ", "office", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", "\\u", "bits", " ", "(", "list", ",", " ", "option", "al", "):", " ", "List", " ", "of", " ", "string", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "generat", "ed", " ", "filename", " ", "and", " ", "separate", "d", " ", "by", " ", "the", " ", "value", " ", "of", " ", "``", "sep", "``.", "\\", "10", ";", " ", " ", " ", " ", "suff", "ix", "\\u", "bits", " ", "(", "list", ",", " ", "option", "al", "):", " ", "List", " ", "of", " ", "string", "s", " ", "tha", "t", " ", "will", " ", "be", " ", "append", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "generat", "ed", " ", "filename", " ", "and", " ", "separate", "d", " ", "by", " ", "the", " ", "value", " ", "of", " ", "``", "sep", "``.", "\\", "10", ";", " ", " ", " ", " ", "sep", " ", "(", "string", ",", " ", "option", "al", "):", " ", "Sepa", "rator", " ", "bet", "ween", " ", "filename", " ", "element", "s", ".", " ", " ", "Default", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "\"\\u\\u", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "represent", "ing", " ", "the", " ", "standardize", "d", " ", "filename", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "election", "-", "relate", "d", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "filename", " ", "component", "s", " ", "in", " ", "a", " ", "list", " ", "tha", "t", " ", "we", "'", "ll", " ", "eventual", "ly", " ", "join", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "bits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "File", "name", " ", "starts", " ", "with", " ", "the", " ", "prefix", " ", "bits", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "bits_", "._", "extend_", "(_", "prefix", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "filename", "s", " ", "need", " ", "a", " ", "date", " ", "and", " ", "a", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "bits_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "date_", "._", "replace_", "(_", "'-'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "lower_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "special_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "'", "special", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "party_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "slugify_", "(_", "party_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "race", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "race", "\\u", "type_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "jur", "isdi", "ction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "slugify_", "(_", "jur", "isdi", "ction_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "office", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "slugify_", "(_", "office", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "office", "\\u", "district_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "slugify_", "(_", "office", "\\u", "district_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reporting", "\\u", "level_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "._", "append_", "(_", "reporting", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\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, 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, 0, 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, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
neurodata/ndstore/test/test_ramon.py
[ { "content": "# Copyright 2014 Open Connectome Project (http://openconnecto.me)\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 urllib2\nimport re\nimport tempfile\nimport h5py\nimport random \nimport csv\nimport numpy as np\nimport pytest\nimport httplib\nfrom contextlib import closing\n\nfrom params import Params\nfrom postmethods import putAnnotation, getAnnotation\nfrom ramon import H5AnnotationFile, getH5id, makeAnno, getId, getField, setField\nimport kvengine_to_test\nimport site_to_test\nimport makeunitdb\nSITE_HOST = site_to_test.site\n\n\np = Params()\np.token = 'unittest'\np.resolution = 0\np.channels = ['unit_anno']\n\n\n# RBTODO add tests key/value and compound fields.\n # assign a field for a wrong annotation type\n# url = \"http://%s/ca/%s/%s/setField/segmentclass/2/\" % ( SITE_HOST, 'unittest',str(annid))\n# with pytest.raises(urllib2.HTTPError): \n# req = urllib2.Request ( url )\n# f = urllib2.urlopen ( url )\n\n# def test_kvpairs(self):\n#\n# \"\"\"Test 1: Create a minimal HDF5 file\"\"\"\n# # Create an in-memory HDF5 file\n# tmpfile = tempfile.NamedTemporaryFile()\n# h5fh = h5py.File ( tmpfile.name )\n#\n# # Create the top level annotation id namespace\n# idgrp = h5fh.create_group ( str(0) )\n#\n# # Create a metadata group\n# mdgrp = idgrp.create_group ( \"METADATA\" )\n#\n# kvpairs={}\n#\n# # Turn our dictionary into a csv file\n# fstring = cStringIO.StringIO()\n# csvw = csv.writer(fstring, delimiter=',')\n# csvw.writerows([r for r in kvpairs.iteritems()])\n#\n# # User-defined metadata\n# mdgrp.create_dataset ( \"KVPAIRS\", (1,), dtype=h5py.special_dtype(vlen=str), data=fstring.getvalue())\n#\n# # Now put an empty file\n# # Build the put URL\n# url = \"http://%s/ca/%s/\" % ( SITE_HOST, 'unittest')\n#\n# # write an object (server creates identifier)\n# req = urllib2.Request ( url, tmpfile.read())\n# response = urllib2.urlopen(req)\n# putid = int(response.read())\n#\n# # now read and verify\n# # retrieve the annotation\n# url = \"http://%s/ca/%s/%s/\" % ( SITE_HOST, 'unittest', str(putid))\n# f = urllib2.urlopen ( url )\n# retfile = tempfile.NamedTemporaryFile ( )\n# retfile.write ( f.read() )\n# retfile.seek(0)\n# h5ret = h5py.File ( tmpfile.name, driver='core', backing_store=False )\n#\n# mdgrpret = idgrpret['METADATA']\n# idgrpret = h5ret.get(str(putid1))\n#\n# assert ( mdgrpret['KVPAIRS'][:] == '' )\n#\n# for i in range(10):\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Test_Ramon:\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.Test_Ramon", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def setup_class(self):\n \"\"\"Create the unittest database\"\"\"\n makeunitdb.createTestDB(p.token, readonly=0)", "metadata": "root.Test_Ramon.setup_class", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 42 }, { "content": " def teardown_class (self):\n \"\"\"Destroy the unittest database\"\"\"\n makeunitdb.deleteTestDB(p.token)", "metadata": "root.Test_Ramon.teardown_class", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 46 }, { "content": " def test_anno_minmal(self):\n \"\"\"Upload a minimal and maximal annotation. Verify fields.\"\"\"\n \n # Create an in-memory HDF5 file\n tmpfile = tempfile.NamedTemporaryFile()\n h5fh = h5py.File ( tmpfile.name )\n # Create the top level annotation id namespace\n idgrp = h5fh.create_group ( str(0) )\n h5fh.flush()\n tmpfile.seek(0)\n \n p.annoid = putAnnotation(p, tmpfile)\n h5ret = getAnnotation(p)\n\n idgrpret = h5ret.get(str(p.annoid))\n assert idgrpret\n assert ( idgrpret['ANNOTATION_TYPE'][0] == 1 )\n assert not idgrpret.get('RESOLUTION')\n assert not idgrpret.get('XYZOFFSET')\n assert not idgrpret.get('VOXELS')\n assert not idgrpret.get('CUTOUT')\n mdgrpret = idgrpret['METADATA']\n assert mdgrpret\n assert ( mdgrpret['CONFIDENCE'][0] == 0.0 )\n assert ( mdgrpret['STATUS'][0] == 0 )\n assert ( mdgrpret['KVPAIRS'][:] == '' )\n assert ( mdgrpret['AUTHOR'][:] == 'unknown' )", "metadata": "root.Test_Ramon.test_anno_minmal", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 51 }, { "content": " def test_anno_full (self):\n \"\"\"Upload a fully populated HDF5 file\"\"\"\n \n # Create an in-memory HDF5 file\n tmpfile = tempfile.NamedTemporaryFile()\n h5fh = h5py.File ( tmpfile.name )\n # Create the top level annotation id namespace\n idgrp = h5fh.create_group ( str(0) )\n \n # Create a metadata group\n mdgrp = idgrp.create_group ( \"METADATA\" )\n\n # now lets add a bunch of random values for the specific annotation type\n ann_status = random.randint(0,4)\n ann_confidence = random.random()\n ann_author = 'unittest_author'\n\n # Annotation type\n idgrp.create_dataset ( \"ANNOTATION_TYPE\", (1,), np.uint32, data=1 )\n\n # Set Annotation specific metadata\n mdgrp.create_dataset ( \"STATUS\", (1,), np.uint32, data=ann_status )\n mdgrp.create_dataset ( \"CONFIDENCE\", (1,), np.float, data=ann_confidence )\n mdgrp.create_dataset ( \"AUTHOR\", (1,), dtype=h5py.special_dtype(vlen=str), data=ann_author )\n\n h5fh.flush()\n tmpfile.seek(0)\n\n p.annoid = putAnnotation(p, tmpfile)\n h5ret = getAnnotation(p)\n\n idgrpret = h5ret.get(str(p.annoid))\n assert idgrpret\n assert ( idgrpret['ANNOTATION_TYPE'][0] == 1 )\n assert not idgrpret.get('RESOLUTION')\n assert not idgrpret.get('XYZOFFSET')\n assert not idgrpret.get('VOXELS')\n assert not idgrpret.get('CUTOUT')\n mdgrpret = idgrpret['METADATA']\n assert mdgrpret\n assert ( abs(mdgrpret['CONFIDENCE'][0] - ann_confidence) < 0.0001 )\n assert ( mdgrpret['STATUS'][0] == ann_status )\n assert ( mdgrpret['AUTHOR'][:] == ann_author )\n\n tmpfile.close()", "metadata": "root.Test_Ramon.test_anno_full", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 80 }, { "content": " def test_anno_update (self):\n \"\"\"Upload a Updated file with new data\"\"\"\n\n tmpfile = tempfile.NamedTemporaryFile()\n h5fh = h5py.File ( tmpfile.name )\n\n # Create the top level annotation id namespace\n idgrp = h5fh.create_group ( str(p.annoid) )\n\n # Create a metadata group\n mdgrp = idgrp.create_group ( \"METADATA\" )\n\n # now lets add a bunch of random values for the specific annotation type\n ann_status = random.randint(0,4)\n ann_confidence = random.random()\n ann_author = 'unittest_author2'\n\n # Annotation type\n idgrp.create_dataset ( \"ANNOTATION_TYPE\", (1,), np.uint32, data=1 )\n\n # Set Annotation specific metadata\n mdgrp.create_dataset ( \"STATUS\", (1,), np.uint32, data=ann_status )\n mdgrp.create_dataset ( \"CONFIDENCE\", (1,), np.float, data=ann_confidence )\n mdgrp.create_dataset ( \"AUTHOR\", (1,), dtype=h5py.special_dtype(vlen=str), data=ann_author )\n\n h5fh.flush()\n tmpfile.seek(0)\n\n p.field = 'update'\n p.annoid = putAnnotation(p, tmpfile)\n p.field = None\n h5ret = getAnnotation(p)\n\n idgrpret = h5ret.get(str(p.annoid))\n assert idgrpret\n assert ( idgrpret['ANNOTATION_TYPE'][0] == 1 )\n assert not idgrpret.get('RESOLUTION')\n assert not idgrpret.get('XYZOFFSET')\n assert not idgrpret.get('VOXELS')\n assert not idgrpret.get('CUTOUT')\n mdgrpret = idgrpret['METADATA']\n assert mdgrpret\n assert ( abs(mdgrpret['CONFIDENCE'][0] - ann_confidence) < 0.0001 )\n #assert ( mdgrpret['CONFIDENCE'][0] == ann_confidence )\n assert ( mdgrpret['STATUS'][0] == ann_status )\n assert ( mdgrpret['AUTHOR'][:] == ann_author )", "metadata": "root.Test_Ramon.test_anno_update", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 127 }, { "content": " def test_anno_delete (self):\n \"\"\"Delete the object\"\"\"\n \n # Build the delete URL\n try:\n (base,suffix) = SITE_HOST.split(\"/\",1)\n except:\n base = SITE_HOST\n suffix = None\n\n conn = httplib.HTTPConnection ( base )\n\n if suffix:\n conn.request ('DELETE', '/{}/ca/{}/{}/{}/'.format(suffix, 'unittest', 'unit_anno', p.annoid)) \n else:\n conn.request ('DELETE', '/ca/{}/{}/{}/'.format('unittest', 'unit_anno', p.annoid))\n\n resp = conn.getresponse()\n content=resp.read()\n\n assert content == 'Success'\n\n # retrieve the annotation\n # verify that it's not there.\n url = \"http://{}/ca/{}/{}/{}/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n urllib2.urlopen ( url )", "metadata": "root.Test_Ramon.test_anno_delete", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 175 }, { "content": " def test_anno_upload( self ):\n \"\"\"Upload all different kinds of annotations and retrieve\"\"\"\n\n for anntype in [ 1, 2, 3, 4, 5, 6]:\n \n annoid = 0\n f = H5AnnotationFile ( anntype, annoid )\n\n putid1 = putAnnotation(p, f)\n\n # this assumes that +1 is available (which it is)\n newid = putid1 + 1\n f = H5AnnotationFile ( anntype, newid )\n\n putid2 = putAnnotation(p, f)\n\n # retrieve both annotations\n p.annoid = putid1\n assert ( putid1 == getId(p) )\n p.annoid = putid2\n assert ( putid2 == getId(p) )", "metadata": "root.Test_Ramon.test_anno_upload", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 204 }, { "content": " def test_annotation_field (self):\n \"\"\"Upload an annotation and test it's fields\"\"\"\n\n # Make an annotation \n makeAnno (p, 1)\n \n # Test Status\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test confidence\n confidence = random.random ()\n f = setField(p, 'confidence', confidence)\n f = getField(p, 'confidence')\n assert confidence - float(f.read()) < 0.001\n \n # Test author\n #f = self.getField(p, 'author')\n #assert 'Unit Test' == f.read()", "metadata": "root.Test_Ramon.test_annotation_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 227 }, { "content": " def test_synapse_field (self):\n \"\"\"Upload a synapse and test it's fields\"\"\"\n\n # Make a synapse\n makeAnno (p, 2)\n\n # Test synapse type\n synapse_type = random.randint (0,100)\n f = setField(p, 'synapse_type', synapse_type)\n f = getField(p, 'synapse_type')\n assert synapse_type == int(f.read()) \n\n # Test the weight\n weight = random.random ()\n f = setField(p, 'weight', weight)\n f = getField(p, 'weight')\n assert weight - float(f.read()) < 0.001\n\n # Test the inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test the seeds\n seeds = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'seeds', ','.join([str(i) for i in seeds]))\n f = getField(p, 'seeds')\n assert ','.join([str(i) for i in seeds]) == f.read()", "metadata": "root.Test_Ramon.test_synapse_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 250 }, { "content": " def test_seed_field (self):\n \"\"\"Upload a seed and test it's fields\"\"\"\n\n # Make a seed\n makeAnno (p, 3)\n\n # Test the parent\n parent = random.randint (0,100)\n f = setField(p, 'parent', parent)\n f = getField(p, 'parent')\n assert parent == int(f.read()) \n\n # Test the source\n source = random.randint (0,100)\n f = setField(p, 'source', source)\n f = getField(p, 'source')\n assert source == int(f.read()) \n\n # Test the cubelocation\n cubelocation = random.randint (0,100)\n f = setField(p, 'cubelocation', cubelocation)\n f = getField(p, 'cubelocation')\n assert cubelocation == int(f.read()) \n \n # Test the position\n position = [random.randint (0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'position', ','.join([str(i) for i in position]))\n f = getField(p, 'position')\n assert ','.join([str(i) for i in position]) == f.read()", "metadata": "root.Test_Ramon.test_seed_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 280 }, { "content": " def test_segment_field (self):\n \"\"\"Upload a segment and test it's fields\"\"\"\n\n # Make a segment\n makeAnno (p, 4)\n\n # Test the parentseed\n parentseed = random.randint (0,100)\n f = setField(p, 'parentseed', parentseed)\n f = getField(p, 'parentseed')\n assert parentseed == int(f.read()) \n\n # Test the segmentclass\n segmentclass = random.randint (0,100)\n f = setField(p, 'segmentclass', segmentclass)\n f = getField(p, 'segmentclass')\n assert segmentclass == int(f.read()) \n\n # Test the neuron\n neuron = random.randint (0,100)\n f = setField(p, 'neuron', neuron)\n f = getField(p, 'neuron')\n assert neuron == int(f.read()) \n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n \n # Test the synapses\n synapses = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'synapses', ','.join([str(i) for i in synapses]))\n f = getField(p, 'synapses')\n assert ','.join([str(i) for i in synapses]) == f.read()", "metadata": "root.Test_Ramon.test_segment_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 311 }, { "content": " def test_neuron_field (self):\n \"\"\"Upload a neuron and test it's fields\"\"\"\n\n # Make a neuron\n makeAnno (p, 5)\n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test segments\n status = [random.randint (0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'segments', \",\".join([str(i) for i in status]))\n f = getField(p, 'segments')\n assert \",\".join([str(i) for i in status]) == f.read()", "metadata": "root.Test_Ramon.test_neuron_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 348 }, { "content": " def test_organelle_field (self):\n \"\"\"Upload an organelle and test it's fields\"\"\"\n\n # Make an organelle \n makeAnno ( p, 6 )\n\n # Test the parentseed\n parentseed = random.randint (0,100)\n f = setField(p, 'parentseed', parentseed)\n f = getField(p, 'parentseed')\n assert parentseed == int(f.read()) \n\n # Test the organelleclass\n organelleclass = random.randint (0,100)\n f = setField(p, 'organelleclass', organelleclass)\n f = getField(p, 'organelleclass')\n assert organelleclass == int(f.read()) \n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test the seeds\n seeds = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'seeds', ','.join([str(i) for i in seeds]))\n f = getField(p, 'seeds')\n assert ','.join([str(i) for i in seeds]) == f.read()", "metadata": "root.Test_Ramon.test_organelle_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 366 }, { "content": " def test_wrong_field ( self ):\n \n # Make an annotation \n makeAnno (p, 2)\n\n # Test the synapse type\n synapse_type = random.randint (0,100)\n f = setField(p, 'synapse_type', synapse_type)\n f = getField(p, 'synapse_type')\n assert synapse_type == int(f.read()) \n\n # Test the weight\n weight = random.random ()\n f = setField(p, 'weight', weight)\n f = getField(p, 'weight')\n assert weight - float(f.read()) < 0.001\n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read())\n \n # bad format to a number\n url = \"http://{}/ca/{}/{}/{}/setField/status/aa/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )\n \n # request a missing field\n url = \"http://{}/ca/{}/{}/{}/getField/othernonesuch/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )", "metadata": "root.Test_Ramon.test_wrong_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 396 } ]
[ { "span": "import re", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 9 }, { "span": "import csv", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 10 }, { "span": "from contextlib import closing", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 30 }, { "span": "from ramon import H5AnnotationFile, getH5id, makeAnno, getId, getField, setField", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 80 }, { "span": "import kvengine_to_test", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\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_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "h5py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "contextlib_", "import_", "closing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "params_", "import_", "Params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "post", "methods_", "import_", "put", "Annotation_", ",_", "get", "Annotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ram", "on_", "import_", "H", "5", "Annot", "ation", "File_", ",_", "get", "H", "5", "id_", ",_", "make", "Ann", "o_", ",_", "get", "Id_", ",_", "get", "Field_", ",_", "set", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "kv", "eng", "ine", "\\u", "to", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "site", "\\u", "to", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "make", "unit", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SITE", "\\u", "HOST_", "=_", "site", "\\u", "to", "\\u", "test_", "._", "site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "token_", "=_", "'", "unittest", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "resolution_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "channels_", "=_", "[_", "'", "unit", "\\u", "anno", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "RB", "TOD", "O", " ", "add", " ", "tests", " ", "key", "/", "value", " ", "and", " ", "compo", "und", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "assign", " ", "a", " ", "field", " ", "for", " ", "a", " ", "wrong", " ", "annot", "ation", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "url", " ", "=", " ", " ", "\"", "http", "://", "%", "s", "/", "ca", "/", "%", "s", "/", "%", "s", "/", "set", "Field", "/", "segment", "class", "/", "2", "/\"", " ", "%", " ", "(", " ", "SITE", "\\u", "HOST", ",", " ", "'", "unittest", "',", "str", "(", "ann", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "with", " ", "pytest", ".", "raise", "s", "(", "url", "lib", "2", ".", "HTTP", "Error", "):", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "req", " ", "=", " ", "url", "lib", "2", ".", "Request", " ", "(", " ", "url", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "f", " ", "=", " ", "url", "lib", "2", ".", "urlo", "pen", " ", "(", " ", "url", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "def", " ", "test\\u", "kv", "pair", "s", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"\"\"", "Test", " ", "1", ":", " ", "Creat", "e", " ", "a", " ", "minima", "l", " ", "HDF", "5", " ", "file", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Creat", "e", " ", "an", " ", "in", "-", "memory", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "tmpfile", " ", "=", " ", "tempfile", ".", "Name", "d", "Tempora", "ry", "File", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h5", "fh", " ", "=", " ", "h5", "py", ".", "File", " ", "(", " ", "tmpfile", ".", "name", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Creat", "e", " ", "the", " ", "top", " ", "level", " ", "annot", "ation", " ", "id", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "id", "grp", " ", "=", " ", "h5", "fh", ".", "create", "\\u", "group", " ", "(", " ", "str", "(", "0", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Creat", "e", " ", "a", " ", "metadata", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "md", "grp", " ", "=", " ", "id", "grp", ".", "create", "\\u", "group", " ", "(", " ", "\"", "METAD", "ATA", "\"", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "kv", "pair", "s", "={}", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Turn", " ", "our", " ", "dictionar", "y", " ", "int", "o", " ", "a", " ", "csv", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "fstr", "ing", " ", "=", " ", "c", "String", "IO", ".", "String", "IO", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "csv", "w", " ", "=", " ", "csv", ".", "writer", "(", "fstr", "ing", ",", " ", "delimiter", "='", ",'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "csv", "w", ".", "writer", "ow", "s", "([", "r", " ", "for", " ", "r", " ", "in", " ", "kv", "pair", "s", ".", "iter", "items", "()]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "User", "-", "defin", "ed", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "md", "grp", ".", "create", "\\u", "dataset", " ", "(", " ", "\"", "KV", "PAIR", "S", "\",", " ", "(", "1", ",)", ",", " ", "dt", "ype", "=", "h5", "py", ".", "special", "\\u", "dt", "ype", "(", "vl", "en", "=", "str", "),", " ", "data", "=", "fstr", "ing", ".", "getv", "alu", "e", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "No", "w", " ", "put", " ", "an", " ", "empty", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "Build", " ", "the", " ", "put", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "url", " ", "=", " ", "\"", "http", "://", "%", "s", "/", "ca", "/", "%", "s", "/\"", " ", "%", " ", "(", " ", "SITE", "\\u", "HOST", ",", " ", "'", "unittest", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "write", " ", "an", " ", "object", " ", "(", "server", " ", "create", "s", " ", "identifi", "er", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "req", " ", "=", " ", "url", "lib", "2", ".", "Request", " ", "(", " ", "url", ",", " ", "tmpfile", ".", "read", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "response", " ", "=", " ", "url", "lib", "2", ".", "urlo", "pen", "(", "req", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "put", "id", " ", "=", " ", "int", "(", "response", ".", "read", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "now", " ", "read", " ", "and", " ", "verify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "#", " ", "retrieve", " ", "the", " ", "annotation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "url", " ", "=", " ", "\"", "http", "://", "%", "s", "/", "ca", "/", "%", "s", "/", "%", "s", "/\"", " ", "%", " ", "(", " ", "SITE", "\\u", "HOST", ",", " ", "'", "unittest", "',", " ", "str", "(", "put", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "f", " ", "=", " ", "url", "lib", "2", ".", "urlo", "pen", " ", "(", " ", "url", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ret", "file", " ", "=", " ", "tempfile", ".", "Name", "d", "Tempora", "ry", "File", " ", "(", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ret", "file", ".", "write", " ", "(", " ", "f", ".", "read", "()", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "ret", "file", ".", "seek", "(", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "h5", "ret", " ", "=", " ", "h5", "py", ".", "File", " ", "(", " ", "tmpfile", ".", "name", ",", " ", "driver", "='", "core", "',", " ", "backing", "\\u", "store", "=", "Fal", "se", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "md", "grp", "ret", " ", "=", " ", "id", "grp", "ret", "['", "METAD", "ATA", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "id", "grp", "ret", " ", "=", " ", "h5", "ret", ".", "get", "(", "str", "(", "put", "id", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "assert", " ", "(", " ", "md", "grp", "ret", "['", "KV", "PAIR", "S", "']", "[:", "]", " ", "==", " ", "''", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "range", "(", "10", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "the", " ", "unittest", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "unit", "db_", "._", "create", "Test", "DB_", "(_", "p_", "._", "token_", ",_", "readonly_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Destr", "oy", " ", "the", " ", "unittest", " ", "databa", "se", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "unit", "db_", "._", "delete", "Test", "DB_", "(_", "p_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "anno", "\\u", "min", "mal", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "minima", "l", " ", "and", " ", "maximal", " ", "annot", "ation", ".", " ", "Verify", " ", "fields", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "in", "-", "memory", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "=_", "h5py_", "._", "File_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "top", " ", "level", " ", "annot", "ation", " ", "id", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "=_", "h5", "fh_", "._", "create", "\\u", "group_", "(_", "str_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "Annotation_", "(_", "p_", ",_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "ret_", "=_", "get", "Annotation_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp", "ret_", "=_", "h5", "ret_", "._", "get_", "(_", "str_", "(_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "id", "grp", "ret_", "[_", "'", "ANNOTAT", "ION", "\\u", "TYPE", "'_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "RESOL", "UTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "XY", "ZO", "FF", "SET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "VO", "XE", "LS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "CUT", "OUT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp", "ret_", "=_", "id", "grp", "ret_", "[_", "'", "METAD", "ATA", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "CONF", "IDE", "NCE", "'_", "]_", "[_", "0_", "]_", "==_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "STATUS", "'_", "]_", "[_", "0_", "]_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "KV", "PAIR", "S", "'_", "]_", "[_", ":_", "]_", "==_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "AUTHOR", "'_", "]_", "[_", ":_", "]_", "==_", "'", "unknown", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "anno", "\\u", "full_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "full", "y", " ", "populate", "d", " ", "HDF", "5", " ", "file", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "in", "-", "memory", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "=_", "h5py_", "._", "File_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "top", " ", "level", " ", "annot", "ation", " ", "id", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "=_", "h5", "fh_", "._", "create", "\\u", "group_", "(_", "str_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "metadata", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "md", "grp_", "=_", "id", "grp_", "._", "create", "\\u", "group_", "(_", "\"", "METAD", "ATA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "lets", " ", "add", " ", "a", " ", "bunch", " ", "of", " ", "random", " ", "values", " ", "for", " ", "the", " ", "specific", " ", "annot", "ation", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "ann", "\\u", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "\\u", "confidence_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "\\u", "author_", "=_", "'", "unittest", "\\u", "author", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Annot", "ation", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "ANNOTAT", "ION", "\\u", "TYPE", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "Annot", "ation", " ", "specific", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "STATUS", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "ann", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "CONF", "IDE", "NCE", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "float_", ",_", "data_", "=_", "ann", "\\u", "confidence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "AUTHOR", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "dtype_", "=_", "h5py_", "._", "special", "\\u", "dtype_", "(_", "vl", "en_", "=_", "str_", ")_", ",_", "data_", "=_", "ann", "\\u", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h5", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "Annotation_", "(_", "p_", ",_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "ret_", "=_", "get", "Annotation_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp", "ret_", "=_", "h5", "ret_", "._", "get_", "(_", "str_", "(_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "id", "grp", "ret_", "[_", "'", "ANNOTAT", "ION", "\\u", "TYPE", "'_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "RESOL", "UTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "XY", "ZO", "FF", "SET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "VO", "XE", "LS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "CUT", "OUT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp", "ret_", "=_", "id", "grp", "ret_", "[_", "'", "METAD", "ATA", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "abs_", "(_", "md", "grp", "ret_", "[_", "'", "CONF", "IDE", "NCE", "'_", "]_", "[_", "0_", "]_", "-_", "ann", "\\u", "confidence_", ")_", "<_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "STATUS", "'_", "]_", "[_", "0_", "]_", "==_", "ann", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "AUTHOR", "'_", "]_", "[_", ":_", "]_", "==_", "ann", "\\u", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "anno", "\\u", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "Update", "d", " ", "file", " ", "with", " ", "new", " ", "data", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "=_", "h5py_", "._", "File_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "top", " ", "level", " ", "annot", "ation", " ", "id", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "=_", "h5", "fh_", "._", "create", "\\u", "group_", "(_", "str_", "(_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "metadata", " ", "group_", "\\u\\u\\uNL\\u\\u\\u_", "md", "grp_", "=_", "id", "grp_", "._", "create", "\\u", "group_", "(_", "\"", "METAD", "ATA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "lets", " ", "add", " ", "a", " ", "bunch", " ", "of", " ", "random", " ", "values", " ", "for", " ", "the", " ", "specific", " ", "annot", "ation", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "ann", "\\u", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "\\u", "confidence_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ann", "\\u", "author_", "=_", "'", "unittest", "\\u", "author", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Annot", "ation", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "ANNOTAT", "ION", "\\u", "TYPE", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "Annot", "ation", " ", "specific", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "STATUS", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "ann", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "CONF", "IDE", "NCE", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "float_", ",_", "data_", "=_", "ann", "\\u", "confidence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "AUTHOR", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "dtype_", "=_", "h5py_", "._", "special", "\\u", "dtype_", "(_", "vl", "en_", "=_", "str_", ")_", ",_", "data_", "=_", "ann", "\\u", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h5", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "field_", "=_", "'", "update", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "Annotation_", "(_", "p_", ",_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "field_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "ret_", "=_", "get", "Annotation_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp", "ret_", "=_", "h5", "ret_", "._", "get_", "(_", "str_", "(_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "id", "grp", "ret_", "[_", "'", "ANNOTAT", "ION", "\\u", "TYPE", "'_", "]_", "[_", "0_", "]_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "RESOL", "UTION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "XY", "ZO", "FF", "SET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "VO", "XE", "LS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "id", "grp", "ret_", "._", "get_", "(_", "'", "CUT", "OUT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "grp", "ret_", "=_", "id", "grp", "ret_", "[_", "'", "METAD", "ATA", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "md", "grp", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "abs_", "(_", "md", "grp", "ret_", "[_", "'", "CONF", "IDE", "NCE", "'_", "]_", "[_", "0_", "]_", "-_", "ann", "\\u", "confidence_", ")_", "<_", "0.0001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "assert", " ", "(", " ", "md", "grp", "ret", "['", "CONF", "IDE", "NCE", "']", "[", "0", "]", " ", "==", " ", "ann", "\\u", "confidence", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "STATUS", "'_", "]_", "[_", "0_", "]_", "==_", "ann", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "md", "grp", "ret_", "[_", "'", "AUTHOR", "'_", "]_", "[_", ":_", "]_", "==_", "ann", "\\u", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "anno", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "the", " ", "object", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "delete", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "base_", ",_", "suffix_", ")_", "=_", "SITE", "\\u", "HOST_", "._", "split_", "(_", "\"/\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "SITE", "\\u", "HOST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "=_", "httplib_", "._", "HTTP", "Connection_", "(_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "suffix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "request_", "(_", "'", "DELET", "E", "'_", ",_", "'/{", "}/", "ca", "/{}/", "{}/{}", "/'_", "._", "format_", "(_", "suffix_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "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 ", " _", "conn_", "._", "request_", "(_", "'", "DELET", "E", "'_", ",_", "'/", "ca", "/{}/", "{}/{}", "/'_", "._", "format_", "(_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "conn_", "._", "getresponse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "resp_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "content_", "==_", "'", "Success", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retrieve", " ", "the", " ", "annotation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "tha", "t", " ", "it", "'", "s", " ", "not", " ", "there", "._", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\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", "anno", "\\u", "upload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "all", " ", "different", " ", "kinds", " ", "of", " ", "annot", "ation", "s", " ", "and", " ", "retrieve", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ann", "type_", "in_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anno", "id_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "H", "5", "Annot", "ation", "File_", "(_", "ann", "type_", ",_", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "put", "id1_", "=_", "put", "Annotation_", "(_", "p_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "this", " ", "assume", "s", " ", "tha", "t", " ", "+", "1", " ", "is", " ", "avail", "able", " ", "(", "whi", "ch", " ", "it", " ", "is", ")_", "\\u\\u\\uNL\\u\\u\\u_", "newi", "d_", "=_", "put", "id1_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "H", "5", "Annot", "ation", "File_", "(_", "ann", "type_", ",_", "newi", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "put", "id2_", "=_", "put", "Annotation_", "(_", "p_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retrieve", " ", "bot", "h", " ", "annotations_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "id1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "put", "id1_", "==_", "get", "Id_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "anno", "id_", "=_", "put", "id2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "put", "id2_", "==_", "get", "Id_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\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", "annot", "ation", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "an", " ", "annot", "ation", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "annot", "ation", " _", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "Status_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "confidence_", "\\u\\u\\uNL\\u\\u\\u_", "confidence_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "confidence", "'_", ",_", "confidence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "confidence", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "confidence_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "author_", "\\u\\u\\uNL\\u\\u\\u_", "#", "f", " ", "=", " ", "self", ".", "get", "Field", "(", "p", ",", " ", "'", "author", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "'", "Unit", " ", "Test", "'", " ", "==", " ", "f", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "synapse", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "synapse", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "synapse_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "synapse", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "\\u", "type_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ",_", "synapse", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "synapse", "\\u", "type_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "weight_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "weight_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "seeds_", "\\u\\u\\uNL\\u\\u\\u_", "seeds_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "seed", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "seed", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "seed_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parent", "'_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parent_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "source", "'_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "source", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "source_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "cube", "location_", "\\u\\u\\uNL\\u\\u\\u_", "cube", "location_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "cube", "location", "'_", ",_", "cube", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "cube", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cube", "location_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "position", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "position_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "position", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "position_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "segment", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "segment", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "segment_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parents", "eed_", "\\u\\u\\uNL\\u\\u\\u_", "parents", "eed_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ",_", "parents", "eed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parents", "eed_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "segment", "class_", "\\u\\u\\uNL\\u\\u\\u_", "segment", "class_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "segment", "class", "'_", ",_", "segment", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "segment", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "segment", "class_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "neuron_", "\\u\\u\\uNL\\u\\u\\u_", "neuron_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "neuro", "n", "'_", ",_", "neuron_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "neuro", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "neuron_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "synapse", "s_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "s_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "s", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "synapse", "s_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "synapse", "s_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "neuro", "n", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "neuro", "n", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "neuron_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "segments", "'_", ",_", "\",\"_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "status_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "segments", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\",\"_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "status_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "orga", "nell", "e\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "an", " ", "orga", "nell", "e", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "orga", "nell", "e", " _", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parents", "eed_", "\\u\\u\\uNL\\u\\u\\u_", "parents", "eed_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ",_", "parents", "eed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parents", "eed_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "orga", "nell", "ecl", "ass_", "\\u\\u\\uNL\\u\\u\\u_", "orga", "nell", "ecl", "ass_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "orga", "nell", "ecl", "ass", "'_", ",_", "orga", "nell", "ecl", "ass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "orga", "nell", "ecl", "ass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "orga", "nell", "ecl", "ass_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "seeds_", "\\u\\u\\uNL\\u\\u\\u_", "seeds_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrong", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "annot", "ation", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "Ann", "o_", "(_", "p_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "synapse", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "\\u", "type_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ",_", "synapse", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "synapse", "\\u", "type_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "weight_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "weight_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "bad", " ", "format", " ", "to", " ", "a", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "set", "Field", "/", "status", "/", "aa", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "request", " ", "a", " ", "missi", "ng", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "get", "Field", "/", "other", "none", "suc", "h", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Unused import
pandemicsyn/stalker/stalkerweb/stalkerweb/views.py
[ { "content": "import json\nimport eventlet\neventlet.monkey_patch()\nfrom eventlet.green import urllib2\nfrom flask import request, abort, render_template, session, redirect\nfrom bson import ObjectId\nfrom time import time\nfrom random import randint\nfrom stalkerweb.auth import is_valid_login, login_required, remove_user\nfrom stalkerweb.stutils import jsonify, genPrimaryKey64\nfrom stalkerweb import app, rc, rdb\nfrom flask.ext.wtf import Form\nfrom wtforms import TextField, PasswordField, BooleanField\nfrom wtforms.validators import Required\nfrom werkzeug.contrib.cache import RedisCache\nimport rethinkdb as r\nfrom rethinkdb.errors import RqlDriverError, RqlRuntimeError\nimport logging\n\nVALID_STATES = ['alerting', 'pending', 'in_maintenance', 'suspended']\n\ncache = RedisCache(host=app.config['REDIS_HOST'], port=app.config['REDIS_PORT'], default_timeout=app.config['CACHE_TTL'])\n\nlogger = logging.getLogger(app.config['LOG_NAME'])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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\nif __name__ == '__main__':\n debug = True\n app.run(host='0.0.0.0', debug=debug)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SignInForm(Form):\n username = TextField(validators=[Required()])\n password = PasswordField(validators=[Required()])\n remember_me = BooleanField()", "metadata": "root.SignInForm", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def _get_local_metrics():\n metrics = {}\n mkeys = ['checks', 'failing', 'flapping', 'pending', 'qsize',\n 'suspended']\n try:\n values = rc.mget(mkeys)\n for k in mkeys:\n metrics[k] = int(values[mkeys.index(k)])\n return metrics\n except Exception as err:\n logger.exception('Error gathering metrics')\n return None", "metadata": "root._get_local_metrics", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def _get_remote_checks(clusterid, state):\n endpoints = {'alerting': '/checks/state/alerting',\n 'pending': '/checks/state/pending',\n 'suspended': '/checks/state/suspended',\n 'in_maintenance': '/checks/state/in_maintenance'}\n target = app.config['GLOBAL_CLUSTERS'][clusterid]['host'] + \\\n endpoints[state]\n headers = {'X-API-KEY': app.config['GLOBAL_CLUSTERS'][clusterid]['key']}\n try:\n req = urllib2.Request(target, headers=headers)\n res = urllib2.urlopen(req, timeout=app.config['REMOTE_TIMEOUT'])\n return json.loads(res.read())\n except Exception as err:\n logger.exception(\"Error grabbing checks for %s: %s\" % (clusterid, err))\n return None", "metadata": "root._get_remote_checks", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def _get_remote_stats(clusterid):\n target = app.config['GLOBAL_CLUSTERS'][clusterid]['host'] + '/stats'\n headers = {'X-API-KEY': app.config['GLOBAL_CLUSTERS'][clusterid]['key']}\n try:\n req = urllib2.Request(target, headers=headers)\n res = urllib2.urlopen(req, timeout=app.config['REMOTE_TIMEOUT'])\n return json.loads(res.read())[clusterid]\n except Exception as err:\n logger.exception(\"Error grabbing stats for %s: %s\" % (clusterid, err))\n return None", "metadata": "root._get_remote_stats", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def _get_users_theme(username):\n q = list(r.table(\"users\").filter({\"username\": username}).pluck({\"theme\": True}).run(rdb.conn))[0]\n return q.get('theme', 'cerulean')", "metadata": "root._get_users_theme", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def _rand_start():\n \"\"\"Used to randomize the first check (and hopefully stagger\n checks on a single host)\"\"\"\n return time() + randint(1, 600)", "metadata": "root._rand_start", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def _valid_registration(content):\n fields = [('hostname', basestring), ('checks', dict), ('roles', list)]\n for field in fields:\n if field[0] in content:\n if not isinstance(content[field[0]], field[1]):\n return False\n else:\n return False\n # validate checks each should have a interval and args field\n for check in content['checks']:\n if not isinstance(content['checks'][check], dict):\n return False\n if 'interval' not in content['checks'][check]:\n return False\n if not isinstance(content['checks'][check]['interval'], int):\n return False\n if not isinstance(content['checks'][check]['follow_up'], int):\n return False\n if 'args' not in content['checks'][check]:\n return False\n if 'priority' in content['checks'][check]:\n if not isinstance(content['checks'][check]['priority'], int):\n return False\n if not isinstance(content['checks'][check]['args'], basestring):\n return False\n # everything checked out\n return True", "metadata": "root._valid_registration", "header": "['module', '___EOS___']", "index": 86 }, { "content": "@app.route(\"/register\", methods=['POST', 'PUT'])\ndef register():\n if request.headers.get('X-REGISTER-KEY') != app.config['REGISTER_KEY']:\n abort(412)\n if not request.json:\n abort(400)\n if not _valid_registration(request.json):\n abort(400)\n hid = request.json['hostname']\n checks = request.json['checks']\n roles = request.json['roles']\n ip_addr = request.json.get('ip', request.remote_addr)\n if ip_addr == '':\n ip_addr = request.remote_addr\n try:\n pkey = genPrimaryKey64(\"%s%s\" % (hid, ip_addr))\n q = r.table(\"hosts\").insert({\n \"id\": pkey,\n \"hostname\": hid,\n \"ip\": ip_addr,\n \"checks\": checks,\n \"roles\": roles\n },conflict=\"update\").run(rdb.conn)\n q = r.table(\"checks\").filter({\"hostname\": hid}).delete().run(rdb.conn) #we're about to reinstart all so just delete all incase checks got removed\n bulk_load = []\n for i in checks:\n bulk_load.append({'id': genPrimaryKey64(\"%s%s%s\" % (hid, ip_addr, i)),\n 'hostname': hid, 'ip': ip_addr,\n 'check': i, 'last': 0, 'next': _rand_start(),\n 'interval': checks[i]['interval'],\n 'follow_up': checks[i]['follow_up'],\n 'pending': False,\n 'status': None, 'in_maintenance': False,\n 'suspended': False, 'out': '',\n 'priority': checks[i].get('priority', 1)})\n q = r.table(\"checks\").insert(bulk_load, conflict=\"update\").run(rdb.conn)\n except Exception as err:\n logger.error(err)\n return jsonify({'status': 'fail', 'error': str(err)}), 400\n return jsonify({'status': 'ok'})", "metadata": "root.register", "header": "['module', '___EOS___']", "index": 115 }, { "content": "@app.route(\"/user/\", defaults={'username': None})\[email protected](\"/user/<username>\", methods=['GET', 'POST', 'DELETE'])\n@login_required\ndef users(username):\n if not username:\n if request.method == 'DELETE':\n abort(400) # don't allow deletes with out user\n if session.get('username', False):\n username = session.get('username')\n else:\n abort(400)\n if request.method == 'GET':\n q = list(r.table(\"users\").filter({\"username\": username}).without(\"hash\").run(rdb.conn))[0]\n if q:\n if 'theme' not in q:\n q['theme'] = 'cerulean'\n return jsonify(q)\n else:\n abort(404)\n elif request.method == 'DELETE':\n return jsonify({'success': remove_user(username)})\n elif request.method == 'POST':\n fields = {}\n if not request.json:\n abort(400)\n if 'theme' in request.json:\n if request.json['theme'] in app.config['THEMES']:\n fields['theme'] = request.json['theme']\n else:\n abort(400)\n if 'email' in request.json:\n fields['email'] = request.json['email']\n q = r.table(\"users\").filter({\"username\": username}).update(fields).run(rdb.conn) \n if q[\"replaced\"] != 0 :\n if session and 'theme' in fields:\n session['theme'] = fields['theme']\n return jsonify({'success': True})\n else:\n return jsonify({'success': False})", "metadata": "root.users", "header": "['module', '___EOS___']", "index": 157 }, { "content": "@app.route(\"/hosts/\", defaults={'host': None})\[email protected](\"/hosts/<host>\", methods=['GET', 'DELETE'])\n@login_required\ndef hosts(host):\n \"\"\"Delete a given host and all its checks\"\"\"\n if not host:\n q = list(r.table(\"hosts\").without(\"id\").run(rdb.conn))\n if q:\n q = {'hosts': q}\n else:\n if request.method == 'DELETE':\n q = r.table(\"checks\").filter((r.row[\"hostname\"] == host) | (r.row[\"ip\"] == host)).delete().run(rdb.conn)\n q = r.table(\"hosts\").filter((r.row[\"hostname\"] == host) | (r.row[\"ip\"] == host)).delete().run(rdb.conn)\n return jsonify({'success': True})\n else:\n q = list(r.table(\"hosts\").filter((r.row[\"hostname\"] == host) | (r.row[\"ip\"] == host)).without(\"id\").run(rdb.conn))\n if q:\n return jsonify(q[0])\n else:\n abort(404)", "metadata": "root.hosts", "header": "['module', '___EOS___']", "index": 198 }, { "content": "@app.route(\"/checks/\", defaults={'host': None})\[email protected](\"/checks/host/<host>\")\n@login_required\ndef checks(host):\n \"\"\"Get all checks for a given hostname or ip\"\"\"\n if not host:\n q = list(r.table(\"checks\").run(rdb.conn))\n else:\n q = list(r.table(\"checks\").filter((r.row[\"hostname\"] == host) | (r.row[\"ip\"] == host)).run(rdb.conn))\n if q:\n for check in q:\n check['id'] = str(check['id'])\n return jsonify({'checks': q})\n else:\n abort(404)", "metadata": "root.checks", "header": "['module', '___EOS___']", "index": 220 }, { "content": "@app.route('/checks/id/<checkid>', methods=['GET', 'DELETE'])\n@login_required\ndef checks_by_id(checkid):\n \"\"\"Get info for or delete a given check\"\"\"\n if request.method == 'GET':\n check = r.table(\"checks\").get(checkid).run(rdb.conn)\n if check:\n check['id'] = str(check['id'])\n return jsonify({'check': check})\n else:\n abort(404)\n elif request.method == 'DELETE':\n q = r.table(\"checks\").get(checkid).delete().run(rdb.conn)\n if q[\"deleted\"] == 1:\n return jsonify({'success': True})\n else:\n return jsonify({'success': False})", "metadata": "root.checks_by_id", "header": "['module', '___EOS___']", "index": 237 }, { "content": "@app.route('/checks/id/<checkid>/owner', methods=['GET', 'POST', 'DELETE'])\n@login_required\ndef check_owner(checkid):\n \"\"\"claim or unclaim a given check\"\"\"\n if request.method == 'GET':\n check = r.table(\"checks\").get(checkid).run(rdb.conn)\n if check:\n check['id'] = str(check['id'])\n return jsonify({'check': check})\n else:\n abort(404)\n elif request.method == 'POST':\n if not request.json:\n abort(400)\n try:\n if request.json.get('owner'):\n q = r.table(\"checks\").get(checkid).update({\"owner\": str(request.json[\"owner\"])}).run(rdb.conn)\n else:\n abort(400)\n if q[\"replaced\"] != 0:\n return jsonify({'success': True})\n else:\n abort(404)\n except Exception as err:\n logger.error(err)\n abort(400)\n elif request.method == 'DELETE':\n try:\n q = r.table(\"checks\").get(checkid).update({\"owner\": \"\"}).run(rdb.conn)\n if q[\"replaced\"] != 0:\n return jsonify({'success': True})\n else:\n abort(404)\n except Exception as err:\n logger.error(err)\n abort(400)", "metadata": "root.check_owner", "header": "['module', '___EOS___']", "index": 256 }, { "content": "@app.route('/checks/id/<checkid>/next', methods=['GET', 'POST'])\n@login_required\ndef check_next(checkid):\n \"\"\"Reschedule a given check\"\"\"\n if request.method == 'GET':\n check = r.table(\"checks\").get(checkid).run(rdb.conn)\n if check:\n check['id'] = str(check['id'])\n return jsonify({'check': check})\n else:\n abort(404)\n elif request.method == 'POST':\n if not request.json:\n abort(400)\n try:\n if not request.json.get('next'):\n abort(400)\n if request.json.get('next') == 'now':\n q = r.table(\"checks\").get(checkid).update({\"next\": time() - 1}).run(rdb.conn)\n else:\n q = r.table(\"checks\").get(checkid).update({\"next\": int(request.json[\"next\"])}).run(rdb.conn)\n if q[\"replaced\"] != 0:\n return jsonify({'success': True})\n else:\n abort(404)\n except Exception as err:\n logger.error(err)\n abort(400)", "metadata": "root.check_next", "header": "['module', '___EOS___']", "index": 294 }, { "content": "@app.route('/checks/id/<checkid>/suspended', methods=['GET', 'POST'])\n@login_required\ndef check_suspended(checkid):\n \"\"\"Suspend a given check\"\"\"\n if request.method == 'GET':\n check = r.table(\"checks\").get(checkid).run(rdb.conn)\n if check:\n check['id'] = str(check['id'])\n return jsonify({'check': check})\n else:\n abort(404)\n elif request.method == 'POST':\n if not request.json:\n abort(400)\n try:\n if not request.json.get('suspended'):\n abort(400)\n if request.json.get('suspended') is True:\n q = r.table(\"checks\").get(checkid).update({\"suspended\": True}).run(rdb.conn)\n elif request.json.get('suspended') is False:\n q = r.table(\"checks\").get(checkid).update({\"suspended\": False}).run(rdb.conn)\n else:\n abort(400)\n if q['replaced'] != 0:\n return jsonify({'success': True})\n else:\n abort(404)\n except Exception as err:\n logger.error(err)\n abort(400)", "metadata": "root.check_suspended", "header": "['module', '___EOS___']", "index": 324 }, { "content": "@app.route('/checks/state/<state>')\n@login_required\ndef check_state(state):\n \"\"\"List of checks in cluster in a given state [alerting/pending/suspended]\"\"\"\n if state == 'alerting':\n q = list(r.table(\"checks\").get_all(False, index=\"status\").run(rdb.conn))\n if q:\n return jsonify({'alerting': q})\n else:\n return jsonify({'alerting': []})\n elif state == 'pending':\n q = list(r.table(\"checks\").get_all(True, index=\"pending\").run(rdb.conn))\n if q:\n return jsonify({'pending': q})\n else:\n return jsonify({'pending': []})\n elif state == 'in_maintenance':\n q = list(r.table(\"checks\").get_all(True, index=\"in_maintenance\").run(rdb.conn))\n if q:\n return jsonify({'in_maintenance': q})\n else:\n return jsonify({'in_maintenance': []})\n elif state == 'suspended':\n q = list(r.table(\"checks\").get_all(True, index=\"suspended\").run(rdb.conn))\n if q:\n return jsonify({'suspended': q})\n else:\n return jsonify({'suspended': []})\n else:\n abort(400)", "metadata": "root.check_state", "header": "['module', '___EOS___']", "index": 356 }, { "content": "@app.route('/state_log/<hostname>/<checkname>', methods=['GET'])\n@login_required\ndef state_log_by_check(hostname, checkname):\n \"\"\"Get check history for a given check on a given host\"\"\"\n if request.method == 'GET':\n try:\n limit = request.args.get('limit', 10, type=int)\n except ValueError:\n abort(400)\n log = list(r.table(\"state_log\").filter({\"hostname\": hostname, \"check\": checkname}).order_by(r.desc(\"last\")).limit(limit).run(rdb.conn))\n if log:\n return jsonify({'state_log': sorted(log, key=lambda k: k['last'])})\n else:\n abort(404)\n else:\n abort(400)", "metadata": "root.state_log_by_check", "header": "['module', '___EOS___']", "index": 388 }, { "content": "@app.route('/notes/<hostname>', methods=['GET', 'POST'])\n@login_required\ndef list_notes(hostname):\n \"\"\"Retrieve a list of notes associated with a host. Or given\n {'user': 'username', 'note': 'some message'} post a note.\"\"\"\n if request.method == 'GET':\n try:\n #someday i should probably add offset support here and in the statelog\n limit = request.args.get('limit', 50, type=int)\n except ValueError:\n abort(400)\n notes = list(r.table(\"notes\").filter({\"hostname\": hostname}).order_by(r.desc(\"ts\")).limit(limit).run(rdb.conn))\n if notes:\n return jsonify({'notes': sorted(notes, key=lambda k: k['ts'])})\n else:\n abort(404)\n elif request.method == 'POST':\n if not request.json:\n abort(400)\n if not request.json.get(\"user\") or not request.json.get(\"note\"):\n abort(400)\n if not r.table(\"hosts\").get_all(hostname, index=\"hostname\").run(rdb.conn):\n abort(404)\n alerting = [x[\"check\"] for x in r.table(\"checks\").filter({\"h stname\": hostname, \"status\": False}).run(rdb.conn)]\n q = r.table(\"notes\").insert({'hostname': hostname, 'user': request.json.get(\"user\"),\n 'note': request.json.get(\"note\"), 'ts': time(), 'alerting': alerting}).run(rdb.conn)\n if q[\"inserted\"] == 1:\n return jsonify({'success': True})\n else:\n logger.error(q)\n abort(500)\n else:\n abort(400)", "metadata": "root.list_notes", "header": "['module', '___EOS___']", "index": 406 }, { "content": "@app.route('/global/clusters')\n@login_required\ndef global_clusters():\n \"\"\"List of known clusters and their id\"\"\"\n return jsonify({'clusters': app.config['GLOBAL_CLUSTERS']})", "metadata": "root.global_clusters", "header": "['module', '___EOS___']", "index": 441 }, { "content": "@app.route('/global/<clusterid>/checks/state/<state>')\n@login_required\ndef global_check_state(clusterid, state):\n \"\"\"Get a list of all checks in provided state for a given cluster\"\"\"\n if clusterid not in app.config['GLOBAL_CLUSTERS']:\n abort(400)\n if state in VALID_STATES:\n ckey = '%s:%s' % (clusterid, state)\n cached = cache.get(ckey)\n if cached:\n return jsonify({clusterid: cached})\n else:\n q = _get_remote_checks(clusterid, state)\n if q:\n cache.set(ckey, q)\n return jsonify({clusterid: q})\n else:\n abort(500)\n else:\n abort(400)", "metadata": "root.global_check_state", "header": "['module', '___EOS___']", "index": 448 }, { "content": "@app.route('/stats', defaults={'clusterid': None})\[email protected]('/stats/<clusterid>')\n@login_required\ndef stalker_stats(clusterid):\n \"\"\"Obtain stats for this cluster or one with a given clusterid\"\"\"\n default = {'qsize': None, 'failing': None, 'flapping': None,\n 'suspended': None, 'checks': None, 'pending': None}\n if not clusterid:\n q = _get_local_metrics()\n if q:\n return jsonify({app.config['LOCAL_CID']: q})\n else:\n return jsonify({app.config['LOCAL_CID']: default})\n else:\n if clusterid in app.config['GLOBAL_CLUSTERS']:\n ckey = '%s:%s' % (clusterid, 'stats')\n cached = cache.get(ckey)\n if cached:\n return jsonify({clusterid: cached})\n else:\n q = _get_remote_stats(clusterid)\n if q:\n cache.set(ckey, q)\n return jsonify({clusterid: q})\n else:\n return jsonify({clusterid: default})\n elif clusterid == 'all':\n q = {}\n q[app.config['LOCAL_CID']] = _get_local_metrics()\n for cid in app.config['GLOBAL_CLUSTERS'].keys():\n ckey = '%s:%s' % (cid, 'stats')\n cached = cache.get(ckey)\n if cached:\n q[cid] = cached\n else:\n q[cid] = _get_remote_stats(cid)\n if not q[cid]:\n q[cid] = default\n cache.set(ckey, q[cid])\n return jsonify({'all': q})\n else:\n abort(404)", "metadata": "root.stalker_stats", "header": "['module', '___EOS___']", "index": 470 }, { "content": "@app.route('/findhost')\n@login_required\ndef findhost():\n \"\"\"Just used for the type ahead\"\"\"\n # probably should cache hosts in memcached/redis for type ahead crap\n if not request.args.get('q'):\n abort(400)\n result = []\n for i in r.table(\"hosts\").filter(\n r.row[\"hostname\"].match(\"^%s\" % request.args.get('q')) | r.row[\"ip\"].match(\"^%s\" % request.args.get('q'))\n ).pluck({\"hostname\": True, \"ip\": True}).run(rdb.conn):\n if i['hostname'].startswith(request.args.get('q')):\n result.append(i['hostname'])\n else:\n result.append(i['ip'])\n return \",\".join(result)", "metadata": "root.findhost", "header": "['module', '___EOS___']", "index": 514 }, { "content": "@app.route('/')\n@login_required\ndef index():\n return render_template('states.html', state='alerting')", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 532 }, { "content": "@app.route('/view/states', defaults={'state': None})\[email protected]('/view/states/<state>')\n@login_required\ndef view_states(state):\n if state:\n if state in VALID_STATES:\n return render_template('states.html', state=state)\n else:\n abort(404)\n else:\n return render_template('states.html', state='alerting')", "metadata": "root.view_states", "header": "['module', '___EOS___']", "index": 538 }, { "content": "@app.route('/view/checks')\n@login_required\ndef view_checks():\n return render_template('allchecks.html')", "metadata": "root.view_checks", "header": "['module', '___EOS___']", "index": 551 }, { "content": "@app.route('/view/host/', defaults={'hostname': None})\[email protected]('/view/host/<hostname>')\n@login_required\ndef view_single_host(hostname):\n if request.args.get('search'):\n hostname = request.args.get('search')\n if not hostname:\n abort(404)\n else:\n return render_template('host.html', target=hostname)", "metadata": "root.view_single_host", "header": "['module', '___EOS___']", "index": 557 }, { "content": "@app.route('/view/user/<username>')\n@login_required\ndef view_user(username):\n return render_template('user.html')", "metadata": "root.view_user", "header": "['module', '___EOS___']", "index": 569 }, { "content": "@app.route('/global/view/states', defaults={'state': None})\[email protected]('/global/view/states/<state>/')\n@login_required\ndef view_global(state):\n \"\"\"Global view of provided state [alerting/pending/suspended]\"\"\"\n if state:\n if state in VALID_STATES:\n return render_template('globalstates.html', state=state)\n else:\n abort(404)\n else:\n return render_template('globalstates.html', state='alerting')", "metadata": "root.view_global", "header": "['module', '___EOS___']", "index": 575 }, { "content": "@app.route('/signout')\ndef signout():\n \"\"\"Sign out\"\"\"\n session.pop('logged_in', None)\n return render_template('signout.html')", "metadata": "root.signout", "header": "['module', '___EOS___']", "index": 589 }, { "content": "@app.route('/signin', methods=[\"GET\", \"POST\"])\ndef signin():\n \"\"\"Sign in\"\"\"\n form = SignInForm()\n if form.validate_on_submit():\n username = form.username.data.strip()\n password = form.password.data.strip()\n if is_valid_login(username, password):\n session['theme'] = _get_users_theme(username)\n session['logged_in'] = True\n session['username'] = username\n if form.remember_me.data:\n session.permanent = True\n else:\n session.permanent = False\n if request.args.get('next') == 'signin':\n return redirect(\"/\")\n else:\n return redirect(request.args.get('next') or request.referrer or \"/\")\n else:\n return render_template('signin.html', form=form, error=\"Failed\")\n return render_template('signin.html', form=form, error=None)", "metadata": "root.signin", "header": "['module', '___EOS___']", "index": 596 }, { "content": "@app.errorhandler(404)\ndef page_not_found(e):\n return render_template('404.html'), 404", "metadata": "root.page_not_found", "header": "['module', '___EOS___']", "index": 620 }, { "content": "@app.route('/routes/list', methods=['GET'])\n@login_required\ndef help():\n \"\"\"Show endpoints\"\"\"\n func_list = {}\n for rule in app.url_map.iter_rules():\n if rule.endpoint != 'static':\n func_list[rule.rule] = app.view_functions[rule.endpoint].__doc__\n return jsonify(func_list)", "metadata": "root.help", "header": "['module', '___EOS___']", "index": 625 } ]
[ { "span": "from bson import ObjectId", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 25 }, { "span": "from rethinkdb.errors import RqlDriverError, RqlRuntimeError", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 60 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "eventlet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eventlet_", "._", "monkey", "\\u", "patch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eventlet_", "._", "green_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", ",_", "abort_", ",_", "render", "\\u", "template_", ",_", "session_", ",_", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bson_", "import_", "Object", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stal", "ker", "web_", "._", "auth_", "import_", "is", "\\u", "valid", "\\u", "login_", ",_", "login", "\\u", "required_", ",_", "remove", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stal", "ker", "web_", "._", "stu", "tils_", "import_", "jsonify_", ",_", "gen", "Prim", "ary", "Key", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stal", "ker", "web_", "import_", "app_", ",_", "rc_", ",_", "rdb", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "wtf", "_", "import_", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "import_", "Text", "Field_", ",_", "Passw", "ord", "Field_", ",_", "Boo", "lean", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wtforms_", "._", "validators_", "import_", "Required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "contrib_", "._", "cache_", "import_", "Red", "is", "Cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ret", "hin", "kd", "b_", "as_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ret", "hin", "kd", "b_", "._", "errors_", "import_", "Rq", "l", "Drive", "r", "Error_", ",_", "Rq", "l", "Run", "time", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VALID", "\\u", "STATES_", "=_", "[_", "'", "alert", "ing", "'_", ",_", "'", "pend", "ing", "'_", ",_", "'", "in", "\\u", "maintenance", "'_", ",_", "'", "suspended", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "Red", "is", "Cache_", "(_", "host_", "=_", "app_", "._", "config_", "[_", "'", "REDIS", "\\u", "HOST", "'_", "]_", ",_", "port_", "=_", "app_", "._", "config_", "[_", "'", "REDIS", "\\u", "PORT", "'_", "]_", ",_", "default", "\\u", "timeout_", "=_", "app_", "._", "config_", "[_", "'", "CACHE", "\\u", "TTL", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "app_", "._", "config_", "[_", "'", "LOG", "\\u", "NAME", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\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u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "run_", "(_", "host_", "=_", "'", "0.", "0.", "0.", "0", "'_", ",_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Sign", "In", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "Text", "Field_", "(_", "validators_", "=_", "[_", "Required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "Passw", "ord", "Field_", "(_", "validators_", "=_", "[_", "Required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remember", "\\u", "me_", "=_", "Boo", "lean", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "local", "\\u", "metrics_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metrics_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mke", "ys_", "=_", "[_", "'", "checks", "'_", ",_", "'", "faili", "ng", "'_", ",_", "'", "fla", "ppi", "ng", "'_", ",_", "'", "pend", "ing", "'_", ",_", "'", "qs", "ize", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suspended", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "rc_", "._", "mg", "et_", "(_", "mke", "ys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "mke", "ys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metrics_", "[_", "k_", "]_", "=_", "int_", "(_", "values_", "[_", "mke", "ys_", "._", "index_", "(_", "k_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "metrics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "'", "Error", " ", "gather", "ing", " ", "metric", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "remote", "\\u", "checks_", "(_", "clusteri", "d_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoints_", "=_", "{_", "'", "alert", "ing", "'_", ":_", "'/", "checks", "/", "state", "/", "alert", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pend", "ing", "'_", ":_", "'/", "checks", "/", "state", "/", "pend", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suspended", "'_", ":_", "'/", "checks", "/", "state", "/", "suspended", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", "\\u", "maintenance", "'_", ":_", "'/", "checks", "/", "state", "/", "in", "\\u", "maintenance", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", "[_", "clusteri", "d_", "]_", "[_", "'", "host", "'_", "]_", "+_", "endpoints_", "[_", "state_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "X", "-", "API", "-", "KEY", "'_", ":_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", "[_", "clusteri", "d_", "]_", "[_", "'", "key", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "target_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ",_", "timeout_", "=_", "app_", "._", "config_", "[_", "'", "REMO", "TE", "\\u", "TIME", "OUT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "res_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Error", " ", "gra", "bbi", "ng", " ", "checks", " ", "for", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "clusteri", "d_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "remote", "\\u", "stats_", "(_", "clusteri", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", "[_", "clusteri", "d_", "]_", "[_", "'", "host", "'_", "]_", "+_", "'/", "stats", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "X", "-", "API", "-", "KEY", "'_", ":_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", "[_", "clusteri", "d_", "]_", "[_", "'", "key", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "target_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ",_", "timeout_", "=_", "app_", "._", "config_", "[_", "'", "REMO", "TE", "\\u", "TIME", "OUT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "res_", "._", "read_", "(_", ")_", ")_", "[_", "clusteri", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "exception_", "(_", "\"", "Error", " ", "gra", "bbi", "ng", " ", "stats", " ", "for", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "clusteri", "d_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "users", "\\u", "theme_", "(_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "users", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "user", "name", "\"_", ":_", "username_", "}_", ")_", "._", "plu", "ck_", "(_", "{_", "\"", "them", "e", "\"_", ":_", "True_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "q_", "._", "get_", "(_", "'", "them", "e", "'_", ",_", "'", "cer", "ule", "an", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rand", "\\u", "start_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "ed", " ", "to", " ", "randomize", " ", "the", " ", "first", " ", "check", " ", "(", "and", " ", "hop", "efu", "ll", "y", " ", "stag", "ger", "\\", "10", ";", " ", " ", " ", " ", "checks", " ", "on", " ", "a", " ", "single", " ", "host", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "time_", "(_", ")_", "+_", "randint_", "(_", "1_", ",_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "valid", "\\u", "registration_", "(_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "(_", "'", "host", "name", "'_", ",_", "basestring_", ")_", ",_", "(_", "'", "checks", "'_", ",_", "dict_", ")_", ",_", "(_", "'", "role", "s", "'_", ",_", "list_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field_", "[_", "0_", "]_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "content_", "[_", "field_", "[_", "0_", "]_", "]_", ",_", "field_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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_", "#", " ", "validat", "e", " ", "checks", " ", "each", " ", "shou", "ld", " ", "have", " ", "a", " ", "interval", " ", "and", " ", "args", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "check_", "in_", "content_", "[_", "'", "checks", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "interval", "'_", "not_", "in_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", "[_", "'", "interval", "'_", "]_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", "[_", "'", "follow", "\\u", "up", "'_", "]_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "args", "'_", "not_", "in_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "priorit", "y", "'_", "in_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", "[_", "'", "priorit", "y", "'_", "]_", ",_", "int_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "content_", "[_", "'", "checks", "'_", "]_", "[_", "check_", "]_", "[_", "'", "args", "'_", "]_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "every", "thing", " ", "checke", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "register", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "PU", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "headers_", "._", "get_", "(_", "'", "X", "-", "REGISTER", "-", "KEY", "'_", ")_", "!=_", "app_", "._", "config_", "[_", "'", "REGISTER", "\\u", "KEY", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "412", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "\\u", "valid", "\\u", "registration_", "(_", "request_", "._", "json_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hid_", "=_", "request_", "._", "json_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checks_", "=_", "request_", "._", "json_", "[_", "'", "checks", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "roles_", "=_", "request_", "._", "json_", "[_", "'", "role", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip", "\\u", "addr_", "=_", "request_", "._", "json_", "._", "get_", "(_", "'", "ip", "'_", ",_", "request_", "._", "remote", "\\u", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ip", "\\u", "addr_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "addr_", "=_", "request_", "._", "remote", "\\u", "addr_", "\\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 ", " _", "pkey_", "=_", "gen", "Prim", "ary", "Key", "64_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "hid_", ",_", "ip", "\\u", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "insert_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "pkey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "name", "\"_", ":_", "hid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ip", "\"_", ":_", "ip", "\\u", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "checks", "\"_", ":_", "checks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "role", "s", "\"_", ":_", "roles_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "conflict_", "=_", "\"", "update", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "host", "name", "\"_", ":_", "hid_", "}_", ")_", "._", "delete_", "(_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "#", "we", "'", "re", " ", "abo", "ut", " ", "to", " ", "rein", "start", " ", "all", " ", "so", " ", "just", " ", "delete", " ", "all", " ", "inca", "se", " ", "checks", " ", "got", " ", "removed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bul", "k", "\\u", "load_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "checks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bul", "k", "\\u", "load_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "gen", "Prim", "ary", "Key", "64_", "(_", "\"%", "s", "%", "s", "%", "s", "\"_", "%_", "(_", "hid_", ",_", "ip", "\\u", "addr_", ",_", "i_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "name", "'_", ":_", "hid_", ",_", "'", "ip", "'_", ":_", "ip", "\\u", "addr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "'_", ":_", "i_", ",_", "'", "last", "'_", ":_", "0_", ",_", "'", "next", "'_", ":_", "\\u", "rand", "\\u", "start_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interval", "'_", ":_", "checks_", "[_", "i_", "]_", "[_", "'", "interval", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "follow", "\\u", "up", "'_", ":_", "checks_", "[_", "i_", "]_", "[_", "'", "follow", "\\u", "up", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pend", "ing", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "None_", ",_", "'", "in", "\\u", "maintenance", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suspended", "'_", ":_", "False_", ",_", "'", "out", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priorit", "y", "'_", ":_", "checks_", "[_", "i_", "]_", "._", "get_", "(_", "'", "priorit", "y", "'_", ",_", "1_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "insert_", "(_", "bul", "k", "\\u", "load_", ",_", "conflict_", "=_", "\"", "update", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "status", "'_", ":_", "'", "fail", "'_", ",_", "'", "error", "'_", ":_", "str_", "(_", "err_", ")_", "}_", ")_", ",_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "@_", "app_", "._", "route_", "(_", "\"/", "user", "/\"_", ",_", "defaults_", "=_", "{_", "'", "user", "name", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "user", "/", "<", "user", "name", ">\"_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", ",_", "'", "DELET", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "users_", "(_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "#", " ", "don", "'", "t", " ", "allow", " ", "delete", "s", " ", "with", " ", "out", " ", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "session_", "._", "get_", "(_", "'", "user", "name", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "session_", "._", "get_", "(_", "'", "user", "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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "users", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "user", "name", "\"_", ":_", "username_", "}_", ")_", "._", "with", "out_", "(_", "\"", "hash", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "them", "e", "'_", "not_", "in_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "[_", "'", "them", "e", "'_", "]_", "=_", "'", "cer", "ule", "an", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "remove", "\\u", "user_", "(_", "username_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "them", "e", "'_", "in_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "json_", "[_", "'", "them", "e", "'_", "]_", "in_", "app_", "._", "config_", "[_", "'", "THEME", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "[_", "'", "them", "e", "'_", "]_", "=_", "request_", "._", "json_", "[_", "'", "them", "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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "email", "'_", "in_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "[_", "'", "email", "'_", "]_", "=_", "request_", "._", "json_", "[_", "'", "email", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "users", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "user", "name", "\"_", ":_", "username_", "}_", ")_", "._", "update_", "(_", "fields_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "[_", "\"", "replaced", "\"_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "session_", "and_", "'", "them", "e", "'_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "them", "e", "'_", "]_", "=_", "fields_", "[_", "'", "them", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "host", "s", "/\"_", ",_", "defaults_", "=_", "{_", "'", "host", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "host", "s", "/", "<", "host", ">\"_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "DELET", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "hosts_", "(_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "a", " ", "give", "n", " ", "host", " ", "and", " ", "all", " ", "its", " ", "checks", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "with", "out_", "(_", "\"", "id", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "{_", "'", "host", "s", "'_", ":_", "q_", "}_", "\\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_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "filter_", "(_", "(_", "r_", "._", "row_", "[_", "\"", "host", "name", "\"_", "]_", "==_", "host_", ")_", "|_", "(_", "r_", "._", "row_", "[_", "\"", "ip", "\"_", "]_", "==_", "host_", ")_", ")_", "._", "delete_", "(_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "filter_", "(_", "(_", "r_", "._", "row_", "[_", "\"", "host", "name", "\"_", "]_", "==_", "host_", ")_", "|_", "(_", "r_", "._", "row_", "[_", "\"", "ip", "\"_", "]_", "==_", "host_", ")_", ")_", "._", "delete_", "(_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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 ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "filter_", "(_", "(_", "r_", "._", "row_", "[_", "\"", "host", "name", "\"_", "]_", "==_", "host_", ")_", "|_", "(_", "r_", "._", "row_", "[_", "\"", "ip", "\"_", "]_", "==_", "host_", ")_", ")_", "._", "with", "out_", "(_", "\"", "id", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "q_", "[_", "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 ", " _", "abort_", "(_", "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_", "(_", "\"/", "checks", "/\"_", ",_", "defaults_", "=_", "{_", "'", "host", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "\"/", "checks", "/", "host", "/", "<", "host", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "checks_", "(_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "all", " ", "checks", " ", "for", " ", "a", " ", "give", "n", " ", "host", "name", " ", "or", " ", "ip", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "filter_", "(_", "(_", "r_", "._", "row_", "[_", "\"", "host", "name", "\"_", "]_", "==_", "host_", ")_", "|_", "(_", "r_", "._", "row_", "[_", "\"", "ip", "\"_", "]_", "==_", "host_", ")_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "check_", "in_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "[_", "'", "id", "'_", "]_", "=_", "str_", "(_", "check_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "checks", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "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_", "(_", "'/", "checks", "/", "id", "/", "<", "check", "id", ">'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "DELET", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "checks", "\\u", "by", "\\u", "id_", "(_", "check", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "info", " ", "for", " ", "or", " ", "delete", " ", "a", " ", "give", "n", " ", "check", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "[_", "'", "id", "'_", "]_", "=_", "str_", "(_", "check_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "check", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "delete_", "(_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "[_", "\"", "delete", "d", "\"_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "checks", "/", "id", "/", "<", "check", "id", ">/", "owner", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", ",_", "'", "DELET", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "owner_", "(_", "check", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "claim", " ", "or", " ", "uncl", "aim", " ", "a", " ", "give", "n", " ", "check", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "[_", "'", "id", "'_", "]_", "=_", "str_", "(_", "check_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "check", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "json_", "._", "get_", "(_", "'", "owner", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "owner", "\"_", ":_", "str_", "(_", "request_", "._", "json_", "[_", "\"", "owner", "\"_", "]_", ")_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", "[_", "\"", "replaced", "\"_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "owner", "\"_", ":_", "\"\"_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "[_", "\"", "replaced", "\"_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "@_", "app_", "._", "route_", "(_", "'/", "checks", "/", "id", "/", "<", "check", "id", ">/", "next", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "next_", "(_", "check", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resc", "hedule", " ", "a", " ", "give", "n", " ", "check", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "[_", "'", "id", "'_", "]_", "=_", "str_", "(_", "check_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "check", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", "._", "get_", "(_", "'", "next", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "json_", "._", "get_", "(_", "'", "next", "'_", ")_", "==_", "'", "now", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "next", "\"_", ":_", "time_", "(_", ")_", "-_", "1_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "next", "\"_", ":_", "int_", "(_", "request_", "._", "json_", "[_", "\"", "next", "\"_", "]_", ")_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", "[_", "\"", "replaced", "\"_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "@_", "app_", "._", "route_", "(_", "'/", "checks", "/", "id", "/", "<", "check", "id", ">/", "suspended", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "suspended", "_", "(_", "check", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Suspend", " ", "a", " ", "give", "n", " ", "check", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "[_", "'", "id", "'_", "]_", "=_", "str_", "(_", "check_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "check", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", "._", "get_", "(_", "'", "suspended", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "json_", "._", "get_", "(_", "'", "suspended", "'_", ")_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "suspended", "\"_", ":_", "True_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "json_", "._", "get_", "(_", "'", "suspended", "'_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get_", "(_", "check", "id_", ")_", "._", "update_", "(_", "{_", "\"", "suspended", "\"_", ":_", "False_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", "[_", "'", "replaced", "'_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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 ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "@_", "app_", "._", "route_", "(_", "'/", "checks", "/", "state", "/", "<", "state", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "state_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "List", " ", "of", " ", "checks", " ", "in", " ", "cluster", " ", "in", " ", "a", " ", "give", "n", " ", "state", " ", "[", "alert", "ing", "/", "pend", "ing", "/", "suspended", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "==_", "'", "alert", "ing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get", "\\u", "all_", "(_", "False_", ",_", "index_", "=_", "\"", "status", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "alert", "ing", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "alert", "ing", "'_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "state_", "==_", "'", "pend", "ing", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get", "\\u", "all_", "(_", "True_", ",_", "index_", "=_", "\"", "pend", "ing", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "pend", "ing", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "pend", "ing", "'_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "state_", "==_", "'", "in", "\\u", "maintenance", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get", "\\u", "all_", "(_", "True_", ",_", "index_", "=_", "\"", "in", "\\u", "maintenance", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "in", "\\u", "maintenance", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "in", "\\u", "maintenance", "'_", ":_", "[_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "state_", "==_", "'", "suspended", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "get", "\\u", "all_", "(_", "True_", ",_", "index_", "=_", "\"", "suspended", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "suspended", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "suspended", "'_", ":_", "[_", "]_", "}_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "(_", "'/", "state", "\\u", "log", "/", "<", "host", "name", ">/", "<", "check", "name", ">'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "state", "\\u", "log", "\\u", "by", "\\u", "check_", "(_", "hostname_", ",_", "check", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "check", " ", "histo", "ry", " ", "for", " ", "a", " ", "give", "n", " ", "check", " ", "on", " ", "a", " ", "give", "n", " ", "host", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\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 ", " _", "limit_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "limit", "'_", ",_", "10_", ",_", "type_", "=_", "int_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "state", "\\u", "log", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "host", "name", "\"_", ":_", "hostname_", ",_", "\"", "check", "\"_", ":_", "check", "name_", "}_", ")_", "._", "order", "\\u", "by_", "(_", "r_", "._", "desc_", "(_", "\"", "last", "\"_", ")_", ")_", "._", "limit_", "(_", "limit_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "state", "\\u", "log", "'_", ":_", "sorted_", "(_", "log_", ",_", "key_", "=_", "lambda_", "k_", ":_", "k_", "[_", "'", "last", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "(_", "'/", "note", "s", "/", "<", "host", "name", ">'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", ",_", "'", "POST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "list", "\\u", "notes_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "a", " ", "list", " ", "of", " ", "note", "s", " ", "associate", "d", " ", "with", " ", "a", " ", "host", ".", " ", "Or", " ", "give", "n", "\\", "10", ";", " ", " ", "{", "'", "user", "':", " ", "'", "user", "name", "',", " ", "'", "note", "':", " ", "'", "some", " ", "message", "'}", " ", "post", " ", "a", " ", "note", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "GET", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "some", "day", " ", "i", " ", "shou", "ld", " ", "probab", "ly", " ", "add", " ", "offset", " ", "support", " ", "here", " ", "and", " ", "in", " ", "the", " ", "state", "log_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "limit", "'_", ",_", "50_", ",_", "type_", "=_", "int_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "notes_", "=_", "list_", "(_", "r_", "._", "table_", "(_", "\"", "note", "s", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "host", "name", "\"_", ":_", "hostname_", "}_", ")_", "._", "order", "\\u", "by_", "(_", "r_", "._", "desc_", "(_", "\"", "ts", "\"_", ")_", ")_", "._", "limit_", "(_", "limit_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "notes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "note", "s", "'_", ":_", "sorted_", "(_", "notes_", ",_", "key_", "=_", "lambda_", "k_", ":_", "k_", "[_", "'", "ts", "'_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "request_", "._", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "request_", "._", "json_", "._", "get_", "(_", "\"", "user", "\"_", ")_", "or_", "not_", "request_", "._", "json_", "._", "get_", "(_", "\"", "note", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "get", "\\u", "all_", "(_", "hostname_", ",_", "index_", "=_", "\"", "host", "name", "\"_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alert", "ing_", "=_", "[_", "x_", "[_", "\"", "check", "\"_", "]_", "for_", "x_", "in_", "r_", "._", "table_", "(_", "\"", "checks", "\"_", ")_", "._", "filter_", "(_", "{_", "\"", "h", " ", "stn", "ame", "\"_", ":_", "hostname_", ",_", "\"", "status", "\"_", ":_", "False_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "r_", "._", "table_", "(_", "\"", "note", "s", "\"_", ")_", "._", "insert_", "(_", "{_", "'", "host", "name", "'_", ":_", "hostname_", ",_", "'", "user", "'_", ":_", "request_", "._", "json_", "._", "get_", "(_", "\"", "user", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "note", "'_", ":_", "request_", "._", "json_", "._", "get_", "(_", "\"", "note", "\"_", ")_", ",_", "'", "ts", "'_", ":_", "time_", "(_", ")_", ",_", "'", "alert", "ing", "'_", ":_", "alert", "ing_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", "[_", "\"", "inserted", "\"_", "]_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "'", "success", "'_", ":_", "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_", "._", "error_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "(_", "500_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "(_", "'/", "global", "/", "cluster", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "global", "\\u", "clusters_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "List", " ", "of", " ", "know", "n", " ", "cluster", "s", " ", "and", " ", "thei", "r", " ", "id", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "cluster", "s", "'_", ":_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "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_", "@_", "app_", "._", "route_", "(_", "'/", "global", "/", "<", "clusteri", "d", ">/", "checks", "/", "state", "/", "<", "state", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "global", "\\u", "check", "\\u", "state_", "(_", "clusteri", "d_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "list", " ", "of", " ", "all", " ", "checks", " ", "in", " ", "provided", " ", "state", " ", "for", " ", "a", " ", "give", "n", " ", "cluster", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "clusteri", "d_", "not_", "in_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "in_", "VALID", "\\u", "STATES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ckey", "_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "clusteri", "d_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cached_", "=_", "cache_", "._", "get_", "(_", "ckey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "clusteri", "d_", ":_", "cached_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "\\u", "get", "\\u", "remote", "\\u", "checks_", "(_", "clusteri", "d_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "set_", "(_", "ckey", "_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "clusteri", "d_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "500_", ")_", "\\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 ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\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_", "(_", "'/", "stats", "'_", ",_", "defaults_", "=_", "{_", "'", "clusteri", "d", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "stats", "/", "<", "clusteri", "d", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "stal", "ker", "\\u", "stats_", "(_", "clusteri", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Obtain", " ", "stats", " ", "for", " ", "this", " ", "cluster", " ", "or", " ", "one", " ", "with", " ", "a", " ", "give", "n", " ", "clusteri", "d", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "{_", "'", "qs", "ize", "'_", ":_", "None_", ",_", "'", "faili", "ng", "'_", ":_", "None_", ",_", "'", "fla", "ppi", "ng", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "suspended", "'_", ":_", "None_", ",_", "'", "checks", "'_", ":_", "None_", ",_", "'", "pend", "ing", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "clusteri", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "\\u", "get", "\\u", "local", "\\u", "metrics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "app_", "._", "config_", "[_", "'", "LOCAL", "\\u", "CID", "'_", "]_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "app_", "._", "config_", "[_", "'", "LOCAL", "\\u", "CID", "'_", "]_", ":_", "default_", "}_", ")_", "\\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_", "clusteri", "d_", "in_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ckey", "_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "clusteri", "d_", ",_", "'", "stats", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cached_", "=_", "cache_", "._", "get_", "(_", "ckey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "jsonify_", "(_", "{_", "clusteri", "d_", ":_", "cached_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "\\u", "get", "\\u", "remote", "\\u", "stats_", "(_", "clusteri", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cache_", "._", "set_", "(_", "ckey", "_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "clusteri", "d_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "jsonify_", "(_", "{_", "clusteri", "d_", ":_", "default_", "}_", ")_", "\\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_", "clusteri", "d_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "[_", "app_", "._", "config_", "[_", "'", "LOCAL", "\\u", "CID", "'_", "]_", "]_", "=_", "\\u", "get", "\\u", "local", "\\u", "metrics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cid_", "in_", "app_", "._", "config_", "[_", "'", "GLOB", "AL", "\\u", "CLUSTER", "S", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ckey", "_", "=_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "cid_", ",_", "'", "stats", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cached_", "=_", "cache_", "._", "get_", "(_", "ckey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q_", "[_", "cid_", "]_", "=_", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q_", "[_", "cid_", "]_", "=_", "\\u", "get", "\\u", "remote", "\\u", "stats_", "(_", "cid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "q_", "[_", "cid_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "q_", "[_", "cid_", "]_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "set_", "(_", "ckey", "_", ",_", "q_", "[_", "cid_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "{_", "'", "all", "'_", ":_", "q_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "find", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "host_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ju", "st", " ", "used", " ", "for", " ", "the", " ", "type", " ", "ahe", "ad", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "probab", "ly", " ", "shou", "ld", " ", "cache", " ", "host", "s", " ", "in", " ", "memcached", "/", "redis", " ", "for", " ", "type", " ", "ahe", "ad", " ", "cra", "p_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "r_", "._", "table_", "(_", "\"", "host", "s", "\"_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "._", "row_", "[_", "\"", "host", "name", "\"_", "]_", "._", "match_", "(_", "\"", "^", "%", "s", "\"_", "%_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ")_", "|_", "r_", "._", "row_", "[_", "\"", "ip", "\"_", "]_", "._", "match_", "(_", "\"", "^", "%", "s", "\"_", "%_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "plu", "ck_", "(_", "{_", "\"", "host", "name", "\"_", ":_", "True_", ",_", "\"", "ip", "\"_", ":_", "True_", "}_", ")_", "._", "run_", "(_", "rdb", "_", "._", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "[_", "'", "host", "name", "'_", "]_", "._", "startswith_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "q", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "i_", "[_", "'", "host", "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 ", " _", "result_", "._", "append_", "(_", "i_", "[_", "'", "ip", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\",\"_", "._", "join_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "state", "s", ".", "html", "'_", ",_", "state_", "=_", "'", "alert", "ing", "'_", ")_", "\\u\\u\\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_", "(_", "'/", "view", "/", "state", "s", "'_", ",_", "defaults_", "=_", "{_", "'", "state", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "view", "/", "state", "s", "/", "<", "state", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "states_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "in_", "VALID", "\\u", "STATES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "state", "s", ".", "html", "'_", ",_", "state_", "=_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\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_", "render", "\\u", "template_", "(_", "'", "state", "s", ".", "html", "'_", ",_", "state_", "=_", "'", "alert", "ing", "'_", ")_", "\\u\\u\\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_", "(_", "'/", "view", "/", "checks", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "checks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "allc", "heck", "s", ".", "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_", "(_", "'/", "view", "/", "host", "/'_", ",_", "defaults_", "=_", "{_", "'", "host", "name", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "view", "/", "host", "/", "<", "host", "name", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "single", "\\u", "host_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "search", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostname_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "search", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hostname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\u\\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_", "render", "\\u", "template_", "(_", "'", "host", ".", "html", "'_", ",_", "target_", "=_", "hostname_", ")_", "\\u\\u\\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_", "(_", "'/", "view", "/", "user", "/", "<", "user", "name", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "user_", "(_", "username_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "user", ".", "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_", "(_", "'/", "global", "/", "view", "/", "state", "s", "'_", ",_", "defaults_", "=_", "{_", "'", "state", "'_", ":_", "None_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "global", "/", "view", "/", "state", "s", "/", "<", "state", ">/", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "view", "\\u", "global_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Global", " ", "view", " ", "of", " ", "provided", " ", "state", " ", "[", "alert", "ing", "/", "pend", "ing", "/", "suspended", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "in_", "VALID", "\\u", "STATES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "globals", "tate", "s", ".", "html", "'_", ",_", "state_", "=_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "(_", "404_", ")_", "\\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_", "render", "\\u", "template_", "(_", "'", "globals", "tate", "s", ".", "html", "'_", ",_", "state_", "=_", "'", "alert", "ing", "'_", ")_", "\\u\\u\\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_", "(_", "'/", "signo", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "signo", "ut_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sign", " ", "out", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "pop_", "(_", "'", "logged", "\\u", "in", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "signo", "ut", ".", "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_", "(_", "'/", "signin", "'_", ",_", "methods_", "=_", "[_", "\"", "GET", "\"_", ",_", "\"", "POST", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "signin", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sign", " ", "in", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "Sign", "In", "Form_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "validat", "e\\u", "on", "\\u", "submit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "form_", "._", "username_", "._", "data_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "form_", "._", "password_", "._", "data_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "valid", "\\u", "login_", "(_", "username_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "them", "e", "'_", "]_", "=_", "\\u", "get", "\\u", "users", "\\u", "theme_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "logged", "\\u", "in", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "user", "name", "'_", "]_", "=_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "remember", "\\u", "me_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "permanent", "_", "=_", "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 ", " _", "session_", "._", "permanent", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "args_", "._", "get_", "(_", "'", "next", "'_", ")_", "==_", "'", "signin", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "next", "'_", ")_", "or_", "request_", "._", "referrer", "_", "or_", "\"/\"_", ")_", "\\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_", "render", "\\u", "template_", "(_", "'", "signin", ".", "html", "'_", ",_", "form_", "=_", "form_", ",_", "error_", "=_", "\"", "Fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "signin", ".", "html", "'_", ",_", "form_", "=_", "form_", ",_", "error_", "=_", "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_", "@_", "app_", "._", "errorhandler_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "page", "\\u", "not", "\\u", "found_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "404", ".", "html", "'_", ")_", ",_", "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_", "@_", "app_", "._", "route_", "(_", "'/", "route", "s", "/", "list", "'_", ",_", "methods_", "=_", "[_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "help_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "endpoint", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "\\u", "list_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rule_", "in_", "app_", "._", "url", "\\u", "map_", "._", "iter", "\\u", "rules_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rule_", "._", "endpoint_", "!=_", "'", "static", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func", "\\u", "list_", "[_", "rule_", "._", "rule_", "]_", "=_", "app_", "._", "view", "\\u", "functions_", "[_", "rule_", "._", "endpoint_", "]_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jsonify_", "(_", "func", "\\u", "list_", ")_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
arctic-nmt/nmt/nmt/homogeneous_data.py
[ { "content": "import numpy\n\nimport itertools\nimport operator\n\nfrom tm_dataset import PytablesBitextIterator \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HomogenousData(PytablesBitextIterator):\n\n\n", "metadata": "root.HomogenousData", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def __init__(self, *args, **kwargs):\n PytablesBitextIterator.__init__(self, *args, **kwargs)\n self.batch_iter = None", "metadata": "root.HomogenousData.__init__", "header": "['class', 'HomogenousData', '(', 'PytablesBitextIterator', ')', ':', '___EOS___']", "index": 9 }, { "content": " def get_homogenous_batch_iter(self):\n end_of_iter = False\n while True:\n k_batches = 10\n batch_size = self.batch_size\n x = []\n y = []\n for k in xrange(k_batches):\n try:\n dx, dy = PytablesBitextIterator.next(self)\n except StopIteration:\n end_of_iter = True\n break\n if dx == None or dy == None:\n break\n x += dx\n y += dy\n if len(x) <= 0 or len(y) <= 0:\n raise StopIteration\n lens = numpy.asarray([map(len, x), map(len, y)])\n order = numpy.argsort(lens.max(axis=0)) if k_batches > 1 else numpy.arange(len(x))\n for k in range(k_batches):\n if k * batch_size > len(order):\n break\n indices = order[k * batch_size:(k + 1) * batch_size]\n yield [[x[ii] for ii in indices], [y[ii] for ii in indices]]\n\n if end_of_iter:\n raise StopIteration", "metadata": "root.HomogenousData.get_homogenous_batch_iter", "header": "['class', 'HomogenousData', '(', 'PytablesBitextIterator', ')', ':', '___EOS___']", "index": 13 }, { "content": " def next(self, peek=False):\n if not self.batch_iter:\n self.batch_iter = self.get_homogenous_batch_iter()\n if not self.batch_iter:\n raise StopIteration\n try:\n batch = next(self.batch_iter)\n except StopIteration:\n self.batch_iter = None\n raise StopIteration\n\n return batch[0], batch[1]", "metadata": "root.HomogenousData.next", "header": "['class', 'HomogenousData', '(', 'PytablesBitextIterator', ')', ':', '___EOS___']", "index": 43 } ]
[ { "span": "import itertools", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 16 }, { "span": "import operator", "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_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tm", "\\u", "dataset_", "import_", "Py", "tables", "Bit", "ext", "Iterator_", "\\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_", "Homo", "geno", "us", "Data_", "(_", "Py", "tables", "Bit", "ext", "Iterator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Homo", "geno", "us", "Data_", "(_", "Py", "tables", "Bit", "ext", "Iterator_", ")_", ":_", "\\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_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Py", "tables", "Bit", "ext", "Iterator_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "batch", "\\u", "iter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Homo", "geno", "us", "Data_", "(_", "Py", "tables", "Bit", "ext", "Iterator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "homo", "geno", "us", "\\u", "batch", "\\u", "iter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "of", "\\u", "iter_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k", "\\u", "batches_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "size_", "=_", "self_", "._", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "k", "\\u", "batches_", ")_", ":_", "\\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 ", " ", "_", "dx_", ",_", "dy_", "=_", "Py", "tables", "Bit", "ext", "Iterator_", "._", "next_", "(_", "self_", ")_", "\\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 ", " ", "_", "end", "\\u", "of", "\\u", "iter_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dx_", "==_", "None_", "or_", "dy_", "==_", "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_", "x_", "+=_", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "+=_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "x_", ")_", "<=_", "0_", "or_", "len_", "(_", "y_", ")_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lens_", "=_", "numpy_", "._", "asarray_", "(_", "[_", "map_", "(_", "len_", ",_", "x_", ")_", ",_", "map_", "(_", "len_", ",_", "y_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "numpy_", "._", "argsort_", "(_", "lens_", "._", "max_", "(_", "axis_", "=_", "0_", ")_", ")_", "if_", "k", "\\u", "batches_", ">_", "1_", "else_", "numpy_", "._", "arange_", "(_", "len_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "k", "\\u", "batches_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "*_", "batch", "\\u", "size_", ">_", "len_", "(_", "order_", ")_", ":_", "\\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_", "indices_", "=_", "order_", "[_", "k_", "*_", "batch", "\\u", "size_", ":_", "(_", "k_", "+_", "1_", ")_", "*_", "batch", "\\u", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "[_", "[_", "x_", "[_", "ii_", "]_", "for_", "ii_", "in_", "indices_", "]_", ",_", "[_", "y_", "[_", "ii_", "]_", "for_", "ii_", "in_", "indices_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "end", "\\u", "of", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Homo", "geno", "us", "Data_", "(_", "Py", "tables", "Bit", "ext", "Iterator_", ")_", ":_", "\\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_", "next_", "(_", "self_", ",_", "peek_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "batch", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "batch", "\\u", "iter_", "=_", "self_", "._", "get", "\\u", "homo", "geno", "us", "\\u", "batch", "\\u", "iter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "batch", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "=_", "next_", "(_", "self_", "._", "batch", "\\u", "iter_", ")_", "\\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 ", " _", "self_", "._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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
CollabQ/CollabQ/.google_appengine/google/appengine/api/datastore_entities.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"Classes for common kinds, including Contact, Message, and Event.\n\nMost of these kinds are based on the gd namespace \"kinds\" from GData:\n\n http://code.google.com/apis/gdata/common-elements.html\n\"\"\"\n\n\n\n\n\nimport types\nimport urlparse\nfrom xml.sax import saxutils\nfrom google.appengine.datastore import datastore_pb\nfrom google.appengine.api import datastore\nfrom google.appengine.api import datastore_errors\nfrom google.appengine.api import datastore_types\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GdKind(datastore.Entity):\n \"\"\" A base class for gd namespace kinds.\n\n This class contains common logic for all gd namespace kinds. For example,\n this class translates datastore (app id, kind, key) tuples to tag:\n URIs appropriate for use in <key> tags.\n \"\"\"\n\n HEADER = u\"\"\"<entry xmlns:gd='http://schemas.google.com/g/2005'>\n <category scheme='http://schemas.google.com/g/2005#kind'\n term='http://schemas.google.com/g/2005#%s' />\"\"\"\n FOOTER = u\"\"\"\n</entry>\"\"\"\n\n _kind_properties = set()\n _contact_properties = set()\n\n\n\n\n\n\n", "metadata": "root.GdKind", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self, kind, title, kind_properties, contact_properties=[]):\n \"\"\" Ctor.\n\n title is the name of this particular entity, e.g. Bob Jones or Mom's\n Birthday Party.\n\n kind_properties is a list of property names that should be included in\n this entity's XML encoding as first-class XML elements, instead of\n <property> elements. 'title' and 'content' are added to kind_properties\n automatically, and may not appear in contact_properties.\n\n contact_properties is a list of property names that are Keys that point to\n Contact entities, and should be included in this entity's XML encoding as\n <gd:who> elements. If a property name is included in both kind_properties\n and contact_properties, it is treated as a Contact property.\n\n Args:\n kind: string\n title: string\n kind_properties: list of strings\n contact_properties: list of string\n \"\"\"\n datastore.Entity.__init__(self, kind)\n\n if not isinstance(title, types.StringTypes):\n raise datastore_errors.BadValueError(\n 'Expected a string for title; received %s (a %s).' %\n (title, datastore_types.typename(title)))\n self['title'] = title\n self['content'] = ''\n\n self._contact_properties = set(contact_properties)\n assert not self._contact_properties.intersection(self.keys())\n\n self._kind_properties = set(kind_properties) - self._contact_properties\n self._kind_properties.add('title')\n self._kind_properties.add('content')", "metadata": "root.GdKind.__init__", "header": "['class', 'GdKind', '(', 'datastore', '.', 'Entity', ')', ':', '___EOS___']", "index": 53 }, { "content": " def _KindPropertiesToXml(self):\n \"\"\" Convert the properties that are part of this gd kind to XML. For\n testability, the XML elements in the output are sorted alphabetically\n by property name.\n\n Returns:\n string # the XML representation of the gd kind properties\n \"\"\"\n properties = self._kind_properties.intersection(set(self.keys()))\n\n xml = u''\n for prop in sorted(properties):\n prop_xml = saxutils.quoteattr(prop)[1:-1]\n\n value = self[prop]\n has_toxml = (hasattr(value, 'ToXml') or\n isinstance(value, list) and hasattr(value[0], 'ToXml'))\n\n for val in self._XmlEscapeValues(prop):\n if has_toxml:\n xml += '\\n %s' % val\n else:\n xml += '\\n <%s>%s</%s>' % (prop_xml, val, prop_xml)\n\n return xml", "metadata": "root.GdKind._KindPropertiesToXml", "header": "['class', 'GdKind', '(', 'datastore', '.', 'Entity', ')', ':', '___EOS___']", "index": 91 }, { "content": " def _ContactPropertiesToXml(self):\n \"\"\" Convert this kind's Contact properties kind to XML. For testability,\n the XML elements in the output are sorted alphabetically by property name.\n\n Returns:\n string # the XML representation of the Contact properties\n \"\"\"\n properties = self._contact_properties.intersection(set(self.keys()))\n\n xml = u''\n for prop in sorted(properties):\n values = self[prop]\n if not isinstance(values, list):\n values = [values]\n\n for value in values:\n assert isinstance(value, datastore_types.Key)\n xml += \"\"\"\n <gd:who rel=\"http://schemas.google.com/g/2005#%s.%s>\n <gd:entryLink href=\"%s\" />\n </gd:who>\"\"\" % (self.kind().lower(), prop, value.ToTagUri())\n\n return xml", "metadata": "root.GdKind._ContactPropertiesToXml", "header": "['class', 'GdKind', '(', 'datastore', '.', 'Entity', ')', ':', '___EOS___']", "index": 118 }, { "content": " def _LeftoverPropertiesToXml(self):\n \"\"\" Convert all of this entity's properties that *aren't* part of this gd\n kind to XML.\n\n Returns:\n string # the XML representation of the leftover properties\n \"\"\"\n leftovers = set(self.keys())\n leftovers -= self._kind_properties\n leftovers -= self._contact_properties\n if leftovers:\n return u'\\n ' + '\\n '.join(self._PropertiesToXml(leftovers))\n else:\n return u''", "metadata": "root.GdKind._LeftoverPropertiesToXml", "header": "['class', 'GdKind', '(', 'datastore', '.', 'Entity', ')', ':', '___EOS___']", "index": 143 }, { "content": " def ToXml(self):\n \"\"\" Returns an XML representation of this entity, as a string.\n \"\"\"\n xml = GdKind.HEADER % self.kind().lower()\n xml += self._KindPropertiesToXml()\n xml += self._ContactPropertiesToXml()\n xml += self._LeftoverPropertiesToXml()\n xml += GdKind.FOOTER\n return xml", "metadata": "root.GdKind.ToXml", "header": "['class', 'GdKind', '(', 'datastore', '.', 'Entity', ')', ':', '___EOS___']", "index": 158 }, { "content": "class Message(GdKind):\n \"\"\"A message, such as an email, a discussion group posting, or a comment.\n\n Includes the message title, contents, participants, and other properties.\n\n This is the gd Message kind. See:\n http://code.google.com/apis/gdata/common-elements.html#gdMessageKind\n\n These properties are meaningful. They are all optional.\n\n property name property type meaning\n -------------------------------------\n title string message subject\n content string message body\n from Contact* sender\n to Contact* primary recipient\n cc Contact* CC recipient\n bcc Contact* BCC recipient\n reply-to Contact* intended recipient of replies\n link Link* attachment\n category Category* tag or label associated with this message\n geoPt GeoPt* geographic location the message was posted from\n rating Rating* message rating, as defined by the application\n\n * means this property may be repeated.\n\n The Contact properties should be Keys of Contact entities. They are\n represented in the XML encoding as linked <gd:who> elements.\n \"\"\"\n KIND_PROPERTIES = ['title', 'content', 'link', 'category', 'geoPt', 'rating']\n CONTACT_PROPERTIES = ['from', 'to', 'cc', 'bcc', 'reply-to']\n", "metadata": "root.Message", "header": "['module', '___EOS___']", "index": 169 }, { "content": " def __init__(self, title, kind='Message'):\n GdKind.__init__(self, kind, title, Message.KIND_PROPERTIES,\n Message.CONTACT_PROPERTIES)", "metadata": "root.Message.__init__", "header": "['class', 'Message', '(', 'GdKind', ')', ':', '___EOS___']", "index": 201 }, { "content": "class Event(GdKind):\n \"\"\"A calendar event.\n\n Includes the event title, description, location, organizer, start and end\n time, and other details.\n\n This is the gd Event kind. See:\n http://code.google.com/apis/gdata/common-elements.html#gdEventKind\n\n These properties are meaningful. They are all optional.\n\n property name property type meaning\n -------------------------------------\n title string event name\n content string event description\n author string the organizer's name\n where string* human-readable location (not a GeoPt)\n startTime timestamp start time\n endTime timestamp end time\n eventStatus string one of the Event.Status values\n link Link* page with more information\n category Category* tag or label associated with this event\n attendee Contact* attendees and other related people\n\n * means this property may be repeated.\n\n The Contact properties should be Keys of Contact entities. They are\n represented in the XML encoding as linked <gd:who> elements.\n \"\"\"\n KIND_PROPERTIES = ['title', 'content', 'author', 'where', 'startTime',\n 'endTime', 'eventStatus', 'link', 'category']\n CONTACT_PROPERTIES = ['attendee']\n\n class Status:\n CONFIRMED = 'confirmed'\n TENTATIVE = 'tentative'\n CANCELED = 'canceled'\n\n", "metadata": "root.Event", "header": "['module', '___EOS___']", "index": 206 }, { "content": " def __init__(self, title, kind='Event'):\n GdKind.__init__(self, kind, title, Event.KIND_PROPERTIES,\n Event.CONTACT_PROPERTIES)", "metadata": "root.Event.__init__", "header": "['class', 'Event', '(', 'GdKind', ')', ':', '___EOS___']", "index": 244 }, { "content": " def ToXml(self):\n \"\"\" Override GdKind.ToXml() to special-case author, gd:where, gd:when, and\n gd:eventStatus.\n \"\"\"\n xml = GdKind.HEADER % self.kind().lower()\n\n self._kind_properties = set(Contact.KIND_PROPERTIES)\n xml += self._KindPropertiesToXml()\n\n if 'author' in self:\n xml += \"\"\"\n <author><name>%s</name></author>\"\"\" % self['author']\n\n if 'eventStatus' in self:\n xml += \"\"\"\n <gd:eventStatus value=\"http://schemas.google.com/g/2005#event.%s\" />\"\"\" % (\n self['eventStatus'])\n\n if 'where' in self:\n lines = ['<gd:where valueString=\"%s\" />' % val\n for val in self._XmlEscapeValues('where')]\n xml += '\\n ' + '\\n '.join(lines)\n\n iso_format = '%Y-%m-%dT%H:%M:%S'\n xml += '\\n <gd:when'\n for key in ['startTime', 'endTime']:\n if key in self:\n xml += ' %s=\"%s\"' % (key, self[key].isoformat())\n xml += ' />'\n\n self._kind_properties.update(['author', 'where', 'startTime', 'endTime',\n 'eventStatus'])\n xml += self._ContactPropertiesToXml()\n xml += self._LeftoverPropertiesToXml()\n xml += GdKind.FOOTER\n return xml", "metadata": "root.Event.ToXml", "header": "['class', 'Event', '(', 'GdKind', ')', ':', '___EOS___']", "index": 248 }, { "content": "class Contact(GdKind):\n \"\"\"A contact: a person, a venue such as a club or a restaurant, or an\n organization.\n\n This is the gd Contact kind. See:\n http://code.google.com/apis/gdata/common-elements.html#gdContactKind\n\n Most of the information about the contact is in the <gd:contactSection>\n element; see the reference section for that element for details.\n\n These properties are meaningful. They are all optional.\n\n property name property type meaning\n -------------------------------------\n title string contact's name\n content string notes\n email Email* email address\n geoPt GeoPt* geographic location\n im IM* IM address\n phoneNumber Phonenumber* phone number\n postalAddress PostalAddress* mailing address\n link Link* link to more information\n category Category* tag or label associated with this contact\n\n * means this property may be repeated.\n \"\"\"\n CONTACT_SECTION_HEADER = \"\"\"\n <gd:contactSection>\"\"\"\n CONTACT_SECTION_FOOTER = \"\"\"\n </gd:contactSection>\"\"\"\n\n KIND_PROPERTIES = ['title', 'content', 'link', 'category']\n\n CONTACT_SECTION_PROPERTIES = ['email', 'geoPt', 'im', 'phoneNumber',\n 'postalAddress']\n\n", "metadata": "root.Contact", "header": "['module', '___EOS___']", "index": 286 }, { "content": " def __init__(self, title, kind='Contact'):\n GdKind.__init__(self, kind, title, Contact.KIND_PROPERTIES)", "metadata": "root.Contact.__init__", "header": "['class', 'Contact', '(', 'GdKind', ')', ':', '___EOS___']", "index": 322 }, { "content": " def ToXml(self):\n \"\"\" Override GdKind.ToXml() to put some properties inside a\n gd:contactSection.\n \"\"\"\n xml = GdKind.HEADER % self.kind().lower()\n\n self._kind_properties = set(Contact.KIND_PROPERTIES)\n xml += self._KindPropertiesToXml()\n\n xml += Contact.CONTACT_SECTION_HEADER\n self._kind_properties = set(Contact.CONTACT_SECTION_PROPERTIES)\n xml += self._KindPropertiesToXml()\n xml += Contact.CONTACT_SECTION_FOOTER\n\n self._kind_properties.update(Contact.KIND_PROPERTIES)\n xml += self._LeftoverPropertiesToXml()\n xml += GdKind.FOOTER\n return xml", "metadata": "root.Contact.ToXml", "header": "['class', 'Contact', '(', 'GdKind', ')', ':', '___EOS___']", "index": 325 } ]
[ { "span": "import urlparse", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 15 }, { "span": "from google.appengine.datastore import datastore_pb", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Class", "es", " ", "for", " ", "common", " ", "kinds", ",", " ", "inclu", "ding", " ", "Conta", "ct", ",", " ", "Messag", "e", ",", " ", "and", " ", "Event", ".", "\\", "10", ";", "\\", "10", ";", "Mos", "t", " ", "of", " ", "these", " ", "kinds", " ", "are", " ", "based", " ", "on", " ", "the", " ", "gd", " ", "namespace", " ", "\"", "kinds", "\"", " ", "from", " ", "GD", "ata", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "gdat", "a", "/", "common", "-", "element", "s", ".", "html", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "sax_", "import_", "sax", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "datastore_", "import_", "datast", "ore", "\\u", "pb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "base", " ", "class", " ", "for", " ", "gd", " ", "namespace", " ", "kinds", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "class", " ", "contain", "s", " ", "common", " ", "logic", " ", "for", " ", "all", " ", "gd", " ", "namespace", " ", "kinds", ".", " ", "For", " ", "example", ",", "\\", "10", ";", " ", " ", "this", " ", "class", " ", "translat", "es", " ", "datast", "ore", " ", "(", "app", " ", "id", ",", " ", "kind", ",", " ", "key", ")", " ", "tuple", "s", " ", "to", " ", "tag", ":", "\\", "10", ";", " ", " ", "URI", "s", " ", "appropr", "iate", " ", "for", " ", "use", " ", "in", " ", "<", "key", ">", " ", "tags", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HEADER_", "=_", "u", "\"\"\"", "<", "entry", " ", "xml", "ns", ":", "gd", "='", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "'>", "\\", "10", ";", " ", " ", "<", "category", " ", "sche", "me", "='", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "#", "kind", "'", "\\", "10", ";", " ", " ", " ", " ", "term", "='", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "#", "%", "s", "'", " ", "/>", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FOO", "TER_", "=_", "u", "\"\"\"", "\\", "10", ";<", "/", "entry", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "kind", "\\u", "properties_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "contact", "\\u", "properties_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ",_", "title_", ",_", "kind", "\\u", "properties_", ",_", "contact", "\\u", "properties_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Ct", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "title", " ", "is", " ", "the", " ", "name", " ", "of", " ", "this", " ", "partic", "ular", " ", "entity", ",", " ", "e", ".", "g", ".", " ", "Bob", " ", "Jones", " ", "or", " ", "Mo", "m", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "Birth", "day", " ", "Part", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "kind", "\\u", "proper", "ties", " ", "is", " ", "a", " ", "list", " ", "of", " ", "property", " ", "names", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "include", "d", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "entity", "'", "s", " ", "XML", " ", "encoding", " ", "as", " ", "first", "-", "class", " ", "XML", " ", "element", "s", ",", " ", "inst", "ead", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "<", "property", ">", " ", "element", "s", ".", " ", "'", "title", "'", " ", "and", " ", "'", "content", "'", " ", "are", " ", "adde", "d", " ", "to", " ", "kind", "\\u", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "automati", "call", "y", ",", " ", "and", " ", "may", " ", "not", " ", "appear", " ", "in", " ", "contact", "\\u", "proper", "ties", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "contact", "\\u", "proper", "ties", " ", "is", " ", "a", " ", "list", " ", "of", " ", "property", " ", "names", " ", "tha", "t", " ", "are", " ", "Keys", " ", "tha", "t", " ", "point", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "Conta", "ct", " ", "entit", "ies", ",", " ", "and", " ", "shou", "ld", " ", "be", " ", "include", "d", " ", "in", " ", "this", " ", "entity", "'", "s", " ", "XML", " ", "encoding", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "<", "gd", ":", "who", ">", " ", "element", "s", ".", " ", "If", " ", "a", " ", "property", " ", "name", " ", "is", " ", "include", "d", " ", "in", " ", "bot", "h", " ", "kind", "\\u", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "contact", "\\u", "proper", "ties", ",", " ", "it", " ", "is", " ", "treat", "ed", " ", "as", " ", "a", " ", "Conta", "ct", " ", "property", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "kind", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "title", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "kind", "\\u", "proper", "ties", ":", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", "contact", "\\u", "proper", "ties", ":", " ", "list", " ", "of", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datastore_", "._", "Entity_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "title_", ",_", "types_", "._", "String", "Types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "datast", "ore", "\\u", "errors_", "._", "Ba", "d", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Expect", "ed", " ", "a", " ", "string", " ", "for", " ", "title", ";", " ", "receive", "d", " ", "%", "s", " ", "(", "a", " ", "%", "s", ").'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "title_", ",_", "datast", "ore", "\\u", "types_", "._", "typename_", "(_", "title_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "[_", "'", "title", "'_", "]_", "=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "[_", "'", "content", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "contact", "\\u", "properties_", "=_", "set_", "(_", "contact", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "self_", "._", "\\u", "contact", "\\u", "properties_", "._", "intersection_", "(_", "self_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "=_", "set_", "(_", "kind", "\\u", "properties_", ")_", "-_", "self_", "._", "\\u", "contact", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "._", "add_", "(_", "'", "title", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "._", "add_", "(_", "'", "content", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Kin", "d", "Proper", "ties", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "the", " ", "proper", "ties", " ", "tha", "t", " ", "are", " ", "part", " ", "of", " ", "this", " ", "gd", " ", "kind", " ", "to", " ", "XML", ".", " ", "For", "\\", "10", ";", " ", " ", " ", " ", "testa", "bilit", "y", ",", " ", "the", " ", "XML", " ", "element", "s", " ", "in", " ", "the", " ", "output", " ", "are", " ", "sorte", "d", " ", "alphabetic", "ally", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "property", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "string", " ", " ", "#", " ", "the", " ", "XML", " ", "represent", "ation", " ", "of", " ", "the", " ", "gd", " ", "kind", " ", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "self_", "._", "\\u", "kind", "\\u", "properties_", "._", "intersection_", "(_", "set_", "(_", "self_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prop_", "in_", "sorted_", "(_", "properties_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prop", "\\u", "xml_", "=_", "sax", "utils_", "._", "quote", "attr_", "(_", "prop_", ")_", "[_", "1_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "self_", "[_", "prop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "tox", "ml_", "=_", "(_", "hasattr_", "(_", "value_", ",_", "'", "To", "Xm", "l", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "value_", ",_", "list_", ")_", "and_", "hasattr_", "(_", "value_", "[_", "0_", "]_", ",_", "'", "To", "Xm", "l", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "val_", "in_", "self_", "._", "\\u", "Xm", "l", "Esc", "ape", "Values_", "(_", "prop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "tox", "ml_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "+=_", "'\\\\", "n", " ", " ", "%", "s", "'_", "%_", "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 ", " _", "xml_", "+=_", "'\\\\", "n", " ", " ", "<", "%", "s", ">", "%", "s", "</", "%", "s", ">'_", "%_", "(_", "prop", "\\u", "xml_", ",_", "val_", ",_", "prop", "\\u", "xml_", ")_", "\\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_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Conta", "ct", "Proper", "ties", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "this", " ", "kind", "'", "s", " ", "Conta", "ct", " ", "proper", "ties", " ", "kind", " ", "to", " ", "XML", ".", " ", "For", " ", "testa", "bilit", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "XML", " ", "element", "s", " ", "in", " ", "the", " ", "output", " ", "are", " ", "sorte", "d", " ", "alphabetic", "ally", " ", "by", " ", "property", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "string", " ", " ", "#", " ", "the", " ", "XML", " ", "represent", "ation", " ", "of", " ", "the", " ", "Conta", "ct", " ", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "properties_", "=_", "self_", "._", "\\u", "contact", "\\u", "properties_", "._", "intersection_", "(_", "set_", "(_", "self_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "prop_", "in_", "sorted_", "(_", "properties_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "self_", "[_", "prop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "values_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "[_", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "value_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "value_", ",_", "datast", "ore", "\\u", "types_", "._", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "\"\"\"", "\\", "10", ";", " ", " ", "<", "gd", ":", "who", " ", "rel", "=\"", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "#", "%", "s", ".", "%", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "gd", ":", "entry", "Link", " ", "href", "=\"", "%", "s", "\"", " ", "/>", "\\", "10", ";", " ", " ", "</", "gd", ":", "who", ">\"\"\"_", "%_", "(_", "self_", "._", "kind_", "(_", ")_", "._", "lower_", "(_", ")_", ",_", "prop_", ",_", "value_", "._", "To", "Ta", "g", "Uri_", "(_", ")_", ")_", "\\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_", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Le", "fto", "ver", "Proper", "ties", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "all", " ", "of", " ", "this", " ", "entity", "'", "s", " ", "proper", "ties", " ", "tha", "t", " ", "*", "are", "n", "'", "t", "*", " ", "part", " ", "of", " ", "this", " ", "gd", "\\", "10", ";", " ", " ", " ", " ", "kind", " ", "to", " ", "XML", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "string", " ", " ", "#", " ", "the", " ", "XML", " ", "represent", "ation", " ", "of", " ", "the", " ", "lefto", "ver", " ", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lefto", "vers_", "=_", "set_", "(_", "self_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lefto", "vers_", "-=_", "self_", "._", "\\u", "kind", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lefto", "vers_", "-=_", "self_", "._", "\\u", "contact", "\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lefto", "vers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "u", "'\\\\", "n", " ", " ", "'_", "+_", "'\\\\", "n", " ", " ", "'_", "._", "join_", "(_", "self_", "._", "\\u", "Proper", "ties", "To", "Xml_", "(_", "lefto", "vers_", ")_", ")_", "\\u\\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\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Gd", "Kind_", "(_", "datastore_", "._", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "an", " ", "XML", " ", "represent", "ation", " ", "of", " ", "this", " ", "entity", ",", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "Gd", "Kind_", "._", "HEADER_", "%_", "self_", "._", "kind_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Kin", "d", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Conta", "ct", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Le", "fto", "ver", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "Gd", "Kind_", "._", "FOO", "TER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "xml_", "\\u\\u\\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_", "Message_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "message", ",", " ", "suc", "h", " ", "as", " ", "an", " ", "email", ",", " ", "a", " ", "discuss", "ion", " ", "group", " ", "posting", ",", " ", "or", " ", "a", " ", "comment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Includes", " ", "the", " ", "message", " ", "title", ",", " ", "content", "s", ",", " ", "participa", "nts", ",", " ", "and", " ", "other", " ", "proper", "ties", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "gd", " ", "Messag", "e", " ", "kind", ".", " ", "See", ":", "\\", "10", ";", " ", " ", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "gdat", "a", "/", "common", "-", "element", "s", ".", "html", "#", "gd", "Messag", "e", "Kin", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", "se", " ", "proper", "ties", " ", "are", " ", "meaning", "ful", ".", " ", "The", "y", " ", "are", " ", "all", " ", "option", "al", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "property", " ", "name", " ", " ", "property", " ", "type", " ", " ", " ", " ", "meaning", "\\", "10", ";", " ", " ", "--------------", "--------------", "---------", "\\", "10", ";", " ", " ", "title", " ", " ", "string", " ", " ", " ", " ", " ", "message", " ", "subject", "\\", "10", ";", " ", " ", "content", " ", " ", " ", " ", "string", " ", " ", " ", " ", " ", "message", " ", "body", "\\", "10", ";", " ", " ", "from", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "sender", "\\", "10", ";", " ", " ", "to", " ", " ", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "primary", " ", "recip", "ient", "\\", "10", ";", " ", " ", "cc", " ", " ", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "CC", " ", "recip", "ient", "\\", "10", ";", " ", " ", "bcc", " ", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "BC", "C", " ", "recip", "ient", "\\", "10", ";", " ", " ", "repl", "y", "-", "to", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "inten", "ded", " ", "recip", "ient", " ", "of", " ", "replies", "\\", "10", ";", " ", " ", "link", " ", " ", " ", "Link", "*", " ", " ", "attach", "ment", "\\", "10", ";", " ", " ", "category", " ", " ", " ", "Cate", "gory", "*", " ", " ", "tag", " ", "or", " ", "label", " ", "associate", "d", " ", "with", " ", "this", " ", "message", "\\", "10", ";", " ", " ", "geo", "Pt", " ", " ", "Geo", "Pt", "*", " ", " ", " ", " ", " ", "geographic", " ", "location", " ", "the", " ", "message", " ", "was", " ", "poste", "d", " ", "from", "\\", "10", ";", " ", " ", "rati", "ng", " ", " ", " ", " ", " ", "Rati", "ng", "*", " ", " ", " ", " ", "message", " ", "rati", "ng", ",", " ", "as", " ", "defin", "ed", " ", "by", " ", "the", " ", "applica", "tion", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", "means", " ", "this", " ", "property", " ", "may", " ", "be", " ", "repeated", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "Conta", "ct", " ", "proper", "ties", " ", "shou", "ld", " ", "be", " ", "Keys", " ", "of", " ", "Conta", "ct", " ", "entit", "ies", ".", " ", "The", "y", " ", "are", "\\", "10", ";", " ", " ", "represent", "ed", " ", "in", " ", "the", " ", "XML", " ", "encoding", " ", "as", " ", "linked", " ", "<", "gd", ":", "who", ">", " ", "element", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KIND", "\\u", "PROPERTIES_", "=_", "[_", "'", "title", "'_", ",_", "'", "content", "'_", ",_", "'", "link", "'_", ",_", "'", "category", "'_", ",_", "'", "geo", "Pt", "'_", ",_", "'", "rati", "ng", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTACT", "\\u", "PROPERTIES_", "=_", "[_", "'", "from", "'_", ",_", "'", "to", "'_", ",_", "'", "cc", "'_", ",_", "'", "bcc", "'_", ",_", "'", "repl", "y", "-", "to", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "title_", ",_", "kind_", "=_", "'", "Messag", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Gd", "Kind_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ",_", "title_", ",_", "Message_", "._", "KIND", "\\u", "PROPERTIES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Message_", "._", "CONTACT", "\\u", "PROPERTIES_", ")_", "\\u\\u\\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_", "Event_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "calendar", " ", "event", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Includes", " ", "the", " ", "event", " ", "title", ",", " ", "description", ",", " ", "location", ",", " ", "organizer", ",", " ", "start", " ", "and", " ", "end", "\\", "10", ";", " ", " ", "time", ",", " ", "and", " ", "other", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "gd", " ", "Event", " ", "kind", ".", " ", "See", ":", "\\", "10", ";", " ", " ", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "gdat", "a", "/", "common", "-", "element", "s", ".", "html", "#", "gd", "Event", "Kin", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", "se", " ", "proper", "ties", " ", "are", " ", "meaning", "ful", ".", " ", "The", "y", " ", "are", " ", "all", " ", "option", "al", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "property", " ", "name", " ", " ", "property", " ", "type", " ", " ", " ", " ", "meaning", "\\", "10", ";", " ", " ", "--------------", "--------------", "---------", "\\", "10", ";", " ", " ", "title", " ", " ", "string", " ", " ", " ", " ", " ", "event", " ", "name", "\\", "10", ";", " ", " ", "content", " ", " ", " ", " ", "string", " ", " ", " ", " ", " ", "event", " ", "description", "\\", "10", ";", " ", " ", "author", " ", " ", " ", " ", " ", "string", " ", " ", " ", " ", " ", "the", " ", "organizer", "'", "s", " ", "name", "\\", "10", ";", " ", " ", "where", " ", " ", "string", "*", " ", " ", " ", " ", "human", "-", "reada", "ble", " ", "location", " ", "(", "not", " ", "a", " ", "Geo", "Pt", ")", "\\", "10", ";", " ", " ", "start", "Time", " ", " ", "timestamp", " ", " ", "start", " ", "time", "\\", "10", ";", " ", " ", "end", "Time", " ", " ", " ", " ", "timestamp", " ", " ", "end", " ", "time", "\\", "10", ";", " ", " ", "event", "Status", " ", " ", " ", " ", "string", " ", " ", " ", " ", " ", "one", " ", "of", " ", "the", " ", "Event", ".", "Status", " ", "values", "\\", "10", ";", " ", " ", "link", " ", " ", " ", "Link", "*", " ", " ", "page", " ", "with", " ", "more", " ", "informati", "on", "\\", "10", ";", " ", " ", "category", " ", " ", " ", "Cate", "gory", "*", " ", " ", "tag", " ", "or", " ", "label", " ", "associate", "d", " ", "with", " ", "this", " ", "event", "\\", "10", ";", " ", " ", "attendee", " ", " ", " ", "Conta", "ct", "*", " ", " ", " ", "attendee", "s", " ", "and", " ", "other", " ", "relate", "d", " ", "people", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", "means", " ", "this", " ", "property", " ", "may", " ", "be", " ", "repeated", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "Conta", "ct", " ", "proper", "ties", " ", "shou", "ld", " ", "be", " ", "Keys", " ", "of", " ", "Conta", "ct", " ", "entit", "ies", ".", " ", "The", "y", " ", "are", "\\", "10", ";", " ", " ", "represent", "ed", " ", "in", " ", "the", " ", "XML", " ", "encoding", " ", "as", " ", "linked", " ", "<", "gd", ":", "who", ">", " ", "element", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KIND", "\\u", "PROPERTIES_", "=_", "[_", "'", "title", "'_", ",_", "'", "content", "'_", ",_", "'", "author", "'_", ",_", "'", "where", "'_", ",_", "'", "start", "Time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "Time", "'_", ",_", "'", "event", "Status", "'_", ",_", "'", "link", "'_", ",_", "'", "category", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTACT", "\\u", "PROPERTIES_", "=_", "[_", "'", "attendee", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIRM", "ED_", "=_", "'", "confirm", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEN", "TAT", "IVE_", "=_", "'", "tent", "ative", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CANCEL", "ED_", "=_", "'", "cancel", "ed", "'_", "\\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_", "Event_", "(_", "Gd", "Kind_", ")_", ":_", "\\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_", ",_", "title_", ",_", "kind_", "=_", "'", "Event", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Gd", "Kind_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ",_", "title_", ",_", "Event_", "._", "KIND", "\\u", "PROPERTIES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Event_", "._", "CONTACT", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Event_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Override", " ", "Gd", "Kin", "d", ".", "To", "Xm", "l", "()", " ", "to", " ", "special", "-", "case", " ", "author", ",", " ", "gd", ":", "where", ",", " ", "gd", ":", "whe", "n", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "gd", ":", "event", "Status", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "Gd", "Kind_", "._", "HEADER_", "%_", "self_", "._", "kind_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "=_", "set_", "(_", "Contact_", "._", "KIND", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Kin", "d", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "author", "'_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "+=_", "\"\"\"", "\\", "10", ";", " ", " ", "<", "author", "><", "name", ">", "%", "s", "</", "name", "><", "/", "author", ">\"\"\"_", "%_", "self_", "[_", "'", "author", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "event", "Status", "'_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "+=_", "\"\"\"", "\\", "10", ";", " ", " ", "<", "gd", ":", "event", "Status", " ", "value", "=\"", "http", "://", "schema", "s", ".", "google", ".", "com", "/", "g", "/", "2005", "#", "event", ".", "%", "s", "\"", " ", "/>", "\"\"\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "event", "Status", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "where", "'_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "[_", "'<", "gd", ":", "where", " ", "value", "String", "=\"", "%", "s", "\"", " ", "/>'_", "%_", "val_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "val_", "in_", "self_", "._", "\\u", "Xm", "l", "Esc", "ape", "Values_", "(_", "'", "where", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "'\\\\", "n", " ", " ", "'_", "+_", "'\\\\", "n", " ", " ", "'_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iso", "\\u", "format_", "=_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "'\\\\", "n", " ", " ", "<", "gd", ":", "whe", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "[_", "'", "start", "Time", "'_", ",_", "'", "end", "Time", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xml_", "+=_", "'", " ", "%", "s", "=\"", "%", "s", "\"'_", "%_", "(_", "key_", ",_", "self_", "[_", "key_", "]_", "._", "isoformat_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xml_", "+=_", "'", " ", "/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "._", "update_", "(_", "[_", "'", "author", "'_", ",_", "'", "where", "'_", ",_", "'", "start", "Time", "'_", ",_", "'", "end", "Time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "Status", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Conta", "ct", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Le", "fto", "ver", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "Gd", "Kind_", "._", "FOO", "TER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "xml_", "\\u\\u\\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_", "Contact_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "contact", ":", " ", "a", " ", "person", ",", " ", "a", " ", "venue", " ", "suc", "h", " ", "as", " ", "a", " ", "club", " ", "or", " ", "a", " ", "restaurant", ",", " ", "or", " ", "an", "\\", "10", ";", " ", " ", "organization", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "gd", " ", "Conta", "ct", " ", "kind", ".", " ", "See", ":", "\\", "10", ";", " ", " ", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "gdat", "a", "/", "common", "-", "element", "s", ".", "html", "#", "gd", "Conta", "ct", "Kin", "d", "\\", "10", ";", "\\", "10", ";", " ", " ", "Mos", "t", " ", "of", " ", "the", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "contact", " ", "is", " ", "in", " ", "the", " ", "<", "gd", ":", "contact", "Sect", "ion", ">", "\\", "10", ";", " ", " ", "element", ";", " ", "see", " ", "the", " ", "reference", " ", "section", " ", "for", " ", "tha", "t", " ", "element", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", "se", " ", "proper", "ties", " ", "are", " ", "meaning", "ful", ".", " ", "The", "y", " ", "are", " ", "all", " ", "option", "al", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "property", " ", "name", " ", " ", "property", " ", "type", " ", " ", " ", " ", "meaning", "\\", "10", ";", " ", " ", "--------------", "--------------", "---------", "\\", "10", ";", " ", " ", "title", " ", " ", "string", " ", " ", " ", " ", " ", "contact", "'", "s", " ", "name", "\\", "10", ";", " ", " ", "content", " ", " ", " ", " ", "string", " ", " ", " ", " ", " ", "note", "s", "\\", "10", ";", " ", " ", "email", " ", " ", "Ema", "il", "*", " ", " ", " ", " ", " ", "email", " ", "address", "\\", "10", ";", " ", " ", "geo", "Pt", " ", " ", "Geo", "Pt", "*", " ", " ", " ", " ", " ", "geographic", " ", "location", "\\", "10", ";", " ", " ", "im", " ", " ", " ", " ", " ", "IM", "*", " ", " ", " ", " ", "IM", " ", "address", "\\", "10", ";", " ", " ", "phone", "Number", " ", " ", " ", " ", "Phone", "number", "*", " ", " ", " ", "phone", " ", "number", "\\", "10", ";", " ", " ", "postal", "Address", " ", " ", "Post", "al", "Address", "*", " ", "mailing", " ", "address", "\\", "10", ";", " ", " ", "link", " ", " ", " ", "Link", "*", " ", " ", "link", " ", "to", " ", "more", " ", "informati", "on", "\\", "10", ";", " ", " ", "category", " ", " ", " ", "Cate", "gory", "*", " ", " ", "tag", " ", "or", " ", "label", " ", "associate", "d", " ", "with", " ", "this", " ", "contact", "\\", "10", ";", "\\", "10", ";", " ", " ", "*", " ", "means", " ", "this", " ", "property", " ", "may", " ", "be", " ", "repeated", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTACT", "\\u", "SECTION", "\\u", "HEADER_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", "<", "gd", ":", "contact", "Sect", "ion", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONTACT", "\\u", "SECTION", "\\u", "FOO", "TER_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", "</", "gd", ":", "contact", "Sect", "ion", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "KIND", "\\u", "PROPERTIES_", "=_", "[_", "'", "title", "'_", ",_", "'", "content", "'_", ",_", "'", "link", "'_", ",_", "'", "category", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONTACT", "\\u", "SECTION", "\\u", "PROPERTIES_", "=_", "[_", "'", "email", "'_", ",_", "'", "geo", "Pt", "'_", ",_", "'", "im", "'_", ",_", "'", "phone", "Number", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "postal", "Address", "'_", "]_", "\\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_", "Contact_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "title_", ",_", "kind_", "=_", "'", "Conta", "ct", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Gd", "Kind_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "kind_", ",_", "title_", ",_", "Contact_", "._", "KIND", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Contact_", "(_", "Gd", "Kind_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "To", "Xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Override", " ", "Gd", "Kin", "d", ".", "To", "Xm", "l", "()", " ", "to", " ", "put", " ", "some", " ", "proper", "ties", " ", "insi", "de", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "gd", ":", "contact", "Sect", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "Gd", "Kind_", "._", "HEADER_", "%_", "self_", "._", "kind_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "=_", "set_", "(_", "Contact_", "._", "KIND", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Kin", "d", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "+=_", "Contact_", "._", "CONTACT", "\\u", "SECTION", "\\u", "HEADER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "=_", "set_", "(_", "Contact_", "._", "CONTACT", "\\u", "SECTION", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Kin", "d", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "Contact_", "._", "CONTACT", "\\u", "SECTION", "\\u", "FOO", "TER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "kind", "\\u", "properties_", "._", "update_", "(_", "Contact_", "._", "KIND", "\\u", "PROPERTIES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "self_", "._", "\\u", "Le", "fto", "ver", "Proper", "ties", "To", "Xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "+=_", "Gd", "Kind_", "._", "FOO", "TER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "xml_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
glenjarvis/ansible_tutorial/src/example_03/ansible_module.py
[ { "content": "def get_distribution():\n ''' return the distribution name '''\n if platform.system() == 'Linux':\n try:\n distribution = platform.linux_distribution()[0].capitalize()\n if not distribution and os.path.isfile('/etc/system-release'):\n distribution = platform.linux_distribution(supported_dists=['system'])[0].capitalize()\n if 'Amazon' in distribution:\n distribution = 'Amazon'\n else:\n distribution = 'OtherLinux'\n except:\n # FIXME: MethodMissing, I assume?\n distribution = platform.dist()[0].capitalize()\n else:\n distribution = None\n return distribution", "metadata": "root.get_distribution", "header": "['module', '___EOS___']", "index": 286 }, { "content": " def is_nfs_path(self, path):\n \"\"\"\n Returns a tuple containing (True, selinux_context) if the given path\n is on a NFS mount point, otherwise the return will be (False, None).\n \"\"\"\n try:\n f = open('/proc/mounts', 'r')\n mount_data = f.readlines()\n f.close()\n except:\n return (False, None)\n path_mount_point = self.find_mount_point(path)\n for line in mount_data:\n (device, mount_point, fstype, options, rest) = line.split(' ', 4)\n if path_mount_point == mount_point and 'nfs' in fstype:\n nfs_context = self.selinux_context(path_mount_point)\n return (True, nfs_context)\n return (False, None)", "metadata": "root.AnsibleModule.is_nfs_path", "header": "['class', 'AnsibleModule', '(', 'object', ')', ':', '___EOS___']", "index": 517 }, { "content": " def _check_argument_types(self):\n ''' ensure all arguments have the requested type '''\n for (k, v) in self.argument_spec.iteritems():\n wanted = v.get('type', None)\n if wanted is None:\n continue\n if k not in self.params:\n continue\n\n value = self.params[k]\n is_invalid = False\n\n if wanted == 'str':\n if not isinstance(value, basestring):\n self.params[k] = str(value)\n elif wanted == 'list':\n if not isinstance(value, list):\n if isinstance(value, basestring):\n self.params[k] = value.split(\",\")\n elif isinstance(value, int) or isinstance(value, float):\n self.params[k] = [ str(value) ]\n else:\n is_invalid = True\n elif wanted == 'dict':\n if not isinstance(value, dict):\n if isinstance(value, basestring):\n if value.startswith(\"{\"):\n try:\n self.params[k] = json.loads(value)\n except:\n (result, exc) = self.safe_eval(value, dict(), include_exceptions=True)\n if exc is not None:\n self.fail_json(msg=\"unable to evaluate dictionary for %s\" % k)\n self.params[k] = result\n elif '=' in value:\n self.params[k] = dict([x.split(\"=\", 1) for x in value.split(\",\")])\n else:\n self.fail_json(msg=\"dictionary requested, could not parse JSON or key=value\")\n else:\n is_invalid = True\n elif wanted == 'bool':\n if not isinstance(value, bool):\n if isinstance(value, basestring):\n self.params[k] = self.boolean(value)\n else:\n is_invalid = True\n elif wanted == 'int':\n if not isinstance(value, int):\n if isinstance(value, basestring):\n self.params[k] = int(value)\n else:\n is_invalid = True\n elif wanted == 'float':\n if not isinstance(value, float):\n if isinstance(value, basestring):\n self.params[k] = float(value)\n else:\n is_invalid = True\n else:\n self.fail_json(msg=\"implementation error: unknown type %s requested for %s\" % (wanted, k))\n\n if is_invalid:\n self.fail_json(msg=\"argument %s is of invalid type: %s, required: %s\" % (k, type(value), wanted))", "metadata": "root.AnsibleModule._check_argument_types", "header": "['class', 'AnsibleModule', '(', 'object', ')', ':', '___EOS___']", "index": 825 }, { "content": " def _set_cwd(self):\n try:\n cwd = os.getcwd()\n if not os.access(cwd, os.F_OK|os.R_OK):\n raise\n return cwd\n except:\n # we don't have access to the cwd, probably because of sudo. \n # Try and move to a neutral location to prevent errors\n for cwd in [os.path.expandvars('$HOME'), tempfile.gettempdir()]:\n try:\n if os.access(cwd, os.F_OK|os.R_OK):\n os.chdir(cwd)\n return cwd\n except:\n pass\n # we won't error here, as it may *not* be a problem, \n # and we don't want to break modules unnecessarily\n return None ", "metadata": "root.AnsibleModule._set_cwd", "header": "['class', 'AnsibleModule', '(', 'object', ')', ':', '___EOS___']", "index": 986 }, { "content": " def run_command(self, args, check_rc=False, close_fds=False, executable=None, data=None, binary_data=False, path_prefix=None, cwd=None, use_unsafe_shell=False):\n '''\n Execute a command, returns rc, stdout, and stderr.\n args is the command to run\n If args is a list, the command will be run with shell=False.\n If args is a string and use_unsafe_shell=False it will split args to a list and run with shell=False\n If args is a string and use_unsafe_shell=True it run with shell=True.\n Other arguments:\n - check_rc (boolean) Whether to call fail_json in case of\n non zero RC. Default is False.\n - close_fds (boolean) See documentation for subprocess.Popen().\n Default is False.\n - executable (string) See documentation for subprocess.Popen().\n Default is None.\n '''\n\n shell = False\n if isinstance(args, list):\n if use_unsafe_shell:\n args = \" \".join([pipes.quote(x) for x in args])\n shell = True\n elif isinstance(args, basestring) and use_unsafe_shell:\n shell = True\n elif isinstance(args, basestring):\n args = shlex.split(args.encode('utf-8'))\n else:\n msg = \"Argument 'args' to run_command must be list or string\"\n self.fail_json(rc=257, cmd=args, msg=msg)\n\n # expand things like $HOME and ~\n if not shell:\n args = [ os.path.expandvars(os.path.expanduser(x)) for x in args ]\n\n rc = 0\n msg = None\n st_in = None\n\n # Set a temporart env path if a prefix is passed\n env=os.environ\n if path_prefix:\n env['PATH']=\"%s:%s\" % (path_prefix, env['PATH'])\n\n # create a printable version of the command for use\n # in reporting later, which strips out things like\n # passwords from the args list\n if isinstance(args, list):\n clean_args = \" \".join(pipes.quote(arg) for arg in args)\n else:\n clean_args = args\n\n # all clean strings should return two match groups, \n # where the first is the CLI argument and the second \n # is the password/key/phrase that will be hidden\n clean_re_strings = [\n # this removes things like --password, --pass, --pass-wd, etc.\n # optionally followed by an '=' or a space. The password can \n # be quoted or not too, though it does not care about quotes\n # that are not balanced\n # source: http://blog.stevenlevithan.com/archives/match-quoted-string\n r'([-]{0,2}pass[-]?(?:word|wd)?[=\\s]?)((?:[\"\\'])?(?:[^\\s])*(?:\\1)?)',\n # TODO: add more regex checks here\n ]\n for re_str in clean_re_strings:\n r = re.compile(re_str)\n clean_args = r.sub(r'\\1********', clean_args)\n\n if data:\n st_in = subprocess.PIPE\n\n kwargs = dict(\n executable=executable,\n shell=shell,\n close_fds=close_fds,\n stdin= st_in,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE \n )\n\n if path_prefix:\n kwargs['env'] = env\n if cwd and os.path.isdir(cwd):\n kwargs['cwd'] = cwd\n\n # store the pwd\n prev_dir = os.getcwd()\n\n # make sure we're in the right working directory\n if cwd and os.path.isdir(cwd):\n try:\n os.chdir(cwd)\n except (OSError, IOError), e:\n self.fail_json(rc=e.errno, msg=\"Could not open %s , %s\" % (cwd, str(e)))\n\n try:\n cmd = subprocess.Popen(args, **kwargs)\n\n if data:\n if not binary_data:\n data += '\\n'\n out, err = cmd.communicate(input=data)\n rc = cmd.returncode\n except (OSError, IOError), e:\n self.fail_json(rc=e.errno, msg=str(e), cmd=clean_args)\n except:\n self.fail_json(rc=257, msg=traceback.format_exc(), cmd=clean_args)\n\n if rc != 0 and check_rc:\n msg = err.rstrip()\n self.fail_json(cmd=clean_args, rc=rc, stdout=out, stderr=err, msg=msg)\n\n # reset the pwd\n os.chdir(prev_dir)\n\n return (rc, out, err)", "metadata": "root.AnsibleModule.run_command", "header": "['class', 'AnsibleModule', '(', 'object', ')', ':', '___EOS___']", "index": 1193 } ]
[ { "span": "except:", "start_line": 297, "start_column": 8, "end_line": 297, "end_column": 15 }, { "span": "except:", "start_line": 526, "start_column": 8, "end_line": 526, "end_column": 15 }, { "span": "except:", "start_line": 854, "start_column": 28, "end_line": 854, "end_column": 35 }, { "span": "except:", "start_line": 992, "start_column": 8, "end_line": 992, "end_column": 15 }, { "span": "except:", "start_line": 1000, "start_column": 16, "end_line": 1000, "end_column": 23 }, { "span": "except:", "start_line": 1296, "start_column": 8, "end_line": 1296, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "distribution_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "return", " ", "the", " ", "distribu", "tion", " ", "name", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Lin", "ux", "'_", ":_", "\\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 ", " _", "distribution_", "=_", "platform_", "._", "linux", "\\u", "distribution_", "(_", ")_", "[_", "0_", "]_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "distribution_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "etc", "/", "system", "-", "release", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distribution_", "=_", "platform_", "._", "linux", "\\u", "distribution_", "(_", "support", "ed", "\\u", "dists_", "=_", "[_", "'", "system", "'_", "]_", ")_", "[_", "0_", "]_", "._", "capitalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "Ama", "zon", "'_", "in_", "distribution_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "distribution_", "=_", "'", "Ama", "zon", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "distribution_", "=_", "'", "Ot", "her", "Lin", "ux", "'_", "\\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_", "#", " ", "FIX", "ME", ":", " ", "Meth", "od", "Missing", ",", " ", "I", " ", "assume", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distribution_", "=_", "platform_", "._", "dist_", "(_", ")_", "[_", "0_", "]_", "._", "capitalize_", "(_", ")_", "\\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 ", " _", "distribution_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "distribution_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ans", "ibl", "e", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "nfs", "\\u", "path_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "tuple", " ", "contain", "ing", " ", "(", "Tru", "e", ",", " ", "selinux", "\\u", "context", ")", " ", "if", " ", "the", " ", "give", "n", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "on", " ", "a", " ", "NF", "S", " ", "mount", " ", "point", ",", " ", "other", "wis", "e", " ", "the", " ", "return", " ", "will", " ", "be", " ", "(", "Fal", "se", ",", " ", "Non", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'/", "proc", "/", "mount", "s", "'_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mount", "\\u", "data_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "False_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path", "\\u", "mount", "\\u", "point_", "=_", "self_", "._", "find", "\\u", "mount", "\\u", "point_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "mount", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "device_", ",_", "mount", "\\u", "point_", ",_", "fstype", "_", ",_", "options_", ",_", "rest_", ")_", "=_", "line_", "._", "split_", "(_", "'", " ", "'_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path", "\\u", "mount", "\\u", "point_", "==_", "mount", "\\u", "point_", "and_", "'", "nfs", "'_", "in_", "fstype", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nfs", "\\u", "context_", "=_", "self_", "._", "selinux", "\\u", "context_", "(_", "path", "\\u", "mount", "\\u", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "True_", ",_", "nfs", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "False_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ans", "ibl", "e", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "argu", "ment", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "ensure", " ", "all", " ", "argu", "ment", "s", " ", "have", " ", "the", " ", "request", "ed", " ", "type", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "self_", "._", "argu", "ment", "\\u", "spec_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wanted_", "=_", "v_", "._", "get_", "(_", "'", "type", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wanted_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "k_", "not_", "in_", "self_", "._", "params_", ":_", "\\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_", "value_", "=_", "self_", "._", "params_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "invalid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "wanted_", "==_", "'", "str", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "params_", "[_", "k_", "]_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "wanted_", "==_", "'", "list", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "value_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "int_", ")_", "or_", "isinstance_", "(_", "value_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "[_", "str_", "(_", "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 ", " ", " _", "is", "\\u", "invalid_", "=_", "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_", "elif_", "wanted_", "==_", "'", "dict", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "value_", "._", "startswith_", "(_", "\"{\"_", ")_", ":_", "\\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_", "._", "params_", "[_", "k_", "]_", "=_", "json_", "._", "loads_", "(_", "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 ", " ", " _", "(_", "result_", ",_", "exc_", ")_", "=_", "self_", "._", "safe", "\\u", "eval_", "(_", "value_", ",_", "dict_", "(_", ")_", ",_", "include", "\\u", "exceptions_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"", "una", "ble", " ", "to", " ", "evaluate", " ", "dictionar", "y", " ", "for", " ", "%", "s", "\"_", "%_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "params_", "[_", "k_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'='_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "dict_", "(_", "[_", "x_", "._", "split_", "(_", "\"=\"_", ",_", "1_", ")_", "for_", "x_", "in_", "value_", "._", "split_", "(_", "\",\"_", ")_", "]_", ")_", "\\u\\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", "\\u", "json_", "(_", "msg_", "=_", "\"", "dictionar", "y", " ", "request", "ed", ",", " ", "coul", "d", " ", "not", " ", "parse", " ", "JSO", "N", " ", "or", " ", "key", "=", "value", "\"_", ")_", "\\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 ", " ", " _", "is", "\\u", "invalid_", "=_", "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_", "elif_", "wanted_", "==_", "'", "bool", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "bool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "self_", "._", "boolean_", "(_", "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 ", " ", " _", "is", "\\u", "invalid_", "=_", "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_", "elif_", "wanted_", "==_", "'", "int", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "int_", "(_", "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 ", " ", " _", "is", "\\u", "invalid_", "=_", "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_", "elif_", "wanted_", "==_", "'", "float", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "float_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "params_", "[_", "k_", "]_", "=_", "float_", "(_", "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 ", " ", " _", "is", "\\u", "invalid_", "=_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"", "implementation", " ", "error", ":", " ", "unknown", " ", "type", " ", "%", "s", " ", "request", "ed", " ", "for", " ", "%", "s", "\"_", "%_", "(_", "wanted_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "invalid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "\"", "argu", "ment", " ", "%", "s", " ", "is", " ", "of", " ", "invalid", " ", "type", ":", " ", "%", "s", ",", " ", "require", "d", ":", " ", "%", "s", "\"_", "%_", "(_", "k_", ",_", "type_", "(_", "value_", ")_", ",_", "wanted_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ans", "ibl", "e", "Module_", "(_", "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\\u", "cwd_", "(_", "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 ", " _", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "access_", "(_", "cwd_", ",_", "os_", "._", "F", "\\u", "OK_", "|_", "os_", "._", "R", "\\u", "OK_", ")_", ":_", "\\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_", "return_", "cwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "access", " ", "to", " ", "the", " ", "cw", "d", ",", " ", "probab", "ly", " ", "bec", "aus", "e", " ", "of", " ", "sudo", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "and", " ", "move", " ", "to", " ", "a", " ", "neutral", " ", "location", " ", "to", " ", "prevent", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cwd_", "in_", "[_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "'$", "HOM", "E", "'_", ")_", ",_", "tempfile_", "._", "gettempdir_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "access_", "(_", "cwd_", ",_", "os_", "._", "F", "\\u", "OK_", "|_", "os_", "._", "R", "\\u", "OK_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "chdir_", "(_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cwd_", "\\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_", "#", " ", "we", " ", "won", "'", "t", " ", "error", " ", "here", ",", " ", "as", " ", "it", " ", "may", " ", "*", "not", "*", " ", "be", " ", "a", " ", "problem", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "break", " ", "module", "s", " ", "unne", "cess", "ari", "ly_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ans", "ibl", "e", "Module_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "command_", "(_", "self_", ",_", "args_", ",_", "check", "\\u", "rc_", "=_", "False_", ",_", "close", "\\u", "fds_", "=_", "False_", ",_", "executable_", "=_", "None_", ",_", "data_", "=_", "None_", ",_", "binar", "y", "\\u", "data_", "=_", "False_", ",_", "path", "\\u", "prefix_", "=_", "None_", ",_", "cwd_", "=_", "None_", ",_", "use", "\\u", "unsafe", "\\u", "shell_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Execut", "e", " ", "a", " ", "command", ",", " ", "return", "s", " ", "rc", ",", " ", "stdout", ",", " ", "and", " ", "std", "err", ".", "\\", "10", ";", " ", " ", " ", " ", "args", " ", "is", " ", "the", " ", "command", " ", "to", " ", "run", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "args", " ", "is", " ", "a", " ", "list", ",", " ", "the", " ", "command", " ", "will", " ", "be", " ", "run", " ", "with", " ", "shell", "=", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "args", " ", "is", " ", "a", " ", "string", " ", "and", " ", "use", "\\u", "unsafe", "\\u", "shell", "=", "Fal", "se", " ", "it", " ", "will", " ", "split", " ", "args", " ", "to", " ", "a", " ", "list", " ", "and", " ", "run", " ", "with", " ", "shell", "=", "Fal", "se", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "args", " ", "is", " ", "a", " ", "string", " ", "and", " ", "use", "\\u", "unsafe", "\\u", "shell", "=", "Tru", "e", " ", "it", " ", "run", " ", "with", " ", "shell", "=", "Tru", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", " ", "argu", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "check", "\\u", "rc", " ", "(", "boolean", ")", " ", " ", "Whe", "ther", " ", "to", " ", "call", " ", "fail", "\\u", "json", " ", "in", " ", "case", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "non", " ", "zero", " ", "RC", ".", " ", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "close", "\\u", "fds", " ", "(", "boolean", ")", " ", "See", " ", "documentation", " ", "for", " ", "subproc", "ess", ".", "Pop", "en", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "executable", " ", "(", "string", ")", " ", "See", " ", "documentation", " ", "for", " ", "subproc", "ess", ".", "Pop", "en", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "args_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "use", "\\u", "unsafe", "\\u", "shell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "[_", "pipes_", "._", "quote_", "(_", "x_", ")_", "for_", "x_", "in_", "args_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shell_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", ",_", "basestring_", ")_", "and_", "use", "\\u", "unsafe", "\\u", "shell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shell_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "shlex_", "._", "split_", "(_", "args_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Arg", "ument", " ", "'", "args", "'", " ", "to", " ", "run", "\\u", "command", " ", "must", " ", "be", " ", "list", " ", "or", " ", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "\\u", "json_", "(_", "rc_", "=_", "257_", ",_", "cmd_", "=_", "args_", ",_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expand", " ", "thing", "s", " ", "like", " ", "$", "HOM", "E", " ", "and", " ", "~_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "shell_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st", "\\u", "in_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "a", " ", "temporar", "t", " ", "env", " ", "path", " ", "if", " ", "a", " ", "prefix", " ", "is", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "os_", "._", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "'", "PATH", "'_", "]_", "=_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "path", "\\u", "prefix_", ",_", "env_", "[_", "'", "PATH", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "printable", " ", "version", " ", "of", " ", "the", " ", "command", " ", "for", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "reporting", " ", "late", "r", ",", " ", "whi", "ch", " ", "strip", "s", " ", "out", " ", "thing", "s", " ", "like_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "passwords", " ", "from", " ", "the", " ", "args", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "args_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "args_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "pipes_", "._", "quote_", "(_", "arg_", ")_", "for_", "arg_", "in_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clean", "\\u", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "clean", " ", "string", "s", " ", "shou", "ld", " ", "return", " ", "two", " ", "match", " ", "group", "s", ",", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "where", " ", "the", " ", "first", " ", "is", " ", "the", " ", "CLI", " ", "argu", "ment", " ", "and", " ", "the", " ", "second", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "password", "/", "key", "/", "phrase", " ", "tha", "t", " ", "will", " ", "be", " ", "hidden_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean", "\\u", "re", "\\u", "strings_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "remove", "s", " ", "thing", "s", " ", "like", " ", "--", "password", ",", " ", "--", "pass", ",", " ", "--", "pass", "-", "wd", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "option", "ally", " ", "followe", "d", " ", "by", " ", "an", " ", "'=", "'", " ", "or", " ", "a", " ", "space", ".", " ", "The", " ", "password", " ", "can", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "quoted", " ", "or", " ", "not", " ", "too", ",", " ", "tho", "ugh", " ", "it", " ", "doe", "s", " ", "not", " ", "care", " ", "abo", "ut", " ", "quotes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "are", " ", "not", " ", "balance", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", ":", " ", "http", "://", "blog", ".", "ste", "ven", "lev", "ith", "an", ".", "com", "/", "archives", "/", "match", "-", "quoted", "-", "string_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'(", "[-]", "{", "0", ",", "2", "}", "pass", "[-]", "?(?", ":", "word", "|", "wd", ")?", "[", "=\\\\", "s", "]?", ")((", "?:[", "\"\\\\'", "])", "?(?", ":[", "^", "\\\\", "s", "])", "*(", "?:\\\\", "1", ")?", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "add", " ", "more", " ", "regex", " ", "checks", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "re", "\\u", "str_", "in_", "clean", "\\u", "re", "\\u", "strings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "re_", "._", "compile_", "(_", "re", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "args_", "=_", "r_", "._", "sub_", "(_", "r", "'\\\\", "1", "********", "'_", ",_", "clean", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st", "\\u", "in_", "=_", "subprocess_", "._", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "executable_", "=_", "executable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "shell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "close", "\\u", "fds_", "=_", "close", "\\u", "fds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "st", "\\u", "in_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path", "\\u", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "env", "'_", "]_", "=_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cwd_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "cwd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "cw", "d", "'_", "]_", "=_", "cwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "pwd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev", "\\u", "dir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "we", "'", "re", " ", "in", " ", "the", " ", "right", " ", "working", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cwd_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "cwd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chdir_", "(_", "cwd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "\\u", "json_", "(_", "rc_", "=_", "e_", "._", "errno_", ",_", "msg_", "=_", "\"", "Cou", "ld", " ", "not", " ", "open", " ", "%", "s", " ", ",", " ", "%", "s", "\"_", "%_", "(_", "cwd_", ",_", "str_", "(_", "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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "binar", "y", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "+=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", ",_", "err_", "=_", "cmd_", "._", "communicate_", "(_", "input_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "=_", "cmd_", "._", "returncode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "\\u", "json_", "(_", "rc_", "=_", "e_", "._", "errno_", ",_", "msg_", "=_", "str_", "(_", "e_", ")_", ",_", "cmd_", "=_", "clean", "\\u", "args_", ")_", "\\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_", "._", "fail", "\\u", "json_", "(_", "rc_", "=_", "257_", ",_", "msg_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ",_", "cmd_", "=_", "clean", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rc_", "!=_", "0_", "and_", "check", "\\u", "rc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "err_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "\\u", "json_", "(_", "cmd_", "=_", "clean", "\\u", "args_", ",_", "rc_", "=_", "rc_", ",_", "stdout_", "=_", "out_", ",_", "stderr_", "=_", "err_", ",_", "msg_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reset", " ", "the", " ", "pwd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "prev", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "rc_", ",_", "out_", ",_", "err_", ")_", "\\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, 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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, 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 ]
Unused local variable
gallantlab/pycortex/cortex/polyutils.py
[ { "content": " def surface_gradient(self, scalars, at_verts=True):\n \"\"\"Gradient of a function with values `scalars` at each vertex on the surface.\n If `at_verts`, returns values at each vertex. Otherwise, returns values at each\n face.\n\n Parameters\n ----------\n scalars : 1D ndarray, shape (total_verts,)\n A scalar-valued function across the cortex.\n at_verts : bool, optional\n If True (default), values will be returned for each vertex. Otherwise,\n values will be retruned for each face.\n\n Returns\n -------\n gradu : 2D ndarray, shape (total_verts,3) or (total_polys,3)\n Contains the x-, y-, and z-axis gradients of the given `scalars` at either\n each vertex (if `at_verts` is True) or each face.\n \"\"\"\n pu = scalars[self.polys]\n fe12, fe23, fe31 = [f.T for f in self._facenorm_cross_edge]\n pu1, pu2, pu3 = pu.T\n fa = self.face_areas\n\n # numexpr is much faster than doing this using numpy!\n #gradu = ((fe12.T * pu[:,2] +\n # fe23.T * pu[:,0] +\n # fe31.T * pu[:,1]) / (2 * self.face_areas)).T\n gradu = np.nan_to_num(ne.evaluate(\"(fe12 * pu3 + fe23 * pu1 + fe31 * pu2) / (2 * fa)\").T)\n \n if at_verts:\n return (self.connected.dot(gradu).T / self.connected.sum(1).A.squeeze()).T\n return gradu", "metadata": "root.Surface.surface_gradient", "header": "['class', 'Surface', '(', 'object', ')', ':', '___EOS___']", "index": 246 }, { "content": " def geodesic_distance(self, verts, m=1.0, fem=False):\n \"\"\"Minimum mesh geodesic distance (in mm) from each vertex in surface to any\n vertex in the collection `verts`.\n\n Geodesic distance is estimated using heat-based method (see 'Geodesics in Heat',\n Crane et al, 2012). Diffusion of heat along the mesh is simulated and then\n used to infer geodesic distance. The duration of the simulation is controlled\n by the parameter `m`. Larger values of `m` will smooth & regularize the distance\n computation. Smaller values of `m` will roughen and will usually increase error\n in the distance computation. The default value of 1.0 is probably pretty good.\n\n This function caches some data (sparse LU factorizations of the laplace-beltrami\n operator and the weighted adjacency matrix), so it will be much faster on\n subsequent runs.\n\n The time taken by this function is independent of the number of vertices in verts.\n\n Parameters\n ----------\n verts : 1D array-like of ints\n Set of vertices to compute distance from. This function returns the shortest\n distance to any of these vertices from every vertex in the surface.\n m : float, optional\n Reverse Euler step length. The optimal value is likely between 0.5 and 1.5.\n Default is 1.0, which should be fine for most cases.\n fem : bool, optional\n Whether to use Finite Element Method lumped mass matrix. Wasn't used in \n Crane 2012 paper. Doesn't seem to help any.\n\n Returns\n -------\n dist : 1D ndarray, shape (total_verts,)\n Geodesic distance (in mm) from each vertex in the surface to the closest\n vertex in `verts`.\n \"\"\"\n npt = len(self.pts)\n if m not in self._rlfac_solvers or m not in self._nLC_solvers:\n B, D, W, V = self.laplace_operator\n nLC = W - V # negative laplace matrix\n if not fem:\n spD = sparse.dia_matrix((D,[0]), (npt,npt)).tocsr() # lumped mass matrix\n else:\n spD = B\n \n t = m * self.avg_edge_length ** 2 # time of heat evolution\n lfac = spD - t * nLC # backward Euler matrix\n\n # Exclude rows with zero weight (these break the sparse LU, that finicky fuck)\n goodrows = np.nonzero(~np.array(lfac.sum(0) == 0).ravel())[0]\n self._goodrows = goodrows\n self._rlfac_solvers[m] = sparse.linalg.dsolve.factorized(lfac[goodrows][:,goodrows])\n self._nLC_solvers[m] = sparse.linalg.dsolve.factorized(nLC[goodrows][:,goodrows])\n\n # Solve system to get u, the heat values\n u0 = np.zeros((npt,)) # initial heat values\n u0[verts] = 1.0\n goodu = self._rlfac_solvers[m](u0[self._goodrows])\n u = np.zeros((npt,))\n u[self._goodrows] = goodu\n\n # Compute grad u at each face\n gradu = self.surface_gradient(u, at_verts=False)\n \n # Compute X (normalized grad u)\n #X = np.nan_to_num((-gradu.T / np.sqrt((gradu**2).sum(1))).T)\n graduT = gradu.T\n gusum = ne.evaluate(\"sum(gradu ** 2, 1)\")\n X = np.nan_to_num(ne.evaluate(\"-graduT / sqrt(gusum)\").T)\n\n # Compute integrated divergence of X at each vertex\n #x1 = x2 = x3 = np.zeros((X.shape[0],))\n c32, c13, c21 = self._cot_edge\n x1 = 0.5 * (c32 * X).sum(1)\n x2 = 0.5 * (c13 * X).sum(1)\n x3 = 0.5 * (c21 * X).sum(1)\n \n conn1, conn2, conn3 = self._polyconn\n divx = conn1.dot(x1) + conn2.dot(x2) + conn3.dot(x3)\n\n # Compute phi (distance)\n goodphi = self._nLC_solvers[m](divx[self._goodrows])\n phi = np.zeros((npt,))\n phi[self._goodrows] = goodphi - goodphi.min()\n\n # Ensure that distance is zero for selected verts\n phi[verts] = 0.0\n\n return phi", "metadata": "root.Surface.geodesic_distance", "header": "['class', 'Surface', '(', 'object', ')', ':', '___EOS___']", "index": 445 } ]
[ { "span": "fe12,", "start_line": 266, "start_column": 8, "end_line": 266, "end_column": 12 }, { "span": "fe23,", "start_line": 266, "start_column": 14, "end_line": 266, "end_column": 18 }, { "span": "fe31 ", "start_line": 266, "start_column": 20, "end_line": 266, "end_column": 24 }, { "span": "pu1,", "start_line": 267, "start_column": 8, "end_line": 267, "end_column": 11 }, { "span": "pu2,", "start_line": 267, "start_column": 13, "end_line": 267, "end_column": 16 }, { "span": "pu3 ", "start_line": 267, "start_column": 18, "end_line": 267, "end_column": 21 }, { "span": "fa ", "start_line": 268, "start_column": 8, "end_line": 268, "end_column": 10 }, { "span": "graduT ", "start_line": 510, "start_column": 8, "end_line": 510, "end_column": 14 }, { "span": "gusum ", "start_line": 511, "start_column": 8, "end_line": 511, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Surface_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "surf", "ace", "\\u", "gradient_", "(_", "self_", ",_", "scalars", "_", ",_", "at", "\\u", "verts_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Grad", "ient", " ", "of", " ", "a", " ", "function", " ", "with", " ", "values", " ", "`", "scalars", "`", " ", "at", " ", "each", " ", "vertex", " ", "on", " ", "the", " ", "surf", "ace", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "at", "\\u", "verts", "`", ",", " ", "return", "s", " ", "values", " ", "at", " ", "each", " ", "vertex", ".", " ", "Ot", "her", "wis", "e", ",", " ", "return", "s", " ", "values", " ", "at", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "face", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "scalars", " ", ":", " ", "1", "D", " ", "ndar", "ray", ",", " ", "shape", " ", "(", "total", "\\u", "verts", ",)", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "scala", "r", "-", "valued", " ", "function", " ", "acro", "ss", " ", "the", " ", "cort", "ex", ".", "\\", "10", ";", " ", " ", " ", " ", "at", "\\u", "verts", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", " ", "(", "default", "),", " ", "values", " ", "will", " ", "be", " ", "return", "ed", " ", "for", " ", "each", " ", "vertex", ".", " ", "Ot", "her", "wis", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "will", " ", "be", " ", "retr", "une", "d", " ", "for", " ", "each", " ", "face", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "gradu", " ", ":", " ", "2", "D", " ", "ndar", "ray", ",", " ", "shape", " ", "(", "total", "\\u", "verts", ",", "3", ")", " ", "or", " ", "(", "total", "\\u", "polys", ",", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "Contain", "s", " ", "the", " ", "x", "-", ",", " ", "y", "-", ",", " ", "and", " ", "z", "-", "axis", " ", "gradi", "ents", " ", "of", " ", "the", " ", "give", "n", " ", "`", "scalars", "`", " ", "at", " ", "eit", "her", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "vertex", " ", "(", "if", " ", "`", "at", "\\u", "verts", "`", " ", "is", " ", "Tru", "e", ")", " ", "or", " ", "each", " ", "face", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pu_", "=_", "scalars", "_", "[_", "self_", "._", "polys", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fe", "12_", ",_", "fe", "23_", ",_", "fe", "31_", "=_", "[_", "f_", "._", "T_", "for_", "f_", "in_", "self_", "._", "\\u", "face", "norm", "\\u", "cross", "\\u", "edge_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pu", "1_", ",_", "pu", "2_", ",_", "pu", "3_", "=_", "pu_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fa_", "=_", "self_", "._", "face", "\\u", "areas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nume", "xpr", " ", "is", " ", "muc", "h", " ", "faste", "r", " ", "than", " ", "doi", "ng", " ", "this", " ", "usi", "ng", " ", "nump", "y", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "gradu", " ", "=", " ", "((", "fe", "12.", "T", " ", "*", " ", "pu", "[:,", "2", "]", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "fe", "23.", "T", " ", "*", " ", "pu", "[:,", "0", "]", " ", "+_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "fe", "31.", "T", " ", "*", " ", "pu", "[:,", "1", "])", " ", "/", " ", "(", "2", " ", "*", " ", "self", ".", "face", "\\u", "area", "s", "))", ".", "T_", "\\u\\u\\uNL\\u\\u\\u_", "gradu", "_", "=_", "np_", "._", "nan", "\\u", "to", "\\u", "num_", "(_", "ne_", "._", "evaluate_", "(_", "\"(", "fe", "1", "2", " ", "*", " ", "pu", "3", " ", "+", " ", "fe", "23", " ", "*", " ", "pu", "1", " ", "+", " ", "fe", "3", "1", " ", "*", " ", "pu", "2", ")", " ", "/", " ", "(", "2", " ", "*", " ", "fa", ")\"_", ")_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "at", "\\u", "verts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "connected_", "._", "dot_", "(_", "gradu", "_", ")_", "._", "T_", "/_", "self_", "._", "connected_", "._", "sum_", "(_", "1_", ")_", "._", "A_", "._", "squeeze_", "(_", ")_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "gradu", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Surface_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "geod", "esi", "c\\u", "distance_", "(_", "self_", ",_", "verts_", ",_", "m_", "=_", "1.0_", ",_", "fem", "_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mini", "mum", " ", "mesh", " ", "geod", "esi", "c", " ", "distance", " ", "(", "in", " ", "mm", ")", " ", "from", " ", "each", " ", "vertex", " ", "in", " ", "surf", "ace", " ", "to", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "vertex", " ", "in", " ", "the", " ", "collection", " ", "`", "verts", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Geo", "desi", "c", " ", "distance", " ", "is", " ", "estimate", "d", " ", "usi", "ng", " ", "heat", "-", "based", " ", "method", " ", "(", "see", " ", "'", "Geo", "desi", "cs", " ", "in", " ", "Heat", "',", "\\", "10", ";", " ", " ", " ", " ", "Cra", "ne", " ", "et", " ", "al", ",", " ", "2012", ").", " ", "Diffus", "ion", " ", "of", " ", "heat", " ", "along", " ", "the", " ", "mesh", " ", "is", " ", "simulat", "ed", " ", "and", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "to", " ", "infer", " ", "geod", "esi", "c", " ", "distance", ".", " ", "The", " ", "duration", " ", "of", " ", "the", " ", "simulati", "on", " ", "is", " ", "controlle", "d", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "parameter", " ", "`", "m", "`.", " ", "Large", "r", " ", "values", " ", "of", " ", "`", "m", "`", " ", "will", " ", "smooth", " ", "&", " ", "regulari", "ze", " ", "the", " ", "distance", "\\", "10", ";", " ", " ", " ", " ", "computation", ".", " ", "Small", "er", " ", "values", " ", "of", " ", "`", "m", "`", " ", "will", " ", "rough", "en", " ", "and", " ", "will", " ", "usual", "ly", " ", "increase", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "distance", " ", "computation", ".", " ", "The", " ", "default", " ", "value", " ", "of", " ", "1.0", " ", "is", " ", "probab", "ly", " ", "pretty", " ", "good", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "cache", "s", " ", "some", " ", "data", " ", "(", "spars", "e", " ", "LU", " ", "factori", "zatio", "ns", " ", "of", " ", "the", " ", "laplac", "e-", "bel", "tram", "i", "\\", "10", ";", " ", " ", " ", " ", "opera", "tor", " ", "and", " ", "the", " ", "weight", "ed", " ", "adjacency", " ", "matrix", "),", " ", "so", " ", "it", " ", "will", " ", "be", " ", "muc", "h", " ", "faste", "r", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "subsequen", "t", " ", "runs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "time", " ", "take", "n", " ", "by", " ", "this", " ", "function", " ", "is", " ", "independent", " ", "of", " ", "the", " ", "number", " ", "of", " ", "vertice", "s", " ", "in", " ", "verts", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "verts", " ", ":", " ", "1", "D", " ", "array", "-", "like", " ", "of", " ", "ints", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "of", " ", "vertice", "s", " ", "to", " ", "compute", " ", "distance", " ", "from", ".", " ", "Thi", "s", " ", "function", " ", "return", "s", " ", "the", " ", "short", "est", "\\", "10", ";", " ", " ", " ", " ", "distance", " ", "to", " ", "any", " ", "of", " ", "these", " ", "vertice", "s", " ", "from", " ", "every", " ", "vertex", " ", "in", " ", "the", " ", "surf", "ace", ".", "\\", "10", ";", " ", " ", " ", " ", "m", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Revers", "e", " ", "Euler", " ", "step", " ", "length", ".", " ", "The", " ", "optim", "al", " ", "value", " ", "is", " ", "like", "ly", " ", "bet", "ween", " ", "0.", "5", " ", "and", " ", "1.5", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", " ", "is", " ", "1.0", ",", " ", "whi", "ch", " ", "shou", "ld", " ", "be", " ", "fine", " ", "for", " ", "most", " ", "case", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "fem", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "use", " ", "Fini", "te", " ", "Element", " ", "Meth", "od", " ", "lum", "ped", " ", "mass", " ", "matrix", ".", " ", "Wa", "sn", "'", "t", " ", "used", " ", "in", " ", "\\", "10", ";", " ", " ", " ", " ", "Cra", "ne", " ", "2012", " ", "pape", "r", ".", " ", "Do", "esn", "'", "t", " ", "see", "m", " ", "to", " ", "help", " ", "any", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "dist", " ", ":", " ", "1", "D", " ", "ndar", "ray", ",", " ", "shape", " ", "(", "total", "\\u", "verts", ",)", "\\", "10", ";", " ", " ", " ", " ", "Geo", "desi", "c", " ", "distance", " ", "(", "in", " ", "mm", ")", " ", "from", " ", "each", " ", "vertex", " ", "in", " ", "the", " ", "surf", "ace", " ", "to", " ", "the", " ", "closest", "\\", "10", ";", " ", " ", " ", " ", "vertex", " ", "in", " ", "`", "verts", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "npt_", "=_", "len_", "(_", "self_", "._", "pts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "not_", "in_", "self_", "._", "\\u", "rl", "fac", "\\u", "solvers", "_", "or_", "m_", "not_", "in_", "self_", "._", "\\u", "n", "LC", "\\u", "solvers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "B_", ",_", "D_", ",_", "W_", ",_", "V_", "=_", "self_", "._", "laplac", "e\\u", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "LC", "_", "=_", "W_", "-_", "V_", "#", " ", "negati", "ve", " ", "laplac", "e", " ", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fem", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp", "D_", "=_", "sparse_", "._", "dia", "\\u", "matrix_", "(_", "(_", "D_", ",_", "[_", "0_", "]_", ")_", ",_", "(_", "npt_", ",_", "npt_", ")_", ")_", "._", "toc", "sr_", "(_", ")_", "#", " ", "lum", "ped", " ", "mass", " ", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp", "D_", "=_", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "m_", "*_", "self_", "._", "avg", "\\u", "edge", "\\u", "length_", "**_", "2_", "#", " ", "time", " ", "of", " ", "heat", " ", "evolution", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf", "ac_", "=_", "sp", "D_", "-_", "t_", "*_", "n", "LC", "_", "#", " ", "back", "ward", " ", "Euler", " ", "matrix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exclude", " ", "rows", " ", "with", " ", "zero", " ", "weight", " ", "(", "these", " ", "break", " ", "the", " ", "spars", "e", " ", "LU", ",", " ", "tha", "t", " ", "fini", "ck", "y", " ", "fuck", ")_", "\\u\\u\\uNL\\u\\u\\u_", "good", "rows_", "=_", "np_", "._", "nonzero_", "(_", "~_", "np_", "._", "array_", "(_", "lf", "ac_", "._", "sum_", "(_", "0_", ")_", "==_", "0_", ")_", "._", "ravel_", "(_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "good", "rows_", "=_", "good", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rl", "fac", "\\u", "solvers", "_", "[_", "m_", "]_", "=_", "sparse_", "._", "linalg_", "._", "dso", "lve", "_", "._", "factori", "zed_", "(_", "lf", "ac_", "[_", "good", "rows_", "]_", "[_", ":_", ",_", "good", "rows_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "n", "LC", "\\u", "solvers", "_", "[_", "m_", "]_", "=_", "sparse_", "._", "linalg_", "._", "dso", "lve", "_", "._", "factori", "zed_", "(_", "n", "LC", "_", "[_", "good", "rows_", "]_", "[_", ":_", ",_", "good", "rows_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Solve", " ", "system", " ", "to", " ", "get", " ", "u", ",", " ", "the", " ", "heat", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "u0", "_", "=_", "np_", "._", "zeros_", "(_", "(_", "npt_", ",_", ")_", ")_", "#", " ", "initial", " ", "heat", " ", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u0", "_", "[_", "verts_", "]_", "=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "u_", "=_", "self_", "._", "\\u", "rl", "fac", "\\u", "solvers", "_", "[_", "m_", "]_", "(_", "u0", "_", "[_", "self_", "._", "\\u", "good", "rows_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "np_", "._", "zeros_", "(_", "(_", "npt_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "[_", "self_", "._", "\\u", "good", "rows_", "]_", "=_", "good", "u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "grad", " ", "u", " ", "at", " ", "each", " ", "face_", "\\u\\u\\uNL\\u\\u\\u_", "gradu", "_", "=_", "self_", "._", "surf", "ace", "\\u", "gradient_", "(_", "u_", ",_", "at", "\\u", "verts_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "X", " ", "(", "normali", "zed", " ", "grad", " ", "u", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "X", " ", "=", " ", "np", ".", "nan", "\\u", "to", "\\u", "num", "((", "-", "gradu", ".", "T", " ", "/", " ", "np", ".", "sqrt", "((", "gradu", "**", "2", ").", "sum", "(", "1", ")))", ".", "T", ")_", "\\u\\u\\uNL\\u\\u\\u_", "gradu", "T_", "=_", "gradu", "_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gus", "um_", "=_", "ne_", "._", "evaluate_", "(_", "\"", "sum", "(", "gradu", " ", "**", " ", "2", ",", " ", "1", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "nan", "\\u", "to", "\\u", "num_", "(_", "ne_", "._", "evaluate_", "(_", "\"-", "gradu", "T", " ", "/", " ", "sqrt", "(", "gus", "um", ")\"_", ")_", "._", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "integrated", " ", "divergence", " ", "of", " ", "X", " ", "at", " ", "each", " ", "vertex_", "\\u\\u\\uNL\\u\\u\\u_", "#", "x1", " ", "=", " ", "x2", " ", "=", " ", "x3", " ", "=", " ", "np", ".", "zero", "s", "((", "X", ".", "shape", "[", "0", "],", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "c3", "2_", ",_", "c1", "3_", ",_", "c2", "1_", "=_", "self_", "._", "\\u", "cot", "\\u", "edge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", "=_", "0.5_", "*_", "(_", "c3", "2_", "*_", "X_", ")_", "._", "sum_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "0.5_", "*_", "(_", "c1", "3_", "*_", "X_", ")_", "._", "sum_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x3_", "=_", "0.5_", "*_", "(_", "c2", "1_", "*_", "X_", ")_", "._", "sum_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conn", "1_", ",_", "conn", "2_", ",_", "conn", "3_", "=_", "self_", "._", "\\u", "poly", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "div", "x_", "=_", "conn", "1_", "._", "dot_", "(_", "x1_", ")_", "+_", "conn", "2_", "._", "dot_", "(_", "x2_", ")_", "+_", "conn", "3_", "._", "dot_", "(_", "x3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compute", " ", "phi", " ", "(", "distance", ")_", "\\u\\u\\uNL\\u\\u\\u_", "good", "phi_", "=_", "self_", "._", "\\u", "n", "LC", "\\u", "solvers", "_", "[_", "m_", "]_", "(_", "div", "x_", "[_", "self_", "._", "\\u", "good", "rows_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phi_", "=_", "np_", "._", "zeros_", "(_", "(_", "npt_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phi_", "[_", "self_", "._", "\\u", "good", "rows_", "]_", "=_", "good", "phi_", "-_", "good", "phi_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "distance", " ", "is", " ", "zero", " ", "for", " ", "selecte", "d", " ", "verts_", "\\u\\u\\uNL\\u\\u\\u_", "phi_", "[_", "verts_", "]_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "phi_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
slinderman/pyhawkes/experiments/hippocampus.py
[ { "content": "def plot_locations(result, offset=0):\n ### Plot the sampled locations for a few neurons\n _, _, _, _, Ls = result\n Ls_rot = []\n for L in Ls:\n R = compute_optimal_rotation(L, pfs, scale=False)\n Ls_rot.append(L.dot(R))\n Ls_rot = np.array(Ls_rot)\n\n fig = create_figure(figsize=(1.4,2.9))\n ax = create_axis_at_location(fig, .3, 1.7, 1, 1)\n\n # toplot = np.random.choice(np.arange(K), size=4, replace=False)\n toplot = np.linspace(offset,K+offset, 4, endpoint=False).astype(np.int)\n print toplot\n wheel_cmap = gradient_cmap([colors[0], colors[3], colors[2], colors[1], colors[0]])\n plot_colors = [wheel_cmap((np.pi+pfs_th[node_perm[j]])/(2*np.pi)) for j in toplot]\n\n for i,k in enumerate(node_perm):\n # plt.text(pfs[k,0], pfs[k,1], \"%d\" % i)\n if i not in toplot:\n color = 0.8 * np.ones(3)\n\n plt.plot(pfs[k,0], pfs[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=1.0)\n\n for i,k in enumerate(node_perm):\n # plt.text(pfs[k,0], pfs[k,1], \"%d\" % i)\n if i in toplot:\n j = np.where(toplot==i)[0][0]\n color = plot_colors[j]\n\n plt.plot(pfs[k,0], pfs[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k])\n\n\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"True Place Fields\")\n plt.xlim(-45,45)\n plt.xticks([-40, -20, 0, 20, 40])\n # plt.xlabel(\"$x$\")\n plt.ylim(-45,45)\n plt.yticks([-40, -20, 0, 20, 40])\n # plt.ylabel(\"$y$\")\n\n # Now plot the inferred locations\n # plt.subplot(212, aspect='equal')\n ax = create_axis_at_location(fig, .3, .2, 1, 1)\n for L in Ls_rot[::2]:\n for j in np.random.permutation(len(toplot)):\n k = node_perm[toplot][j]\n color = plot_colors[j]\n plt.plot(L[k,0], L[k,1], 'o',\n markerfacecolor=color, markeredgecolor=\"none\",\n markersize=4, alpha=0.25)\n\n plt.title(\"Locations Samples\")\n # plt.xlim(-30, 30)\n # plt.xticks([])\n # plt.ylim(-30, 30)\n # plt.yticks([])\n plt.xlim(-3, 3)\n plt.xticks([-2, 0, 2])\n plt.ylim(-3, 3)\n plt.yticks([-2, 0, 2])\n\n plt.savefig(os.path.join(results_dir, \"locations_%d.pdf\" % offset))\n # plt.show()", "metadata": "root.plot_locations", "header": "['module', '___EOS___']", "index": 293 }, { "content": "def plot_mean_locations():\n ### Plot the sampled locations for a few neurons\n _, _, _, _, Ls = result\n Ls_rot = []\n for L in Ls:\n R = compute_optimal_rotation(L, pfs)\n Ls_rot.append(L.dot(R))\n Ls_rot = np.array(Ls_rot)\n\n Ls_mean = np.mean(Ls_rot, 0)\n\n fig = create_figure(figsize=(1.4,2.5))\n plt.subplot(211, aspect='equal')\n\n wheel_cmap = gradient_cmap([colors[0], colors[3], colors[2], colors[1], colors[0]])\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(pfs[k,0], pfs[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"True Place Fields\")\n plt.xlim(-45, 45)\n # plt.xlabel(\"$x$\")\n plt.xticks([-40, -20, 0, 20, 40], [])\n plt.ylim(-45, 45)\n # plt.ylabel(\"$y$\")\n plt.yticks([-40, -20, 0, 20, 40], [])\n\n # Now plot the inferred locations\n\n\n plt.subplot(212, aspect='equal')\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(Ls_mean[k,0], Ls_mean[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"Mean Locations\")\n plt.xlim(-30, 30)\n plt.xticks([])\n plt.ylim(-30, 30)\n plt.yticks([])\n\n plt.tight_layout()\n plt.savefig(os.path.join(results_dir, \"hipp_mean_locations.pdf\"))\n plt.show()", "metadata": "root.plot_mean_locations", "header": "['module', '___EOS___']", "index": 368 }, { "content": "def plot_mean_locations():\n ### Plot the sampled locations for a few neurons\n _, _, _, _, Ls = result\n Ls_rot = []\n for L in Ls:\n R = compute_optimal_rotation(L, pfs)\n Ls_rot.append(L.dot(R))\n Ls_rot = np.array(Ls_rot)\n\n Ls_mean = np.mean(Ls_rot, 0)\n\n fig = create_figure(figsize=(1.4,2.5))\n plt.subplot(211, aspect='equal')\n\n wheel_cmap = gradient_cmap([colors[0], colors[3], colors[2], colors[1], colors[0]])\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(pfs[k,0], pfs[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"True Place Fields\")\n plt.xlim(-45, 45)\n # plt.xlabel(\"$x$\")\n plt.xticks([-40, -20, 0, 20, 40], [])\n plt.ylim(-45, 45)\n # plt.ylabel(\"$y$\")\n plt.yticks([-40, -20, 0, 20, 40], [])\n\n # Now plot the inferred locations\n\n\n plt.subplot(212, aspect='equal')\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(Ls_mean[k,0], Ls_mean[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"Mean Locations\")\n plt.xlim(-30, 30)\n plt.xticks([])\n plt.ylim(-30, 30)\n plt.yticks([])\n\n plt.tight_layout()\n plt.savefig(os.path.join(results_dir, \"hipp_mean_locations.pdf\"))\n plt.show()", "metadata": "root.plot_mean_locations", "header": "['module', '___EOS___']", "index": 492 }, { "content": "def plot_mean_and_pca_locations(result):\n ### Plot the sampled locations for a few neurons\n _, _, _, _, Ls = result\n Ls_rot = []\n for L in Ls:\n R = compute_optimal_rotation(L, pfs, scale=False)\n Ls_rot.append(L.dot(R))\n Ls_rot = np.array(Ls_rot)\n Ls_mean = np.mean(Ls_rot, 0)\n\n # Bin the data\n from pyhawkes.utils.utils import convert_continuous_to_discrete\n S_dt = convert_continuous_to_discrete(S, C, 0.25, 0, T)\n\n # Smooth the data to get a firing rate\n from scipy.ndimage.filters import gaussian_filter1d\n S_smooth = np.array([gaussian_filter1d(s, 4) for s in S_dt.T]).T\n\n # Run pca to gte an embedding\n from sklearn.decomposition import PCA\n pca = PCA(n_components=2)\n pca.fit(S_smooth)\n Z = pca.components_.T\n\n # Rotate\n R = compute_optimal_rotation(Z, pfs, scale=False)\n Z = Z.dot(R)\n\n wheel_cmap = gradient_cmap([colors[0], colors[3], colors[2], colors[1], colors[0]])\n fig = create_figure(figsize=(1.4,2.9))\n # plt.subplot(211, aspect='equal')\n ax = create_axis_at_location(fig, .3, 1.7, 1, 1)\n\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(Ls_mean[k,0], Ls_mean[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"Mean Locations\")\n plt.xlim(-3, 3)\n plt.xticks([-2, 0, 2])\n plt.ylim(-3, 3)\n plt.yticks([-2, 0, 2])\n\n\n # plt.subplot(212, aspect='equal')\n ax = create_axis_at_location(fig, .3, .2, 1, 1)\n\n for i,k in enumerate(node_perm):\n color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))\n plt.plot(Z[k,0], Z[k, 1], 'o',\n markerfacecolor=color, markeredgecolor=color,\n markersize=4 + 4 * pf_size[k],\n alpha=0.7)\n\n # plt.gca().add_patch(Circle((0,0), radius=rad, ec='k', fc=\"none\"))\n plt.title(\"PCA Locations\")\n plt.xlim(-.5, .5)\n # plt.xlabel(\"$x$\")\n plt.xticks([-.4, 0, .4])\n plt.ylim(-.5, .5)\n # plt.ylabel(\"$y$\")\n plt.yticks([-.4, 0, .4])\n\n # plt.tight_layout()\n plt.savefig(os.path.join(results_dir, \"hipp_mean_pca_locations.pdf\"))\n plt.show()", "metadata": "root.plot_mean_and_pca_locations", "header": "['module', '___EOS___']", "index": 548 } ]
[ { "span": "ax ", "start_line": 303, "start_column": 4, "end_line": 303, "end_column": 6 }, { "span": "plot_mean_locations(", "start_line": 368, "start_column": 4, "end_line": 368, "end_column": 23 }, { "span": "ax ", "start_line": 579, "start_column": 4, "end_line": 579, "end_column": 6 } ]
[ { "span": "ax ", "start_line": 344, "start_column": 4, "end_line": 344, "end_column": 6 }, { "span": "plot_mean_locations(", "start_line": 492, "start_column": 4, "end_line": 492, "end_column": 23 }, { "span": "ax ", "start_line": 598, "start_column": 4, "end_line": 598, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "locations_", "(_", "result_", ",_", "offset_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Plot", " ", "the", " ", "sample", "d", " ", "location", "s", " ", "for", " ", "a", " ", "few", " ", "neurons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "Ls_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "L_", "in_", "Ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "compute", "\\u", "optim", "al", "\\u", "rotation_", "(_", "L_", ",_", "pf", "s_", ",_", "scale_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "._", "append_", "(_", "L_", "._", "dot_", "(_", "R_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "np_", "._", "array_", "(_", "Ls", "\\u", "rot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "create", "\\u", "figure_", "(_", "figsize_", "=_", "(_", "1.4_", ",_", "2.9", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "create", "\\u", "axis", "\\u", "at", "\\u", "location_", "(_", "fig_", ",_", ".3_", ",_", "1.7", "_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "top", "lot", " ", "=", " ", "np", ".", "random", ".", "choice", "(", "np", ".", "aran", "ge", "(", "K", "),", " ", "size", "=", "4", ",", " ", "replace", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "top", "lot_", "=_", "np_", "._", "linspace_", "(_", "offset_", ",_", "K_", "+_", "offset_", ",_", "4_", ",_", "endpoint_", "=_", "False_", ")_", "._", "astype_", "(_", "np_", "._", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "top", "lot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wheel", "\\u", "cmap_", "=_", "gradi", "ent", "\\u", "cmap_", "(_", "[_", "colors_", "[_", "0_", "]_", ",_", "colors_", "[_", "3_", "]_", ",_", "colors_", "[_", "2_", "]_", ",_", "colors_", "[_", "1_", "]_", ",_", "colors_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "colors_", "=_", "[_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "node", "\\u", "perm_", "[_", "j_", "]_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "for_", "j_", "in_", "top", "lot_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "text", "(", "pf", "s", "[", "k", ",", "0", "],", " ", "pf", "s", "[", "k", ",", "1", "],", " ", "\"%", "d", "\"", " ", "%", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "not_", "in_", "top", "lot_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "0.8_", "*_", "np_", "._", "ones_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "plot_", "(_", "pf", "s_", "[_", "k_", ",_", "0_", "]_", ",_", "pf", "s_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "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_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "text", "(", "pf", "s", "[", "k", ",", "0", "],", " ", "pf", "s", "[", "k", ",", "1", "],", " ", "\"%", "d", "\"", " ", "%", " ", "i", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "in_", "top", "lot_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "np_", "._", "where_", "(_", "top", "lot_", "==_", "i_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "plot", "\\u", "colors_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "plot_", "(_", "pf", "s_", "[_", "k_", ",_", "0_", "]_", ",_", "pf", "s_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Tru", "e", " ", "Place", " ", "Field", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "xlabel", "(\"", "$", "x", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "ylabel", "(\"", "$", "y", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "plot", " ", "the", " ", "inferred", " ", "locations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "subplot", "(", "212", ",", " ", "aspect", "='", "equal", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "create", "\\u", "axis", "\\u", "at", "\\u", "location_", "(_", "fig_", ",_", ".3_", ",_", ".2_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "L_", "in_", "Ls", "\\u", "rot_", "[_", ":_", ":_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "np_", "._", "random_", "._", "permutation_", "(_", "len_", "(_", "top", "lot_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "node", "\\u", "perm_", "[_", "top", "lot_", "]_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "plot", "\\u", "colors_", "[_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "L_", "[_", "k_", ",_", "0_", "]_", ",_", "L_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "\"", "none", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", ",_", "alpha_", "=_", "0.25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Locat", "ion", "s", " ", "Sampl", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "xlim", "(-", "30", ",", " ", "30", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "xtick", "s", "([", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "ylim", "(-", "30", ",", " ", "30", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "ytick", "s", "([", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", "2_", ",_", "0_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", "2_", ",_", "0_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "results", "\\u", "dir_", ",_", "\"", "location", "s", "\\u", "%", "d", ".", "pdf", "\"_", "%_", "offset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "show", "()", "_", "\\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_", "plot", "\\u", "mean", "\\u", "locations_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Plot", " ", "the", " ", "sample", "d", " ", "location", "s", " ", "for", " ", "a", " ", "few", " ", "neurons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "Ls_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "L_", "in_", "Ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "compute", "\\u", "optim", "al", "\\u", "rotation_", "(_", "L_", ",_", "pf", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "._", "append_", "(_", "L_", "._", "dot_", "(_", "R_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "np_", "._", "array_", "(_", "Ls", "\\u", "rot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ls", "\\u", "mean_", "=_", "np_", "._", "mean_", "(_", "Ls", "\\u", "rot_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "create", "\\u", "figure_", "(_", "figsize_", "=_", "(_", "1.4_", ",_", "2.5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "211_", ",_", "aspect_", "=_", "'", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wheel", "\\u", "cmap_", "=_", "gradi", "ent", "\\u", "cmap_", "(_", "[_", "colors_", "[_", "0_", "]_", ",_", "colors_", "[_", "3_", "]_", ",_", "colors_", "[_", "2_", "]_", ",_", "colors_", "[_", "1_", "]_", ",_", "colors_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "pf", "s_", "[_", "k_", ",_", "0_", "]_", ",_", "pf", "s_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Tru", "e", " ", "Place", " ", "Field", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "xlabel", "(\"", "$", "x", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "ylabel", "(\"", "$", "y", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "plot", " ", "the", " ", "inferred", " ", "locations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "212_", ",_", "aspect_", "=_", "'", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "0_", "]_", ",_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Mea", "n", " ", "Locat", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "30_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "30_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "tig", "ht", "\\u", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "results", "\\u", "dir_", ",_", "\"", "hip", "p", "\\u", "mean", "\\u", "location", "s", ".", "pdf", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\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_", "plot", "\\u", "mean", "\\u", "locations_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Plot", " ", "the", " ", "sample", "d", " ", "location", "s", " ", "for", " ", "a", " ", "few", " ", "neurons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "Ls_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "L_", "in_", "Ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "compute", "\\u", "optim", "al", "\\u", "rotation_", "(_", "L_", ",_", "pf", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "._", "append_", "(_", "L_", "._", "dot_", "(_", "R_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "np_", "._", "array_", "(_", "Ls", "\\u", "rot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Ls", "\\u", "mean_", "=_", "np_", "._", "mean_", "(_", "Ls", "\\u", "rot_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "create", "\\u", "figure_", "(_", "figsize_", "=_", "(_", "1.4_", ",_", "2.5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "211_", ",_", "aspect_", "=_", "'", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wheel", "\\u", "cmap_", "=_", "gradi", "ent", "\\u", "cmap_", "(_", "[_", "colors_", "[_", "0_", "]_", ",_", "colors_", "[_", "3_", "]_", ",_", "colors_", "[_", "2_", "]_", ",_", "colors_", "[_", "1_", "]_", ",_", "colors_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "pf", "s_", "[_", "k_", ",_", "0_", "]_", ",_", "pf", "s_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Tru", "e", " ", "Place", " ", "Field", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "xlabel", "(\"", "$", "x", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "45_", ",_", "45_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "ylabel", "(\"", "$", "y", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", "40_", ",_", "-_", "20_", ",_", "0_", ",_", "20_", ",_", "40_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "plot", " ", "the", " ", "inferred", " ", "locations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "212_", ",_", "aspect_", "=_", "'", "equal", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "0_", "]_", ",_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Mea", "n", " ", "Locat", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "30_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "30_", ",_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "tig", "ht", "\\u", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "results", "\\u", "dir_", ",_", "\"", "hip", "p", "\\u", "mean", "\\u", "location", "s", ".", "pdf", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\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_", "plot", "\\u", "mean", "\\u", "and", "\\u", "pca", "\\u", "locations_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "Plot", " ", "the", " ", "sample", "d", " ", "location", "s", " ", "for", " ", "a", " ", "few", " ", "neurons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "\\u_", ",_", "Ls_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "L_", "in_", "Ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "R_", "=_", "compute", "\\u", "optim", "al", "\\u", "rotation_", "(_", "L_", ",_", "pf", "s_", ",_", "scale_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "rot_", "._", "append_", "(_", "L_", "._", "dot_", "(_", "R_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Ls", "\\u", "rot_", "=_", "np_", "._", "array_", "(_", "Ls", "\\u", "rot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ls", "\\u", "mean_", "=_", "np_", "._", "mean_", "(_", "Ls", "\\u", "rot_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bin", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyh", "aw", "kes", "_", "._", "utils_", "._", "utils_", "import_", "convert", "\\u", "continuous", "\\u", "to", "\\u", "discrete", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "\\u", "dt_", "=_", "convert", "\\u", "continuous", "\\u", "to", "\\u", "discrete", "_", "(_", "S_", ",_", "C_", ",_", "0.25_", ",_", "0_", ",_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Smooth", " ", "the", " ", "data", " ", "to", " ", "get", " ", "a", " ", "fir", "ing", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "ndimage_", "._", "filters_", "import_", "gauss", "ian", "\\u", "filter", "1d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S", "\\u", "smooth_", "=_", "np_", "._", "array_", "(_", "[_", "gauss", "ian", "\\u", "filter", "1d_", "(_", "s_", ",_", "4_", ")_", "for_", "s_", "in_", "S", "\\u", "dt_", "._", "T_", "]_", ")_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "pca", " ", "to", " ", "gte", " ", "an", " ", "embedding_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sklearn_", "._", "decomposition", "_", "import_", "PCA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "=_", "PCA", "_", "(_", "n", "\\u", "components_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pca_", "._", "fit_", "(_", "S", "\\u", "smooth_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "pca_", "._", "component", "s\\u_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rotate", "_", "\\u\\u\\uNL\\u\\u\\u_", "R_", "=_", "compute", "\\u", "optim", "al", "\\u", "rotation_", "(_", "Z_", ",_", "pf", "s_", ",_", "scale_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Z_", "=_", "Z_", "._", "dot_", "(_", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wheel", "\\u", "cmap_", "=_", "gradi", "ent", "\\u", "cmap_", "(_", "[_", "colors_", "[_", "0_", "]_", ",_", "colors_", "[_", "3_", "]_", ",_", "colors_", "[_", "2_", "]_", ",_", "colors_", "[_", "1_", "]_", ",_", "colors_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "create", "\\u", "figure_", "(_", "figsize_", "=_", "(_", "1.4_", ",_", "2.9", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "subplot", "(", "211", ",", " ", "aspect", "='", "equal", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "create", "\\u", "axis", "\\u", "at", "\\u", "location_", "(_", "fig_", ",_", ".3_", ",_", "1.7", "_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "0_", "]_", ",_", "Ls", "\\u", "mean_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "Mea", "n", " ", "Locat", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", "2_", ",_", "0_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", "2_", ",_", "0_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "subplot", "(", "212", ",", " ", "aspect", "='", "equal", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "create", "\\u", "axis", "\\u", "at", "\\u", "location_", "(_", "fig_", ",_", ".3_", ",_", ".2_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "k_", "in_", "enumerate_", "(_", "node", "\\u", "perm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "wheel", "\\u", "cmap_", "(_", "(_", "np_", "._", "pi_", "+_", "pf", "s", "\\u", "th_", "[_", "k_", "]_", ")_", "/_", "(_", "2_", "*_", "np_", "._", "pi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "Z_", "[_", "k_", ",_", "0_", "]_", ",_", "Z_", "[_", "k_", ",_", "1_", "]_", ",_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker", "facecolor_", "=_", "color_", ",_", "marker", "edgecolor_", "=_", "color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "markersize_", "=_", "4_", "+_", "4_", "*_", "pf", "\\u", "size_", "[_", "k_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "gca", "()", ".", "add", "\\u", "patch", "(", "Circ", "le", "((", "0", ",", "0", "),", " ", "radi", "us", "=", "rad", ",", " ", "ec", "='", "k", "',", " ", "fc", "=\"", "none", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "PCA", " ", "Locat", "ion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "-_", ".5_", ",_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "xlabel", "(\"", "$", "x", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "-_", ".4_", ",_", "0_", ",_", ".4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "-_", ".5_", ",_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "plt", ".", "ylabel", "(\"", "$", "y", "$", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "-_", ".4_", ",_", "0_", ",_", ".4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "tig", "ht", "\\u", "layout", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "join_", "(_", "results", "\\u", "dir_", ",_", "\"", "hip", "p", "\\u", "mean", "\\u", "pca", "\\u", "location", "s", ".", "pdf", "\"_", ")_", ")_", "\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dcramer/sentry-old/sentry/plugins/sentry_redmine/migrations/0001_initial.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'sentry.groupedmessage': {\n 'Meta': {'unique_together': \"(('logger', 'view', 'checksum'),)\", 'object_name': 'GroupedMessage'},\n 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '32'}),\n 'class_name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}),\n 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),\n 'level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}),\n 'logger': ('django.db.models.fields.CharField', [], {'default': \"'root'\", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}),\n 'message': ('django.db.models.fields.TextField', [], {}),\n 'status': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),\n 'times_seen': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),\n 'traceback': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'view': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})\n },\n 'sentry_redmine.redmineissue': {\n 'Meta': {'object_name': 'RedmineIssue'},\n 'group': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['sentry.GroupedMessage']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'issue_id': ('django.db.models.fields.PositiveIntegerField', [], {})\n }\n }\n\n complete_apps = ['sentry_redmine']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Adding model 'RedmineIssue'\n db.create_table('sentry_redmine_redmineissue', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('group', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sentry.GroupedMessage'])),\n ('issue_id', self.gf('django.db.models.fields.PositiveIntegerField')()),\n ))\n db.send_create_signal('sentry_redmine', ['RedmineIssue'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Deleting model 'RedmineIssue'\n db.delete_table('sentry_redmine_redmineissue')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 19 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sentry", ".", "groupe", "dme", "ssa", "ge", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "logg", "er", "',", " ", "'", "view", "',", " ", "'", "checks", "um", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Groupe", "d", "Messag", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "checks", "um", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "32", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "see", "n", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "see", "n", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "40", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "logg", "er", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "root", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "times", "\\u", "see", "n", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "traceback", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sentry", "\\u", "red", "mine", ".", "red", "mine", "issue", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Red", "mine", "Issue", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "sentry", ".", "Groupe", "d", "Messag", "e", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "issue", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "sentry", "\\u", "red", "mine", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Red", "mine", "Issue", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "sentry", "\\u", "red", "mine", "\\u", "red", "mine", "issue", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "group", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "sentry", ".", "Groupe", "d", "Messag", "e", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "issue", "\\u", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "sentry", "\\u", "red", "mine", "'_", ",_", "[_", "'", "Red", "mine", "Issue", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Red", "mine", "Issue", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "table_", "(_", "'", "sentry", "\\u", "red", "mine", "\\u", "red", "mine", "issue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
enthought/traits/traits/tests/test_cythonized_traits.py
[ { "content": "def has_no_compiler():\n if no_cython:\n return True\n # Easy way to check if we have access to a compiler\n code = \"return 1+1\"\n try:\n cython.inline(code)\n return False\n except:\n return True", "metadata": "root.has_no_compiler", "header": "['module', '___EOS___']", "index": 22 }, { "content": " @unittest.skipIf(SKIP_TEST, 'Missing Cython and/or compiler')\n def test_on_trait_lambda_failure(self):\n\n # Lambda function are converted like builtins when cythonized which\n # causes the following code to fail\n\n code = \"\"\"\nfrom traits.api import HasTraits, Str, Int, Property\n\ndef Alias(name):\n return Property(\n lambda obj: getattr(obj, name),\n lambda obj, value: setattr(obj, name, value)\n )\n\nclass Test(HasTraits):\n name = Str\n\n funky_name = Alias('name')\n\nreturn Test()\n\"\"\"\n\n try:\n cython.inline(code, get_type=_always_object_type, force=True,\n locals={}, globals={})\n except:\n # We suppose we have an exception. Because of the usage of the\n # skipIf decorator on the test, we can't use an expectedFailure\n # decorator as they don't play well together.\n pass\n else:\n self.fail(\n 'Unexpected results. Cython was not managing lambda as regular'\n ' functions. Behaviour changed ...'\n )", "metadata": "root.CythonizedTraitsTestCase.test_on_trait_lambda_failure", "header": "['class', 'CythonizedTraitsTestCase', '(', 'unittest', '.', 'TestCase', ',', 'UnittestTools', ')', ':', '___EOS___']", "index": 247 } ]
[ { "span": "except:", "start_line": 30, "start_column": 4, "end_line": 30, "end_column": 11 }, { "span": "except:", "start_line": 273, "start_column": 8, "end_line": 273, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "has", "\\u", "no", "\\u", "compiler_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "no", "\\u", "cython", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Eas", "y", " ", "way", " ", "to", " ", "check", " ", "if", " ", "we", " ", "have", " ", "access", " ", "to", " ", "a", " ", "compiler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code_", "=_", "\"", "return", " ", "1", "+", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cython", "_", "._", "inline_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cython", "ize", "d", "Trait", "s", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Unit", "test", "Tools_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip", "If_", "(_", "SKIP", "\\u", "TEST_", ",_", "'", "Missing", " ", "Cython", " ", "and", "/", "or", " ", "compiler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "on", "\\u", "tra", "it", "\\u", "lambda", "\\u", "failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lam", "bda", " ", "function", " ", "are", " ", "convert", "ed", " ", "like", " ", "bui", "lti", "ns", " ", "whe", "n", " ", "cython", "ize", "d", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "caus", "es", " ", "the", " ", "follow", "ing", " ", "code", " ", "to", " ", "fail_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "\\", "10", ";", "from", " ", "traits", ".", "api", " ", "import", " ", "Has", "Trait", "s", ",", " ", "Str", ",", " ", "Int", ",", " ", "Proper", "ty", "\\", "10", ";", "\\", "10", ";", "def", " ", "Ali", "as", "(", "name", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Proper", "ty", "(", "\\", "10", ";", " ", " ", " ", " ", "lambda", " ", "obj", ":", " ", "getattr", "(", "obj", ",", " ", "name", "),", "\\", "10", ";", " ", " ", " ", " ", "lambda", " ", "obj", ",", " ", "value", ":", " ", "setattr", "(", "obj", ",", " ", "name", ",", " ", "value", ")", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", "\\", "10", ";", "class", " ", "Test", "(", "Has", "Trait", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "name", " ", "=", " ", "Str", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "fun", "ky", "\\u", "name", " ", "=", " ", "Ali", "as", "('", "name", "')", "\\", "10", ";", "\\", "10", ";", "return", " ", "Test", "()", "\\", "10", ";\"\"\"_", "\\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 ", " _", "cython", "_", "._", "inline_", "(_", "code_", ",_", "get", "\\u", "type_", "=_", "\\u", "alw", "ay", "s", "\\u", "object\\u", "type_", ",_", "force_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "=_", "{_", "}_", ",_", "globals_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "supp", "ose", " ", "we", " ", "have", " ", "an", " ", "exception", ".", " ", "Be", "caus", "e", " ", "of", " ", "the", " ", "usage", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", "If", " ", "decorat", "or", " ", "on", " ", "the", " ", "test", ",", " ", "we", " ", "can", "'", "t", " ", "use", " ", "an", " ", "expected", "Failure_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decorat", "or", " ", "as", " ", "the", "y", " ", "don", "'", "t", " ", "play", " ", "well", " ", "tog", "ether", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Une", "xpe", "cte", "d", " ", "results", ".", " ", "Cython", " ", "was", " ", "not", " ", "mana", "ging", " ", "lambda", " ", "as", " ", "regular", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "function", "s", ".", " ", "Behavio", "ur", " ", "change", "d", " ", "...'_", "\\u\\u\\uNL\\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, 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 ]
Unused local variable
karesansui/karesansui/bin/delete_export_data.py
[ { "content": " def process(self):\n (opts, args) = getopts()\n chkopts(opts)\n self.up_progress(10)\n\n kvc = KaresansuiVirtConnection()\n # #1 libvirt process\n try:\n #inactive_pool = kvc.list_inactive_storage_pool()\n inactive_pool = []\n active_pool = kvc.list_active_storage_pool()\n pools = inactive_pool + active_pool\n pools.sort()\n\n export = []\n for pool_name in pools:\n pool = kvc.search_kvn_storage_pools(pool_name)\n path = pool[0].get_info()[\"target\"][\"path\"]\n if os.path.exists(path):\n for _afile in glob.glob(\"%s/*/info.dat\" % (path,)):\n e_param = ExportConfigParam()\n e_param.load_xml_config(_afile)\n\n if e_param.get_uuid() != opts.uuid:\n continue\n\n e_name = e_param.get_domain()\n _dir = os.path.dirname(_afile)\n\n param = ConfigParam(e_name)\n\n path = \"%s/%s.xml\" % (_dir, e_name)\n if os.path.isfile(path) is False:\n raise KssCommandException(\n 'Export corrupt data.(file not found) - path=%s' % path)\n\n param.load_xml_config(path)\n\n if e_name != param.get_domain_name():\n raise KssCommandException(\n 'Export corrupt data.(The name does not match) - info=%s, xml=%s' \\\n % (e_name, param.get_name()))\n\n _dir = os.path.dirname(_afile)\n\n export.append({\"dir\" : _dir,\n \"pool\" : pool_name,\n \"uuid\" : e_param.get_uuid(),\n \"name\" : e_name,\n })\n\n if len(export) < 1:\n # refresh pool.\n conn = KaresansuiVirtConnection(readonly=False)\n try:\n conn.refresh_pools()\n finally:\n conn.close()\n raise KssCommandException('libvirt data did not exist. - uuid=%s' % opts.uuid)\n else:\n export = export[0]\n\n finally:\n kvc.close()\n\n self.up_progress(30)\n # #2 physical process\n if os.path.isdir(export['dir']) is False:\n raise KssCommandException(_(\"Failed to delete export data. - %s\") % (_(\"Export data directory not found. [%s]\") % (export['dir'])))\n\n uuid = os.path.basename(export['dir'])\n pool_dir = os.path.dirname(export['dir'])\n\n if not is_uuid(export['uuid']):\n raise KssCommandException(_(\"Failed to delete export data. - %s\") % (_(\"'%s' is not valid export data directory.\") % (export['dir'])))\n\n shutil.rmtree(export['dir'])\n\n for _afile in glob.glob(\"%s*img\" % (export['dir'])):\n os.remove(_afile)\n\n self.up_progress(30)\n # refresh pool.\n conn = KaresansuiVirtConnection(readonly=False)\n try:\n try:\n conn.refresh_pools()\n finally:\n conn.close()\n except:\n pass\n\n self.logger.info('Deleted export data. - uuid=%s' % (opts.uuid))\n print >>sys.stdout, _('Deleted export data. - uuid=%s') % (opts.uuid)\n return True", "metadata": "root.DeleteExportData.process", "header": "['class', 'DeleteExportData', '(', 'KssCommand', ')', ':', '___EOS___']", "index": 69 } ]
[ { "span": "uuid ", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 12 }, { "span": "pool_dir ", "start_line": 140, "start_column": 8, "end_line": 140, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Delete", "Export", "Data_", "(_", "Ks", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "opts_", ",_", "args_", ")_", "=_", "getop", "ts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chk", "opts_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kv", "c_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "#", "1", " ", "libvi", "rt", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "inact", "ive", "\\u", "pool", " ", "=", " ", "kv", "c", ".", "list", "\\u", "inact", "ive", "\\u", "storage", "\\u", "pool", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inact", "ive", "\\u", "pool_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "active", "\\u", "pool_", "=_", "kv", "c_", "._", "list", "\\u", "active", "\\u", "storage", "\\u", "pool_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "=_", "inact", "ive", "\\u", "pool_", "+_", "active", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pools_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "export_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pool", "\\u", "name_", "in_", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pool_", "=_", "kv", "c_", "._", "search", "\\u", "kv", "n", "\\u", "storage", "\\u", "pools_", "(_", "pool", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "pool_", "[_", "0_", "]_", "._", "get", "\\u", "info_", "(_", ")_", "[_", "\"", "target", "\"_", "]_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "\\u", "afile", "_", "in_", "glob_", "._", "glob_", "(_", "\"%", "s", "/*", "/", "info", ".", "dat", "\"_", "%_", "(_", "path_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "e\\u", "param_", "=_", "Export", "Config", "Param_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e\\u", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", "!=_", "opts_", "._", "uuid_", ":_", "\\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_", "e\\u", "name_", "=_", "e\\u", "param_", "._", "get", "\\u", "domain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "=_", "Config", "Param_", "(_", "e\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "\"%", "s", "/", "%", "s", ".", "xml", "\"_", "%_", "(_", "\\u", "dir_", ",_", "e\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Export", " ", "corrupt", " ", "data", ".(", "file", " ", "not", " ", "found", ")", " ", "-", " ", "path", "=", "%", "s", "'_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "param_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "e\\u", "name_", "!=_", "param_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Export", " ", "corrupt", " ", "data", ".(", "The", " ", "name", " ", "doe", "s", " ", "not", " ", "match", ")", " ", "-", " ", "info", "=", "%", "s", ",", " ", "xml", "=", "%", "s", "'_", "%_", "(_", "e\\u", "name_", ",_", "param_", "._", "get", "\\u", "name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "export_", "._", "append_", "(_", "{_", "\"", "dir", "\"_", ":_", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pool", "\"_", ":_", "pool", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uuid", "\"_", ":_", "e\\u", "param_", "._", "get", "\\u", "uuid_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "e\\u", "name_", ",_", "\\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_", "len_", "(_", "export_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refre", "sh", " ", "pool", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "readonly_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "conn_", "._", "refre", "sh", "\\u", "pools_", "(_", ")_", "\\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 ", " ", "_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Ks", "s", "Command", "Exception_", "(_", "'", "libvi", "rt", " ", "data", " ", "did", " ", "not", " ", "exist", ".", " ", "-", " ", "uuid", "=", "%", "s", "'_", "%_", "opts_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "export_", "=_", "export_", "[_", "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_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kv", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "#", "2", " ", "physical", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u_", "(_", "\"", "Fail", "ed", " ", "to", " ", "delete", " ", "export", " ", "data", ".", " ", "-", " ", "%", "s", "\"_", ")_", "%_", "(_", "\\u_", "(_", "\"", "Export", " ", "data", " ", "director", "y", " ", "not", " ", "found", ".", " ", "[", "%", "s", "]\"_", ")_", "%_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "uuid_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "uuid_", "(_", "export_", "[_", "'", "uuid", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ks", "s", "Command", "Exception_", "(_", "\\u_", "(_", "\"", "Fail", "ed", " ", "to", " ", "delete", " ", "export", " ", "data", ".", " ", "-", " ", "%", "s", "\"_", ")_", "%_", "(_", "\\u_", "(_", "\"'", "%", "s", "'", " ", "is", " ", "not", " ", "valid", " ", "export", " ", "data", " ", "director", "y", ".\"_", ")_", "%_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "afile", "_", "in_", "glob_", "._", "glob_", "(_", "\"%", "s", "*", "img", "\"_", "%_", "(_", "export_", "[_", "'", "dir", "'_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "\\u", "afile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "up", "\\u", "progress_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refre", "sh", " ", "pool", "._", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "=_", "Kar", "esa", "nsu", "i", "Virt", "Connection_", "(_", "readonly_", "=_", "False_", ")_", "\\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 ", " _", "conn_", "._", "refre", "sh", "\\u", "pools_", "(_", ")_", "\\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 ", " _", "conn_", "._", "close_", "(_", ")_", "\\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_", "self_", "._", "logger_", "._", "info_", "(_", "'", "Delete", "d", " ", "export", " ", "data", ".", " ", "-", " ", "uuid", "=", "%", "s", "'_", "%_", "(_", "opts_", "._", "uuid_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stdout_", ",_", "\\u_", "(_", "'", "Delete", "d", " ", "export", " ", "data", ".", " ", "-", " ", "uuid", "=", "%", "s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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Insecure temporary file
babble/babble/include/jython/Lib/test/test_logging.py
[ { "content": "def test4():\n for i in range(4):\n conf = globals()['config%d' % i]\n sys.stdout.write('config%d: ' % i)\n loggerDict = logging.getLogger().manager.loggerDict\n logging._acquireLock()\n try:\n saved_handlers = logging._handlers.copy()\n saved_handler_list = logging._handlerList[:]\n saved_loggers = loggerDict.copy()\n finally:\n logging._releaseLock()\n try:\n fn = tempfile.mktemp(\".ini\")\n f = open(fn, \"w\")\n f.write(conf)\n f.close()\n try:\n logging.config.fileConfig(fn)\n #call again to make sure cleanup is correct\n logging.config.fileConfig(fn)\n except:\n t = sys.exc_info()[0]\n message(str(t))\n else:\n message('ok.')\n os.remove(fn)\n finally:\n logging._acquireLock()\n try:\n logging._handlers.clear()\n logging._handlers.update(saved_handlers)\n logging._handlerList[:] = saved_handler_list\n loggerDict = logging.getLogger().manager.loggerDict\n loggerDict.clear()\n loggerDict.update(saved_loggers)\n finally:\n logging._releaseLock()", "metadata": "root.test4", "header": "['module', '___EOS___']", "index": 471 }, { "content": "def test5():\n loggerDict = logging.getLogger().manager.loggerDict\n logging._acquireLock()\n try:\n saved_handlers = logging._handlers.copy()\n saved_handler_list = logging._handlerList[:]\n saved_loggers = loggerDict.copy()\n finally:\n logging._releaseLock()\n try:\n fn = tempfile.mktemp(\".ini\")\n f = open(fn, \"w\")\n f.write(test5_config)\n f.close()\n logging.config.fileConfig(fn)\n try:\n raise KeyError\n except KeyError:\n logging.exception(\"just testing\")\n os.remove(fn)\n hdlr = logging.getLogger().handlers[0]\n logging.getLogger().handlers.remove(hdlr)\n finally:\n logging._acquireLock()\n try:\n logging._handlers.clear()\n logging._handlers.update(saved_handlers)\n logging._handlerList[:] = saved_handler_list\n loggerDict = logging.getLogger().manager.loggerDict\n loggerDict.clear()\n loggerDict.update(saved_loggers)\n finally:\n logging._releaseLock()", "metadata": "root.test5", "header": "['module', '___EOS___']", "index": 545 } ]
[ { "span": "tempfile.mktemp(\".ini\")", "start_line": 484, "start_column": 17, "end_line": 484, "end_column": 40 }, { "span": "tempfile.mktemp(\".ini\")", "start_line": 555, "start_column": 13, "end_line": 555, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "4_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "globals_", "(_", ")_", "[_", "'", "config", "%", "d", "'_", "%_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", "config", "%", "d", ":", " ", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "manager_", "._", "logg", "er", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "handlers_", "=_", "logging_", "._", "\\u", "handlers_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "handler", "\\u", "list_", "=_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "loggers_", "=_", "logg", "er", "Dict_", "._", "copy_", "(_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\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 ", " _", "fn_", "=_", "tempfile_", "._", "mktemp_", "(_", "\".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "fn_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "config_", "._", "file", "Config_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "call", " ", "again", " ", "to", " ", "make", " ", "sure", " ", "clean", "up", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "config_", "._", "file", "Config_", "(_", "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 ", " _", "t_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "(_", "str_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "(_", "'", "ok", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "fn_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "\\u", "handlers_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "handlers_", "._", "update_", "(_", "saved", "\\u", "handlers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "=_", "saved", "\\u", "handler", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "manager_", "._", "logg", "er", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "._", "update_", "(_", "saved", "\\u", "loggers_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "5_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logg", "er", "Dict_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "manager_", "._", "logg", "er", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "handlers_", "=_", "logging_", "._", "\\u", "handlers_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "handler", "\\u", "list_", "=_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "loggers_", "=_", "logg", "er", "Dict_", "._", "copy_", "(_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\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 ", " _", "fn_", "=_", "tempfile_", "._", "mktemp_", "(_", "\".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "fn_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "test", "5", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "config_", "._", "file", "Config_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Key", "Error_", "\\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 ", " _", "logging_", "._", "exception_", "(_", "\"", "just", " ", "testi", "ng", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdl", "r_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "handlers_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "handlers_", "._", "remove_", "(_", "hdl", "r_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "acquir", "e", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "\\u", "handlers_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "handlers_", "._", "update_", "(_", "saved", "\\u", "handlers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "\\u", "handler", "List_", "[_", ":_", "]_", "=_", "saved", "\\u", "handler", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "=_", "logging_", "._", "get", "Logger_", "(_", ")_", "._", "manager_", "._", "logg", "er", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "er", "Dict_", "._", "update_", "(_", "saved", "\\u", "loggers_", ")_", "\\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 ", " _", "logging_", "._", "\\u", "release", "Lock_", "(_", ")_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 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 ]
Unused local variable
IanLewis/django-lifestream/lifestream/rss.py
[ { "content": " def item_categories(self, item):\n def item_categories(self, item):\n if 'tagging' in settings.INSTALLED_APPS:\n return [tag.name for tag in item.tag_set]\n else:\n return []", "metadata": "root.RecentItemsFeed.item_categories", "header": "['class', 'RecentItemsFeed', '(', 'SyndicationFeed', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "item_categories(", "start_line": 31, "start_column": 12, "end_line": 31, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Rece", "nt", "Item", "s", "Feed_", "(_", "Syn", "dicat", "ion", "Feed_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "item", "\\u", "categories_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "item", "\\u", "categories_", "(_", "self_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "tagging", "'_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "tag_", "._", "name_", "for_", "tag_", "in_", "item_", "._", "tag", "\\u", "set_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 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 ]
First argument to super() is not enclosing class
python-visualization/folium/folium/plugins/heat_map.py
[ { "content": " def __init__(self, data, name=None, min_opacity=0.5, max_zoom=18,\n max_val=1.0, radius=25, blur=15, gradient=None, overlay=True):\n \"\"\"Create a Heatmap layer\n\n Parameters\n ----------\n data : list of points of the form [lat, lng] or [lat, lng, weight]\n The points you want to plot.\n You can also provide a numpy.array of shape (n,2) or (n,3).\n name : str\n The name of the layer that will be created.\n min_opacity : default 1.\n The minimum opacity the heat will start at.\n max_zoom : default 18\n Zoom level where the points reach maximum intensity (as intensity\n scales with zoom), equals maxZoom of the map by default\n max_val : float, default 1.\n Maximum point intensity\n radius : int, default 25\n Radius of each \"point\" of the heatmap\n blur : int, default 15\n Amount of blur\n gradient : dict, default None\n Color gradient config. e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'}\n \"\"\"\n super(TileLayer, self).__init__(name=name)\n self._name = 'HeatMap'\n self.tile_name = name if name is not None else self.get_name()\n\n self.data = [[x for x in line] for line in data]\n self.min_opacity = min_opacity\n self.max_zoom = max_zoom\n self.max_val = max_val\n self.radius = radius\n self.blur = blur\n self.gradient = (json.dumps(gradient, sort_keys=True) if\n gradient is not None else \"null\")\n self.overlay = overlay\n\n self._template = Template(u\"\"\"\n {% macro script(this, kwargs) %}\n var {{this.get_name()}} = L.heatLayer(\n {{this.data}},\n {\n minOpacity: {{this.min_opacity}},\n maxZoom: {{this.max_zoom}},\n max: {{this.max_val}},\n radius: {{this.radius}},\n blur: {{this.blur}},\n gradient: {{this.gradient}}\n })\n .addTo({{this._parent.get_name()}});\n {% endmacro %}\n \"\"\")", "metadata": "root.HeatMap.__init__", "header": "['class', 'HeatMap', '(', 'TileLayer', ')', ':', '___EOS___']", "index": 18 }, { "content": " def render(self, **kwargs):\n super(TileLayer, self).render()\n\n figure = self.get_root()\n assert isinstance(figure, Figure), (\"You cannot render this Element \"\n \"if it's not in a Figure.\")\n\n figure.header.add_children(\n JavascriptLink(\"https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js\"), # noqa\n name='leaflet-heat.js')", "metadata": "root.HeatMap.render", "header": "['class', 'HeatMap', '(', 'TileLayer', ')', ':', '___EOS___']", "index": 73 } ]
[ { "span": "super(TileLayer, self).", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 30 }, { "span": "super(TileLayer, self).", "start_line": 74, "start_column": 8, "end_line": 74, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Heat", "Map_", "(_", "Til", "e", "Layer_", ")_", ":_", "\\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_", ",_", "data_", ",_", "name_", "=_", "None_", ",_", "min", "\\u", "opacity_", "=_", "0.5_", ",_", "max", "\\u", "zoom_", "=_", "18_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "val_", "=_", "1.0_", ",_", "radius_", "=_", "25_", ",_", "blur", "_", "=_", "15_", ",_", "gradient_", "=_", "None_", ",_", "overlay_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "Heat", "map", " ", "layer", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "data", " ", ":", " ", "list", " ", "of", " ", "points", " ", "of", " ", "the", " ", "form", " ", "[", "lat", ",", " ", "ln", "g", "]", " ", "or", " ", "[", "lat", ",", " ", "ln", "g", ",", " ", "weight", "]", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "points", " ", "you", " ", "want", " ", "to", " ", "plot", ".", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "als", "o", " ", "provide", " ", "a", " ", "nump", "y", ".", "array", " ", "of", " ", "shape", " ", "(", "n", ",", "2", ")", " ", "or", " ", "(", "n", ",", "3", ").", "\\", "10", ";", " ", " ", " ", " ", "name", " ", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "layer", " ", "tha", "t", " ", "will", " ", "be", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", "min", "\\u", "opa", "city", " ", " ", ":", " ", "default", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "minim", "um", " ", "opa", "city", " ", "the", " ", "heat", " ", "will", " ", "start", " ", "at", ".", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "zoom", " ", ":", " ", "default", " ", "1", "8", "\\", "10", ";", " ", " ", " ", " ", "Zoom", " ", "level", " ", "where", " ", "the", " ", "points", " ", "reach", " ", "maxim", "um", " ", "intensity", " ", "(", "as", " ", "intensity", "\\", "10", ";", " ", " ", " ", " ", "scale", "s", " ", "with", " ", "zoom", "),", " ", "equals", " ", "max", "Zoom", " ", "of", " ", "the", " ", "map", " ", "by", " ", "default", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "val", " ", ":", " ", "float", ",", " ", "default", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "Maxim", "um", " ", "point", " ", "intensity", "\\", "10", ";", " ", " ", " ", " ", "radi", "us", " ", ":", " ", "int", ",", " ", "default", " ", "25", "\\", "10", ";", " ", " ", " ", " ", "Rad", "ius", " ", "of", " ", "each", " ", "\"", "point", "\"", " ", "of", " ", "the", " ", "heatmap", "\\", "10", ";", " ", " ", " ", " ", "blur", " ", ":", " ", "int", ",", " ", "default", " ", "15", "\\", "10", ";", " ", " ", " ", " ", "Amo", "unt", " ", "of", " ", "blur", "\\", "10", ";", " ", " ", " ", " ", "gradi", "ent", " ", ":", " ", "dict", ",", " ", "default", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Color", " ", "gradi", "ent", " ", "config", ".", " ", "e", ".", "g", ".", " ", "{", "0.", "4", ":", " ", "'", "blue", "',", " ", "0.65", ":", " ", "'", "lim", "e", "',", " ", "1", ":", " ", "'", "red", "'}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Til", "e", "Layer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "'", "Heat", "Map", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tile", "\\u", "name_", "=_", "name_", "if_", "name_", "is_", "not_", "None_", "else_", "self_", "._", "get", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data_", "=_", "[_", "[_", "x_", "for_", "x_", "in_", "line_", "]_", "for_", "line_", "in_", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "min", "\\u", "opacity_", "=_", "min", "\\u", "opacity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "zoom_", "=_", "max", "\\u", "zoom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "val_", "=_", "max", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "blur", "_", "=_", "blur", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gradient_", "=_", "(_", "json_", "._", "dumps_", "(_", "gradient_", ",_", "sort", "\\u", "keys_", "=_", "True_", ")_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "gradient_", "is_", "not_", "None_", "else_", "\"", "null", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "overlay_", "=_", "overlay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "template_", "=_", "Template_", "(_", "u", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "macro", " ", "script", "(", "this", ",", " ", "kwarg", "s", ")", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "{{", "this", ".", "get", "\\u", "name", "()}", "}", " ", "=", " ", "L", ".", "heat", "Layer", "(", "\\", "10", ";", " ", " ", " ", " ", "{{", "this", ".", "data", "}}", ",", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", "min", "Opa", "city", ":", " ", "{{", "this", ".", "min", "\\u", "opa", "city", "}}", ",", "\\", "10", ";", " ", " ", "max", "Zoom", ":", " ", "{{", "this", ".", "max", "\\u", "zoom", "}}", ",", "\\", "10", ";", " ", " ", "max", ":", " ", "{{", "this", ".", "max", "\\u", "val", "}}", ",", "\\", "10", ";", " ", " ", "radi", "us", ":", " ", "{{", "this", ".", "radi", "us", "}}", ",", "\\", "10", ";", " ", " ", "blur", ":", " ", "{{", "this", ".", "blur", "}}", ",", "\\", "10", ";", " ", " ", "gradi", "ent", ":", " ", "{{", "this", ".", "gradi", "ent", "}}\\", "10", ";", " ", " ", "})", "\\", "10", ";", " ", " ", " ", " ", ".", "add", "To", "({", "{", "this", ".\\u", "parent", ".", "get", "\\u", "name", "()}", "})", ";", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "end", "macro", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Heat", "Map_", "(_", "Til", "e", "Layer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Til", "e", "Layer_", ",_", "self_", ")_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "figure_", "=_", "self_", "._", "get", "\\u", "root_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "figure_", ",_", "Figure_", ")_", ",_", "(_", "\"", "You", " ", "cann", "ot", " ", "render", " ", "this", " ", "Element", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "if", " ", "it", "'", "s", " ", "not", " ", "in", " ", "a", " ", "Fig", "ure", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "figure_", "._", "header_", "._", "add", "\\u", "children_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Javascript", "Link_", "(_", "\"", "https", "://", "leaf", "let", ".", "git", "hub", ".", "io", "/", "Lea", "fle", "t", ".", "heat", "/", "dist", "/", "leaf", "let", "-", "heat", ".", "js", "\"_", ")_", ",_", "#", " ", "no", "qa_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "leaf", "let", "-", "heat", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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 ]
Except block handles 'BaseException'
dtmilano/AndroidViewClient/tests/com/dtmilano/android/uiautomator/uiautomatorhelpertests.py
[ { "content": "#! /usr/bin/env python\nfrom PIL import Image\nimport random\nimport sys\nimport os\nimport time\nimport cStringIO\n\ntry:\n sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))\nexcept:\n pass\n\n\nfrom com.dtmilano.android.viewclient import ViewClient\nfrom com.dtmilano.android.uiautomator.uiautomatorhelper import UiAutomatorHelper\n\n__author__ = 'diego'\n\nimport unittest\n\n\nDEBUG = False\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 10, "start_column": 0, "end_line": 10, "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_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\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 ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "'", "ANDROID", "\\u", "VIEW", "\\u", "CLIENT", "\\u", "HOM", "E", "'_", "]_", ",_", "'", "src", "'_", ")_", ")_", "\\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_", "from_", "com_", "._", "dtm", "ila", "no_", "._", "android", "_", "._", "view", "client_", "import_", "View", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com_", "._", "dtm", "ila", "no_", "._", "android", "_", "._", "ui", "automato", "r_", "._", "ui", "automato", "rhe", "lp", "er_", "import_", "Ui", "Automat", "or", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "die", "go", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 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, 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 ]
Except block handles 'BaseException'
dimagi/commcare-hq/corehq/apps/style/forms/widgets.py
[ { "content": " def render(self, name, value, attrs=None):\n final_attrs = self.build_attrs(attrs, type='checkbox', name=name)\n try:\n result = self.check_test(value)\n except: # Silently catch exceptions\n result = False\n if result:\n final_attrs['checked'] = 'checked'\n if value not in ('', True, False, None):\n # Only add the 'value' attribute if a value is non-empty.\n final_attrs['value'] = force_unicode(value)\n return mark_safe(u'<label class=\"checkbox\"><input%s /> %s</label>' %\n (flatatt(final_attrs), self.inline_label))", "metadata": "root.BootstrapCheckboxInput.render", "header": "['class', 'BootstrapCheckboxInput', '(', 'CheckboxInput', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "except: ", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Boots", "trap", "Checkb", "ox", "Input_", "(_", "Checkb", "ox", "Input_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "attrs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "attrs_", "=_", "self_", "._", "build", "\\u", "attrs_", "(_", "attrs_", ",_", "type_", "=_", "'", "checkb", "ox", "'_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "check", "\\u", "test_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "Sile", "ntl", "y", " ", "catch", " ", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "attrs_", "[_", "'", "checke", "d", "'_", "]_", "=_", "'", "checke", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "not_", "in_", "(_", "''_", ",_", "True_", ",_", "False_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "add", " ", "the", " ", "'", "value", "'", " ", "attribute", " ", "if", " ", "a", " ", "value", " ", "is", " ", "non", "-", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "attrs_", "[_", "'", "value", "'_", "]_", "=_", "force", "\\u", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mark", "\\u", "safe_", "(_", "u", "'<", "label", " ", "class", "=\"", "checkb", "ox", "\">", "<", "input", "%", "s", " ", "/>", " ", "%", "s", "</", "label", ">'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "flat", "att_", "(_", "final", "\\u", "attrs_", ")_", ",_", "self_", "._", "inline", "\\u", "label_", ")_", ")_", "\\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, 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 ]
Unused import
rwl/muntjac/muntjac/demo/sampler/features/dragndrop/__init__.py
[ { "content": "\nfrom muntjac.demo.sampler.features.dragndrop.DragDropTreeSorting import DragDropTreeSorting\nfrom muntjac.demo.sampler.features.dragndrop.DragDropHtml5FromDesktop import DragDropHtml5FromDesktop\nfrom muntjac.demo.sampler.features.dragndrop.DragDropTableTree import DragDropTableTree\nfrom muntjac.demo.sampler.features.dragndrop.DragDropServerValidation import DragDropServerValidation\nfrom muntjac.demo.sampler.features.dragndrop.DragDropRearrangeComponents import DragDropRearrangeComponents\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from muntjac.demo.sampler.features.dragndrop.DragDropTreeSorting import DragDropTreeSorting", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 91 }, { "span": "from muntjac.demo.sampler.features.dragndrop.DragDropHtml5FromDesktop import DragDropHtml5FromDesktop", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 101 }, { "span": "from muntjac.demo.sampler.features.dragndrop.DragDropTableTree import DragDropTableTree", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 87 }, { "span": "from muntjac.demo.sampler.features.dragndrop.DragDropServerValidation import DragDropServerValidation", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 101 }, { "span": "from muntjac.demo.sampler.features.dragndrop.DragDropRearrangeComponents import DragDropRearrangeComponents", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 107 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "demo_", "._", "sampler_", "._", "features_", "._", "drag", "ndr", "op_", "._", "Drag", "Drop", "Tree", "Sort", "ing_", "import_", "Drag", "Drop", "Tree", "Sort", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "demo_", "._", "sampler_", "._", "features_", "._", "drag", "ndr", "op_", "._", "Drag", "Drop", "Ht", "ml", "5", "Fro", "m", "Des", "kto", "p_", "import_", "Drag", "Drop", "Ht", "ml", "5", "Fro", "m", "Des", "kto", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "demo_", "._", "sampler_", "._", "features_", "._", "drag", "ndr", "op_", "._", "Drag", "Drop", "Table", "Tree_", "import_", "Drag", "Drop", "Table", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "demo_", "._", "sampler_", "._", "features_", "._", "drag", "ndr", "op_", "._", "Drag", "Drop", "Server", "Validation_", "import_", "Drag", "Drop", "Server", "Validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mun", "tj", "ac_", "._", "demo_", "._", "sampler_", "._", "features_", "._", "drag", "ndr", "op_", "._", "Drag", "Drop", "Rea", "rra", "nge", "Components_", "import_", "Drag", "Drop", "Rea", "rra", "nge", "Components_" ]
[ 4, 4, 4, 4, 4, 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, 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, 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, 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 ]
Unused import
amrdraz/kodr/app/brython/www/src/Lib/test/test_xmlrpc_net.py
[ { "content": "#!/usr/bin/env python3\n\nimport collections.abc\nimport errno\nimport socket\nimport sys\nimport unittest\nfrom test import support\n\nimport xmlrpc.client as xmlrpclib\n\n\n\n\nif __name__ == \"__main__\":\n test_main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CurrentTimeTest(unittest.TestCase):\n\n", "metadata": "root.CurrentTimeTest", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def test_current_time(self):\n # Get the current time from xmlrpc.com. This code exercises\n # the minimal HTTP functionality in xmlrpclib.\n self.skipTest(\"time.xmlrpc.com is unreliable\")\n server = xmlrpclib.ServerProxy(\"http://time.xmlrpc.com/RPC2\")\n try:\n t0 = server.currentTime.getCurrentTime()\n except socket.error as e:\n self.skipTest(\"network error: %s\" % e)\n return\n\n # Perform a minimal sanity check on the result, just to be sure\n # the request means what we think it means.\n t1 = xmlrpclib.DateTime()\n\n dt0 = xmlrpclib._datetime_type(t0.value)\n dt1 = xmlrpclib._datetime_type(t1.value)\n if dt0 > dt1:\n delta = dt0 - dt1\n else:\n delta = dt1 - dt0\n # The difference between the system time here and the system\n # time on the server should not be too big.\n self.assertTrue(delta.days <= 1)", "metadata": "root.CurrentTimeTest.test_current_time", "header": "['class', 'CurrentTimeTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_python_builders(self):\n # Get the list of builders from the XMLRPC buildbot interface at\n # python.org.\n server = xmlrpclib.ServerProxy(\"http://buildbot.python.org/all/xmlrpc/\")\n try:\n builders = server.getAllBuilders()\n except socket.error as e:\n self.skipTest(\"network error: %s\" % e)\n return\n self.addCleanup(lambda: server('close')())\n\n # Perform a minimal sanity check on the result, just to be sure\n # the request means what we think it means.\n self.assertIsInstance(builders, collections.abc.Sequence)\n self.assertTrue([x for x in builders if \"3.x\" in x], builders)", "metadata": "root.CurrentTimeTest.test_python_builders", "header": "['class', 'CurrentTimeTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": "def test_main():\n support.requires(\"network\")\n support.run_unittest(CurrentTimeTest)", "metadata": "root.test_main", "header": "['module', '___EOS___']", "index": 55 } ]
[ { "span": "import errno", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 12 }, { "span": "import sys", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "collections_", "._", "abc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "import_", "support_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "xmlrpc", "_", "._", "client_", "as_", "xmlrpclib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Curr", "ent", "Time", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Curr", "ent", "Time", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "current", "\\u", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "current", " ", "time", " ", "from", " ", "xmlrpc", ".", "com", ".", " ", " ", "Thi", "s", " ", "code", " ", "exercise", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "minima", "l", " ", "HTTP", " ", "functional", "it", "y", " ", "in", " ", "xmlrpc", "lib", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "time", ".", "xmlrpc", ".", "com", " ", "is", " ", "unre", "lia", "ble", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "xmlrpclib_", "._", "Server", "Proxy_", "(_", "\"", "http", "://", "time", ".", "xmlrpc", ".", "com", "/", "RP", "C2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t0_", "=_", "server_", "._", "current", "Time_", "._", "get", "Curr", "ent", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "network", " ", "error", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "a", " ", "minima", "l", " ", "sanity", " ", "check", " ", "on", " ", "the", " ", "result", ",", " ", "just", " ", "to", " ", "be", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "request", " ", "means", " ", "what", " ", "we", " ", "think", " ", "it", " ", "means", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "=_", "xmlrpclib_", "._", "Date", "Time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dt", "0_", "=_", "xmlrpclib_", "._", "\\u", "datetime", "\\u", "type_", "(_", "t0_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt", "1_", "=_", "xmlrpclib_", "._", "\\u", "datetime", "\\u", "type_", "(_", "t1_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dt", "0_", ">_", "dt", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta_", "=_", "dt", "0_", "-_", "dt", "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 ", " _", "delta_", "=_", "dt", "1_", "-_", "dt", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "difference", " ", "bet", "ween", " ", "the", " ", "system", " ", "time", " ", "here", " ", "and", " ", "the", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "time", " ", "on", " ", "the", " ", "server", " ", "shou", "ld", " ", "not", " ", "be", " ", "too", " ", "big", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "delta_", "._", "days_", "<=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Curr", "ent", "Time", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "python", "\\u", "builders_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "list", " ", "of", " ", "builders", " ", "from", " ", "the", " ", "XMLRPC", " ", "build", "bot", " ", "interface", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", ".", "org", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "=_", "xmlrpclib_", "._", "Server", "Proxy_", "(_", "\"", "http", "://", "build", "bot", ".", "python", ".", "org", "/", "all", "/", "xmlrpc", "/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builders_", "=_", "server_", "._", "get", "All", "Build", "ers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "network", " ", "error", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "lambda_", ":_", "server_", "(_", "'", "close", "'_", ")_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "a", " ", "minima", "l", " ", "sanity", " ", "check", " ", "on", " ", "the", " ", "result", ",", " ", "just", " ", "to", " ", "be", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "request", " ", "means", " ", "what", " ", "we", " ", "think", " ", "it", " ", "means", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "builders_", ",_", "collections_", "._", "abc_", "._", "Sequence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "[_", "x_", "for_", "x_", "in_", "builders_", "if_", "\"", "3", ".", "x", "\"_", "in_", "x_", "]_", ",_", "builders_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "support_", "._", "requires_", "(_", "\"", "network", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support_", "._", "run", "\\u", "unittest_", "(_", "Curr", "ent", "Time", "Test_", ")_", "\\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, 0, 1, 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, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
hyperopt/hyperopt/hyperopt/pyll/base.py
[ { "content": " @property\n def arg(self):\n # XXX: move this introspection to __init__, and change\n # the basic data-structure to not use pos_args and named_args.\n # XXX: think though... we want the binding to be updated if pos_args\n # and named_args is modified... so maybe this is an ok way to do it?\n #\n # XXX: extend something to deal with Lambda objects instead of\n # decorated python functions.\n #\n # http://docs.python.org/reference/expressions.html#calls\n #\n binding = {}\n\n fn = scope._impls[self.name]\n # XXX does not work for builtin functions\n defaults = fn.__defaults__ # right-aligned default values for params\n code = fn.__code__\n\n extra_args_ok = bool(code.co_flags & 0x04)\n extra_kwargs_ok = bool(code.co_flags & 0x08)\n\n # -- assert that my understanding of calling protocol is correct\n try:\n if extra_args_ok and extra_kwargs_ok:\n assert len(code.co_varnames) >= code.co_argcount + 2\n param_names = code.co_varnames[:code.co_argcount + 2]\n args_param = param_names[code.co_argcount]\n kwargs_param = param_names[code.co_argcount + 1]\n pos_params = param_names[:code.co_argcount]\n elif extra_kwargs_ok:\n assert len(code.co_varnames) >= code.co_argcount + 1\n param_names = code.co_varnames[:code.co_argcount + 1]\n kwargs_param = param_names[code.co_argcount]\n pos_params = param_names[:code.co_argcount]\n elif extra_args_ok:\n assert len(code.co_varnames) >= code.co_argcount + 1\n param_names = code.co_varnames[:code.co_argcount + 1]\n args_param = param_names[code.co_argcount]\n pos_params = param_names[:code.co_argcount]\n else:\n assert len(code.co_varnames) >= code.co_argcount\n param_names = code.co_varnames[:code.co_argcount]\n pos_params = param_names[:code.co_argcount]\n except AssertionError:\n print 'YIKES: MISUNDERSTANDING OF CALL PROTOCOL:',\n print code.co_argcount,\n print code.co_varnames,\n print '%x' % code.co_flags\n raise\n\n if extra_args_ok:\n binding[args_param] == []\n\n if extra_kwargs_ok:\n binding[kwargs_param] == {}\n\n if len(self.pos_args) > code.co_argcount and not extra_args_ok:\n raise TypeError('Argument count exceeds number of positional params')\n\n # -- bind positional arguments\n for param_i, arg_i in zip(param_names, self.pos_args):\n binding[param_i] = arg_i\n\n if extra_args_ok:\n # XXX: THIS IS NOT BEING TESTED AND IS OBVIOUSLY BROKEN\n binding[args_param].extend(args[code.co_argcount:])\n\n # -- bind keyword arguments\n for aname, aval in self.named_args:\n try:\n pos = pos_params.index(aname)\n except ValueError:\n if extra_kwargs_ok:\n binding[kwargs_param][aname] = aval\n continue\n else:\n raise TypeError('Unrecognized keyword argument', aname)\n param = param_names[pos]\n if param in binding:\n raise TypeError('Duplicate argument for parameter', param)\n binding[param] = aval\n\n assert len(binding) <= len(param_names)\n\n if len(binding) < len(param_names):\n for p in param_names:\n if p not in binding:\n binding[p] = MissingArgument\n\n return binding", "metadata": "root.Apply.arg", "header": "['class', 'Apply', '(', 'object', ')', ':', '___EOS___']", "index": 305 } ]
[ { "span": "defaults ", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Apply", "_", "(_", "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_", "arg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "move", " ", "this", " ", "introspect", "ion", " ", "to", " ", "\\u\\u", "init", "\\u\\u", ",", " ", "and", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "the", " ", "basic", " ", "data", "-", "structure", " ", "to", " ", "not", " ", "use", " ", "pos", "\\u", "args", " ", "and", " ", "named", "\\u", "args", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "think", " ", "tho", "ugh", "...", " ", "we", " ", "want", " ", "the", " ", "bindi", "ng", " ", "to", " ", "be", " ", "update", "d", " ", "if", " ", "pos", "\\u", "args_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "named", "\\u", "args", " ", "is", " ", "modifi", "ed", "...", " ", "so", " ", "may", "be", " ", "this", " ", "is", " ", "an", " ", "ok", " ", "way", " ", "to", " ", "do", " ", "it", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "extend", " ", "somet", "hing", " ", "to", " ", "deal", " ", "with", " ", "Lam", "bda", " ", "object", "s", " ", "inst", "ead", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "decorated", " ", "python", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "docs", ".", "python", ".", "org", "/", "reference", "/", "express", "ion", "s", ".", "html", "#", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binding_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "scope_", "._", "\\u", "impl", "s_", "[_", "self_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "doe", "s", " ", "not", " ", "work", " ", "for", " ", "bui", "lti", "n", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "defaults_", "=_", "fn_", "._", "\\u\\u", "default", "s\\u\\u_", "#", " ", "right", "-", "aligned", " ", "default", " ", "values", " ", "for", " ", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "fn_", "._", "\\u\\u", "code", "\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "args", "\\u", "ok_", "=_", "bool_", "(_", "code_", "._", "co", "\\u", "flags_", "&_", "0x04_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "kwarg", "s", "\\u", "ok_", "=_", "bool_", "(_", "code_", "._", "co", "\\u", "flags_", "&_", "0x08_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "assert", " ", "tha", "t", " ", "my", " ", "underst", "and", "ing", " ", "of", " ", "calling", " ", "protoc", "ol", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "extra", "\\u", "args", "\\u", "ok_", "and_", "extra", "\\u", "kwarg", "s", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "code_", "._", "co", "\\u", "varnames", "_", ")_", ">=_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "names_", "=_", "code_", "._", "co", "\\u", "varnames", "_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "param_", "=_", "param", "\\u", "names_", "[_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "param_", "=_", "param", "\\u", "names_", "[_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "\\u", "params_", "=_", "param", "\\u", "names_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "extra", "\\u", "kwarg", "s", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "code_", "._", "co", "\\u", "varnames", "_", ")_", ">=_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "names_", "=_", "code_", "._", "co", "\\u", "varnames", "_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwarg", "s", "\\u", "param_", "=_", "param", "\\u", "names_", "[_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "\\u", "params_", "=_", "param", "\\u", "names_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "extra", "\\u", "args", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "code_", "._", "co", "\\u", "varnames", "_", ")_", ">=_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "names_", "=_", "code_", "._", "co", "\\u", "varnames", "_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "param_", "=_", "param", "\\u", "names_", "[_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "\\u", "params_", "=_", "param", "\\u", "names_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\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_", "len_", "(_", "code_", "._", "co", "\\u", "varnames", "_", ")_", ">=_", "code_", "._", "co", "\\u", "argc", "ount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "names_", "=_", "code_", "._", "co", "\\u", "varnames", "_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos", "\\u", "params_", "=_", "param", "\\u", "names_", "[_", ":_", "code_", "._", "co", "\\u", "argc", "ount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "print_", "'", "YI", "KE", "S", ":", " ", "MIS", "UNDER", "STAN", "DING", " ", "OF", " ", "CALL", " ", "PROTOCOL", ":'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "code_", "._", "co", "\\u", "argc", "ount_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "code_", "._", "co", "\\u", "varnames", "_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "x", "'_", "%_", "code_", "._", "co", "\\u", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "args", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binding_", "[_", "args", "\\u", "param_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "kwarg", "s", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binding_", "[_", "kwarg", "s", "\\u", "param_", "]_", "==_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "pos", "\\u", "args_", ")_", ">_", "code_", "._", "co", "\\u", "argc", "ount_", "and_", "not_", "extra", "\\u", "args", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Arg", "ument", " ", "count", " ", "exceed", "s", " ", "number", " ", "of", " ", "positional", " ", "params", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "bind", " ", "positional", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "param", "\\u", "i_", ",_", "arg", "\\u", "i_", "in_", "zip_", "(_", "param", "\\u", "names_", ",_", "self_", "._", "pos", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binding_", "[_", "param", "\\u", "i_", "]_", "=_", "arg", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "args", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "THIS", " ", "IS", " ", "NOT", " ", "BE", "ING", " ", "TEST", "ED", " ", "AND", " ", "IS", " ", "OB", "VIO", "US", "LY", " ", "BRO", "KEN", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "binding_", "[_", "args", "\\u", "param_", "]_", "._", "extend_", "(_", "args_", "[_", "code_", "._", "co", "\\u", "argc", "ount_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "bind", " ", "keyw", "ord", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "aname_", ",_", "aval", "_", "in_", "self_", "._", "named", "\\u", "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 ", " _", "pos_", "=_", "pos", "\\u", "params_", "._", "index_", "(_", "aname_", ")_", "\\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 ", " _", "if_", "extra", "\\u", "kwarg", "s", "\\u", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "binding_", "[_", "kwarg", "s", "\\u", "param_", "]_", "[_", "aname_", "]_", "=_", "aval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\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_", "(_", "'", "Unre", "cogni", "zed", " ", "keyw", "ord", " ", "argu", "ment", "'_", ",_", "aname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "param_", "=_", "param", "\\u", "names_", "[_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "param_", "in_", "binding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Duplicate", " ", "argu", "ment", " ", "for", " ", "parameter", "'_", ",_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "binding_", "[_", "param_", "]_", "=_", "aval", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "binding_", ")_", "<=_", "len_", "(_", "param", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "binding_", ")_", "<_", "len_", "(_", "param", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "param", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "p_", "not_", "in_", "binding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "binding_", "[_", "p_", "]_", "=_", "Missing", "Argument_", "\\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_", "binding_", "\\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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ate_list = shippo.Rate.all()\n self.assertTrue('count' in rate_list)\n self.assertTrue('results' in rate_list)", "metadata": "root.RateTests.test_list_all", "header": "['class', 'RateTests', '(', 'ShippoTestCase', ')', ':', '___EOS___']", "index": 45 } ]
[ { "span": "self.assertTrue('count' in rate_list)", "start_line": 47, "start_column": 8, "end_line": 47, "end_column": 45 }, { "span": "self.assertTrue('results' in rate_list)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 47 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Rat", "e", "Tests_", "(_", "Ship", "po", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rate", "\\u", "list_", "=_", "ship", "po_", "._", "Rate_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "count", "'_", "in_", "rate", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "results", "'_", "in_", "rate", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
aliles/begins/tests/test_formatters.py
[ { "content": "from __future__ import absolute_import, division, print_function\nimport argparse\nimport mock\nimport sys\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest\n\nfrom begin import formatters\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCompose(unittest.TestCase):\n\n\n\n\n\n\n\n\n", "metadata": "root.TestCompose", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def make_parser(self, formatter_class):\n parser = argparse.ArgumentParser(description='A test parser',\n formatter_class=formatter_class)\n parser.add_argument('test', help='Test argument')\n subparsers = parser.add_subparsers(title='Available subcommands')\n subparser = subparsers.add_parser('command', help='Test Subcommand',\n formatter_class=formatter_class)\n subparser.add_argument('test', help='Test argument')\n return parser", "metadata": "root.TestCompose.make_parser", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_zero_mixins(self):\n formatter_class = formatters.compose()", "metadata": "root.TestCompose.test_zero_mixins", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_all_mixins(self):\n formatter_class = formatters.compose(\n formatters.RawArguments,\n formatters.RawDescription,\n formatters.ArgumentDefaults,\n formatters.RemoveSubcommandsLine)", "metadata": "root.TestCompose.test_all_mixins", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 }, { "content": " def test_with_name(self):\n name = '__HelpFormatterForTesting'\n formatter_class = formatters.compose(formatters.RawDescription,\n name=name)\n self.assertEqual(formatter_class.__name__, name)", "metadata": "root.TestCompose.test_with_name", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_invalid_keyword(self):\n with self.assertRaises(TypeError):\n formatters.compose(invalid=None)", "metadata": "root.TestCompose.test_invalid_keyword", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def test_raw_argument(self):\n formatter_class = formatters.compose(formatters.RawArguments)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_raw_argument", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def test_raw_description(self):\n formatter_class = formatters.compose(formatters.RawDescription)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_raw_description", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_argument_defaults(self):\n formatter_class = formatters.compose(formatters.ArgumentDefaults)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_argument_defaults", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def test_remove_subcommands_line(self):\n formatter_class = formatters.compose(formatters.RemoveSubcommandsLine)\n parser = self.make_parser(formatter_class)\n clihelp = parser.format_help()", "metadata": "root.TestCompose.test_remove_subcommands_line", "header": "['class', 'TestCompose', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "import mock", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 }, { "span": "import sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\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 ", " _", "import_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "begin_", "import_", "formatters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Compose", "_", "(_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "make", "\\u", "parser_", "(_", "self_", ",_", "formatter", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "A", " ", "test", " ", "parser", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "test", "'_", ",_", "help_", "=_", "'", "Test", " ", "argu", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparsers_", "=_", "parser_", "._", "add", "\\u", "subparsers_", "(_", "title_", "=_", "'", "Avail", "able", " ", "subcommands", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparser_", "=_", "subparsers_", "._", "add", "\\u", "parser_", "(_", "'", "command", "'_", ",_", "help_", "=_", "'", "Test", " ", "Subc", "ommand", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparser_", "._", "add", "\\u", "argument_", "(_", "'", "test", "'_", ",_", "help_", "=_", "'", "Test", " ", "argu", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "zero", "\\u", "mixins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "mixins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Ra", "w", "Arguments_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Ra", "w", "Description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Arg", "ument", "Defaults_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "._", "Remove", "Subc", "ommand", "s", "Line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'\\u", "\\u", "Help", "Formatt", "er", "For", "Test", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Ra", "w", "Description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "formatter", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "keyword_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatters_", "._", "compose_", "(_", "invalid_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "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", "raw", "\\u", "argument_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Ra", "w", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "raw", "\\u", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Ra", "w", "Description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "argu", "ment", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Arg", "ument", "Defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Compose", "_", "(_", "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", "\\u", "subcommands", "\\u", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formatter", "\\u", "class_", "=_", "formatters_", "._", "compose_", "(_", "formatters_", "._", "Remove", "Subc", "ommand", "s", "Line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "self_", "._", "make", "\\u", "parser_", "(_", "formatter", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cli", "help_", "=_", "parser_", "._", "format\\u", "help_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bokeh/bokeh/bokeh/tests/test_themes.py
[ { "content": " def test_construct_no_json_or_filename(self):\n with self.assertRaises(ValueError) as manager:\n Theme()\n self.assertTrue(\"requires json or a filename\" in repr(manager.exception))", "metadata": "root.TestThemes.test_construct_no_json_or_filename", "header": "['class', 'TestThemes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_construct_json_and_filename(self):\n with self.assertRaises(ValueError) as manager:\n # we check \"\" and {} as falsey values, to try to trick\n # our code into thinking they weren't provided.\n Theme(filename=\"\", json={})\n self.assertTrue(\"not both\" in repr(manager.exception))", "metadata": "root.TestThemes.test_construct_json_and_filename", "header": "['class', 'TestThemes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_construct_bad_attrs(self):\n with self.assertRaises(ValueError) as manager:\n Theme(json=dict(attrs=42))\n self.assertTrue(\"should be a dictionary of class names\" in repr(manager.exception))", "metadata": "root.TestThemes.test_construct_bad_attrs", "header": "['class', 'TestThemes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def test_construct_bad_class_props(self):\n with self.assertRaises(ValueError) as manager:\n Theme(json=dict(attrs=dict(SomeClass=42)))\n self.assertTrue(\"should be a dictionary of properties\" in repr(manager.exception))", "metadata": "root.TestThemes.test_construct_bad_class_props", "header": "['class', 'TestThemes', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 } ]
[ { "span": "self.assertTrue(\"requires json or a filename\" in repr(manager.exception))", "start_line": 37, "start_column": 8, "end_line": 37, "end_column": 81 }, { "span": "self.assertTrue(\"not both\" in repr(manager.exception))", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 62 }, { "span": "self.assertTrue(\"should be a dictionary of class names\" in repr(manager.exception))", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 91 }, { "span": "self.assertTrue(\"should be a dictionary of properties\" in repr(manager.exception))", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 90 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Them", "es_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "construct", "\\u", "no", "\\u", "json", "\\u", "or", "\\u", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ")_", "as_", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Theme_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "require", "s", " ", "json", " ", "or", " ", "a", " ", "filename", "\"_", "in_", "repr_", "(_", "manager_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Them", "es_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "construct", "\\u", "json", "\\u", "and", "\\u", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ")_", "as_", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "check", " ", "\"\"", " ", "and", " ", "{}", " ", "as", " ", "fal", "sey", " ", "values", ",", " ", "to", " ", "try", " ", "to", " ", "trick", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "our", " ", "code", " ", "int", "o", " ", "think", "ing", " ", "the", "y", " ", "wer", "en", "'", "t", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Theme_", "(_", "filename_", "=_", "\"\"_", ",_", "json_", "=_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "not", " ", "bot", "h", "\"_", "in_", "repr_", "(_", "manager_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Them", "es_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "construct", "\\u", "bad", "\\u", "attrs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ")_", "as_", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Theme_", "(_", "json_", "=_", "dict_", "(_", "attrs_", "=_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "shou", "ld", " ", "be", " ", "a", " ", "dictionar", "y", " ", "of", " ", "class", " ", "names", "\"_", "in_", "repr_", "(_", "manager_", "._", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Them", "es_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "construct", "\\u", "bad", "\\u", "class", "\\u", "props_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ")_", "as_", "manager_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Theme_", "(_", "json_", "=_", "dict_", "(_", "attrs_", "=_", "dict_", "(_", "Some", "Class_", "=_", "42_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "shou", "ld", " ", "be", " ", "a", " ", "dictionar", "y", " ", "of", " ", "proper", "ties", "\"_", "in_", "repr_", "(_", "manager_", "._", "exception_", ")_", ")_", "\\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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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
comodit/demos/openshift/helper.py
[ { "content": "import time, sys, os, config, string, random\n\nfrom comodit_client.api.exceptions import PythonApiException\nfrom comodit_client.rest.exceptions import ApiException\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_host(env, name, platform, distribution, applications = []):\n host = env.hosts().create(name, \"\", platform['name'], distribution['name'])\n\n # Configure platform\n context = host.get_platform()\n for key, value in platform['settings'].iteritems():\n context.settings().create(key, value)\n\n # Configure distribution\n context = host.get_distribution()\n for key, value in distribution['settings'].iteritems():\n context.settings().create(key, value)\n\n # Install applications\n for app in applications:\n host.install(app['name'], app['settings'])\n\n return host", "metadata": "root.create_host", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def get_short_hostname(hostname):\n parts = hostname.split('.')\n return parts[0]", "metadata": "root.get_short_hostname", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def get_latest_id(prefix, env):\n names = env.hosts_f\n last_id = -1\n for name in names:\n if name.startswith(prefix):\n i = int(name[len(prefix):].rstrip())\n if i > last_id:\n last_id = i\n return last_id", "metadata": "root.get_latest_id", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def generate_id(size=6, chars=string.ascii_uppercase + string.digits):\n return ''.join(random.choice(chars) for x in range(size))", "metadata": "root.generate_id", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def track_changes(host):\n changes = host.changes().list()\n c = changes[-1]\n current_task = -1\n done = False\n while not done:\n for t in c.tasks:\n # Skip already processed tasks\n if t.order_num < current_task:\n continue\n\n # If the current task\n if t.order_num == current_task:\n if t.status == \"OK\":\n print \" [OK]\"\n if current_task == len(c.tasks) -1:\n done = True\n continue\n elif t.status == \"ERROR\":\n print \" [ERROR](%s...)\" % t.error[:80]\n if current_task == len(c.tasks) -1:\n done = True\n continue\n if t.status == \"PENDING\":\n break\n \n # Moved to a new task\n current_task = t.order_num\n sys.stdout.write(\" - %s...\" % t.description)\n sys.stdout.flush()\n break\n\n # Otherwise we wait, refresh, and loop\n time.sleep(1)\n c.refresh()", "metadata": "root.track_changes", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "import time, sys, os, config, string, random", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 44 }, { "span": "from comodit_client.api.exceptions import PythonApiException", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 60 }, { "span": "from comodit_client.rest.exceptions import ApiException", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "time_", ",_", "sys_", ",_", "os_", ",_", "config_", ",_", "string_", ",_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "api_", "._", "exceptions_", "import_", "Pyth", "on", "Ap", "i", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "com", "odi", "t", "\\u", "client_", "._", "rest_", "._", "exceptions_", "import_", "Ap", "i", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "host_", "(_", "env_", ",_", "name_", ",_", "platform_", ",_", "distribution_", ",_", "applications_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "env_", "._", "hosts_", "(_", ")_", "._", "create_", "(_", "name_", ",_", "\"\"_", ",_", "platform_", "[_", "'", "name", "'_", "]_", ",_", "distribution_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "platform_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "host_", "._", "get", "\\u", "platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "platform_", "[_", "'", "settings", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "settings_", "(_", ")_", "._", "create_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Configure", " ", "distribution_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "host_", "._", "get", "\\u", "distribution_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "distribution_", "[_", "'", "settings", "'_", "]_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "._", "settings_", "(_", ")_", "._", "create_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Install", " ", "applications_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "app_", "in_", "applications_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "._", "install_", "(_", "app_", "[_", "'", "name", "'_", "]_", ",_", "app_", "[_", "'", "settings", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "host_", "\\u\\u\\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", "short", "\\u", "hostname_", "(_", "hostname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "hostname_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "late", "st", "\\u", "id_", "(_", "prefix_", ",_", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "env_", "._", "host", "s", "\\u", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "id_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "._", "startswith_", "(_", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "int_", "(_", "name_", "[_", "len_", "(_", "prefix_", ")_", ":_", "]_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">_", "last", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "id_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "last", "\\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_", "generat", "e\\u", "id_", "(_", "size_", "=_", "6_", ",_", "chars_", "=_", "string_", "._", "ascii", "\\u", "uppercase_", "+_", "string_", "._", "digits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "._", "join_", "(_", "random_", "._", "choice_", "(_", "chars_", ")_", "for_", "x_", "in_", "range_", "(_", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "track", "\\u", "changes_", "(_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "=_", "host_", "._", "changes_", "(_", ")_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "changes_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "task_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", "in_", "c_", "._", "tasks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "alr", "ead", "y", " ", "process", "ed", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "._", "order", "\\u", "num_", "<_", "current", "\\u", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "current", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "._", "order", "\\u", "num_", "==_", "current", "\\u", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "._", "status_", "==_", "\"", "OK", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "[", "OK", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "task_", "==_", "len_", "(_", "c_", "._", "tasks_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "._", "status_", "==_", "\"", "ERROR", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "[", "ERROR", "](", "%", "s", "...)", "\"_", "%_", "t_", "._", "error_", "[_", ":_", "80_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "task_", "==_", "len_", "(_", "c_", "._", "tasks_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "._", "status_", "==_", "\"", "PEND", "ING", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", "d", " ", "to", " ", "a", " ", "new", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "task_", "=_", "t_", "._", "order", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", " ", " ", "-", " ", "%", "s", "...\"_", "%_", "t_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "we", " ", "wait", ",", " ", "refre", "sh", ",", " ", "and", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\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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 ]
Imprecise assert
ASPP/pelita/test/test_game_master.py
[ { "content": " def test_win_on_timeout_team_0(self):\n test_start = (\n \"\"\" ######\n #0 ..#\n #.. 1#\n ###### \"\"\")\n # the game lasts two rounds, enough time for bot 1 to eat food\n NUM_ROUNDS = 2\n # bot 1 moves east twice to eat the single food\n teams = [\n SimpleTeam(TestPlayer('>>')),\n SimpleTeam(StoppingPlayer())\n ]\n gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n gm.play()\n\n # check\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 0)\n self.assertEqual(gm.game_state[\"round_index\"], NUM_ROUNDS)", "metadata": "root.TestGame.test_win_on_timeout_team_0", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 540 }, { "content": " def test_win_on_timeout_team_1(self):\n test_start = (\n \"\"\" ######\n #0 ..#\n #.. 1#\n ###### \"\"\")\n # the game lasts two rounds, enough time for bot 1 to eat food\n NUM_ROUNDS = 2\n\n teams = [\n SimpleTeam(StoppingPlayer()),\n SimpleTeam(TestPlayer('<<')) # bot 1 moves west twice to eat the single food\n ]\n gm = GameMaster(test_start, teams, 2, game_time=NUM_ROUNDS)\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n gm.play()\n\n # check\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 1)\n self.assertEqual(gm.game_state[\"round_index\"], NUM_ROUNDS)", "metadata": "root.TestGame.test_win_on_timeout_team_1", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 573 }, { "content": " def test_win_on_eating_all(self):\n test_start = (\n \"\"\" ######\n #0 . #\n # . 1#\n ###### \"\"\"\n )\n teams = [\n SimpleTeam(StoppingPlayer()),\n SimpleTeam(TestPlayer('<<<'))\n ]\n # bot 1 eats all the food and the game stops\n gm = GameMaster(test_start, teams, 2, 100)\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n gm.play()\n\n # check\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 1)\n self.assertEqual(tv.cache[-1][\"round_index\"], 1)\n self.assertEqual(gm.game_state[\"round_index\"], 1)", "metadata": "root.TestGame.test_win_on_eating_all", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 635 }, { "content": " def test_lose_on_eating_all(self):\n test_start = (\n \"\"\" ######\n #0 . #\n # . 1#\n ###### \"\"\"\n )\n teams = [\n SimpleTeam(StoppingPlayer()),\n SimpleTeam(TestPlayer('<<<'))\n ]\n # bot 1 eats all the food and the game stops\n gm = GameMaster(test_start, teams, 2, 100)\n gm.universe.teams[0].score = 2\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n gm.play()\n\n # check\n self.assertEqual(tv.cache[-1][\"round_index\"], 1)\n self.assertEqual(gm.universe.teams[0].score, 2)\n self.assertEqual(gm.universe.teams[1].score, 1)\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 0)\n self.assertEqual(gm.game_state[\"round_index\"], 1)", "metadata": "root.TestGame.test_lose_on_eating_all", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 668 }, { "content": " def test_lose_5_timeouts(self):\n # 0 must move back and forth because of random steps\n test_start = (\n \"\"\" ######\n #0 #.#\n ### #\n ##. 1#\n ###### \"\"\"\n )\n # players do nothing\n class TimeOutPlayer(AbstractPlayer):\n def get_move(self):\n raise PlayerTimeout\n\n teams = [\n SimpleTeam(TimeOutPlayer()),\n SimpleTeam(StoppingPlayer())\n ]\n # the game lasts one round, and then draws\n gm = GameMaster(test_start, teams, 2, 100, max_timeouts=5)\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n\n self.assertEqual(gm.universe.bots[0].current_pos, (1,1))\n\n gm.play()\n\n # check\n self.assertEqual(gm.game_state[\"max_timeouts\"], 5)\n self.assertEqual(tv.cache[-1][\"round_index\"], gm.game_state[\"max_timeouts\"] - 1)\n self.assertEqual(gm.universe.teams[0].score, 0)\n self.assertEqual(gm.universe.teams[1].score, 0)\n # the bot moves four times, so after the fourth time,\n # it is back on its original position\n self.assertEqual(gm.universe.bots[0].current_pos, (1,1))\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 1)", "metadata": "root.TestGame.test_lose_5_timeouts", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 704 }, { "content": " def test_must_not_move_after_last_timeout(self):\n # 0 must move back and forth because of random steps\n # but due to its last timeout, it should be disqualified\n # immediately\n test_start = (\n \"\"\" ######\n ##0.##\n # ## #\n ##. 1#\n ###### \"\"\"\n )\n # players do nothing\n class TimeOutPlayer(AbstractPlayer):\n def get_move(self):\n raise PlayerTimeout\n\n class CheckTestPlayer(AbstractPlayer):\n def get_move(self):\n raise RuntimeError(\"This should never be called\")\n\n teams = [\n SimpleTeam(TimeOutPlayer()),\n SimpleTeam(CheckTestPlayer())\n ]\n # the game lasts one round, and then draws\n gm = GameMaster(test_start, teams, 2, 100, max_timeouts=1)\n\n # this test viewer caches all events lists seen through observe\n class TestViewer(AbstractViewer):\n def __init__(self):\n self.cache = list()\n def observe(self, universe, game_state):\n self.cache.append(game_state)\n\n # run the game\n tv = TestViewer()\n gm.register_viewer(tv)\n gm.set_initial()\n\n gm.play()\n print(gm.universe.pretty)\n print(gm.game_state)\n\n # check\n self.assertEqual(gm.game_state[\"max_timeouts\"], 1)\n self.assertEqual(tv.cache[-1][\"round_index\"], gm.game_state[\"max_timeouts\"] - 1)\n self.assertEqual(gm.universe.teams[0].score, 0)\n self.assertEqual(gm.universe.teams[1].score, 0)\n self.assertEqual(gm.universe.bots[0].current_pos, (2,1))\n self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)\n self.assertEqual(tv.cache[-1][\"team_wins\"], 1)\n\n # the game ends in round 0 with bot_id 0\n self.assertEqual(gm.game_state[\"round_index\"], 0)\n self.assertEqual(gm.game_state[\"bot_id\"], 0)", "metadata": "root.TestGame.test_must_not_move_after_last_timeout", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 752 }, { "content": " def test_play_step(self):\n\n test_start = (\n \"\"\" ########\n # 0 ..#\n #.. 1 #\n ######## \"\"\")\n\n number_bots = 2\n\n\n teams = [\n SimpleTeam(TestPlayer('>>>>')),\n SimpleTeam(TestPlayer('<<<<'))\n ]\n gm = GameMaster(test_start, teams, number_bots, 4)\n\n gm.set_initial()\n\n gm.play_round()\n self.assertEqual(gm.universe.bots[0].current_pos, (3,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (4,2))\n self.assertEqual(gm.game_state[\"round_index\"], 0)\n self.assertTrue(gm.game_state[\"bot_id\"] is None)\n self.assertFalse(gm.game_state[\"finished\"])\n\n gm.play_step()\n self.assertEqual(gm.universe.bots[0].current_pos, (4,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (4,2))\n self.assertEqual(gm.game_state[\"round_index\"], 1)\n self.assertEqual(gm.game_state[\"bot_id\"], 0)\n self.assertEqual(gm.game_state[\"finished\"], False)\n\n gm.play_step()\n self.assertEqual(gm.universe.bots[0].current_pos, (4,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (3,2))\n self.assertEqual(gm.game_state[\"round_index\"], 1)\n self.assertEqual(gm.game_state[\"bot_id\"], 1)\n self.assertEqual(gm.game_state[\"finished\"], False)\n\n gm.play_step()\n self.assertEqual(gm.universe.bots[0].current_pos, (5,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (3,2))\n self.assertEqual(gm.game_state[\"round_index\"], 2)\n self.assertEqual(gm.game_state[\"bot_id\"], 0)\n self.assertEqual(gm.game_state[\"finished\"], False)\n\n gm.play_step()\n self.assertEqual(gm.universe.bots[0].current_pos, (5,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (2,2))\n self.assertEqual(gm.game_state[\"round_index\"], 2)\n self.assertEqual(gm.game_state[\"bot_id\"], 1)\n self.assertEqual(gm.game_state[\"finished\"], False)\n\n gm.play_round()\n # first call tries to finish current round (which already is finished)\n # so nothing happens\n self.assertEqual(gm.universe.bots[0].current_pos, (5,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (2,2))\n self.assertEqual(gm.game_state[\"round_index\"], 2)\n self.assertTrue(gm.game_state[\"bot_id\"] is None)\n self.assertEqual(gm.game_state[\"finished\"], False)\n self.assertEqual(gm.game_state[\"team_wins\"], None)\n self.assertEqual(gm.game_state[\"game_draw\"], None)\n\n gm.play_round()\n # second call works\n self.assertEqual(gm.universe.bots[0].current_pos, (6,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (1,2))\n self.assertEqual(gm.game_state[\"round_index\"], 3)\n self.assertTrue(gm.game_state[\"bot_id\"] is None)\n self.assertEqual(gm.game_state[\"finished\"], True)\n self.assertEqual(gm.game_state[\"team_wins\"], None)\n self.assertEqual(gm.game_state[\"game_draw\"], True)\n\n # Game finished because all food was eaten\n # team 0 finished first but the round was played regularly to the end\n # (hence round_index == 3 and bot_id is None)\n\n # nothing happens anymore\n gm.play_round()\n self.assertEqual(gm.universe.bots[0].current_pos, (6,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (1,2))\n self.assertEqual(gm.game_state[\"round_index\"], 3)\n self.assertTrue(gm.game_state[\"bot_id\"] is None)\n self.assertEqual(gm.game_state[\"finished\"], True)\n self.assertEqual(gm.game_state[\"team_wins\"], None)\n self.assertEqual(gm.game_state[\"game_draw\"], True)\n\n # nothing happens anymore\n gm.play_round()\n self.assertEqual(gm.universe.bots[0].current_pos, (6,1))\n self.assertEqual(gm.universe.bots[1].current_pos, (1,2))\n self.assertEqual(gm.game_state[\"round_index\"], 3)\n self.assertTrue(gm.game_state[\"bot_id\"] is None)\n self.assertEqual(gm.game_state[\"finished\"], True)\n self.assertEqual(gm.game_state[\"team_wins\"], None)\n self.assertEqual(gm.game_state[\"game_draw\"], True)", "metadata": "root.TestGame.test_play_step", "header": "['class', 'TestGame', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 809 } ]
[ { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 569, "start_column": 8, "end_line": 569, "end_column": 62 }, { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 602, "start_column": 8, "end_line": 602, "end_column": 62 }, { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 663, "start_column": 8, "end_line": 663, "end_column": 62 }, { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 700, "start_column": 8, "end_line": 700, "end_column": 62 }, { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 749, "start_column": 8, "end_line": 749, "end_column": 62 }, { "span": "self.assertTrue(tv.cache[-1][\"team_wins\"] is not None)", "start_line": 801, "start_column": 8, "end_line": 801, "end_column": 62 }, { "span": "self.assertTrue(gm.game_state[\"bot_id\"] is None)", "start_line": 832, "start_column": 8, "end_line": 832, "end_column": 56 }, { "span": "self.assertTrue(gm.game_state[\"bot_id\"] is None)", "start_line": 869, "start_column": 8, "end_line": 869, "end_column": 56 }, { "span": "self.assertTrue(gm.game_state[\"bot_id\"] is None)", "start_line": 879, "start_column": 8, "end_line": 879, "end_column": 56 }, { "span": "self.assertTrue(gm.game_state[\"bot_id\"] is None)", "start_line": 893, "start_column": 8, "end_line": 893, "end_column": 56 }, { "span": "self.assertTrue(gm.game_state[\"bot_id\"] is None)", "start_line": 903, "start_column": 8, "end_line": 903, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "win", "\\u", "on", "\\u", "timeo", "ut", "\\u", "team", "\\u", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "#", "0", " ", "..", "#", "\\", "10", ";", " ", " ", " ", " ", "#..", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "game", " ", "lasts", " ", "two", " ", "round", "s", ",", " ", "eno", "ugh", " ", "time", " ", "for", " ", "bot", " ", "1", " ", "to", " ", "eat", " ", "food_", "\\u\\u\\uNL\\u\\u\\u_", "NUM", "\\u", "ROUND", "S_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bot", " ", "1", " ", "moves", " ", "east", " ", "twi", "ce", " ", "to", " ", "eat", " ", "the", " ", "single", " ", "food_", "\\u\\u\\uNL\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'>>", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Stopp", "ing", "Player_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "game", "\\u", "time_", "=_", "NUM", "\\u", "ROUND", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "NUM", "\\u", "ROUND", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "win", "\\u", "on", "\\u", "timeo", "ut", "\\u", "team", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "#", "0", " ", "..", "#", "\\", "10", ";", " ", " ", " ", " ", "#..", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "game", " ", "lasts", " ", "two", " ", "round", "s", ",", " ", "eno", "ugh", " ", "time", " ", "for", " ", "bot", " ", "1", " ", "to", " ", "eat", " ", "food_", "\\u\\u\\uNL\\u\\u\\u_", "NUM", "\\u", "ROUND", "S_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Stopp", "ing", "Player_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'<<", "'_", ")_", ")_", "#", " ", "bot", " ", "1", " ", "moves", " ", "west", " ", "twi", "ce", " ", "to", " ", "eat", " ", "the", " ", "single", " ", "food_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "game", "\\u", "time_", "=_", "NUM", "\\u", "ROUND", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "NUM", "\\u", "ROUND", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "win", "\\u", "on", "\\u", "eat", "ing", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "#", "0", " ", ".", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "#", " ", ".", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Stopp", "ing", "Player_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'<<", "<'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bot", " ", "1", " ", "eat", "s", " ", "all", " ", "the", " ", "food", " ", "and", " ", "the", " ", "game", " ", "stops_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lose", "\\u", "on", "\\u", "eat", "ing", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "#", "0", " ", ".", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "#", " ", ".", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Stopp", "ing", "Player_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'<<", "<'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bot", " ", "1", " ", "eat", "s", " ", "all", " ", "the", " ", "food", " ", "and", " ", "the", " ", "game", " ", "stops_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "universe_", "._", "teams_", "[_", "0_", "]_", "._", "score_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "0_", "]_", "._", "score_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "1_", "]_", "._", "score_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lose", "\\u", "5", "\\u", "timeouts", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "0", " ", "must", " ", "move", " ", "back", " ", "and", " ", "fort", "h", " ", "bec", "aus", "e", " ", "of", " ", "random", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "#", "0", " ", "#.", "#", "\\", "10", ";", " ", " ", " ", " ", "###", " ", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "##", ".", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "player", "s", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Time", "Out", "Player_", "(_", "Abstract", "Player_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "move_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Player", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Time", "Out", "Player_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Stopp", "ing", "Player_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "game", " ", "lasts", " ", "one", " ", "round", ",", " ", "and", " ", "then", " ", "draws", "_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "100_", ",_", "max", "\\u", "timeouts", "_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "max", "\\u", "timeouts", "\"_", "]_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "max", "\\u", "timeouts", "\"_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "0_", "]_", "._", "score_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "1_", "]_", "._", "score_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "bot", " ", "moves", " ", "four", " ", "times", ",", " ", "so", " ", "after", " ", "the", " ", "fourth", " ", "time", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "is", " ", "back", " ", "on", " ", "its", " ", "original", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "must", "\\u", "not", "\\u", "move", "\\u", "after", "\\u", "last", "\\u", "timeout_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "0", " ", "must", " ", "move", " ", "back", " ", "and", " ", "fort", "h", " ", "bec", "aus", "e", " ", "of", " ", "random", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "due", " ", "to", " ", "its", " ", "last", " ", "timeo", "ut", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "dis", "qualified", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "immediate", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "\\", "10", ";", " ", " ", " ", " ", "##", "0.", "##", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "##", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "##", ".", " ", "1", "#", "\\", "10", ";", " ", " ", " ", " ", "######", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "player", "s", " ", "do", " ", "nothing_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Time", "Out", "Player_", "(_", "Abstract", "Player_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "move_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Player", "Timeout_", "\\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_", "Check", "Test", "Player_", "(_", "Abstract", "Player_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "move_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Thi", "s", " ", "shou", "ld", " ", "neve", "r", " ", "be", " ", "call", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Time", "Out", "Player_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Check", "Test", "Player_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "game", " ", "lasts", " ", "one", " ", "round", ",", " ", "and", " ", "then", " ", "draws", "_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "2_", ",_", "100_", ",_", "max", "\\u", "timeouts", "_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "test", " ", "viewer", " ", "cache", "s", " ", "all", " ", "events", " ", "lists", " ", "see", "n", " ", "through", " ", "observe", "_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Viewer_", "(_", "Abstract", "Viewer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "observe", "_", "(_", "self_", ",_", "universe_", ",_", "game", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "._", "append_", "(_", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "run", " ", "the", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tv_", "=_", "Test", "Viewer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "register", "\\u", "viewer_", "(_", "tv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "gm_", "._", "universe_", "._", "pretty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "gm_", "._", "game", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "max", "\\u", "timeouts", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "max", "\\u", "timeouts", "\"_", "]_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "0_", "]_", "._", "score_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "teams_", "[_", "1_", "]_", "._", "score_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "2_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tv_", "._", "cache_", "[_", "-_", "1_", "]_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "game", " ", "ends", " ", "in", " ", "round", " ", "0", " ", "with", " ", "bot", "\\u", "id", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Game_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "play", "\\u", "step_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "start_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "######", "##", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "0", " ", " ", "..", "#", "\\", "10", ";", " ", " ", " ", " ", "#..", " ", " ", "1", " ", "#", "\\", "10", ";", " ", " ", " ", " ", "######", "##", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "number", "\\u", "bots_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "teams_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'>>", ">>'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Simple", "Team_", "(_", "Test", "Player_", "(_", "'<<", "<<", "'_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gm_", "=_", "Game", "Master_", "(_", "test\\u", "start_", ",_", "teams_", ",_", "number", "\\u", "bots_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "set\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "3_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "4_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "4_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "4_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "4_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "3_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "5_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "3_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "step_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "5_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "call", " ", "trie", "s", " ", "to", " ", "finish", " ", "current", " ", "round", " ", "(", "whi", "ch", " ", "alr", "ead", "y", " ", "is", " ", "finish", "ed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "not", "hing", " ", "happ", "ens_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "5_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "game", "\\u", "draw", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "second", " ", "call", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "6_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "game", "\\u", "draw", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Game", " ", "finish", "ed", " ", "bec", "aus", "e", " ", "all", " ", "food", " ", "was", " ", "eat", "en_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "team", " ", "0", " ", "finish", "ed", " ", "first", " ", "but", " ", "the", " ", "round", " ", "was", " ", "played", " ", "regular", "ly", " ", "to", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "hen", "ce", " ", "round", "\\u", "index", " ", "==", " ", "3", " ", "and", " ", "bot", "\\u", "id", " ", "is", " ", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", "hing", " ", "happ", "ens", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "6_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "game", "\\u", "draw", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", "hing", " ", "happ", "ens", " ", "any", "more_", "\\u\\u\\uNL\\u\\u\\u_", "gm_", "._", "play", "\\u", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "0_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "6_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "universe_", "._", "bots_", "[_", "1_", "]_", "._", "current", "\\u", "pos_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "round", "\\u", "index", "\"_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "bot", "\\u", "id", "\"_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "finish", "ed", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "team", "\\u", "wins", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "gm_", "._", "game", "\\u", "state_", "[_", "\"", "game", "\\u", "draw", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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 ]
Unused local variable
CGATOxford/cgat/scripts/bam2geneprofile.py
[ { "content": "def main(argv=None):\n \"\"\"script main.\n\n parses command line options in sys.argv, unless *argv* is given.\n \"\"\"\n\n if not argv:\n argv = sys.argv\n\n # setup command line parser\n parser = E.OptionParser(version=\"%prog version: $Id$\",\n usage=globals()[\"__doc__\"])\n\n parser.add_option(\"-m\", \"--method\", dest=\"methods\", type=\"choice\",\n action=\"append\",\n choices=(\"geneprofile\", \"tssprofile\", \"utrprofile\",\n \"intervalprofile\", \"midpointprofile\",\n \"geneprofilewithintrons\",\n \"geneprofileabsolutedistancefromthreeprimeend\",\n \"separateexonprofile\",\n \"separateexonprofilewithintrons\",\n ),\n help='counters to use. Counters describe the '\n 'meta-gene structure to use. '\n 'Note using geneprofilewithintrons, or '\n 'geneprofileabsolutedistancefromthreeprimeend will '\n 'automatically turn on the --use-base-accuracy option'\n '[%default].')\n\n parser.add_option(\"-b\", \"--bam-file\", \"--bedfile\", \"--bigwigfile\",\n dest=\"infiles\",\n metavar=\"BAM\",\n type=\"string\", action=\"append\",\n help=\"BAM/bed/bigwig files to use. Do not mix \"\n \"different types [%default]\")\n\n parser.add_option(\"-c\", \"--control-bam-file\", dest=\"controlfiles\",\n metavar=\"BAM\",\n type=\"string\", action=\"append\",\n help=\"control/input to use. Should be of the same \"\n \"type as the bam/bed/bigwig file\"\n \" [%default]\")\n\n parser.add_option(\"-g\", \"--gtf-file\", dest=\"gtffile\", type=\"string\",\n metavar=\"GTF\",\n help=\"GTF file to use. \"\n \"[%default]\")\n\n parser.add_option(\n \"--normalize-transcript\",\n dest=\"transcript_normalization\",\n type=\"choice\",\n choices=(\"none\", \"max\", \"sum\", \"total-max\", \"total-sum\"),\n help=\"normalization to apply on each transcript \"\n \"profile before adding to meta-gene profile. \"\n \"[%default]\")\n\n parser.add_option(\n \"--normalize-profile\",\n dest=\"profile_normalizations\",\n type=\"choice\", action=\"append\",\n choices=(\"all\", \"none\", \"area\", \"counts\", \"background\"),\n help=\"normalization to apply on meta-gene \"\n \"profile normalization. \"\n \"[%default]\")\n\n parser.add_option(\n \"-r\", \"--reporter\", dest=\"reporter\", type=\"choice\",\n choices=(\"gene\", \"transcript\"),\n help=\"report results for genes or transcripts.\"\n \" When 'genes` is chosen, exons across all transcripts for\"\n \" a gene are merged. When 'transcript' is chosen, counts are\"\n \" computed for each transcript separately with each transcript\"\n \" contributing equally to the meta-gene profile.\"\n \" [%default]\")\n\n parser.add_option(\"-i\", \"--shift-size\", dest=\"shifts\", type=\"int\",\n action=\"append\",\n help=\"shift reads in :term:`bam` formatted file \"\n \"before computing densities (ChIP-Seq). \"\n \"[%default]\")\n\n parser.add_option(\"-a\", \"--merge-pairs\", dest=\"merge_pairs\",\n action=\"store_true\",\n help=\"merge pairs in :term:`bam` formatted \"\n \"file before computing \"\n \"densities (ChIP-Seq). \"\n \"[%default]\")\n\n parser.add_option(\"-u\", \"--use-base-accuracy\", dest=\"base_accuracy\",\n action=\"store_true\",\n help=\"compute densities with base accuracy. The default \"\n \"is to only use the start and end of the aligned region \"\n \"(RNA-Seq) \"\n \"[%default]\")\n\n parser.add_option(\"-e\", \"--extend\", dest=\"extends\", type=\"int\",\n action=\"append\",\n help=\"extend reads in :term:`bam` formatted file \"\n \"(ChIP-Seq). \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-upstream\", dest=\"resolution_upstream\",\n type=\"int\",\n help=\"resolution of upstream region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-downstream\", dest=\"resolution_downstream\",\n type=\"int\",\n help=\"resolution of downstream region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-upstream-utr\",\n dest=\"resolution_upstream_utr\",\n type=\"int\",\n help=\"resolution of upstream UTR region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-downstream-utr\",\n dest=\"resolution_downstream_utr\",\n type=\"int\",\n help=\"resolution of downstream UTR region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-cds\", dest=\"resolution_cds\", type=\"int\",\n help=\"resolution of cds region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-first-exon\", dest=\"resolution_first\",\n type=\"int\",\n help=\"resolution of first exon in gene, in bp\"\n \"[%default]\")\n\n parser.add_option(\"--resolution-last-exon\", dest=\"resolution_last\",\n type=\"int\",\n help=\"resolution of last exon in gene, in bp\"\n \"[%default]\")\n\n parser.add_option(\"--resolution-introns\",\n dest=\"resolution_introns\", type=\"int\",\n help=\"resolution of introns region in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-exons-absolute-distance-topolya\",\n dest=\"resolution_exons_absolute_distance_topolya\",\n type=\"int\",\n help=\"resolution of exons absolute distance \"\n \"topolya in bp \"\n \"[%default]\")\n\n parser.add_option(\"--resolution-introns-absolute-distance-topolya\",\n dest=\"resolution_introns_absolute_distance_topolya\",\n type=\"int\",\n help=\"resolution of introns absolute distance \"\n \"topolya in bp \"\n \"[%default]\")\n\n parser.add_option(\"--extension-exons-absolute-distance-topolya\",\n dest=\"extension_exons_absolute_distance_topolya\",\n type=\"int\",\n help=\"extension for exons from the absolute \"\n \"distance from the topolya in bp \"\n \"[%default]\")\n\n parser.add_option(\n \"--extension-introns-absolute-distance-topolya\",\n dest=\"extension_introns_absolute_distance_topolya\", type=\"int\",\n help=\"extension for introns from the absolute distance from \"\n \"the topolya in bp [%default]\")\n\n parser.add_option(\n \"--extension-upstream\", dest=\"extension_upstream\", type=\"int\",\n help=\"extension upstream from the first exon in bp\"\n \"[%default]\")\n\n parser.add_option(\n \"--extension-downstream\", dest=\"extension_downstream\", type=\"int\",\n help=\"extension downstream from the last exon in bp\"\n \"[%default]\")\n\n parser.add_option(\n \"--extension-inward\", dest=\"extension_inward\", type=\"int\",\n help=\"extension inward from a TSS start site in bp\"\n \"[%default]\")\n\n parser.add_option(\n \"--extension-outward\", dest=\"extension_outward\", type=\"int\",\n help=\"extension outward from a TSS start site in bp\"\n \"[%default]\")\n\n parser.add_option(\"--scale-flank-length\", dest=\"scale_flanks\", type=\"int\",\n help=\"scale flanks to (integer multiples of) gene length\"\n \"[%default]\")\n\n parser.add_option(\n \"--control-factor\", dest=\"control_factor\", type=\"float\",\n help=\"factor for normalizing control and foreground data. \"\n \"Computed from data if not set. \"\n \"[%default]\")\n\n parser.add_option(\"--output-all-profiles\", dest=\"output_all_profiles\",\n action=\"store_true\",\n help=\"keep individual profiles for each \"\n \"transcript and output. \"\n \"[%default]\")\n\n parser.add_option(\"--counts-tsv-file\", dest=\"input_filename_counts\",\n type=\"string\",\n help=\"filename with count data for each transcript. \"\n \"Use this instead \"\n \"of recomputing the profile. Useful for plotting the \"\n \"meta-gene profile \"\n \"from previously computed counts \"\n \"[%default]\")\n\n parser.add_option(\n \"--background-region-bins\",\n dest=\"background_region_bins\",\n type=\"int\",\n help=\"number of bins on either end of the profile \"\n \"to be considered for background meta-gene normalization \"\n \"[%default]\")\n\n parser.set_defaults(\n remove_rna=False,\n ignore_pairs=False,\n force_output=False,\n bin_size=10,\n extends=[],\n shifts=[],\n sort=[],\n reporter=\"transcript\",\n resolution_cds=1000,\n resolution_introns=1000,\n # 3kb is a good balance of seeing long enough 3 prime bias and not omit\n # too many genes. Tim 31th Aug 2013\n resolution_exons_absolute_distance_topolya=3000,\n # introns is only for assess the noise level, thus do ont need a long\n # region, a long region has the side effect of omit more genes. Tim\n # 31th Aug 2013\n resolution_introns_absolute_distance_topolya=500,\n # extension can simply just be the same as resolution\n extension_exons_absolute_distance_topolya=3000,\n extension_introns_absolute_distance_topolya=500,\n resolution_upstream_utr=1000,\n resolution_downstream_utr=1000,\n resolution_upstream=1000,\n resolution_downstream=1000,\n resolution_first=1000,\n resolution_last=1000,\n # mean length of transcripts: about 2.5 kb\n extension_upstream=2500,\n extension_downstream=2500,\n extension_inward=3000,\n extension_outward=3000,\n plot=True,\n methods=[],\n infiles=[],\n controlfiles=[],\n gtffile=None,\n profile_normalizations=[],\n transcript_normalization=None,\n scale_flanks=0,\n merge_pairs=False,\n min_insert_size=0,\n max_insert_size=1000,\n base_accuracy=False,\n matrix_format=\"single\",\n control_factor=None,\n output_all_profiles=False,\n background_region_bins=10,\n input_filename_counts=None,\n )\n\n # add common options (-h/--help, ...) and parse command line\n (options, args) = E.Start(parser, argv=argv, add_output_options=True)\n\n # Keep for backwards compatability\n if len(args) == 2:\n infile, gtf = args\n options.infiles.append(infile)\n options.gtffile = gtf\n\n if not options.gtffile:\n raise ValueError(\"no GTF file specified\")\n\n if options.gtffile == \"-\":\n options.gtffile = options.stdin\n else:\n options.gtffile = IOTools.openFile(options.gtffile)\n\n if len(options.infiles) == 0:\n raise ValueError(\"no bam/wig/bed files specified\")\n\n for methodsRequiresBaseAccuracy in [\n \"geneprofilewithintrons\",\n \"geneprofileabsolutedistancefromthreeprimeend\",\n ]:\n # If you implemented any methods that you do not want the\n # spliced out introns or exons appear to be covered by\n # non-existent reads, it is better you let those methods imply\n # --base-accurarcy by add them here.\n if methodsRequiresBaseAccuracy in options.methods:\n options.base_accuracy = True\n\n if options.reporter == \"gene\":\n gtf_iterator = GTF.flat_gene_iterator(GTF.iterator(options.gtffile))\n elif options.reporter == \"transcript\":\n gtf_iterator = GTF.transcript_iterator(GTF.iterator(options.gtffile))\n\n # Select rangecounter based on file type\n if len(options.infiles) > 0:\n if options.infiles[0].endswith(\".bam\"):\n bamfiles = [pysam.Samfile(x, \"rb\") for x in options.infiles]\n\n if options.controlfiles:\n controlfiles = [pysam.Samfile(x, \"rb\")\n for x in options.controlfiles]\n else:\n controlfiles = None\n\n format = \"bam\"\n if options.merge_pairs:\n range_counter = _bam2geneprofile.RangeCounterBAM(\n bamfiles,\n shifts=options.shifts,\n extends=options.extends,\n merge_pairs=options.merge_pairs,\n min_insert_size=options.min_insert_size,\n max_insert_size=options.max_insert_size,\n controfiles=controlfiles,\n control_factor=options.control_factor)\n\n elif options.shifts or options.extends:\n range_counter = _bam2geneprofile.RangeCounterBAM(\n bamfiles,\n shifts=options.shifts,\n extends=options.extends,\n controlfiles=controlfiles,\n control_factor=options.control_factor)\n\n elif options.base_accuracy:\n range_counter = _bam2geneprofile.RangeCounterBAMBaseAccuracy(\n bamfiles,\n controlfiles=controlfiles,\n control_factor=options.control_factor)\n else:\n range_counter = _bam2geneprofile.RangeCounterBAM(\n bamfiles,\n controlfiles=controlfiles,\n control_factor=options.control_factor)\n\n elif options.infiles[0].endswith(\".bed.gz\"):\n bedfiles = [pysam.Tabixfile(x) for x in options.infiles]\n\n if options.controlfiles:\n controlfiles = [pysam.Tabixfile(x)\n for x in options.controlfiles]\n else:\n controlfiles = None\n\n range_counter = _bam2geneprofile.RangeCounterBed(\n bedfiles,\n controlfiles=controlfiles,\n control_factor=options.control_factor)\n\n elif options.infiles[0].endswith(\".bw\"):\n wigfiles = [BigWigFile(file=open(x)) for x in options.infiles]\n range_counter = _bam2geneprofile.RangeCounterBigWig(wigfiles)\n\n else:\n raise NotImplementedError(\n \"can't determine file type for %s\" % str(options.infiles))\n\n counters = []\n for method in options.methods:\n if method == \"utrprofile\":\n counters.append(_bam2geneprofile.UTRCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_upstream_utr,\n options.resolution_cds,\n options.resolution_downstream_utr,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream,\n ))\n\n elif method == \"geneprofile\":\n counters.append(_bam2geneprofile.GeneCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_cds,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream,\n options.scale_flanks))\n\n elif method == \"geneprofilewithintrons\":\n counters.append(_bam2geneprofile.GeneCounterWithIntrons(\n range_counter,\n options.resolution_upstream,\n options.resolution_cds,\n options.resolution_introns,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream,\n options.scale_flanks))\n\n elif method == \"geneprofileabsolutedistancefromthreeprimeend\":\n # options.extension_exons_absolute_distance_tostartsite,\n # options.extension_introns_absolute_distance_tostartsite,\n # Tim 31th Aug 2013: a possible feature for future, if five prime\n # bias is of your interest.\n # (you need to create another class). It is not very difficult to\n # derive from this class, but is not implemented yet\n # This future feature is slightly different the TSS profile\n # already implemented, because in this future feature introns are\n # skipped,\n counters.append(\n _bam2geneprofile.GeneCounterAbsoluteDistanceFromThreePrimeEnd(\n range_counter, options.resolution_upstream,\n options.resolution_downstream,\n options.resolution_exons_absolute_distance_topolya,\n options.resolution_introns_absolute_distance_topolya,\n options.extension_upstream,\n options.extension_downstream,\n options.extension_exons_absolute_distance_topolya,\n options.extension_introns_absolute_distance_topolya,\n options.scale_flanks))\n\n elif method == \"tssprofile\":\n counters.append(_bam2geneprofile.TSSCounter(\n range_counter,\n options.extension_outward,\n options.extension_inward))\n\n elif method == \"intervalprofile\":\n counters.append(_bam2geneprofile.RegionCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_cds,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream))\n\n elif method == \"midpointprofile\":\n counters.append(_bam2geneprofile.MidpointCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream))\n\n # add new method to split 1st and last exons out\n # requires a representative transcript for reach gene\n # gtf should be sorted gene-position\n elif method == \"separateexonprofile\":\n counters.append(_bam2geneprofile.SeparateExonCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_first,\n options.resolution_last,\n options.resolution_cds,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream))\n\n elif method == \"separateexonprofilewithintrons\":\n counters.append(_bam2geneprofile.SeparateExonWithIntronCounter(\n range_counter,\n options.resolution_upstream,\n options.resolution_first,\n options.resolution_last,\n options.resolution_cds,\n options.resolution_introns,\n options.resolution_downstream,\n options.extension_upstream,\n options.extension_downstream))\n\n # set normalization\n for c in counters:\n c.setNormalization(options.transcript_normalization)\n if options.output_all_profiles:\n c.setOutputProfiles(IOTools.openFile(E.getOutputFile(c.name) +\n \".profiles.tsv.gz\", \"w\"))\n\n if options.input_filename_counts:\n # read counts from file\n E.info(\"reading counts from %s\" % options.input_filename_counts)\n all_counts = pandas.read_csv(\n IOTools.openFile(options.input_filename_counts),\n sep='\\t', header=0, index_col=0)\n\n if len(counters) != 1:\n raise NotImplementedError(\n 'counting from matrix only implemented for 1 counter.')\n # build counter based on reference counter\n counter = _bam2geneprofile.UnsegmentedCounter(counters[0])\n counters = [counter]\n _bam2geneprofile.countFromCounts(counters, all_counts)\n\n else:\n E.info(\"starting counting with %i counters\" % len(counters))\n feature_names = _bam2geneprofile.countFromGTF(counters,\n gtf_iterator)\n\n # output matrices\n if not options.profile_normalizations:\n options.profile_normalizations.append(\"none\")\n elif \"all\" in options.profile_normalizations:\n options.profile_normalizations = [\"none\",\n \"area\",\n \"counts\",\n \"background\"]\n\n for method, counter in zip(options.methods, counters):\n profiles = []\n for norm in options.profile_normalizations:\n # build matrix, apply normalization\n profile = counter.getProfile(\n normalize=norm,\n background_region_bins=options.background_region_bins)\n profiles.append(profile)\n\n for x in range(1, len(profiles)):\n assert profiles[0].shape == profiles[x].shape\n\n # build a single matrix of all profiles for output\n matrix = numpy.concatenate(profiles)\n matrix.shape = len(profiles), len(profiles[0])\n matrix = matrix.transpose()\n\n with IOTools.openFile(E.getOutputFile(counter.name) +\n \".matrix.tsv.gz\", \"w\") as outfile:\n outfile.write(\"bin\\tregion\\tregion_bin\\t%s\\n\" % \"\\t\".join(\n options.profile_normalizations))\n fields = []\n bins = []\n for field, nbins in zip(counter.fields, counter.nbins):\n fields.extend([field] * nbins)\n bins.extend(list(range(nbins)))\n\n for row, cols in enumerate(zip(fields, bins, matrix)):\n outfile.write(\"%i\\t%s\\t\" %\n (row, \"\\t\".join([str(x) for x in cols[:-1]])))\n outfile.write(\"%s\\n\" %\n (\"\\t\".join([str(x) for x in cols[-1]])))\n\n with IOTools.openFile(E.getOutputFile(counter.name) +\n \".lengths.tsv.gz\", \"w\") as outfile:\n counter.writeLengthStats(outfile)\n\n if options.output_all_profiles:\n counter.closeOutputProfiles()\n\n if options.plot:\n\n import matplotlib\n # avoid Tk or any X\n matplotlib.use(\"Agg\")\n import matplotlib.pyplot as plt\n\n for method, counter in zip(options.methods, counters):\n\n if method in (\"geneprofile\",\n \"geneprofilewithintrons\",\n \"geneprofileabsolutedistancefromthreeprimeend\",\n \"utrprofile\",\n \"intervalprofile\",\n \"separateexonprofile\",\n \"separateexonprofilewithintrons\"):\n\n plt.figure()\n plt.subplots_adjust(wspace=0.05)\n max_scale = max([max(x) for x in counter.aggregate_counts])\n\n for x, counts in enumerate(counter.aggregate_counts):\n plt.subplot(6, 1, x + 1)\n plt.plot(range(len(counts)), counts)\n plt.title(counter.fields[x])\n plt.ylim(0, max_scale)\n\n figname = counter.name + \".full\"\n\n fn = E.getOutputFile(figname) + \".png\"\n plt.savefig(os.path.expanduser(fn))\n\n plt.figure()\n\n points = []\n cuts = []\n for x, counts in enumerate(counter.aggregate_counts):\n points.extend(counts)\n cuts.append(len(counts))\n\n plt.plot(range(len(points)), points)\n\n xx, xxx = 0, []\n for x in cuts:\n xxx.append(xx + x // 2)\n xx += x\n plt.axvline(xx,\n color=\"r\",\n ls=\"--\")\n\n plt.xticks(xxx, counter.fields)\n\n figname = counter.name + \".detail\"\n\n fn = E.getOutputFile(figname) + \".png\"\n plt.savefig(os.path.expanduser(fn))\n\n elif method == \"tssprofile\":\n\n plt.figure()\n plt.subplot(1, 3, 1)\n plt.plot(range(-options.extension_outward,\n options.extension_inward),\n counter.aggregate_counts[0])\n plt.title(counter.fields[0])\n plt.subplot(1, 3, 2)\n plt.plot(range(-options.extension_inward,\n options.extension_outward),\n counter.aggregate_counts[1])\n plt.title(counter.fields[1])\n plt.subplot(1, 3, 3)\n plt.title(\"combined\")\n plt.plot(range(-options.extension_outward,\n options.extension_inward),\n counter.aggregate_counts[0])\n plt.plot(range(-options.extension_inward,\n options.extension_outward),\n counter.aggregate_counts[1])\n plt.legend(counter.fields[:2])\n\n fn = E.getOutputFile(counter.name) + \".png\"\n plt.savefig(os.path.expanduser(fn))\n\n elif method == \"midpointprofile\":\n\n plt.figure()\n plt.plot(numpy.arange(-options.resolution_upstream, 0),\n counter.aggregate_counts[0])\n plt.plot(numpy.arange(0, options.resolution_downstream),\n counter.aggregate_counts[1])\n\n fn = E.getOutputFile(counter.name) + \".png\"\n plt.savefig(os.path.expanduser(fn))\n\n # write footer and output benchmark information.\n E.Stop()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 324 } ]
[ { "span": "format ", "start_line": 645, "start_column": 12, "end_line": 645, "end_column": 18 }, { "span": "feature_names ", "start_line": 828, "start_column": 8, "end_line": 828, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", "argv_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "script", " ", "main", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "parse", "s", " ", "command", " ", "line", " ", "options", " ", "in", " ", "sys", ".", "argv", ",", " ", "unl", "ess", " ", "*", "argv", "*", " ", "is", " ", "give", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv_", "=_", "sys_", "._", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "command", " ", "line", " ", "parser_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parser_", "=_", "E_", "._", "Optio", "n", "Parser_", "(_", "version_", "=_", "\"%", "prog", " ", "version", ":", " ", "$", "Id", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage_", "=_", "globals_", "(_", ")_", "[_", "\"\\u\\u", "doc", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "m", "\"_", ",_", "\"--", "method", "\"_", ",_", "dest_", "=_", "\"", "method", "s", "\"_", ",_", "type_", "=_", "\"", "choice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "gene", "profile", "\"_", ",_", "\"", "tss", "profile", "\"_", ",_", "\"", "utr", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interval", "profile", "\"_", ",_", "\"", "midpoint", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "within", "tron", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "abs", "olute", "distance", "from", "three", "prim", "een", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "separate", "exon", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "separate", "exon", "profile", "within", "tron", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "counter", "s", " ", "to", " ", "use", ".", " ", "Counter", "s", " ", "descri", "be", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "meta", "-", "gene", " ", "structure", " ", "to", " ", "use", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Not", "e", " ", "usi", "ng", " ", "gene", "profile", "within", "tron", "s", ",", " ", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gene", "profile", "abs", "olute", "distance", "from", "three", "prim", "een", "d", " ", "will", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "automati", "call", "y", " ", "turn", " ", "on", " ", "the", " ", "--", "use", "-", "base", "-", "accu", "rac", "y", " ", "option", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'[", "%", "default", "].", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "b", "\"_", ",_", "\"--", "bam", "-", "file", "\"_", ",_", "\"--", "bed", "file", "\"_", ",_", "\"--", "big", "wig", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "infiles", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "BAM", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "string", "\"_", ",_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "BAM", "/", "bed", "/", "big", "wig", " ", "files", " ", "to", " ", "use", ".", " ", "Do", " ", "not", " ", "mix", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "different", " ", "types", " ", "[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "c", "\"_", ",_", "\"--", "control", "-", "bam", "-", "file", "\"_", ",_", "dest_", "=_", "\"", "control", "files", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "BAM", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "string", "\"_", ",_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "control", "/", "input", " ", "to", " ", "use", ".", " ", "Sho", "ul", "d", " ", "be", " ", "of", " ", "the", " ", "same", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", " ", "as", " ", "the", " ", "bam", "/", "bed", "/", "big", "wig", " ", "file", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "g", "\"_", ",_", "\"--", "gtf", "-", "file", "\"_", ",_", "dest_", "=_", "\"", "gtf", "file", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"", "GT", "F", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "GT", "F", " ", "file", " ", "to", " ", "use", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "normali", "ze", "-", "transcri", "pt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "transcri", "pt", "\\u", "normaliza", "tion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "choice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "none", "\"_", ",_", "\"", "max", "\"_", ",_", "\"", "sum", "\"_", ",_", "\"", "total", "-", "max", "\"_", ",_", "\"", "total", "-", "sum", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "normaliza", "tion", " ", "to", " ", "appl", "y", " ", "on", " ", "each", " ", "transcri", "pt", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "profile", " ", "bef", "ore", " ", "addin", "g", " ", "to", " ", "meta", "-", "gene", " ", "profile", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "normali", "ze", "-", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "profile", "\\u", "normaliza", "tion", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "choice", "\"_", ",_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "all", "\"_", ",_", "\"", "none", "\"_", ",_", "\"", "area", "\"_", ",_", "\"", "count", "s", "\"_", ",_", "\"", "background", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "normaliza", "tion", " ", "to", " ", "appl", "y", " ", "on", " ", "meta", "-", "gene", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "profile", " ", "normaliza", "tion", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "r", "\"_", ",_", "\"--", "reporter", "\"_", ",_", "dest_", "=_", "\"", "reporter", "\"_", ",_", "type_", "=_", "\"", "choice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\"", "gene", "\"_", ",_", "\"", "transcri", "pt", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "report", " ", "results", " ", "for", " ", "gene", "s", " ", "or", " ", "transcripts", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "Whe", "n", " ", "'", "gene", "s", "`", " ", "is", " ", "chosen", ",", " ", "exon", "s", " ", "acro", "ss", " ", "all", " ", "transcripts", " ", "for", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "a", " ", "gene", " ", "are", " ", "merge", "d", ".", " ", "Whe", "n", " ", "'", "transcri", "pt", "'", " ", "is", " ", "chosen", ",", " ", "count", "s", " ", "are", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "compute", "d", " ", "for", " ", "each", " ", "transcri", "pt", " ", "separately", " ", "with", " ", "each", " ", "transcri", "pt", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "contrib", "uti", "ng", " ", "equal", "ly", " ", "to", " ", "the", " ", "meta", "-", "gene", " ", "profile", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "i", "\"_", ",_", "\"--", "shift", "-", "size", "\"_", ",_", "dest_", "=_", "\"", "shift", "s", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "shift", " ", "reads", " ", "in", " ", ":", "term", ":`", "bam", "`", " ", "format", "ted", " ", "file", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bef", "ore", " ", "compu", "ting", " ", "densit", "ies", " ", "(", "Ch", "IP", "-", "Seq", ").", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "a", "\"_", ",_", "\"--", "merge", "-", "pair", "s", "\"_", ",_", "dest_", "=_", "\"", "merge", "\\u", "pair", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "merge", " ", "pair", "s", " ", "in", " ", ":", "term", ":`", "bam", "`", " ", "format", "ted", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", " ", "bef", "ore", " ", "compu", "ting", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "densit", "ies", " ", "(", "Ch", "IP", "-", "Seq", ").", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "u", "\"_", ",_", "\"--", "use", "-", "base", "-", "accu", "rac", "y", "\"_", ",_", "dest_", "=_", "\"", "base", "\\u", "accu", "rac", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "compute", " ", "densit", "ies", " ", "with", " ", "base", " ", "accu", "rac", "y", ".", " ", "The", " ", "default", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", " ", "to", " ", "only", " ", "use", " ", "the", " ", "start", " ", "and", " ", "end", " ", "of", " ", "the", " ", "aligned", " ", "region", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "RNA", "-", "Seq", ")", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "e", "\"_", ",_", "\"--", "extend", "\"_", ",_", "dest_", "=_", "\"", "extend", "s", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "append", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extend", " ", "reads", " ", "in", " ", ":", "term", ":`", "bam", "`", " ", "format", "ted", " ", "file", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "Ch", "IP", "-", "Seq", ").", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "ups", "tream", "\"_", ",_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "ups", "tream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "ups", "tream", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "downstream", "\"_", ",_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "downstream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "downstream", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "ups", "tream", "-", "utr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "ups", "tream", "\\u", "utr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "ups", "tream", " ", "UT", "R", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "downstream", "-", "utr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "downstream", "\\u", "utr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "downstream", " ", "UT", "R", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "cds", "\"_", ",_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "cds", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "cds", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "first", "-", "exon", "\"_", ",_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "first", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "first", " ", "exon", " ", "in", " ", "gene", ",", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "last", "-", "exon", "\"_", ",_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "last", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "last", " ", "exon", " ", "in", " ", "gene", ",", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "intron", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "intron", "s", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "intron", "s", " ", "region", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "exon", "s", "-", "abs", "olute", "-", "distance", "-", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "exon", "s", " ", "abs", "olute", " ", "distance", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "topo", "ly", "a", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "resolu", "tion", "-", "intron", "s", "-", "abs", "olute", "-", "distance", "-", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "resolu", "tion", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "resolu", "tion", " ", "of", " ", "intron", "s", " ", "abs", "olute", " ", "distance", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "topo", "ly", "a", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "extensi", "on", "-", "exon", "s", "-", "abs", "olute", "-", "distance", "-", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "extensi", "on", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "for", " ", "exon", "s", " ", "from", " ", "the", " ", "abs", "olute", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "distance", " ", "from", " ", "the", " ", "topo", "ly", "a", " ", "in", " ", "bp", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "extensi", "on", "-", "intron", "s", "-", "abs", "olute", "-", "distance", "-", "topo", "ly", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "extensi", "on", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "for", " ", "intron", "s", " ", "from", " ", "the", " ", "abs", "olute", " ", "distance", " ", "from", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "topo", "ly", "a", " ", "in", " ", "bp", " ", "[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "extensi", "on", "-", "ups", "tream", "\"_", ",_", "dest_", "=_", "\"", "extensi", "on", "\\u", "ups", "tream", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "ups", "tream", " ", "from", " ", "the", " ", "first", " ", "exon", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "extensi", "on", "-", "downstream", "\"_", ",_", "dest_", "=_", "\"", "extensi", "on", "\\u", "downstream", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "downstream", " ", "from", " ", "the", " ", "last", " ", "exon", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "extensi", "on", "-", "in", "ward", "\"_", ",_", "dest_", "=_", "\"", "extensi", "on", "\\u", "in", "ward", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "in", "ward", " ", "from", " ", "a", " ", "TS", "S", " ", "start", " ", "site", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "extensi", "on", "-", "out", "ward", "\"_", ",_", "dest_", "=_", "\"", "extensi", "on", "\\u", "out", "ward", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "extensi", "on", " ", "out", "ward", " ", "from", " ", "a", " ", "TS", "S", " ", "start", " ", "site", " ", "in", " ", "bp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "scale", "-", "flan", "k", "-", "length", "\"_", ",_", "dest_", "=_", "\"", "scale", "\\u", "flan", "ks", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "scale", " ", "flan", "ks", " ", "to", " ", "(", "integ", "er", " ", "multiple", "s", " ", "of", ")", " ", "gene", " ", "length", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "control", "-", "factor", "\"_", ",_", "dest_", "=_", "\"", "control", "\\u", "factor", "\"_", ",_", "type_", "=_", "\"", "float", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "factor", " ", "for", " ", "normali", "zin", "g", " ", "control", " ", "and", " ", "fore", "ground", " ", "data", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Computed", " ", "from", " ", "data", " ", "if", " ", "not", " ", "set", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "output", "-", "all", "-", "profile", "s", "\"_", ",_", "dest_", "=_", "\"", "output", "\\u", "all", "\\u", "profile", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "keep", " ", "individual", " ", "profile", "s", " ", "for", " ", "each", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "transcri", "pt", " ", "and", " ", "output", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\"--", "count", "s", "-", "tsv", "-", "file", "\"_", ",_", "dest_", "=_", "\"", "input", "\\u", "filename", "\\u", "count", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "string", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "filename", " ", "with", " ", "count", " ", "data", " ", "for", " ", "each", " ", "transcri", "pt", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Us", "e", " ", "this", " ", "inst", "ead", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "of", " ", "recom", "put", "ing", " ", "the", " ", "profile", ".", " ", "Us", "efu", "l", " ", "for", " ", "plott", "ing", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "meta", "-", "gene", " ", "profile", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", " ", "previ", "ously", " ", "compute", "d", " ", "count", "s", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "option_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "background", "-", "region", "-", "bins", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "\"", "background", "\\u", "region", "\\u", "bins", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "int", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "number", " ", "of", " ", "bins", " ", "on", " ", "eit", "her", " ", "end", " ", "of", " ", "the", " ", "profile", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "be", " ", "consider", "ed", " ", "for", " ", "background", " ", "meta", "-", "gene", " ", "normaliza", "tion", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "set\\u", "defaults_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "\\u", "rna", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "pairs_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "output_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bin", "\\u", "size_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "s_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shifts_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sort_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reporter_", "=_", "\"", "transcri", "pt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "cds", "_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "intron", "s_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", "kb", " ", "is", " ", "a", " ", "good", " ", "balance", " ", "of", " ", "see", "ing", " ", "long", " ", "eno", "ugh", " ", "3", " ", "prim", "e", " ", "bias", " ", "and", " ", "not", " ", "omit", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "too", " ", "many", " ", "gene", "s", ".", " ", "Tim", " ", "3", "1", "th", " ", "Au", "g", " ", "2013_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", "=_", "3000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "intron", "s", " ", "is", " ", "only", " ", "for", " ", "assess", " ", "the", " ", "noise", " ", "level", ",", " ", "thu", "s", " ", "do", " ", "ont", " ", "need", " ", "a", " ", "long_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "region", ",", " ", "a", " ", "long", " ", "region", " ", "has", " ", "the", " ", "side", " ", "effect", " ", "of", " ", "omit", " ", "more", " ", "gene", "s", ".", " ", "Tim", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", "1", "th", " ", "Au", "g", " ", "2013_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", "=_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "on", " ", "can", " ", "simp", "ly", " ", "just", " ", "be", " ", "the", " ", "same", " ", "as", " ", "resolution_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", "=_", "3000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", "=_", "500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "ups", "tream", "\\u", "utr", "_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "downstream", "\\u", "utr", "_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "upstream_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "downstream", "_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "first_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resolu", "tion", "\\u", "last_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mean", " ", "length", " ", "of", " ", "transcripts", ":", " ", "abo", "ut", " ", "2.5", " ", "kb_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "upstream_", "=_", "2500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "downstream", "_", "=_", "2500_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "in", "ward", "_", "=_", "3000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensi", "on", "\\u", "out", "ward", "_", "=_", "3000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plot_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "methods_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infiles", "_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "files_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gtf", "file_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "profile", "\\u", "normaliza", "tions_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transcri", "pt", "\\u", "normalization_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale", "\\u", "flan", "ks_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "pairs_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "insert", "\\u", "size_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "insert", "\\u", "size_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "accuracy_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "matrix", "\\u", "format_", "=_", "\"", "single", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "all", "\\u", "profiles_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "background", "\\u", "region", "\\u", "bins_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "filename", "\\u", "counts_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "common", " ", "options", " ", "(-", "h", "/--", "help", ",", " ", "...)", " ", "and", " ", "parse", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "E_", "._", "Start_", "(_", "parser_", ",_", "argv_", "=_", "argv_", ",_", "add", "\\u", "output", "\\u", "options_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "for", " ", "back", "ward", "s", " ", "compa", "tabi", "lity_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", ",_", "gtf", "_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "infiles", "_", "._", "append_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "gtf", "file_", "=_", "gtf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "gtf", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "no", " ", "GT", "F", " ", "file", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "gtf", "file_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "gtf", "file_", "=_", "options_", "._", "stdin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "gtf", "file_", "=_", "IO", "Tools_", "._", "open", "File_", "(_", "options_", "._", "gtf", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "options_", "._", "infiles", "_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "no", " ", "bam", "/", "wig", "/", "bed", " ", "files", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method", "s", "Requ", "ires", "Base", "Accu", "rac", "y_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "within", "tron", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "abs", "olute", "distance", "from", "three", "prim", "een", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "implemented", " ", "any", " ", "method", "s", " ", "tha", "t", " ", "you", " ", "do", " ", "not", " ", "want", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "splice", "d", " ", "out", " ", "intron", "s", " ", "or", " ", "exon", "s", " ", "appear", " ", "to", " ", "be", " ", "covered", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "existen", "t", " ", "reads", ",", " ", "it", " ", "is", " ", "bett", "er", " ", "you", " ", "let", " ", "tho", "se", " ", "method", "s", " ", "impl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", "base", "-", "accu", "rar", "cy", " ", "by", " ", "add", " ", "them", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method", "s", "Requ", "ires", "Base", "Accu", "rac", "y_", "in_", "options_", "._", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "base", "\\u", "accuracy_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "reporter_", "==_", "\"", "gene", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gtf", "\\u", "iterator_", "=_", "GT", "F_", "._", "flat", "\\u", "gene", "\\u", "iterator_", "(_", "GT", "F_", "._", "iterator_", "(_", "options_", "._", "gtf", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "reporter_", "==_", "\"", "transcri", "pt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gtf", "\\u", "iterator_", "=_", "GT", "F_", "._", "transcri", "pt", "\\u", "iterator_", "(_", "GT", "F_", "._", "iterator_", "(_", "options_", "._", "gtf", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "range", "counter", " ", "based", " ", "on", " ", "file", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "options_", "._", "infiles", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "infiles", "_", "[_", "0_", "]_", "._", "endswith_", "(_", "\".", "bam", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bam", "files_", "=_", "[_", "pysam", "_", "._", "Sam", "file_", "(_", "x_", ",_", "\"", "rb", "\"_", ")_", "for_", "x_", "in_", "options_", "._", "infiles", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "control", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control", "files_", "=_", "[_", "pysam", "_", "._", "Sam", "file_", "(_", "x_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "control", "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 ", " _", "control", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "format_", "=_", "\"", "bam", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "merge", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "BAM", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bam", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shifts_", "=_", "options_", "._", "shifts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "s_", "=_", "options_", "._", "extend", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "merge", "\\u", "pairs_", "=_", "options_", "._", "merge", "\\u", "pairs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "insert", "\\u", "size_", "=_", "options_", "._", "min", "\\u", "insert", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "insert", "\\u", "size_", "=_", "options_", "._", "max", "\\u", "insert", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contr", "ofi", "les_", "=_", "control", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "options_", "._", "control", "\\u", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "shifts_", "or_", "options_", "._", "extend", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "BAM", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bam", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shifts_", "=_", "options_", "._", "shifts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extend", "s_", "=_", "options_", "._", "extend", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "files_", "=_", "control", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "options_", "._", "control", "\\u", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "base", "\\u", "accuracy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "BAM", "Base", "Accu", "rac", "y_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bam", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "files_", "=_", "control", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "options_", "._", "control", "\\u", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "BAM", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bam", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "files_", "=_", "control", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "options_", "._", "control", "\\u", "factor_", ")_", "\\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_", "options_", "._", "infiles", "_", "[_", "0_", "]_", "._", "endswith_", "(_", "\".", "bed", ".", "gz", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bed", "files_", "=_", "[_", "pysam", "_", "._", "Tab", "ix", "file_", "(_", "x_", ")_", "for_", "x_", "in_", "options_", "._", "infiles", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "control", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control", "files_", "=_", "[_", "pysam", "_", "._", "Tab", "ix", "file_", "(_", "x_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "options_", "._", "control", "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 ", " _", "control", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "Bed", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "bed", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "files_", "=_", "control", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control", "\\u", "factor_", "=_", "options_", "._", "control", "\\u", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "options_", "._", "infiles", "_", "[_", "0_", "]_", "._", "endswith_", "(_", "\".", "bw", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wig", "files_", "=_", "[_", "Big", "Wi", "g", "File_", "(_", "file_", "=_", "open_", "(_", "x_", ")_", ")_", "for_", "x_", "in_", "options_", "._", "infiles", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Range", "Counter", "Big", "Wi", "g_", "(_", "wig", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", "'", "t", " ", "dete", "rmin", "e", " ", "file", " ", "type", " ", "for", " ", "%", "s", "\"_", "%_", "str_", "(_", "options_", "._", "infiles", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "options_", "._", "methods_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method_", "==_", "\"", "utr", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "UT", "RC", "ount", "er_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "ups", "tream", "\\u", "utr", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "\\u", "utr", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "gene", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Gene", "Counter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "scale", "\\u", "flan", "ks_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "gene", "profile", "within", "tron", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Gene", "Counter", "With", "Intro", "ns_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "intron", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "scale", "\\u", "flan", "ks_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "gene", "profile", "abs", "olute", "distance", "from", "three", "prim", "een", "d", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "options", ".", "extensi", "on", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "tost", "arts", "ite", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "options", ".", "extensi", "on", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "tost", "arts", "ite", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tim", " ", "3", "1", "th", " ", "Au", "g", " ", "2013", ":", " ", "a", " ", "possib", "le", " ", "feature", " ", "for", " ", "future", ",", " ", " ", "if", " ", "five", " ", "prime_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bias", " ", "is", " ", "of", " ", "your", " ", "interest", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "you", " ", "need", " ", "to", " ", "create", " ", "anot", "her", " ", "class", ").", " ", "It", " ", "is", " ", "not", " ", "very", " ", "difficult", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", " ", "from", " ", "this", " ", "class", ",", " ", "but", " ", "is", " ", "not", " ", "implemented", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "future", " ", "feature", " ", "is", " ", "slight", "ly", " ", "different", " ", "the", " ", "TS", "S", " ", "profile_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alr", "ead", "y", " ", "implemented", ",", " ", "bec", "aus", "e", " ", "in", " ", "this", " ", "future", " ", "feature", " ", "intron", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "skip", "ped", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "bam", "2g", "ene", "profile_", "._", "Gene", "Counter", "Abs", "olute", "Distan", "ce", "Fro", "m", "Thre", "e", "Prime", "End_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "exon", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "intron", "s", "\\u", "abs", "olute", "\\u", "distance", "\\u", "topo", "ly", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "scale", "\\u", "flan", "ks_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "tss", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "TS", "SC", "ount", "er_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "out", "ward", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "in", "ward", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "interval", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Region", "Counter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "midpoint", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Mid", "point", "Counter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "new", " ", "method", " ", "to", " ", "split", " ", "1s", "t", " ", "and", " ", "last", " ", "exon", "s", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "require", "s", " ", "a", " ", "representative", " ", "transcri", "pt", " ", "for", " ", "reach", " ", "gene_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gtf", " ", "shou", "ld", " ", "be", " ", "sorte", "d", " ", "gene", "-", "position_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "separate", "exon", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Separate", "Exo", "n", "Counter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "first_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "last_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "separate", "exon", "profile", "within", "tron", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counters_", "._", "append_", "(_", "\\u", "bam", "2g", "ene", "profile_", "._", "Separate", "Exo", "n", "With", "Intro", "n", "Counter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "first_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "last_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "cds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "intron", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "upstream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "downstream", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "normalization_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "c_", "in_", "counters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "set", "Normalization_", "(_", "options_", "._", "transcri", "pt", "\\u", "normalization_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "output", "\\u", "all", "\\u", "profiles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "._", "set", "Output", "Profil", "es_", "(_", "IO", "Tools_", "._", "open", "File_", "(_", "E_", "._", "get", "Output", "File_", "(_", "c_", "._", "name_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\".", "profile", "s", ".", "tsv", ".", "gz", "\"_", ",_", "\"", "w", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "input", "\\u", "filename", "\\u", "counts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "read", " ", "count", "s", " ", "from", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "info_", "(_", "\"", "readi", "ng", " ", "count", "s", " ", "from", " ", "%", "s", "\"_", "%_", "options_", "._", "input", "\\u", "filename", "\\u", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "counts_", "=_", "pandas_", "._", "read", "\\u", "csv_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IO", "Tools_", "._", "open", "File_", "(_", "options_", "._", "input", "\\u", "filename", "\\u", "counts_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sep_", "=_", "'\\\\", "t", "'_", ",_", "header_", "=_", "0_", ",_", "index", "\\u", "col_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "counters_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "counti", "ng", " ", "from", " ", "matrix", " ", "only", " ", "implemented", " ", "for", " ", "1", " ", "counter", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "counter", " ", "based", " ", "on", " ", "reference", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "counter_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "Unse", "gment", "ed", "Counter_", "(_", "counters_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counters_", "=_", "[_", "counter_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bam", "2g", "ene", "profile_", "._", "count", "Fro", "m", "Counts_", "(_", "counters_", ",_", "all", "\\u", "counts_", ")_", "\\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 ", " _", "E_", "._", "info_", "(_", "\"", "startin", "g", " ", "counti", "ng", " ", "with", " ", "%", "i", " ", "counter", "s", "\"_", "%_", "len_", "(_", "counters_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feature", "\\u", "names_", "=_", "\\u", "bam", "2g", "ene", "profile_", "._", "count", "Fro", "m", "GT", "F_", "(_", "counters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gtf", "\\u", "iterator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "matrices_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "options_", "._", "profile", "\\u", "normaliza", "tions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "profile", "\\u", "normaliza", "tions_", "._", "append_", "(_", "\"", "none", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "all", "\"_", "in_", "options_", "._", "profile", "\\u", "normaliza", "tions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "._", "profile", "\\u", "normaliza", "tions_", "=_", "[_", "\"", "none", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "area", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "background", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method_", ",_", "counter_", "in_", "zip_", "(_", "options_", "._", "methods_", ",_", "counters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profiles_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "norm_", "in_", "options_", "._", "profile", "\\u", "normaliza", "tions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "matrix", ",", " ", "appl", "y", " ", "normalization_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile_", "=_", "counter_", "._", "get", "Profile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "norm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "background", "\\u", "region", "\\u", "bins_", "=_", "options_", "._", "background", "\\u", "region", "\\u", "bins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profiles_", "._", "append_", "(_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "x_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "profiles_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "profiles_", "[_", "0_", "]_", "._", "shape_", "==_", "profiles_", "[_", "x_", "]_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "single", " ", "matrix", " ", "of", " ", "all", " ", "profile", "s", " ", "for", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "matrix_", "=_", "numpy_", "._", "concatenate_", "(_", "profiles_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matrix_", "._", "shape_", "=_", "len_", "(_", "profiles_", ")_", ",_", "len_", "(_", "profiles_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matrix_", "=_", "matrix_", "._", "transpose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "IO", "Tools_", "._", "open", "File_", "(_", "E_", "._", "get", "Output", "File_", "(_", "counter_", "._", "name_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\".", "matrix", ".", "tsv", ".", "gz", "\"_", ",_", "\"", "w", "\"_", ")_", "as_", "outfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "._", "write_", "(_", "\"", "bin", "\\\\", "tre", "gion", "\\\\", "tre", "gion", "\\u", "bin", "\\\\", "t", "%", "s", "\\\\", "n", "\"_", "%_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "profile", "\\u", "normaliza", "tions_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bins_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", ",_", "nbins_", "in_", "zip_", "(_", "counter_", "._", "fields_", ",_", "counter_", "._", "nbins_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "._", "extend_", "(_", "[_", "field_", "]_", "*_", "nbins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bins_", "._", "extend_", "(_", "list_", "(_", "range_", "(_", "nbins_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "row_", ",_", "cols_", "in_", "enumerate_", "(_", "zip_", "(_", "fields_", ",_", "bins_", ",_", "matrix_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "._", "write_", "(_", "\"%", "i", "\\\\", "t", "%", "s", "\\\\", "t", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "row_", ",_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "[_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "cols_", "[_", ":_", "-_", "1_", "]_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "._", "write_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"\\\\", "t", "\"_", "._", "join_", "(_", "[_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "cols_", "[_", "-_", "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_", "with_", "IO", "Tools_", "._", "open", "File_", "(_", "E_", "._", "get", "Output", "File_", "(_", "counter_", "._", "name_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\".", "length", "s", ".", "tsv", ".", "gz", "\"_", ",_", "\"", "w", "\"_", ")_", "as_", "outfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "write", "Length", "Stats_", "(_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "output", "\\u", "all", "\\u", "profiles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counter_", "._", "close", "Output", "Profil", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "plot_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "avoid", " ", "Tk", " ", "or", " ", "any", " ", "X_", "\\u\\u\\uNL\\u\\u\\u_", "matplotlib_", "._", "use_", "(_", "\"", "Agg", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "method_", ",_", "counter_", "in_", "zip_", "(_", "options_", "._", "methods_", ",_", "counters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "method_", "in_", "(_", "\"", "gene", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "within", "tron", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gene", "profile", "abs", "olute", "distance", "from", "three", "prim", "een", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "utr", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interval", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "separate", "exon", "profile", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "separate", "exon", "profile", "within", "tron", "s", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot", "s", "\\u", "adjust_", "(_", "wsp", "ace_", "=_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "scale_", "=_", "max_", "(_", "[_", "max_", "(_", "x_", ")_", "for_", "x_", "in_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", ",_", "counts_", "in_", "enumerate_", "(_", "counter_", "._", "aggre", "gate", "\\u", "counts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "plt_", "._", "subplot_", "(_", "6_", ",_", "1_", ",_", "x_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "len_", "(_", "counts_", ")_", ")_", ",_", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "counter_", "._", "fields_", "[_", "x_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "0_", ",_", "max", "\\u", "scale_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fign", "ame_", "=_", "counter_", "._", "name_", "+_", "\".", "full", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "E_", "._", "get", "Output", "File_", "(_", "fign", "ame_", ")_", "+_", "\".", "png", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cuts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", ",_", "counts_", "in_", "enumerate_", "(_", "counter_", "._", "aggre", "gate", "\\u", "counts_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "points_", "._", "extend_", "(_", "counts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cuts_", "._", "append_", "(_", "len_", "(_", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "len_", "(_", "points_", ")_", ")_", ",_", "points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xx_", ",_", "xxx", "_", "=_", "0_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "cuts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "xxx", "_", "._", "append_", "(_", "xx_", "+_", "x_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xx_", "+=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "axvline_", "(_", "xx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "\"", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ls_", "=_", "\"--\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "xxx", "_", ",_", "counter_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fign", "ame_", "=_", "counter_", "._", "name_", "+_", "\".", "deta", "il", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "E_", "._", "get", "Output", "File_", "(_", "fign", "ame_", ")_", "+_", "\".", "png", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "tss", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "1_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "-_", "options_", "._", "extensi", "on", "\\u", "out", "ward", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "in", "ward", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "counter_", "._", "fields_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "1_", ",_", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "-_", "options_", "._", "extensi", "on", "\\u", "in", "ward", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "out", "ward", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "counter_", "._", "fields_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "1_", ",_", "3_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"", "combin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "-_", "options_", "._", "extensi", "on", "\\u", "out", "ward", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "in", "ward", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "range_", "(_", "-_", "options_", "._", "extensi", "on", "\\u", "in", "ward", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "extensi", "on", "\\u", "out", "ward", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "legend_", "(_", "counter_", "._", "fields_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "E_", "._", "get", "Output", "File_", "(_", "counter_", "._", "name_", ")_", "+_", "\".", "png", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "method_", "==_", "\"", "midpoint", "profile", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "numpy_", "._", "arange_", "(_", "-_", "options_", "._", "resolu", "tion", "\\u", "upstream_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "numpy_", "._", "arange_", "(_", "0_", ",_", "options_", "._", "resolu", "tion", "\\u", "downstream", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "._", "aggre", "gate", "\\u", "counts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fn_", "=_", "E_", "._", "get", "Output", "File_", "(_", "counter_", "._", "name_", ")_", "+_", "\".", "png", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "footer", " ", "and", " ", "output", " ", "bench", "mark", " ", "informati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "Stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
saltstack/salt/salt/modules/elasticsearch.py
[ { "content": "def alias_create(indices, alias, hosts=None, body=None, profile=None):\n '''\n Create an alias for a specific index/indices\n\n CLI example::\n\n salt myminion elasticsearch.alias_create testindex_v1 testindex\n '''\n es = _get_instance(hosts, profile)\n try:\n result = es.indices.put_alias(index=indices, name=alias, body=body) # TODO error handling\n return True\n except elasticsearch.exceptions.NotFoundError:\n return None\n return None", "metadata": "root.alias_create", "header": "['module', '___EOS___']", "index": 100 }, { "content": "def document_create(index, doc_type, body=None, id=None, hosts=None, profile=None):\n '''\n Create a document in a specified index\n\n CLI example::\n\n salt myminion elasticsearch.document_create testindex doctype1 '{}'\n '''\n es = _get_instance(hosts, profile)\n try:\n result = es.index(index=index, doc_type=doc_type, body=body, id=id) # TODO error handling\n return True\n except elasticsearch.exceptions.NotFoundError:\n return None\n return None", "metadata": "root.document_create", "header": "['module', '___EOS___']", "index": 176 }, { "content": "def index_create(index, body=None, hosts=None, profile=None):\n '''\n Create an index\n\n CLI example::\n\n salt myminion elasticsearch.index_create testindex\n '''\n es = _get_instance(hosts, profile)\n try:\n if index_exists(index):\n return True\n else:\n result = es.indices.create(index=index, body=body) # TODO error handling\n return True\n except elasticsearch.exceptions.NotFoundError:\n return None\n return None", "metadata": "root.index_create", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def mapping_create(index, doc_type, body, hosts=None, profile=None):\n '''\n Create a mapping in a given index\n\n CLI example::\n\n salt myminion elasticsearch.mapping_create testindex user '{ \"user\" : { \"properties\" : { \"message\" : {\"type\" : \"string\", \"store\" : true } } } }'\n '''\n es = _get_instance(hosts, profile)\n try:\n result = es.indices.put_mapping(index=index, doc_type=doc_type, body=body) # TODO error handling\n return mapping_get(index, doc_type)\n except elasticsearch.exceptions.NotFoundError:\n return None\n return None", "metadata": "root.mapping_create", "header": "['module', '___EOS___']", "index": 340 }, { "content": "def index_template_create(name, body, hosts=None, profile=None):\n '''\n Create an index template\n\n CLI example::\n\n salt myminion elasticsearch.index_template_create testindex_templ '{ \"template\": \"logstash-*\", \"order\": 1, \"settings\": { \"number_of_shards\": 1 } }'\n '''\n es = _get_instance(hosts, profile)\n try:\n result = es.indices.put_template(name=name, body=body) # TODO error handling\n return True\n except elasticsearch.exceptions.NotFoundError:\n return None\n return None", "metadata": "root.index_template_create", "header": "['module', '___EOS___']", "index": 395 } ]
[ { "span": "result ", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 14 }, { "span": "result ", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 14 }, { "span": "result ", "start_line": 268, "start_column": 12, "end_line": 268, "end_column": 18 }, { "span": "result ", "start_line": 350, "start_column": 8, "end_line": 350, "end_column": 14 }, { "span": "result ", "start_line": 405, "start_column": 8, "end_line": 405, "end_column": 14 } ]
[]
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_", "alias", "\\u", "create_", "(_", "indices_", ",_", "alias_", ",_", "hosts_", "=_", "None_", ",_", "body_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "an", " ", "alias", " ", "for", " ", "a", " ", "specific", " ", "index", "/", "indice", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "elastic", "search", ".", "alias", "\\u", "create", " ", "testi", "nde", "x", "\\u", "v1", " ", "testi", "nde", "x", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "\\u", "get", "\\u", "instance_", "(_", "hosts_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "es_", "._", "indices_", "._", "put", "\\u", "alias_", "(_", "index_", "=_", "indices_", ",_", "name_", "=_", "alias_", ",_", "body_", "=_", "body_", ")_", "#", " ", "TOD", "O", " ", "error", " ", "handling", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "elasticsearch_", "._", "exceptions_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "document", "\\u", "create_", "(_", "index_", ",_", "doc", "\\u", "type_", ",_", "body_", "=_", "None_", ",_", "id_", "=_", "None_", ",_", "hosts_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "document", " ", "in", " ", "a", " ", "specified", " ", "index", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "elastic", "search", ".", "document", "\\u", "create", " ", "testi", "nde", "x", " ", "doct", "ype", "1", " ", "'{}'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "\\u", "get", "\\u", "instance_", "(_", "hosts_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "es_", "._", "index_", "(_", "index_", "=_", "index_", ",_", "doc", "\\u", "type_", "=_", "doc", "\\u", "type_", ",_", "body_", "=_", "body_", ",_", "id_", "=_", "id_", ")_", "#", " ", "TOD", "O", " ", "error", " ", "handling", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "elasticsearch_", "._", "exceptions_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "index", "\\u", "create_", "(_", "index_", ",_", "body_", "=_", "None_", ",_", "hosts_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "an", " ", "index", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "elastic", "search", ".", "index", "\\u", "create", " ", "testi", "nde", "x", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "\\u", "get", "\\u", "instance_", "(_", "hosts_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "index", "\\u", "exists_", "(_", "index_", ")_", ":_", "\\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 ", " _", "result_", "=_", "es_", "._", "indices_", "._", "create_", "(_", "index_", "=_", "index_", ",_", "body_", "=_", "body_", ")_", "#", " ", "TOD", "O", " ", "error", " ", "handling", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "elasticsearch_", "._", "exceptions_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "mapping", "\\u", "create_", "(_", "index_", ",_", "doc", "\\u", "type_", ",_", "body_", ",_", "hosts_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "mapping", " ", "in", " ", "a", " ", "give", "n", " ", "index", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "elastic", "search", ".", "mapping", "\\u", "create", " ", "testi", "nde", "x", " ", "user", " ", "'{", " ", "\"", "user", "\"", " ", ":", " ", "{", " ", "\"", "proper", "ties", "\"", " ", ":", " ", "{", " ", "\"", "message", "\"", " ", ":", " ", "{", "\"", "type", "\"", " ", ":", " ", "\"", "string", "\",", " ", "\"", "store", "\"", " ", ":", " ", "true", " ", "}", " ", "}", " ", "}", " ", "}'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "\\u", "get", "\\u", "instance_", "(_", "hosts_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "es_", "._", "indices_", "._", "put", "\\u", "mapping_", "(_", "index_", "=_", "index_", ",_", "doc", "\\u", "type_", "=_", "doc", "\\u", "type_", ",_", "body_", "=_", "body_", ")_", "#", " ", "TOD", "O", " ", "error", " ", "handling", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "mapping", "\\u", "get_", "(_", "index_", ",_", "doc", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "elasticsearch_", "._", "exceptions_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "index", "\\u", "template", "\\u", "create_", "(_", "name_", ",_", "body_", ",_", "hosts_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "an", " ", "index", " ", "template", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "mym", "ini", "on", " ", "elastic", "search", ".", "index", "\\u", "template", "\\u", "create", " ", "testi", "nde", "x", "\\u", "templ", " ", "'{", " ", "\"", "template", "\":", " ", "\"", "logst", "ash", "-*", "\",", " ", "\"", "order", "\":", " ", "1", ",", " ", "\"", "settings", "\":", " ", "{", " ", "\"", "number", "\\u", "of", "\\u", "shard", "s", "\":", " ", "1", " ", "}", " ", "}'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "es_", "=_", "\\u", "get", "\\u", "instance_", "(_", "hosts_", ",_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "es_", "._", "indices_", "._", "put", "\\u", "template_", "(_", "name_", "=_", "name_", ",_", "body_", "=_", "body_", ")_", "#", " ", "TOD", "O", " ", "error", " ", "handling", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "elasticsearch_", "._", "exceptions_", "._", "Not", "Foun", "d", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 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\n schema = {\n \"type\": \"object\",\n \"properties\": {\n \"Consistent\": {\n \"type\": \"boolean\",\n },\n \"Args\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n }\n argument_model = create_argument_model_from_schema(schema)\n m = model.DenormalizedStructureBuilder().with_members(OrderedDict([\n ('Consistent', {'type': 'boolean'}),\n ('Args', { 'type': 'list', 'member': { 'type': 'string', }}),\n ])).build_model()\n generated_example = self.shorthand_documenter.generate_shorthand_example(\n '--foo', m)\n self.assertIn('Consistent=boolean,Args=string,string',\n generated_example)", "metadata": "root.TestDocGen.test_gen_structure_list_scalar_docs", "header": "['class', 'TestDocGen', '(', 'BaseArgProcessTest', ')', ':', '___NEWLINE___', \"# These aren't very extensive doc tests, as we want to stay somewhat\", '___NL___', '# flexible and allow the docs to slightly change without breaking these', '___NL___', '# tests.', '___NL___', '___EOS___']", "index": 536 }, { "content": " def test_can_gen_recursive_structure(self):\n argument = self.get_param_model('dynamodb.PutItem.Item')\n generated_example = self.get_generated_example_for(argument)", "metadata": "root.TestDocGen.test_can_gen_recursive_structure", "header": "['class', 'TestDocGen', '(', 'BaseArgProcessTest', ')', ':', '___NEWLINE___', \"# These aren't very extensive doc tests, as we want to stay somewhat\", '___NL___', '# flexible and allow the docs to slightly change without breaking these', '___NL___', '# tests.', '___NL___', '___EOS___']", "index": 561 } ]
[ { "span": "argument_model ", "start_line": 551, "start_column": 8, "end_line": 551, "end_column": 22 }, { "span": "generated_example ", "start_line": 563, "start_column": 8, "end_line": 563, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Doc", "Gen_", "(_", "Base", "Arg", "Process", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "are", "n", "'", "t", " ", "very", " ", "extensi", "ve", " ", "doc", " ", "tests", ",", " ", "as", " ", "we", " ", "want", " ", "to", " ", "stay", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flexib", "le", " ", "and", " ", "allow", " ", "the", " ", "docs", " ", "to", " ", "slight", "ly", " ", "change", " ", "with", "out", " ", "break", "ing", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "gen", "\\u", "structure", "\\u", "list", "\\u", "scala", "r", "\\u", "docs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "object", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "proper", "ties", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cons", "iste", "nt", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Arg", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "array", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "items", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "string", "\"_", "\\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_", "argu", "ment", "\\u", "model_", "=_", "create", "\\u", "argu", "ment", "\\u", "model", "\\u", "from", "\\u", "schema_", "(_", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "model_", "._", "Den", "ormal", "ize", "d", "Structur", "e", "Builder_", "(_", ")_", "._", "with", "\\u", "members_", "(_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Cons", "iste", "nt", "'_", ",_", "{_", "'", "type", "'_", ":_", "'", "boolean", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Arg", "s", "'_", ",_", "{_", "'", "type", "'_", ":_", "'", "list", "'_", ",_", "'", "member", "'_", ":_", "{_", "'", "type", "'_", ":_", "'", "string", "'_", ",_", "}_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ")_", "._", "build", "\\u", "model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "ed", "\\u", "example_", "=_", "self_", "._", "short", "hand", "\\u", "documente", "r_", "._", "generat", "e\\u", "short", "hand", "\\u", "example_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "foo", "'_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "Cons", "iste", "nt", "=", "boolean", ",", "Arg", "s", "=", "string", ",", "string", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "generat", "ed", "\\u", "example_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Doc", "Gen_", "(_", "Base", "Arg", "Process", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "are", "n", "'", "t", " ", "very", " ", "extensi", "ve", " ", "doc", " ", "tests", ",", " ", "as", " ", "we", " ", "want", " ", "to", " ", "stay", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flexib", "le", " ", "and", " ", "allow", " ", "the", " ", "docs", " ", "to", " ", "slight", "ly", " ", "change", " ", "with", "out", " ", "break", "ing", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "can", "\\u", "gen", "\\u", "recurs", "ive", "\\u", "structure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argument_", "=_", "self_", "._", "get", "\\u", "param", "\\u", "model_", "(_", "'", "dynamodb", ".", "Put", "Item", ".", "Item", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "ed", "\\u", "example_", "=_", "self_", "._", "get", "\\u", "generat", "ed", "\\u", "example", "\\u", "for_", "(_", "argument_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ufora/ufora/ufora/FORA/Axioms/generateAxiomSignatures.py
[ { "content": "# Copyright 2015 Ufora Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nRun this script to generate a file of axiom signatures which can be fed into Axioms_consistency_test.py.\nThis generates all axioms, but by default comments them all out. Uncomment the ones you want to test.\n\"\"\"\n\nimport ufora.native\nimport ufora.FORA.python.Runtime as Runtime\nimport ufora.native.FORA as FORANative\nimport os\n\ndir = os.path.dirname(__file__)\nAXIOMS_TO_TEST_FILENAME = os.path.join(dir, \"AXIOMS_TO_TEST.txt\")\n\nruntime = Runtime.getMainRuntime()\naxioms = runtime.getAxioms()\n\nreadme_string = '\"\"\"\\nThis file lists all the axioms we would like to check for consistency in\\nAxioms_consistency_test.py. It supports basic python-like commenting\\n\"\"\"\\n\\n'\n\nwith open(AXIOMS_TO_TEST_FILENAME, \"w\") as f:\n f.write(readme_string)\n f.write('\"\"\"\\n')\n for i in range(axioms.axiomCount):\n f.write(\"%s\\n\" %axioms.getAxiomGroupByIndex(i).signature())\n f.write('\"\"\"')\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import ufora.native", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 19 }, { "span": "import ufora.native.FORA as FORANative", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "201", "5", " ", "Uf", "ora", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Run", " ", "this", " ", "script", " ", "to", " ", "generat", "e", " ", "a", " ", "file", " ", "of", " ", "axiom", " ", "signa", "tures", " ", "whi", "ch", " ", "can", " ", "be", " ", "fed", " ", "int", "o", " ", "Axi", "oms", "\\u", "consiste", "nc", "y", "\\u", "test", ".", "py", ".", "\\", "10", ";", "Thi", "s", " ", "generat", "es", " ", "all", " ", "axiom", "s", ",", " ", "but", " ", "by", " ", "default", " ", "comment", "s", " ", "them", " ", "all", " ", "out", ".", " ", "Unco", "mmen", "t", " ", "the", " ", "ones", " ", "you", " ", "want", " ", "to", " ", "test", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "Runtime_", "as_", "Runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "native_", "._", "FOR", "A_", "as_", "FOR", "AN", "ative_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AX", "IO", "MS", "\\u", "TO", "\\u", "TEST", "\\u", "FILENAME_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir_", ",_", "\"", "AX", "IO", "MS", "\\u", "TO", "\\u", "TEST", ".", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runtime_", "=_", "Runtime_", "._", "get", "Main", "Runtime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "axiom", "s_", "=_", "runtime_", "._", "get", "Axi", "oms", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "readme", "\\u", "string_", "=_", "'\"", "\"\"", "\\\\", "n", "Thi", "s", " ", "file", " ", "lists", " ", "all", " ", "the", " ", "axiom", "s", " ", "we", " ", "wou", "ld", " ", "like", " ", "to", " ", "check", " ", "for", " ", "consiste", "nc", "y", " ", "in", "\\\\", "n", "Axi", "oms", "\\u", "consiste", "nc", "y", "\\u", "test", ".", "py", ".", " ", "It", " ", "support", "s", " ", "basic", " ", "python", "-", "like", " ", "comment", "ing", "\\\\", "n", "\"\"\"", "\\\\", "n", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "AX", "IO", "MS", "\\u", "TO", "\\u", "TEST", "\\u", "FILENAME_", ",_", "\"", "w", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "readme", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'\"", "\"\"", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "axiom", "s_", "._", "axiom", "Count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "axiom", "s_", "._", "get", "Axi", "om", "Group", "By", "Index_", "(_", "i_", ")_", "._", "signature_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'\"", "\"\"", "'_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nigma/django-session-activity/session_activity/conf.py
[ { "content": "#-*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport datetime\n\nfrom django.conf import settings\n\nfrom appconf import AppConf\n\n\nSESSION_IP_KEY = \"_activity_ip\"\nSESSION_LAST_USED_KEY = \"_activity_last_used\"\nSESSION_USER_AGENT_KEY = \"_activity_user_agent\"\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SessionActivityAppConf(AppConf):\n\n UPDATE_THROTTLE = datetime.timedelta(minutes=5)\n", "metadata": "root.SessionActivityAppConf", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def configure_update_throttle(self, value):\n if isinstance(value, int):\n value = datetime.timedelta(seconds=value)\n return value", "metadata": "root.SessionActivityAppConf.configure_update_throttle", "header": "['class', 'SessionActivityAppConf', '(', 'AppConf', ')', ':', '___EOS___']", "index": 20 } ]
[ { "span": "from django.conf import settings", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "appc", "onf_", "import_", "App", "Conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SES", "SION", "\\u", "IP", "\\u", "KEY_", "=_", "\"\\u", "activit", "y", "\\u", "ip", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SES", "SION", "\\u", "LAS", "T", "\\u", "USED", "\\u", "KEY_", "=_", "\"\\u", "activit", "y", "\\u", "last", "\\u", "used", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SES", "SION", "\\u", "USER", "\\u", "AGE", "NT", "\\u", "KEY_", "=_", "\"\\u", "activit", "y", "\\u", "user", "\\u", "agent", "\"_", "\\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_", "Sess", "ion", "Activ", "it", "y", "App", "Conf_", "(_", "App", "Conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "UPDATE", "\\u", "THRO", "TTL", "E_", "=_", "datetime_", "._", "timedelta_", "(_", "minutes_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sess", "ion", "Activ", "it", "y", "App", "Conf_", "(_", "App", "Conf_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configur", "e\\u", "update", "\\u", "throttle_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
treeio/treeio/treeio/sales/forms.py
[ { "content": " def __init__(self, user, skip=None, *args, **kwargs):\n if skip is None:\n skip = []\n super(ProductFilterForm, self).__init__(*args, **kwargs)\n\n self.fields['product_type'].queryset = Object.filter_permitted(user,\n Product.objects.filter(active=True))\n self.fields['product_type'].required = False\n self.fields['product_type'].label = _(\"Product type\")\n\n self.fields['supplier'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['supplier'].required = False\n self.fields['supplier'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['supplier'].label = _(\"Supplier\")\n\n self.fields['active'].required = False\n self.fields['active'].initial = True\n self.fields['active'].label = _(\"Active\")", "metadata": "root.ProductFilterForm.__init__", "header": "['class', 'ProductFilterForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 583 }, { "content": " def __init__(self, user, skip=None, *args, **kwargs):\n if skip is None:\n skip = []\n super(LeadFilterForm, self).__init__(*args, **kwargs)\n\n self.fields['contact'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['contact'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['contact'].required = False\n self.fields['contact'].label = _(\"Contact\")\n\n self.fields['products_interested'].queryset = Object.filter_permitted(\n user, Product.objects)\n self.fields['products_interested'].required = False\n self.fields['products_interested'].help_text = \"\"\n self.fields['products_interested'].label = _(\"Products interested\")\n\n self.fields['source'].queryset = Object.filter_permitted(user,\n SaleSource.objects.filter(active=True))\n self.fields['source'].required = False\n self.fields['source'].label = _(\"Source\")\n\n self.fields['status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_leads=True))\n self.fields['status'].required = False\n self.fields['status'].label = _(\"Status\")\n\n self.fields['contact_method'].required = False\n self.fields['contact_method'].label = _(\"Contact method\")", "metadata": "root.LeadFilterForm.__init__", "header": "['class', 'LeadFilterForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 937 }, { "content": " def __init__(self, user, skip=None, *args, **kwargs):\n if skip is None:\n skip = []\n super(OpportunityFilterForm, self).__init__(*args, **kwargs)\n\n self.fields['contact'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['contact'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['contact'].required = False\n self.fields['contact'].label = _(\"Contact\")\n\n self.fields['source'].queryset = Object.filter_permitted(user,\n SaleSource.objects.filter(active=True))\n self.fields['source'].required = False\n self.fields['source'].label = _(\"Source\")\n\n self.fields['products_interested'].queryset = Object.filter_permitted(user,\n Product.objects.filter(active=True))\n self.fields['products_interested'].required = False\n self.fields['products_interested'].help_text = \"\"\n self.fields['products_interested'].label = _(\"Products interested\")\n\n self.fields['status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_opportunities=True))\n self.fields['status'].required = False\n self.fields['status'].label = _(\"Status\")", "metadata": "root.OpportunityFilterForm.__init__", "header": "['class', 'OpportunityFilterForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 1062 } ]
[ { "span": "skip ", "start_line": 585, "start_column": 12, "end_line": 585, "end_column": 16 }, { "span": "skip ", "start_line": 939, "start_column": 12, "end_line": 939, "end_column": 16 }, { "span": "skip ", "start_line": 1064, "start_column": 12, "end_line": 1064, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Product", "Filter", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "skip_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "skip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Product", "Filter", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "\\u", "type", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Product_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "\\u", "type", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "\\u", "type", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "supplier", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "supplier", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "supplier", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "supplier", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Supplier", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "active", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "active", "'_", "]_", "._", "initial_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "active", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Activ", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lead", "Filter", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "skip_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "skip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Lead", "Filter", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Product_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "s", " ", "interest", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "leads", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "\\u", "method", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "\\u", "method", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oppo", "rtu", "nit", "y", "Filter", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "skip_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "skip_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Oppo", "rtu", "nit", "y", "Filter", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Product_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "s", " ", "interest", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "opportunit", "ies_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\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, 0, 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 ]
Unused import
simonw/bugle_project/bugle_project/bugle/management/commands/populate_is_todo.py
[ { "content": "from django.core.management.base import BaseCommand, CommandError\nfrom bugle.models import Blast\nfrom django.contrib.auth.models import User\nimport re, sys\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n help = \"\"\"\n Ensures that all @username mentions are added to the mentions DB table\n \"\"\".strip()\n \n requires_model_validation = True\n can_import_settings = True\n ", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def handle(self, *args, **options):\n if len(args) != 0:\n raise CommandError(\"Command doesn't accept any arguments\")\n \n for blast in Blast.objects.all():\n blast.is_todo = blast.derive_is_todo()\n blast.save()\n sys.stdout.write('.')\n sys.stdout.write(' done\\n')", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "from django.contrib.auth.models import User", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 43 }, { "span": "import re, sys", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bug", "le_", "._", "models_", "import_", "Blast", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", ",_", "sys_", "\\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_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "es", " ", "tha", "t", " ", "all", " ", "@", "user", "name", " ", "mentions", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "mentions", " ", "DB", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "s", "\\u", "model", "\\u", "validation_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "can", "\\u", "import", "\\u", "settings_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "\"", "Command", " ", "doe", "sn", "'", "t", " ", "accept", " ", "any", " ", "argu", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "blast", "_", "in_", "Blast", "_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blast", "_", "._", "is", "\\u", "todo_", "=_", "blast", "_", "._", "derive", "\\u", "is", "\\u", "todo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blast", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'", " ", "don", "e", "\\\\", "n", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pydata/pandas/pandas/tests/series/test_misc_api.py
[ { "content": " def test_tab_completion(self):\n # GH 9910\n s = Series(list('abcd'))\n # Series of str values should have .str but not .dt/.cat in __dir__\n self.assertTrue('str' in dir(s))\n self.assertTrue('dt' not in dir(s))\n self.assertTrue('cat' not in dir(s))\n\n # similiarly for .dt\n s = Series(date_range('1/1/2015', periods=5))\n self.assertTrue('dt' in dir(s))\n self.assertTrue('str' not in dir(s))\n self.assertTrue('cat' not in dir(s))\n\n # similiarly for .cat, but with the twist that str and dt should be\n # there if the categories are of that type first cat and str\n s = Series(list('abbcd'), dtype=\"category\")\n self.assertTrue('cat' in dir(s))\n self.assertTrue('str' in dir(s)) # as it is a string categorical\n self.assertTrue('dt' not in dir(s))\n\n # similar to cat and str\n s = Series(date_range('1/1/2015', periods=5)).astype(\"category\")\n self.assertTrue('cat' in dir(s))\n self.assertTrue('str' not in dir(s))\n self.assertTrue('dt' in dir(s)) # as it is a datetime categorical", "metadata": "root.TestSeriesMisc.test_tab_completion", "header": "['class', 'TestSeriesMisc', '(', 'TestData', ',', 'SharedWithSparse', ',', 'tm', '.', 'TestCase', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "self.assertTrue('str' in dir(s))", "start_line": 126, "start_column": 8, "end_line": 126, "end_column": 40 }, { "span": "self.assertTrue('dt' not in dir(s))", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 43 }, { "span": "self.assertTrue('cat' not in dir(s))", "start_line": 128, "start_column": 8, "end_line": 128, "end_column": 44 }, { "span": "self.assertTrue('dt' in dir(s))", "start_line": 132, "start_column": 8, "end_line": 132, "end_column": 39 }, { "span": "self.assertTrue('str' not in dir(s))", "start_line": 133, "start_column": 8, "end_line": 133, "end_column": 44 }, { "span": "self.assertTrue('cat' not in dir(s))", "start_line": 134, "start_column": 8, "end_line": 134, "end_column": 44 }, { "span": "self.assertTrue('cat' in dir(s))", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 40 }, { "span": "self.assertTrue('str' in dir(s)) ", "start_line": 140, "start_column": 8, "end_line": 140, "end_column": 40 }, { "span": "self.assertTrue('dt' not in dir(s))", "start_line": 141, "start_column": 8, "end_line": 141, "end_column": 43 }, { "span": "self.assertTrue('cat' in dir(s))", "start_line": 145, "start_column": 8, "end_line": 145, "end_column": 40 }, { "span": "self.assertTrue('str' not in dir(s))", "start_line": 146, "start_column": 8, "end_line": 146, "end_column": 44 }, { "span": "self.assertTrue('dt' in dir(s)) ", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Serie", "s", "Mis", "c_", "(_", "Test", "Data_", ",_", "Share", "d", "With", "Spar", "se_", ",_", "tm_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "tab", "\\u", "completion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "GH", " ", "991", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Series_", "(_", "list_", "(_", "'", "abc", "d", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Serie", "s", " ", "of", " ", "str", " ", "values", " ", "shou", "ld", " ", "have", " ", ".", "str", " ", "but", " ", "not", " ", ".", "dt", "/.", "cat", " ", "in", " ", "\\u\\u", "dir\\u", "\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "str", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dt", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "cat", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simi", "lia", "rl", "y", " ", "for", " ", ".", "dt_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Series_", "(_", "date", "\\u", "range_", "(_", "'", "1", "/", "1", "/", "201", "5", "'_", ",_", "periods_", "=_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dt", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "str", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "cat", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simi", "lia", "rl", "y", " ", "for", " ", ".", "cat", ",", " ", "but", " ", "with", " ", "the", " ", "twist", " ", "tha", "t", " ", "str", " ", "and", " ", "dt", " ", "shou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", " ", "if", " ", "the", " ", "categor", "ies", " ", "are", " ", "of", " ", "tha", "t", " ", "type", " ", "first", " ", "cat", " ", "and", " ", "str_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Series_", "(_", "list_", "(_", "'", "abb", "cd", "'_", ")_", ",_", "dtype_", "=_", "\"", "category", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "cat", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "str", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "#", " ", "as", " ", "it", " ", "is", " ", "a", " ", "string", " ", "categorical_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dt", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "similar", " ", "to", " ", "cat", " ", "and", " ", "str_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Series_", "(_", "date", "\\u", "range_", "(_", "'", "1", "/", "1", "/", "201", "5", "'_", ",_", "periods_", "=_", "5_", ")_", ")_", "._", "astype_", "(_", "\"", "category", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "cat", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "str", "'_", "not_", "in_", "dir_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dt", "'_", "in_", "dir_", "(_", "s_", ")_", ")_", "#", " ", "as", " ", "it", " ", "is", " ", "a", " ", "datetime", " ", "categorical_", "\\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, 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, 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, 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 ]
Imprecise assert
mhrivnak/radiotherm/tests/field/test_build_get_return.py
[ { "content": " def test_with_name(self):\n field = Field('/fake', 'fake')\n ret = field._build_get_return(self.INT_RETURN_VALUE)\n self.assertTrue('raw' in ret)\n self.assertEqual(len(ret), 1)\n self.assertEqual(ret['raw'], self.INT_RETURN_VALUE['fake'])", "metadata": "root.TestBuildGetReturn.test_with_name", "header": "['class', 'TestBuildGetReturn', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_without_name(self):\n field = Field('/fake', None)\n ret = field._build_get_return(self.NO_NAME_RETURN_VALUE)\n self.assertTrue('raw' in ret)\n self.assertEqual(len(ret), 1)\n self.assertEqual(ret['raw'], self.NO_NAME_RETURN_VALUE)", "metadata": "root.TestBuildGetReturn.test_without_name", "header": "['class', 'TestBuildGetReturn', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_with_human(self):\n field = Field('/fake', 'fake', {0: 'Off', 1: 'On'})\n field._convert_to_human = MagicMock(return_value='On')\n ret = field._build_get_return(self.INT_RETURN_VALUE)\n self.assertTrue('raw' in ret)\n self.assertTrue('human' in ret)\n self.assertEqual(ret['human'], 'On')", "metadata": "root.TestBuildGetReturn.test_with_human", "header": "['class', 'TestBuildGetReturn', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 23 } ]
[ { "span": "self.assertTrue('raw' in ret)", "start_line": 12, "start_column": 8, "end_line": 12, "end_column": 37 }, { "span": "self.assertTrue('raw' in ret)", "start_line": 19, "start_column": 8, "end_line": 19, "end_column": 37 }, { "span": "self.assertTrue('raw' in ret)", "start_line": 27, "start_column": 8, "end_line": 27, "end_column": 37 }, { "span": "self.assertTrue('human' in ret)", "start_line": 28, "start_column": 8, "end_line": 28, "end_column": 39 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Build", "Get", "Return_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "Field_", "(_", "'/", "fake", "'_", ",_", "'", "fake", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "field_", "._", "\\u", "build", "\\u", "get", "\\u", "return_", "(_", "self_", "._", "INT", "\\u", "RETURN", "\\u", "VALUE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "raw", "'_", "in_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ret_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "[_", "'", "raw", "'_", "]_", ",_", "self_", "._", "INT", "\\u", "RETURN", "\\u", "VALUE_", "[_", "'", "fake", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Build", "Get", "Return_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "out", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "Field_", "(_", "'/", "fake", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "field_", "._", "\\u", "build", "\\u", "get", "\\u", "return_", "(_", "self_", "._", "NO", "\\u", "NAME", "\\u", "RETURN", "\\u", "VALUE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "raw", "'_", "in_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "ret_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "[_", "'", "raw", "'_", "]_", ",_", "self_", "._", "NO", "\\u", "NAME", "\\u", "RETURN", "\\u", "VALUE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Build", "Get", "Return_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "with", "\\u", "human_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field_", "=_", "Field_", "(_", "'/", "fake", "'_", ",_", "'", "fake", "'_", ",_", "{_", "0_", ":_", "'", "Off", "'_", ",_", "1_", ":_", "'", "On", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "._", "\\u", "convert", "\\u", "to", "\\u", "human_", "=_", "Mag", "ic", "Mock_", "(_", "return", "\\u", "value_", "=_", "'", "On", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "field_", "._", "\\u", "build", "\\u", "get", "\\u", "return_", "(_", "self_", "._", "INT", "\\u", "RETURN", "\\u", "VALUE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "raw", "'_", "in_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "human", "'_", "in_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ret_", "[_", "'", "human", "'_", "]_", ",_", "'", "On", "'_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
mvantellingen/localshop/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Localshop documentation build configuration file, created by\n# sphinx-quickstart on Mon Apr 27 13:39:49 2015.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\nimport shlex\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'sphinx.ext.autodoc',\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n# source_suffix = ['.rst', '.md']\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'Localshop'\ncopyright = u'2015, Michael van Tellingen'\nauthor = u'Michael van Tellingen'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.8.3'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.8.3'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n# If true, `todo` and `todoList` produce output, else they produce nothing.\ntodo_include_todos = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\n#html_theme = 'classic'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n#html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Language to be used for generating the HTML full-text search index.\n# Sphinx supports the following languages:\n# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'\n# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'\n#html_search_language = 'en'\n\n# A dictionary with options for the search language support, empty by default.\n# Now only 'ja' uses this config value\n#html_search_options = {'type': 'default'}\n\n# The name of a javascript file (relative to the configuration directory) that\n# implements a search results scorer. If empty, the default will be used.\n#html_search_scorer = 'scorer.js'\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Localshopdoc'\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# Latex figure (float) alignment\n#'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n (master_doc, 'Localshop.tex', u'Localshop Documentation',\n u'Michael van Tellingen', '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 (master_doc, 'localshop', u'Localshop Documentation',\n [author], 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 (master_doc, 'Localshop', u'Localshop Documentation',\n author, 'Localshop', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 10 }, { "span": "import os", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 9 }, { "span": "import shlex", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 12 } ]
[]
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_", "#", " ", "Local", "shop", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Mon", " ", "Ap", "r", " ", "2", "7", " ", "13", ":", "3", "9", ":", "4", "9", " ", "201", "5._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", "(", "es", ")", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "can", " ", "speci", "fy", " ", "multiple", " ", "suff", "ix", " ", "as", " ", "a", " ", "list", " ", "of", " ", "string", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "source", "\\u", "suff", "ix", " ", "=", " ", "['", ".", "rst", "',", " ", "'.", "md", "']", "_", "\\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", "'", "Local", "shop", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "201", "5", ",", " ", "Mich", "ael", " ", "van", " ", "Tell", "inge", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author_", "=_", "u", "'", "Mich", "ael", " ", "van", " ", "Tell", "inge", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "8.3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.", "8.3", "'_", "\\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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "als", "o", " ", "used", " ", "if", " ", "you", " ", "do", " ", "content", " ", "translatio", "n", " ", "via", " ", "gettext", " ", "catalogs", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ual", "ly", " ", "you", " ", "set", " ", "\"", "language", "\"", " ", "from", " ", "the", " ", "command", " ", "line", " ", "for", " ", "these", " ", "case", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "keep", " ", "warn", "ings", " ", "as", " ", "\"", "system", " ", "message", "\"", " ", "paragraph", "s", " ", "in", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "keep", "\\u", "warn", "ings", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "`", "todo", "`", " ", "and", " ", "`", "todo", "List", "`", " ", "produce", " ", "output", ",", " ", "else", " ", "the", "y", " ", "produce", " ", "not", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "todo", "\\u", "include", "\\u", "todos_", "=_", "False_", "\\u\\u\\uNEWLINE\\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", "them", "e", " ", "=", " ", "'", "classic", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "extra", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "robots", ".", "txt", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "hta", "ccess", ")", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "se", " ", "files", " ", "are", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "to", " ", "the", " ", "root", " ", "of", " ", "the", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "extra", "\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "to", " ", "be", " ", "used", " ", "for", " ", "generat", "ing", " ", "the", " ", "HTM", "L", " ", "full", "-", "text", " ", "search", " ", "index", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "support", "s", " ", "the", " ", "follow", "ing", " ", "language", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "da", "',", " ", "'", "de", "',", " ", "'", "en", "',", " ", "'", "es", "',", " ", "'", "fi", "',", " ", "'", "fr", "',", " ", "'", "hu", "',", " ", "'", "it", "',", " ", "'", "ja", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "'", "nl", "',", " ", "'", "no", "',", " ", "'", "pt", "',", " ", "'", "ro", "',", " ", "'", "ru", "',", " ", "'", "sv", "',", " ", "'", "tr", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "language", " ", "=", " ", "'", "en", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "dictionar", "y", " ", "with", " ", "options", " ", "for", " ", "the", " ", "search", " ", "language", " ", "support", ",", " ", "empty", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "only", " ", "'", "ja", "'", " ", "use", "s", " ", "this", " ", "config", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "options", " ", "=", " ", "{", "'", "type", "':", " ", "'", "default", "'}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "a", " ", "javascript", " ", "file", " ", "(", "relative", " ", "to", " ", "the", " ", "configura", "tion", " ", "director", "y", ")", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "implement", "s", " ", "a", " ", "search", " ", "results", " ", "scorer", ".", " ", "If", " ", "empty", ",", " ", "the", " ", "default", " ", "will", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "search", "\\u", "scorer", " ", "=", " ", "'", "scorer", ".", "js", "'_", "\\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_", "=_", "'", "Local", "shop", "doc", "'_", "\\u\\u\\uNEWLINE\\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\\uNL\\u\\u\\u_", "#", " ", "Latex", " ", "figure", " ", "(", "float", ")", " ", "alignment_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "figure", "\\u", "align", "':", " ", "'", "ht", "bp", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", ",", " ", "manu", "al", ",", " ", "or", " ", "own", " ", "class", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "master", "\\u", "doc_", ",_", "'", "Local", "shop", ".", "tex", "'_", ",_", "u", "'", "Local", "shop", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Mich", "ael", " ", "van", " ", "Tell", "inge", "n", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "master", "\\u", "doc_", ",_", "'", "locals", "hop", "'_", ",_", "u", "'", "Local", "shop", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "author_", "]_", ",_", "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_", "(_", "master", "\\u", "doc_", ",_", "'", "Local", "shop", "'_", ",_", "u", "'", "Local", "shop", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", ",_", "'", "Local", "shop", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "do", " ", "not", " ", "generat", "e", " ", "a", " ", "@", "deta", "il", "menu", " ", "in", " ", "the", " ", "\"", "Top", "\"", " ", "node", "'", "s", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "no", "\\u", "deta", "il", "menu", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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\nimport sys,time\nimport SocketServer,struct,select\n\nglobal bufLen\nglobal endflag\nglobal socksPort\n###################\nsocksPort = 50000 #Default socks5 proxy port\n###################\nendflag = []\nbufLen = 4*1024\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "global bufLen", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 13 }, { "span": "global endflag", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 14 }, { "span": "global socksPort", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", " ", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Sock", "et", "Server_", ",_", "struct_", ",_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "buf", "Len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "endf", "lag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "socks", "Port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "socks", "Port_", "=_", "50000_", "#", "Default", " ", "socks", "5", " ", "proxy", " ", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "endf", "lag_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf", "Len_", "=_", "4_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "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_" ]
[ 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, 0, 1, 1, 2, 0, 1, 1, 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 ]
Missing call to `__init__` during object initialization
azoft-dev-team/imagrium/env/Lib/optparse.py
[ { "content": " def __init__(self, msg):\n self.msg = msg", "metadata": "root.OptParseError.__init__", "header": "['class', 'OptParseError', '(', 'Exception', ')', ':', '___EOS___']", "index": 97 }, { "content": "class OptionError (OptParseError):\n \"\"\"\n Raised if an Option instance is created with invalid or\n inconsistent arguments.\n \"\"\"\n\n", "metadata": "root.OptionError", "header": "['module', '___EOS___']", "index": 104 }, { "content": " def __init__(self, msg, option):\n self.msg = msg\n self.option_id = str(option)", "metadata": "root.OptionError.__init__", "header": "['class', 'OptionError', '(', 'OptParseError', ')', ':', '___EOS___']", "index": 110 }, { "content": "class BadOptionError (OptParseError):\n \"\"\"\n Raised if an invalid option is seen on the command line.\n \"\"\"\n", "metadata": "root.BadOptionError", "header": "['module', '___EOS___']", "index": 131 }, { "content": " def __init__(self, opt_str):\n self.opt_str = opt_str", "metadata": "root.BadOptionError.__init__", "header": "['class', 'BadOptionError', '(', 'OptParseError', ')', ':', '___EOS___']", "index": 135 } ]
[ { "span": "class OptionError (OptParseError):", "start_line": 104, "start_column": 0, "end_line": 104, "end_column": 34 }, { "span": "class BadOptionError (OptParseError):", "start_line": 131, "start_column": 0, "end_line": 131, "end_column": 37 } ]
[ { "span": "def __init__(self, msg):", "start_line": 97, "start_column": 4, "end_line": 97, "end_column": 28 }, { "span": "def __init__(self, msg, option):", "start_line": 110, "start_column": 4, "end_line": 110, "end_column": 36 }, { "span": "def __init__(self, opt_str):", "start_line": 135, "start_column": 4, "end_line": 135, "end_column": 32 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Opt", "Pars", "e", "Error_", "(_", "Exception_", ")_", ":_", "\\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_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "msg_", "=_", "msg_", "\\u\\u\\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_", "Optio", "n", "Error_", "(_", "Opt", "Pars", "e", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "if", " ", "an", " ", "Optio", "n", " ", "instance", " ", "is", " ", "created", " ", "with", " ", "invalid", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "inconsistent", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Optio", "n", "Error_", "(_", "Opt", "Pars", "e", "Error_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "msg_", ",_", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "msg_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "option", "\\u", "id_", "=_", "str_", "(_", "option_", ")_", "\\u\\u\\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_", "Ba", "d", "Optio", "n", "Error_", "(_", "Opt", "Pars", "e", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "if", " ", "an", " ", "invalid", " ", "option", " ", "is", " ", "see", "n", " ", "on", " ", "the", " ", "command", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ba", "d", "Optio", "n", "Error_", "(_", "Opt", "Pars", "e", "Error_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "opt", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "opt", "\\u", "str_", "=_", "opt", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
RJT1990/pyflux/pyflux/inference/__init__.py
[ { "content": "\"\"\"\nThe module Inference holds estimation procedures.\n\"\"\"\nfrom priors import Normal, InverseGamma, Uniform\nfrom metropolis_hastings import metropolis_hastings\nfrom norm_post_sim import norm_post_sim\nfrom bbvi import BBVI\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from priors import Normal, InverseGamma, Uniform", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 48 }, { "span": "from metropolis_hastings import metropolis_hastings", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 51 }, { "span": "from norm_post_sim import norm_post_sim", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 39 }, { "span": "from bbvi import BBVI", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "module", " ", "Infer", "ence", " ", "hold", "s", " ", "estimati", "on", " ", "procedure", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "priors_", "import_", "Normal_", ",_", "Inv", "erse", "Gamma", "_", ",_", "Uniform", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "metro", "polis", "\\u", "hast", "ings_", "import_", "metro", "polis", "\\u", "hast", "ings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "norm", "\\u", "post", "\\u", "sim_", "import_", "norm", "\\u", "post", "\\u", "sim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bb", "vi_", "import_", "BB", "VI", "_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1 ]
Variable defined multiple times
tvidas/a5/scripts/bin/control.py
[ { "content": "def runInVM(m,job,VMs,adbport,vmlock,adbl,results, fcnt):\n\tname = multiprocessing.current_process().name\n\n \tformatter = logging.Formatter(fmt=LOGFORMAT,datefmt=LOGDATEFORMAT)\n \tpathForFile = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-run.log\"\n\tprint \"HH%sHH\" % pathForFile\n \thandler = logging.FileHandler(pathForFile, mode='w')\n \thandler.setFormatter(formatter)\n\n \tvlogger = logger.getChild(\"worker\" + name + \".vm\")\n \tvlogger.setLevel(logging.DEBUG)\n \tvlogger.addHandler(handler)\n\n\tvlogger.info(\"logging started at \" + pathForFile)\n\n\n\trval = True\n\tif VMs[m].state in [\"Reserved\"] :\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Starting\"\n\t\t\tVMs[m] = VMlocal;\n\t\t#emulator doens't observe system hosts: (must start emulator with -partition-size 128 (for example) to give room to write)\n\t\t#adb pull /etc/hosts\n\t\t#edit to 10.0.2.2 (your local machine)\n\t\t#adb remount\n\t\t#adb push hosts /etc/hosts\n\t\tt1 = time.time()\n\t\t\n\n\t\t#emulator -avd NAME -partition-size 128 -ports 5,2322 -no-window -tcpdump FILE -dns-server SERVER -http-proxy PROXY\n\t\t#TODO instead of wipe-data, would be best to re-create the VM\n\t\tEMUSTART = \"%s/emulator -avd %s -partition-size %s -port %s -no-window -tcpdump %s -wipe-data\"\n\t\t#./adb logcat\n\t\t#./adb install /storage/malware/RU.apk\n\t\t#./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED\n\n\t\t#start (with specified ports)\n\t\t#emulator -ports X,Y @avd_X\n\n\t\t#wait for emulator to be fully started\n\t\t#./adb -s emulator-5584 wait-for-device\n\t\tEMUWAIT = \"%s/adb -s %s wait-for-device\"\n\n\t\tEMULOGCAT = \"%s/adb -s %s logcat\"\n\n\t\t#command\n\t\t#adb -s emualtor-X shell cmd\n\n\t\tEMUINSTALL = \"%s/adb -s %s install %s\"\n\n\t\t#<INTENT> specifications include these flags:\n\t\t# [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n\t\t# [-c <CATEGORY> [-c <CATEGORY>] ...]\n\t\t# [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]\n\t\t# [--esn <EXTRA_KEY> ...]\n\t\t# [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]\n\t\t# [-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]\n\t\t#adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver\n\t\t#am broadcast -a android.intent.action.BOOT_COMPLETED\n\t\tEMUINTENT = \"%s/adb -s %s shell am broadcast -a %s\"\n\t\n\t\t#adb shell am start -n com.package.name/com.package.name.ActivityName\n\t\t#am start -a android.intent.action.MAIN -n com.iftitah.android.contact/com.iftitah.android.contact.Contact\n\t\t#am start -a <ACTION> -n <PACKAGE>/<PACKAGE><ACTIVITYCLASS>\n\t\tEMULAUNCH = \"%s/adb -s %s shell am start -a %s -n %s/%s\"\n\n\t\t#kill\n\t\t#could do adb shell stop\n\t\t#but why really? just going to reset for next run anyway\n\t\t# (though a stop would preserve state)\n\t\t#adb -s emulator-X emu kill\n\t\tEMUKILL = \"%s/adb -s %s emu kill\"\n\n\t\t#monkey\n\t\t#$ adb shell monkey -v -p your.package.name 100 --ignore-security-exceptions -s SEED\n\t\tEMUMONKEY = \"%s/adb -s %s shell monkey -v -p %s 100 --ignore-security-exceptions -s %s --throttle 250\"\n\n\t\t#update database with start values\n\t\tpermissions_filename = job['sha256'] + \".xml\"\n\t\timage_used = VMs[m].name\n\t\tstart_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tmsdb.updateStartRun(job['jobuuid'],image_used,start_time,permissions_filename,MSVERSION)\n\n\t\tvlogger.info( name + \":\" + \"...starting VM \" + VMs[m].name)\n\t\t#start it\n\t\tcmd = EMUSTART % ( SDKPATH, VMs[m].name, PSIZE, str(adbport), MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256']+ \"-orig.pcap\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpEmu = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tpEmu = subprocess.Popen(args)\n\t\texcept:\n\t\t\tvlogger.info( name + \":\" + \"emulator start error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\t\t#check for start error conditions:\n\t\t#emulator: WARNING: ignoring locked SD Card image at /path/to/avd/ms-sdk003-003/sdcard.img\n\t\t#it seems too many emulator instances are running on this machine. Aborting\n\n\n\t\t#wait for it to start\n\t\tcmd = EMUWAIT % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator wait returned: %d\" % ret )\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator wait error: %s\" % cmd )\n\t\t\tsys.exit(1)\n\t\tvlogger.info( name + \":\" + \"emulator-\" + str(adbport) + \" started\")\n\t\ttime.sleep(VM_POLL_REST * 3)\n\t\twith vmlock:\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Running\"\n\t\t\tVMs[m] = VMlocal;\n\n\t\t#start logcat\n\t\t#start it\n\t\tcmd = EMULOGCAT % ( SDKPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\tpLogCat = None\n\t\tfLogCat = None\n\t\ttry:\n\t\t\targs = shlex.split(cmd)\n\t\t\tvlogger.info( args)\n\t\t\tfLogCat = open(MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".logcat\",\"w\")\n\t\t\tfNull = open(\"/dev/null\")\n#TODO\t\t\tpLogCat = subprocess.Popen(args, stdin=fNull, stderr=fNull, stdout=fLogCat)\n\t\texcept:\n\t\t\tvlogger.error( name + \": \" + cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tvlogger.error( name + \":\" + \"emulator logcat error\", sys.exc_info()[0])\n\t\t\tsys.exit(1)\n\n\t\t#install malicious app\n\t\tcmd = EMUINSTALL % ( ADBPATH, \"emulator-\" + str(adbport), \"'\" + job['fullpath'] + \"'\")\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator install returned: %s\" % ret )\n\t\t\tinstall_attempts = ADBTRIES\n\t\t\twhile \"Success\" not in ret and install_attempts > 0:\n\t\t\t\tkick_adb_maybe(adbl, fcnt)\n\t\t\t\tvlogger.info( name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\ttime.sleep(VM_POLL_REST)\n\n\t\t\t\t#TODO FIXME, track down why this sometimes stalls forever, seem on SDKs 11 and 14...\n\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\t\tinstall_attempts -= 1\n\t\t\t\tif install_attempts <= 0:\n\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\tvlogger.error(VMs[m].name + \":\" + \"install failed emulator install returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator install fatal error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#possible errors:\n\t\t#Error: Could not access the Package Manager. Is the system running?\n\n\t\ttime.sleep(VM_POLL_REST * 3)\n\n\t\t#stimulate\n\t\tdoc = etree.parse( MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".xml\")\n\t\tpackage = doc.find('package')\n\n\t\t\n\t\tli = libIntent.libIntent(\"localhost\",adbport)\n\t\n\t\t#for each rint\n\t\tfor rint in doc.findall('rint'):\n\t\t\tvlogger.info( name + \" handling \" + str(rint.text))\n\t\t\tli.handleRIntent(str(rint.text))\n\n\t\t#for each permission (actions and rints _should_ catch all these....)\n\t\tfor perm in doc.findall('permission'):\n\t\t\tvlogger.info( name + \" handling \" + str(perm.text))\n\t\t\tli.handlePermission(str(perm.text))\n\n\t\t#for each action\n\t\tfor action in doc.findall('action'):\n\t\t\tvlogger.info( name + \" handling \" + str(action.text))\n\t\t\tli.handleAction(str(action.text))\n\t\t\t#BROADCASTS are done this way\n\t\t\t#cmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), \"android.intent.action.BOOT_COMPLETED\")\n\t\t\tcmd = EMUINTENT % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text))\n\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\ttry:\n\t\t\t\t#TODO check for \"Broadcast completed\" in output, repeat if necessary\n\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\texcept:\n\t\t\t\tsyslog.syslog(\"app %s error sending intent %s\" % (job['sha256'],str(action.text)))\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %s\" % cmd )\n\t\t\t\tvlogger.error( name + \":\" + \"emulator intent error: %d\" % ret )\n\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t#sys.exit(1)\n\t\t\t\t#sys.exit(1)\n\n\t\t#somethings just don't have nice rint or actions\n\t\tli.sendCall()\n\t\ttime.sleep(VM_POLL_REST)\n\t\tli.endAllCalls()\n\n\t\t#open app\n\n\n\t\t# TODO this should not be a for/for loop, the actions shoudl be paired with activities\n\t\tfor activity in doc.findall('activity'):\n\t\t\tfor action in doc.findall('action'):\n\t\t\t\tvlogger.info( name + \": \" + \"################## launching activity \" + str(activity.text))\n\t\t\t\tcmd = EMULAUNCH % ( ADBPATH, \"emulator-\" + str(adbport), str(action.text), str(package.text), str(activity.text))\n\t\t\t\tvlogger.info( name + \":\" + cmd)\n\t\t\t\ttry:\n\t\t\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\t\t\texcept:\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %s\" % cmd )\n\t\t\t\t\tvlogger.error( name + \":\" + \"emulator launch error: %d\" % ret )\n\t\t\t\t\t#TODO exit is a little too harsh here, but should probably requeue somehow\n\t\t\t\t\t#sys.exit(1)\n\n\t\ttime.sleep(VM_POLL_REST * 5)\n\n\t\t#monkey around\n\t\tcmd = EMUMONKEY % ( ADBPATH, \"emulator-\" + str(adbport), str(package.text), random.randint(1,100))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\n\t\ttry:\n\t\t\tret = subprocess.check_output([cmd], shell=True)\n\t\t\tvlogger.info( name + \":\" + \"emulator monkey returned: %s\" % ret )\n#\t\t\tmonkey_attempts = ADBTRIES\n#\t\t\twhile \"Success\" not in ret and monkey_attempts > 0:\n#\t\t\t\tkick_adb_maybe(adbl, fcnt)\n#\t\t\t\tvlogger.info( name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n#\t\t\t\ttime.sleep(VM_POLL_REST)\n#\n#\t\t\t\tret = subprocess.check_output([cmd], shell=True)\n#\t\t\t\tmonkey_attempts -= 1\n#\t\t\t\tif monkey_attempts <= 0:\n#\t\t\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey returned: %s\" % ret )\n\t\t\t\t\n\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator monkey fatal error: %s\" % cmd )\n\t\t\tsyslog.syslog(VMs[m].name + \":\" + \"monkey failed emulator monkey error: %s\" % cmd )\n\t\t\tvlogger.error( formatExceptionInfo())\n\t\t\tsys.exit(1)\n\n\t\t#kill\n\t\tcmd = EMUKILL % ( ADBPATH, \"emulator-\" + str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"emulator kill error\")\n\t\t\tsys.exit(1)\n\n\t\t#cleanup\n\t\tif pEmu.poll() is not None:\n\t\t\tvlogger.info( name + \": \" + \"poll is \" + str(pEmu.poll()))\n\t\t\ttry:\t\n\t\t\t\tpEmu.terminate()\n\t\t\texcept:\n\t\t\t\tvlogger.error( name + \": \" + \"pEmu term failed\")\n#TODO\t\tif pLogCat.poll() is not None:\n#TODO\t\t\tpLogCat.terminate()\n\t\tfLogCat.flush()\n\t\tfLogCat.close()\n\t\tfNull.close()\n\t\t\n\t\ttime.sleep(VM_POLL_REST)\n\t\tvlogger.info( name + \":\" + \"...stopping VM \" + VMs[m].name)\n\t\twith vmlock:\t\n\t\t\tVMlocal = VMs[m];\n\t\t\tVMlocal.state = \"Off\"\n\t\t\tVMs[m] = VMlocal;\n\t\n\t\tt2 = time.time()\t\n\n\t\tcomplete_time = time.strftime(\"%Y-%m-%d-%H:%M:%S\", time.gmtime())\n\t\tresults_file = job['sha256'] + \".pcap\"\n\t\tmsdb.updateFinishRun(job['jobuuid'],complete_time,results_file)\n\n\t\t#post process pcap, pretty crude for now, adb uses it's port and port+1; so two prunes\n\t\t#...and it seems that adb uses 5555 regardless of which even port is specified\n\t\toriginalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-orig.pcap\"\n\t\ttmppcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \"-temp.pcap\"\n\t\tfinalpcap = MALWAREJOBSBASE + \"/\" + job['jobuuid'] + \"/\" + job['sha256'] + \".pcap\"\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(adbport))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,tmppcap, str(adbport))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(int(adbport)+1))\n\t\tcmd = \"prune_pcap.sh %s %s %s\" % (tmppcap,finalpcap, str(int(adbport)+1))\n\t\tvlogger.info( name + \":\" + cmd)\n\t\ttry:\n\t\t\tret = subprocess.check_call([cmd], shell=True)\n\t\texcept:\n\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n\t\t\tsys.exit(1)\n\n\t\t#cmd = \"prune_pcap.sh %s %s %s\" % (os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \"-orig.pcap\",os.path.dirname(job['fullpath']) + \"/\" + job['sha256']+ \".pcap\", str(5555))\n#\t\tcmd = \"prune_pcap.sh %s %s %s\" % (originalpcap,finalpcap, str(adbport))\n#\t\tvlogger.info( name + \":\" + cmd)\n#\t\ttry:\n#\t\t\tret = subprocess.check_call([cmd], shell=True)\n#\t\texcept:\n#\t\t\tvlogger.error( name + \":\" + \"pcap prune error\")\n#\t\t\tsys.exit(1)\n\n\t\t#TODO unique ip addresses\n\t\t#tshark -r <input.pcap> -T fields -e ip.dst ip.src | sort | uniq\n\n\n\t\tvlogger.info( name + \":\" + \"sample took %s seconds process\" % str(t2 - t1))\n\t\tresults.put(t2-t1)\n\n\telif VMs[m].state in [\"Off\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: found in state OFF!\")\n\t\trval = False\n\telif VMs[m].state in [\"Ready\"]:\n\t\tvlogger.info( name + \":\" + VMs[m].name + \"run error: is running and not available for new malware\")\n\t\trval = False\n\t\t#if m.name in assignments:\n\t\t#\tif assignments[m.name]['timeout'] <= time.time():\n\t\t#\t\t#do anything you want to wrap up\n\t\t#\t\tjob_post_process(m)\n\t\t#\t\tjob_cleanup(m)\n\t\t#\t\tvm_poweroff(m)\n\t\t#else: # if the machine is running but there is no job assigned to it then kill it\n\t\t#\tpcap_terminate(m)\n\t\t#\tvm_poweroff(m)\n#\telse: #not sure this is relevant...may need to remove it\n#\t\tvm_poweroff(m) #I need to get a list of states that I want to poweroff by default\n\treturn rval", "metadata": "root.runInVM", "header": "['module', '___EOS___']", "index": 221 } ]
[ { "span": "ret ", "start_line": 475, "start_column": 3, "end_line": 475, "end_column": 6 }, { "span": "ret ", "start_line": 516, "start_column": 3, "end_line": 516, "end_column": 6 } ]
[ { "span": "ret ", "start_line": 525, "start_column": 3, "end_line": 525, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "In", "VM_", "(_", "m_", ",_", "job_", ",_", "VM", "s_", ",_", "adb", "port_", ",_", "vm", "lock_", ",_", "adb", "l_", ",_", "results_", ",_", "fcn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "name_", "=_", "multiprocessing_", "._", "current", "\\u", "process_", "(_", ")_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "fmt_", "=_", "LOG", "FORMAT_", ",_", "datefmt_", "=_", "LOG", "DAT", "EF", "ORM", "AT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "For", "File_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "run", ".", "log", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "HH", "%", "s", "HH", "\"_", "%_", "path", "For", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "logging_", "._", "File", "Handler_", "(_", "path", "For", "File_", ",_", "mode_", "=_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "=_", "logger_", "._", "get", "Child_", "(_", "\"", "worker", "\"_", "+_", "name_", "+_", "\".", "vm", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "add", "Handler_", "(_", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "\"", "logg", "ing", " ", "start", "ed", " ", "at", " ", "\"_", "+_", "path", "For", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rval_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Reserve", "d", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Start", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "emulator", " ", "doe", "ns", "'", "t", " ", "observe", " ", "system", " ", "host", "s", ":", " ", " ", "(", "must", " ", "start", " ", "emulator", " ", "with", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "(", "for", " ", "example", ")", " ", "to", " ", "give", " ", "room", " ", "to", " ", "write", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "pull", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "#", "edit", " ", "to", " ", "10.", "0.", "2.2", " ", "(", "your", " ", "local", " ", "machine", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "remo", "unt_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "push", " ", "host", "s", " ", "/", "etc", "/", "hosts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "av", "d", " ", "NAME", " ", "-", "partit", "ion", "-", "size", " ", "128", " ", "-", "port", "s", " ", "5", ",", "232", "2", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "FILE", " ", "-", "dns", "-", "server", " ", "SERVER", " ", "-", "http", "-", "proxy", " ", "PROX", "Y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "inst", "ead", " ", "of", " ", "wipe", "-", "data", ",", " ", "wou", "ld", " ", "be", " ", "best", " ", "to", " ", "re", "-", "create", " ", "the", " ", "VM_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UST", "ART", "_", "=_", "\"%", "s", "/", "emulator", " ", "-", "av", "d", " ", "%", "s", " ", "-", "partit", "ion", "-", "size", " ", "%", "s", " ", "-", "port", " ", "%", "s", " ", "-", "no", "-", "window", " ", "-", "tcp", "dump", " ", "%", "s", " ", "-", "wipe", "-", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#.", "/", "adb", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "install", " ", "/", "storage", "/", "mal", "ware", "/", "RU", ".", "apk", "_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "(", "with", " ", "specified", " ", "port", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", " ", "-", "port", "s", " ", "X", ",", "Y", " ", "@", "av", "d\\u", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "emulator", " ", "to", " ", "be", " ", "full", "y", " ", "started_", "\\u\\u\\uNL\\u\\u\\u_", "#.", "/", "adb", " ", "-", "s", " ", "emulator", "-", "558", "4", " ", "wait", "-", "for", "-", "device_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UW", "AI", "T_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "wait", "-", "for", "-", "device", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UL", "OG", "CAT", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "logc", "at", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emu", "alt", "or", "-", "X", " ", "shell", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UI", "NS", "TAL", "L_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "install", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "<", "INTEN", "T", ">", " ", "specifica", "tion", "s", " ", "include", " ", "these", " ", "flags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "a", " ", "<", "ACTI", "ON", ">]", " ", "[-", "d", " ", "<", "DATA", "\\u", "URI", ">]", " ", "[-", "t", " ", "<", "MIME", "\\u", "TYPE", ">]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "c", " ", "<", "CATEGORY", ">", " ", "[-", "c", " ", "<", "CATEGORY", ">]", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "es", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "STRING", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "esn", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "-", "ez", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "BOOLEAN", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "[-", "e", "|--", "ei", " ", "<", "EXTRA", "\\u", "KEY", ">", " ", "<", "EXTRA", "\\u", "INT", "\\u", "VALU", "E", ">", " ", "...]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", " ", "-", "c", " ", "android", ".", "intent", ".", "category", ".", "HOM", "E", " ", "-", "n", " ", "net", ".", "fsta", "b", ".", "check", "it", "\\u", "android", "/.", "Start", "up", "Receiver_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "broadcast", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UINT", "ENT_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "broadcast", " ", "-", "a", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "shell", " ", "am", " ", "start", " ", "-", "n", " ", "com", ".", "package", ".", "name", "/", "com", ".", "package", ".", "name", ".", "Activ", "it", "y", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "android", ".", "intent", ".", "action", ".", "MAIN", " ", "-", "n", " ", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", "/", "com", ".", "ift", "ita", "h", ".", "android", ".", "contact", ".", "Contact_", "\\u\\u\\uNL\\u\\u\\u_", "#", "am", " ", "start", " ", "-", "a", " ", "<", "ACTI", "ON", ">", " ", "-", "n", " ", "<", "PACKAG", "E", ">/", "<", "PACKAG", "E", "><", "ACTIVITY", "CLASS", ">_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "ULA", "UNC", "H_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "am", " ", "start", " ", "-", "a", " ", "%", "s", " ", "-", "n", " ", "%", "s", "/", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "#", "coul", "d", " ", "do", " ", "adb", " ", "shell", " ", "stop_", "\\u\\u\\uNL\\u\\u\\u_", "#", "but", " ", "wh", "y", " ", "reall", "y", "?", " ", " ", "just", " ", "goi", "ng", " ", "to", " ", "reset", " ", "for", " ", "next", " ", "run", " ", "anyway", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "tho", "ugh", " ", "a", " ", "stop", " ", "wou", "ld", " ", "preserve", " ", "state", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "adb", " ", "-", "s", " ", "emulator", "-", "X", " ", "emu", " ", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UK", "ILL", "_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "emu", " ", "kill", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey_", "\\u\\u\\uNL\\u\\u\\u_", "#$", " ", "adb", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "your", ".", "package", ".", "name", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "SEED", "_", "\\u\\u\\uNL\\u\\u\\u_", "EM", "UM", "ON", "KEY_", "=_", "\"%", "s", "/", "adb", " ", "-", "s", " ", "%", "s", " ", "shell", " ", "monkey", " ", "-", "v", " ", "-", "p", " ", "%", "s", " ", "100", " ", "--", "ignore", "-", "security", "-", "exception", "s", " ", "-", "s", " ", "%", "s", " ", "--", "throttle", " ", "250", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "update", " ", "databa", "se", " ", "with", " ", "start", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "permissi", "ons", "\\u", "filename_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "used_", "=_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Start", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "image", "\\u", "used_", ",_", "start", "\\u", "time_", ",_", "permissi", "ons", "\\u", "filename_", ",_", "MS", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "startin", "g", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UST", "ART", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ",_", "PS", "IZE_", ",_", "str_", "(_", "adb", "port_", ")_", ",_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Em", "u_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "start", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "for", " ", "start", " ", "error", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "emulator", ":", " ", "WARN", "ING", ":", " ", "ign", "orin", "g", " ", "lock", "ed", " ", "SD", " ", "Card", " ", "image", " ", "at", " ", "/", "path", "/", "to", "/", "av", "d", "/", "ms", "-", "sd", "k", "003", "-0", "03", "/", "sdc", "ard", ".", "img_", "\\u\\u\\uNL\\u\\u\\u_", "#", "it", " ", "see", "ms", " ", "too", " ", "many", " ", "emulator", " ", "instance", "s", " ", "are", " ", "runn", "ing", " ", "on", " ", "this", " ", "machine", ".", " ", "Abo", "rti", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "wait", " ", "for", " ", "it", " ", "to", " ", "start_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UW", "AI", "T_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "return", "ed", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "wait", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", "+_", "\"", " ", "start", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Run", "ning", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "logc", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "start", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UL", "OG", "CAT", "_", "%_", "(_", "SD", "KP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "args_", "=_", "shlex_", "._", "split_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "=_", "open_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "logc", "at", "\"_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "=_", "open_", "(_", "\"/", "dev", "/", "null", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", " ", "=", " ", "subproc", "ess", ".", "Pop", "en", "(", "args", ",", " ", "std", "in", "=", "f", "Null", ",", " ", "std", "err", "=", "f", "Null", ",", " ", "stdout", "=", "f", "Log", "Cat", ")_", "\\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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "logc", "at", " ", "error", "\"_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "install", " ", "mali", "cio", "us", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UI", "NS", "TAL", "L_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "\"'\"_", "+_", "job_", "[_", "'", "full", "path", "'_", "]_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "=_", "AD", "BT", "RIE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "\"", "Success", "\"_", "not_", "in_", "ret_", "and_", "install", "\\u", "attempts_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "kick", "\\u", "adb", "\\u", "may", "be_", "(_", "adb", "l_", ",_", "fcn", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "FIX", "ME", ",", " ", "track", " ", "down", " ", "wh", "y", " ", "this", " ", "somet", "imes", " ", "stall", "s", " ", "forever", ",", " ", "see", "m", " ", "on", " ", "SD", "Ks", " ", "11", " ", "and", " ", "14.", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "\\u", "attempts_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "install", "\\u", "attempts_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "install", " ", "fail", "ed", " ", "emulator", " ", "install", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "install", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "possib", "le", " ", "error", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Error", ":", " ", "Cou", "ld", " ", "not", " ", "access", " ", "the", " ", "Packa", "ge", " ", "Manager", ".", " ", " ", "Is", " ", "the", " ", "system", " ", "runn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "stimul", "ate_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "etree_", "._", "parse_", "(_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "doc_", "._", "find_", "(_", "'", "package", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "li_", "=_", "lib", "Inten", "t_", "._", "lib", "Inten", "t_", "(_", "\"", "local", "host", "\"_", ",_", "adb", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "rint_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "rint_", "in_", "doc_", "._", "findall_", "(_", "'", "rint", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "RI", "ntent", "_", "(_", "str_", "(_", "rint_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "permissi", "on", " ", "(", "action", "s", " ", "and", " ", "rint", "s", " ", "\\u", "shou", "ld", "\\u", " ", "catch", " ", "all", " ", "these", "....", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "perm_", "in_", "doc_", "._", "findall_", "(_", "'", "permissi", "on", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Permission_", "(_", "str_", "(_", "perm_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "each", " ", "action_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\"", " ", "handling", " ", "\"_", "+_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "handle", "Action_", "(_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "BROADCAST", "S", " ", "are", " ", "don", "e", " ", "this", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "EM", "UINT", "ENT", " ", "%", " ", "(", " ", "AD", "BP", "ATH", ",", " ", "\"", "emulator", "-\"", " ", "+", " ", "str", "(", "adb", "port", "),", " ", "\"", "android", ".", "intent", ".", "action", ".", "BOOT", "\\u", "COMPLETED", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UINT", "ENT_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "check", " ", "for", " ", "\"", "Broad", "cast", " ", "complete", "d", "\"", " ", "in", " ", "output", ",", " ", "repeat", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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", "\t\t\t_", "syslog_", "._", "syslog_", "(_", "\"", "app", " ", "%", "s", " ", "error", " ", "sendin", "g", " ", "intent", " ", "%", "s", "\"_", "%_", "(_", "job_", "[_", "'", "sha2", "56", "'_", "]_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "intent", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "somet", "hing", "s", " ", "just", " ", "don", "'", "t", " ", "have", " ", "nice", " ", "rint", " ", "or", " ", "actions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "li_", "._", "send", "Call_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "li_", "._", "end", "All", "Calls", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "open", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "this", " ", "shou", "ld", " ", "not", " ", "be", " ", "a", " ", "for", "/", "for", " ", "loop", ",", " ", "the", " ", "action", "s", " ", "shou", "dl", " ", "be", " ", "paired", " ", "with", " ", "activities_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "activity_", "in_", "doc_", "._", "findall_", "(_", "'", "activit", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "action_", "in_", "doc_", "._", "findall_", "(_", "'", "action", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"############", "######", " ", "launch", "ing", " ", "activit", "y", " ", "\"_", "+_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "EM", "ULA", "UNC", "H_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "action_", "._", "text_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "str_", "(_", "activity_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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", "\t\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "launch", " ", "error", ":", " ", "%", "d", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "exit", " ", "is", " ", "a", " ", "litt", "le", " ", "too", " ", "har", "sh", " ", "here", ",", " ", "but", " ", "shou", "ld", " ", "probab", "ly", " ", "reque", "ue", " ", "some", "how_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "exit", "(", "1", ")_", "\\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_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "monkey", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "EM", "UM", "ON", "KEY_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ",_", "str_", "(_", "package_", "._", "text_", ")_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "\t\t\t", "monkey", "\\u", "atte", "mpt", "s", " ", "=", " ", "AD", "BT", "RIE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "whi", "le", " ", "\"", "Success", "\"", " ", "not", " ", "in", " ", "ret", " ", "and", " ", "monkey", "\\u", "atte", "mpt", "s", " ", ">", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "kick", "\\u", "adb", "\\u", "may", "be", "(", "adb", "l", ",", " ", "fcn", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "time", ".", "sleep", "(", "VM", "\\u", "POLL", "\\u", "REST", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "output", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "monkey", "\\u", "atte", "mpt", "s", " ", "-=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "if", " ", "monkey", "\\u", "atte", "mpt", "s", " ", "<=", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "\t", "\t", "syslo", "g", ".", "syslo", "g", "(", "VM", "s", "[", "m", "].", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "return", "ed", ":", " ", "%", "s", "\"", " ", "%", " ", "ret", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\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\t", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "monkey", " ", "fat", "al", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syslog_", "._", "syslog_", "(_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\":\"_", "+_", "\"", "monkey", " ", "fail", "ed", " ", "emulator", " ", "monkey", " ", "error", ":", " ", "%", "s", "\"_", "%_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "error_", "(_", "format", "Except", "ion", "Info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "kill_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "EM", "UK", "ILL", "_", "%_", "(_", "AD", "BP", "ATH", "_", ",_", "\"", "emulator", "-\"_", "+_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "emulator", " ", "kill", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cleanup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "Em", "u_", "._", "poll_", "(_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "poll", " ", "is", " ", "\"_", "+_", "str_", "(_", "p", "Em", "u_", "._", "poll_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "p", "Em", "u_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":", " ", "\"_", "+_", "\"", "p", "Em", "u", " ", "term", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "\t", "\t", "if", " ", "p", "Log", "Cat", ".", "poll", "()", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", "\t\t\t", "p", "Log", "Cat", ".", "terminate", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "Log", "Cat_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Log", "Cat_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "Null_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "VM", "\\u", "POLL", "\\u", "REST", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"...", "stopping", " ", "VM", " ", "\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "vm", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "VM", "local_", "=_", "VM", "s_", "[_", "m_", "]_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "local_", "._", "state_", "=_", "\"", "Off", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VM", "s_", "[_", "m_", "]_", "=_", "VM", "local_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "time_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", "-%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "time_", "._", "gmtime_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "file_", "=_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msd", "b_", "._", "update", "Finish", "Run_", "(_", "job_", "[_", "'", "job", "uuid", "'_", "]_", ",_", "complete", "\\u", "time_", ",_", "results", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "post", " ", "process", " ", "pcap", ",", " ", "pretty", " ", "crud", "e", " ", "for", " ", "now", ",", " ", "adb", " ", "use", "s", " ", "it", "'", "s", " ", "port", " ", "and", " ", "port", "+", "1", ";", " ", "so", " ", "two", " ", "prune", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#..", ".", "and", " ", "it", " ", "see", "ms", " ", "tha", "t", " ", "adb", " ", "use", "s", " ", "5555", " ", "rega", "rd", "less", " ", "of", " ", "whi", "ch", " ", "even", " ", "port", " ", "is", " ", "specified", "_", "\\u\\u\\uNL\\u\\u\\u_", "original", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "orig", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\"-", "temp", ".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "pcap", "_", "=_", "MAL", "WARE", "JOB", "SB", "AS", "E_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "job", "uuid", "'_", "]_", "+_", "\"/\"_", "+_", "job_", "[_", "'", "sha2", "56", "'_", "]_", "+_", "\".", "pcap", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "original", "pcap", "_", ",_", "tmp", "pcap", "_", ",_", "str_", "(_", "adb", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "int", "(", "adb", "port", ")+", "1", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "=_", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "tmp", "pcap", "_", ",_", "final", "pcap", "_", ",_", "str_", "(_", "int_", "(_", "adb", "port_", ")_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ret_", "=_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "cmd_", "]_", ",_", "shell_", "=_", "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", "\t\t_", "vlo", "gger_", "._", "error_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "pcap", " ", "prune", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\"-", "orig", ".", "pcap", "\",", "os", ".", "path", ".", "dir", "name", "(", "job", "['", "full", "path", "'])", " ", "+", " ", "\"/", "\"", " ", "+", " ", "job", "['", "sha2", "56", "']", "+", " ", "\".", "pcap", "\",", " ", "str", "(", "5555", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "cmd", " ", "=", " ", "\"", "prune", "\\u", "pcap", ".", "sh", " ", "%", "s", " ", "%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "original", "pcap", ",", "final", "pcap", ",", " ", "str", "(", "adb", "port", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vlo", "gger", ".", "info", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "ret", " ", "=", " ", "subproc", "ess", ".", "check", "\\u", "call", "([", "cmd", "],", " ", "shell", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "vlo", "gger", ".", "error", "(", " ", "name", " ", "+", " ", "\":\"", " ", "+", " ", "\"", "pcap", " ", "prune", " ", "error", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t\t\t", "sys", ".", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "unique", " ", "ip", " ", "addresses_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tsh", "ark", " ", "-", "r", " ", "<", "input", ".", "pcap", ">", " ", "-", "T", " ", "fields", " ", "-", "e", " ", "ip", ".", "dst", " ", "ip", ".", "src", " ", "|", " ", "sort", " ", "|", " ", "uniq", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "\"", "sample", " ", "too", "k", " ", "%", "s", " ", "second", "s", " ", "process", "\"_", "%_", "str_", "(_", "t2_", "-_", "t1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "put_", "(_", "t2_", "-_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Off", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "found", " ", "in", " ", "state", " ", "OFF", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "VM", "s_", "[_", "m_", "]_", "._", "state_", "in_", "[_", "\"", "Read", "y", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "vlo", "gger_", "._", "info_", "(_", "name_", "+_", "\":\"_", "+_", "VM", "s_", "[_", "m_", "]_", "._", "name_", "+_", "\"", "run", " ", "error", ":", " ", "is", " ", "runn", "ing", " ", "and", " ", "not", " ", "avail", "able", " ", "for", " ", "new", " ", "mal", "ware", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rval_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "m", ".", "name", " ", "in", " ", "assign", "ment", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "if", " ", "assign", "ment", "s", "[", "m", ".", "name", "]['", "timeo", "ut", "']", " ", "<=", " ", "time", ".", "time", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "#", "do", " ", "anyt", "hing", " ", "you", " ", "want", " ", "to", " ", "wrap", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "post", "\\u", "process", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "job", "\\u", "clean", "up", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", "#", " ", "if", " ", "the", " ", "machine", " ", "is", " ", "runn", "ing", " ", "but", " ", "there", " ", "is", " ", "no", " ", "job", " ", "assign", "ed", " ", "to", " ", "it", " ", "then", " ", "kill", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "pcap", "\\u", "terminate", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "vm", "\\u", "power", "off", "(", "m", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "else", ":", " ", "#", "not", " ", "sure", " ", "this", " ", "is", " ", "rele", "van", "t", "...", "may", " ", "need", " ", "to", " ", "remove", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "vm", "\\u", "power", "off", "(", "m", ")", " ", "#", "I", " ", "need", " ", "to", " ", "get", " ", "a", " ", "list", " ", "of", " ", "state", "s", " ", "tha", "t", " ", "I", " ", "want", " ", "to", " ", "power", "off", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rval_", "\\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,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scale/AppServer/lib/django-1.3/tests/regressiontests/generic_views/base.py
[ { "content": " def test_no_init_kwargs(self):\n \"\"\"\n Test that a view can't be accidentally instantiated before deployment\n \"\"\"\n try:\n view = SimpleView(key='value').as_view()\n self.fail('Should not be able to instantiate a view')\n except AttributeError:\n pass", "metadata": "root.ViewTest.test_no_init_kwargs", "header": "['class', 'ViewTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 65 }, { "content": " def test_no_init_args(self):\n \"\"\"\n Test that a view can't be accidentally instantiated before deployment\n \"\"\"\n try:\n view = SimpleView.as_view('value')\n self.fail('Should not be able to use non-keyword arguments instantiating a view')\n except TypeError:\n pass", "metadata": "root.ViewTest.test_no_init_args", "header": "['class', 'ViewTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 75 } ]
[ { "span": "view ", "start_line": 70, "start_column": 12, "end_line": 70, "end_column": 16 }, { "span": "view ", "start_line": 80, "start_column": 12, "end_line": 80, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "View", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "init", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "a", " ", "view", " ", "can", "'", "t", " ", "be", " ", "accident", "ally", " ", "instantiate", "d", " ", "bef", "ore", " ", "deploy", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "Simple", "View_", "(_", "key_", "=_", "'", "value", "'_", ")_", "._", "as", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "'", "Sho", "ul", "d", " ", "not", " ", "be", " ", "able", " ", "to", " ", "instantiate", " ", "a", " ", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "init", "\\u", "args_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "tha", "t", " ", "a", " ", "view", " ", "can", "'", "t", " ", "be", " ", "accident", "ally", " ", "instantiate", "d", " ", "bef", "ore", " ", "deploy", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "Simple", "View_", "._", "as", "\\u", "view_", "(_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "'", "Sho", "ul", "d", " ", "not", " ", "be", " ", "able", " ", "to", " ", "use", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "instant", "iati", "ng", " ", "a", " ", "view", "'_", ")_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terfaces.py
[ { "content": "\tdef __contains__( other ):\n\t\t\"\"\"Determine whether object contains other\"\"\"", "metadata": "root.IObjectContains.__contains__", "header": "['class', 'IObjectContains', '(', 'Interface', ')', ':', '___EOS___']", "index": 19 }, { "content": "\tdef __eq__( other ):\n\t\t\"\"\"Determine whether object == other\"\"\"", "metadata": "root.IObjectEq.__eq__", "header": "['class', 'IObjectEq', '(', 'Interface', ')', ':', '___EOS___']", "index": 27 }, { "content": "\tdef __ne__( other ):\n\t\t\"\"\"Determine whether object != other\"\"\"", "metadata": "root.IObjectNe.__ne__", "header": "['class', 'IObjectNe', '(', 'Interface', ')', ':', '___EOS___']", "index": 34 }, { "content": "\tdef __getitem__( key ):\n\t\t\"\"\"Get sub-item by key or index\"\"\"", "metadata": "root.IObjectGetItem.__getitem__", "header": "['class', 'IObjectGetItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 53 }, { "content": "\tdef __setitem__( key, other ):\n\t\t\"\"\"Set sub-item by key or index\"\"\"", "metadata": "root.IObjectSetItem.__setitem__", "header": "['class', 'IObjectSetItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 57 }, { "content": "\tdef __delitem__( key ):\n\t\t\"\"\"Delete sub-item by key or index\"\"\"", "metadata": "root.IObjectDelItem.__delitem__", "header": "['class', 'IObjectDelItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 61 }, { "content": "\tdef __len__( ):\n\t\t\"\"\"Return the length as an integer or long\"\"\"", "metadata": "root.IObjectLength.__len__", "header": "['class', 'IObjectLength', '(', 'Interface', ')', ':', '___EOS___']", "index": 66 }, { "content": "\tdef __nonzero__( ):\n\t\t\"\"\"Determine if the object is True (not False)\"\"\"", "metadata": "root.IObjectNonZero.__nonzero__", "header": "['class', 'IObjectNonZero', '(', 'Interface', ')', ':', '___EOS___']", "index": 73 }, { "content": "\tdef __hash__( ):\n\t\t\"\"\"Return the hash as an integer\"\"\"", "metadata": "root.IObjectHash.__hash__", "header": "['class', 'IObjectHash', '(', 'Interface', ')', ':', '___EOS___']", "index": 78 }, { "content": "\tdef __iter__():\n\t\t\"\"\"Return an iterator for the items of this object\"\"\"", "metadata": "root.IObjectIter.__iter__", "header": "['class', 'IObjectIter', '(', 'Interface', ')', ':', '___EOS___']", "index": 83 }, { "content": "\tdef __getitem__( index ):\n\t\t\"\"\"Get sub-item by index\"\"\"", "metadata": "root.ISequenceGetItem.__getitem__", "header": "['class', 'ISequenceGetItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 133 }, { "content": "\tdef __setitem__( index, other ):\n\t\t\"\"\"Set sub-item by index\"\"\"", "metadata": "root.ISequenceSetItem.__setitem__", "header": "['class', 'ISequenceSetItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 137 }, { "content": "\tdef __delitem__( index ):\n\t\t\"\"\"Delete sub-item by index\"\"\"", "metadata": "root.ISequenceDelItem.__delitem__", "header": "['class', 'ISequenceDelItem', '(', 'Interface', ')', ':', '___EOS___']", "index": 141 }, { "content": "\tdef __getslice__( start, stop):\n\t\t\"\"\"Get sub-items by index-range\"\"\"", "metadata": "root.ISequenceGetSlice.__getslice__", "header": "['class', 'ISequenceGetSlice', '(', 'Interface', ')', ':', '___EOS___']", "index": 146 }, { "content": "\tdef __setslice__( start, stop, other):\n\t\t\"\"\"Set sub-items by index-range\"\"\"", "metadata": "root.ISequenceSetSlice.__setslice__", "header": "['class', 'ISequenceSetSlice', '(', 'Interface', ')', ':', '___EOS___']", "index": 150 }, { "content": "\tdef __delslice__( start, stop):\n\t\t\"\"\"Delete sub-items by index-range\"\"\"", "metadata": "root.ISequenceDelSlice.__delslice__", "header": "['class', 'ISequenceDelSlice', '(', 'Interface', ')', ':', '___EOS___']", "index": 154 }, { "content": "\tdef __iter__():\n\t\t\"\"\"Return the object itself to allow for x in Iterator operation\"\"\"", "metadata": "root.IIterator.__iter__", "header": "['class', 'IIterator', '(', 'Interface', ')', ':', '___EOS___']", "index": 211 } ]
[ { "span": "def __contains__( other ):", "start_line": 19, "start_column": 1, "end_line": 19, "end_column": 27 }, { "span": "def __eq__( other ):", "start_line": 27, "start_column": 1, "end_line": 27, "end_column": 21 }, { "span": "def __ne__( other ):", "start_line": 34, "start_column": 1, "end_line": 34, "end_column": 21 }, { "span": "def __getitem__( key ):", "start_line": 53, "start_column": 1, "end_line": 53, "end_column": 24 }, { "span": "def __setitem__( key, other ):", "start_line": 57, "start_column": 1, "end_line": 57, "end_column": 31 }, { "span": "def __delitem__( key ):", "start_line": 61, "start_column": 1, "end_line": 61, "end_column": 24 }, { "span": "def __len__( ):", "start_line": 66, "start_column": 1, "end_line": 66, "end_column": 16 }, { "span": "def __nonzero__( ):", "start_line": 73, "start_column": 1, "end_line": 73, "end_column": 20 }, { "span": "def __hash__( ):", "start_line": 78, "start_column": 1, "end_line": 78, "end_column": 17 }, { "span": "def __iter__():", "start_line": 83, "start_column": 1, "end_line": 83, "end_column": 16 }, { "span": "def __getitem__( index ):", "start_line": 133, "start_column": 1, "end_line": 133, "end_column": 26 }, { "span": "def __setitem__( index, other ):", "start_line": 137, "start_column": 1, "end_line": 137, "end_column": 33 }, { "span": "def __delitem__( index ):", "start_line": 141, "start_column": 1, "end_line": 141, "end_column": 26 }, { "span": "def __getslice__( start, stop):", "start_line": 146, "start_column": 1, "end_line": 146, "end_column": 32 }, { "span": "def __setslice__( start, stop, other):", "start_line": 150, "start_column": 1, "end_line": 150, "end_column": 39 }, { "span": "def __delslice__( start, stop):", "start_line": 154, "start_column": 1, "end_line": 154, "end_column": 32 }, { "span": "def __iter__():", "start_line": 211, "start_column": 1, "end_line": 211, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Special", "_", "method_", "has_", "incorrect", "_", "signature_", "[SEP]_", "class_", "IO", "bject", "Contains_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Det", "erm", "ine", " ", "whe", "ther", " ", "object", " ", "contain", "s", " ", "other", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Eq_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Det", "erm", "ine", " ", "whe", "ther", " ", "object", " ", "==", " ", "other", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Ne", "_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Det", "erm", "ine", " ", "whe", "ther", " ", "object", " ", "!=", " ", "other", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Get", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Get", " ", "sub", "-", "item", " ", "by", " ", "key", " ", "or", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Set", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "key_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Set", " ", "sub", "-", "item", " ", "by", " ", "key", " ", "or", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Del", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Delete", " ", "sub", "-", "item", " ", "by", " ", "key", " ", "or", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Length_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "the", " ", "length", " ", "as", " ", "an", " ", "integ", "er", " ", "or", " ", "long", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Non", "Zero_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "nonzero\\u", "\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Det", "erm", "ine", " ", "if", " ", "the", " ", "object", " ", "is", " ", "Tru", "e", " ", "(", "not", " ", "Fal", "se", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Hash_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "the", " ", "hash", " ", "as", " ", "an", " ", "integ", "er", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IO", "bject", "Iter_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "an", " ", "iter", "ator", " ", "for", " ", "the", " ", "items", " ", "of", " ", "this", " ", "object", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Get", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Get", " ", "sub", "-", "item", " ", "by", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Set", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "index_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Set", " ", "sub", "-", "item", " ", "by", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Del", "Item_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Delete", " ", "sub", "-", "item", " ", "by", " ", "index", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Get", "Slice_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "gets", "lice", "\\u\\u_", "(_", "start_", ",_", "stop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Get", " ", "sub", "-", "items", " ", "by", " ", "index", "-", "range", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Set", "Slice_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "start_", ",_", "stop_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Set", " ", "sub", "-", "items", " ", "by", " ", "index", "-", "range", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IS", "eque", "nce", "Del", "Slice_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "dels", "lice", "\\u\\u_", "(_", "start_", ",_", "stop_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Delete", " ", "sub", "-", "items", " ", "by", " ", "index", "-", "range", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "II", "tera", "tor_", "(_", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", "Return", " ", "the", " ", "object", " ", "its", "elf", " ", "to", " ", "allow", " ", "for", " ", "x", " ", "in", " ", "Iterat", "or", " ", "operati", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2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 0, 1, 1, 1, 1, 1, 1, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 4, 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 ]
Unreachable code
natduca/quickopen/src/info_bar_gtk.py
[ { "content": "# Copyright 2011 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport gtk\nimport pango\n\nfrom event import *\n\n\n\n\n\n\nif __name__ == \"__main__\" and False:\n w = gtk.Window()\n w.set_size_request(400,-1)\n b = InfoBarGtk()\n b.text = \"blah blah blah\"\n w.add(b)\n w.show_all()\n gtk.main()\n\nif __name__ == \"__main__\" and True:\n w = gtk.Window()\n w.set_size_request(400,-1)\n bbc = InfoBarGtkCollection()\n\n # bb1\n bb = InfoBarGtk(\"blah blah blah\")\n bbc.add_bar(bb)\n\n # bb1\n bb = InfoBarGtk(\"this is informational\")\n bb.set_stock_icon(gtk.STOCK_DIALOG_INFO)\n bbc.add_bar(bb)\n\n # bb1\n bb = InfoBarGtk(\"blah blah blah\")\n bb.add_button(\"Accept\", lambda: True)\n bbc.add_bar(bb)\n\n # bb1\n bb = InfoBarGtk(\"OMG you need to do somethnig\")\n bb.set_stock_icon(gtk.STOCK_DIALOG_WARNING)\n bb.add_button(\"Accept\", lambda: True)\n bb.add_close_button(lambda: True)\n bbc.add_bar(bb)\n\n w.add(bbc)\n w.show_all()\n gtk.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "w = gtk.Window()", "start_line": 167, "start_column": 2, "end_line": 167, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pango", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "event_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", "and_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "gtk_", "._", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "set\\u", "size", "\\u", "request_", "(_", "400_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "Info", "Bar", "Gtk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "text_", "=_", "\"", "bla", "h", " ", "bla", "h", " ", "bla", "h", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "add_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "show", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gtk_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", "and_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "=_", "gtk_", "._", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "set\\u", "size", "\\u", "request_", "(_", "400_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "c_", "=_", "Info", "Bar", "Gt", "k", "Collection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bb", "1_", "\\u\\u\\uNL\\u\\u\\u_", "bb_", "=_", "Info", "Bar", "Gtk_", "(_", "\"", "bla", "h", " ", "bla", "h", " ", "bla", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "c_", "._", "add", "\\u", "bar_", "(_", "bb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bb", "1_", "\\u\\u\\uNL\\u\\u\\u_", "bb_", "=_", "Info", "Bar", "Gtk_", "(_", "\"", "this", " ", "is", " ", "informati", "onal", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "._", "set\\u", "stock", "\\u", "icon_", "(_", "gtk_", "._", "STO", "CK", "\\u", "DIAL", "OG", "\\u", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "c_", "._", "add", "\\u", "bar_", "(_", "bb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bb", "1_", "\\u\\u\\uNL\\u\\u\\u_", "bb_", "=_", "Info", "Bar", "Gtk_", "(_", "\"", "bla", "h", " ", "bla", "h", " ", "bla", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "._", "add", "\\u", "button_", "(_", "\"", "Accept", "\"_", ",_", "lambda_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "c_", "._", "add", "\\u", "bar_", "(_", "bb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bb", "1_", "\\u\\u\\uNL\\u\\u\\u_", "bb_", "=_", "Info", "Bar", "Gtk_", "(_", "\"", "OM", "G", " ", "you", " ", "need", " ", "to", " ", "do", " ", "somet", "hn", "ig", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "._", "set\\u", "stock", "\\u", "icon_", "(_", "gtk_", "._", "STO", "CK", "\\u", "DIAL", "OG", "\\u", "WARNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "._", "add", "\\u", "button_", "(_", "\"", "Accept", "\"_", ",_", "lambda_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "._", "add", "\\u", "close", "\\u", "button_", "(_", "lambda_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb", "c_", "._", "add", "\\u", "bar_", "(_", "bb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", "._", "add_", "(_", "bb", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "._", "show", "\\u", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gtk_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
UFAL-DSG/cloud-asr/cloudasr/shared/cloudasr/schema.py
[ { "content": "import random\nimport struct\nimport datetime\nfrom flask.ext.sqlalchemy import SQLAlchemy\nfrom sqlalchemy import Column, String, Text, Integer, Float, DateTime, Boolean, ForeignKey, create_engine, types\nfrom sqlalchemy.orm import sessionmaker, relationship\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.dialects.mysql.base import MSBinary\n\ndb = SQLAlchemy()\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UUID(types.TypeDecorator):\n impl = MSBinary\n\n\n\n", "metadata": "root.UUID", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self):\n self.impl.length = 16\n types.TypeDecorator.__init__(self, length=self.impl.length)", "metadata": "root.UUID.__init__", "header": "['class', 'UUID', '(', 'types', '.', 'TypeDecorator', ')', ':', '___EOS___']", "index": 14 }, { "content": " def process_bind_param(self, value, dialect=None):\n if value is not None:\n value = int(value)\n return struct.pack('>QQ', (value >> 64), value & ((1 << 64) - 1))\n else:\n return None", "metadata": "root.UUID.process_bind_param", "header": "['class', 'UUID', '(', 'types', '.', 'TypeDecorator', ')', ':', '___EOS___']", "index": 18 }, { "content": " def process_result_value(self, value, dialect=None):\n if value:\n (upper, lower) = struct.unpack('>QQ', value)\n return (upper << 64) | lower\n else:\n return None", "metadata": "root.UUID.process_result_value", "header": "['class', 'UUID', '(', 'types', '.', 'TypeDecorator', ')', ':', '___EOS___']", "index": 25 }, { "content": " def is_mutable(self):\n return False", "metadata": "root.UUID.is_mutable", "header": "['class', 'UUID', '(', 'types', '.', 'TypeDecorator', ')', ':', '___EOS___']", "index": 32 }, { "content": "class User(db.Model):\n __tablename__ = 'user'\n\n id = Column(UUID, primary_key = True)\n email = Column(String(128))\n name = Column(String(128))\n avatar = Column(String(128))\n transcriptions = relationship('Transcription', backref=\"user\")\n admin = Column(Boolean)\n\n\n\n", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def is_authenticated(self):\n return True", "metadata": "root.User.is_authenticated", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 46 }, { "content": " def is_active(self):\n return True", "metadata": "root.User.is_active", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 49 }, { "content": " def is_anonymous(self):\n return False", "metadata": "root.User.is_anonymous", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 52 }, { "content": " def get_id(self):\n return unicode(self.id)", "metadata": "root.User.get_id", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 55 }, { "content": "class WorkerType(db.Model):\n __tablename__ = 'worker_type'\n\n id = Column(String(32), primary_key = True)\n lang = Column(String(10))\n name = Column(String(128))\n description = Column(Text)\n visible = Column(Boolean, default = False)\n language_models = relationship('LanguageModel')\n recordings = relationship('Recording')", "metadata": "root.WorkerType", "header": "['module', '___EOS___']", "index": 59 }, { "content": "class LanguageModel(db.Model):\n __tablename__ = 'language_model'\n\n id = Column(Integer, primary_key = True)\n key = Column(String(32))\n name = Column(String(32))\n worker_type = Column(String(32), ForeignKey('worker_type.id'))", "metadata": "root.LanguageModel", "header": "['module', '___EOS___']", "index": 70 }, { "content": "class Recording(db.Model):\n __tablename__ = 'recording'\n\n id = Column(UUID, primary_key = True)\n uuid = Column(UUID)\n part = Column(Integer)\n model = Column(String(32), ForeignKey('worker_type.id'))\n path = Column(String(128))\n url = Column(String(128))\n best_transcription = Column(Text)\n score = Column(Float)\n created = Column(DateTime, default = datetime.datetime.utcnow)\n hypotheses = relationship('Hypothesis')\n transcriptions = relationship('Transcription')", "metadata": "root.Recording", "header": "['module', '___EOS___']", "index": 78 }, { "content": "class Hypothesis(db.Model):\n __tablename__ = 'hypothesis'\n\n id = Column(Integer, primary_key = True)\n recording_id = Column(UUID, ForeignKey('recording.id'))\n text = Column(Text)\n confidence = Column(Float)", "metadata": "root.Hypothesis", "header": "['module', '___EOS___']", "index": 94 }, { "content": "class Transcription(db.Model):\n __tablename__ = 'transcription'\n\n id = Column(Integer, primary_key = True)\n recording_id = Column(UUID, ForeignKey('recording.id'))\n user_id = Column(UUID, ForeignKey('user.id'), nullable = True)\n text = Column(Text)\n created = Column(DateTime, default = datetime.datetime.utcnow)\n has_been_played = Column(Boolean)\n native_speaker = Column(Boolean)\n offensive_language = Column(Boolean)\n not_a_speech = Column(Boolean)", "metadata": "root.Transcription", "header": "['module', '___EOS___']", "index": 103 } ]
[ { "span": "import random", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 }, { "span": "from sqlalchemy import Column, String, Text, Integer, Float, DateTime, Boolean, ForeignKey, create_engine, types", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 112 }, { "span": "from sqlalchemy.orm import sessionmaker, relationship", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 53 }, { "span": "from sqlalchemy.ext.declarative import declarative_base", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "sqlalchemy_", "import_", "SQL", "Alchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "import_", "Column_", ",_", "String_", ",_", "Text_", ",_", "Integer_", ",_", "Float_", ",_", "Date", "Time_", ",_", "Boolean_", ",_", "Fore", "ign", "Key_", ",_", "create", "\\u", "engine_", ",_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "orm_", "import_", "sessionmaker_", ",_", "relationship_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "ext_", "._", "declarative", "_", "import_", "declarative", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "dialect", "s_", "._", "mysql_", "._", "base_", "import_", "MS", "Binary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "SQL", "Alchemy_", "(_", ")_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "UUID_", "(_", "types_", "._", "Type", "Decorator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "impl_", "=_", "MS", "Binary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "UUID_", "(_", "types_", "._", "Type", "Decorator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "impl_", "._", "length_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "types_", "._", "Type", "Decorator_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "length_", "=_", "self_", "._", "impl_", "._", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UUID_", "(_", "types_", "._", "Type", "Decorator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "bind", "\\u", "param_", "(_", "self_", ",_", "value_", ",_", "dialect_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "struct_", "._", "pack_", "(_", "'>", "QQ", "'_", ",_", "(_", "value_", ">>_", "64_", ")_", ",_", "value_", "&_", "(_", "(_", "1_", "<<_", "64_", ")_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UUID_", "(_", "types_", "._", "Type", "Decorator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "result", "\\u", "value_", "(_", "self_", ",_", "value_", ",_", "dialect_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "upper_", ",_", "lower_", ")_", "=_", "struct_", "._", "unpack_", "(_", "'>", "QQ", "'_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "upper_", "<<_", "64_", ")_", "|_", "lower_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UUID_", "(_", "types_", "._", "Type", "Decorator_", ")_", ":_", "\\u\\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", "mutable", "_", "(_", "self_", ")_", ":_", "\\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_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "UUID_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "avatar_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcription", "s_", "=_", "relationship_", "(_", "'", "Transcript", "ion", "'_", ",_", "backref_", "=_", "\"", "user", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "Column_", "(_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "authenticated_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "active_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\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_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Worke", "r", "Type_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "worker", "\\u", "type", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "String_", "(_", "32_", ")_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", "=_", "Column_", "(_", "String_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "Column_", "(_", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visible_", "=_", "Column_", "(_", "Boolean_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language", "\\u", "models_", "=_", "relationship_", "(_", "'", "Lang", "ua", "ge", "Model", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recordings", "_", "=_", "relationship_", "(_", "'", "Record", "ing", "'_", ")_", "\\u\\u\\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_", "Lang", "ua", "ge", "Model_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "language", "\\u", "model", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "Column_", "(_", "String_", "(_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "Column_", "(_", "String_", "(_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker", "\\u", "type_", "=_", "Column_", "(_", "String_", "(_", "32_", ")_", ",_", "Fore", "ign", "Key_", "(_", "'", "worker", "\\u", "type", ".", "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_", "class_", "Record", "ing_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "record", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "UUID_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uuid_", "=_", "Column_", "(_", "UUID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "=_", "Column_", "(_", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "Column_", "(_", "String_", "(_", "32_", ")_", ",_", "Fore", "ign", "Key_", "(_", "'", "worker", "\\u", "type", ".", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "Column_", "(_", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best", "\\u", "transcription", "_", "=_", "Column_", "(_", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "Column_", "(_", "Float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "Column_", "(_", "Date", "Time_", ",_", "default_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hypot", "hes", "es_", "=_", "relationship_", "(_", "'", "Hyp", "othe", "sis", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transcription", "s_", "=_", "relationship_", "(_", "'", "Transcript", "ion", "'_", ")_", "\\u\\u\\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_", "Hyp", "othe", "sis_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "hypothesis", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "ing", "\\u", "id_", "=_", "Column_", "(_", "UUID_", ",_", "Fore", "ign", "Key_", "(_", "'", "record", "ing", ".", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "Column_", "(_", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confidence_", "=_", "Column_", "(_", "Float_", ")_", "\\u\\u\\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_", "Transcript", "ion_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "transcription", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Column_", "(_", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record", "ing", "\\u", "id_", "=_", "Column_", "(_", "UUID_", ",_", "Fore", "ign", "Key_", "(_", "'", "record", "ing", ".", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "id_", "=_", "Column_", "(_", "UUID_", ",_", "Fore", "ign", "Key_", "(_", "'", "user", ".", "id", "'_", ")_", ",_", "nullable_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "Column_", "(_", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "Column_", "(_", "Date", "Time_", ",_", "default_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "bee", "n", "\\u", "played", "_", "=_", "Column_", "(_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nativ", "e\\u", "speaker_", "=_", "Column_", "(_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offen", "sive", "\\u", "language_", "=_", "Column_", "(_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "a", "\\u", "speech_", "=_", "Column_", "(_", "Boolean_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 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 ]
Except block handles 'BaseException'
ioam/holoviews/holoviews/core/operation.py
[ { "content": "\"\"\"\nOperations manipulate Elements, HoloMaps and Layouts, typically for\nthe purposes of analysis or visualization.\n\"\"\"\nfrom functools import reduce\nimport param\n\ntry:\n from itertools import izip as zip\nexcept:\n pass\n\nfrom .dimension import ViewableElement\nfrom .element import Element, HoloMap, GridSpace, Collator\nfrom .layout import Layout\nfrom .overlay import NdOverlay, Overlay\nfrom .spaces import DynamicMap\nfrom .traversal import unique_dimkeys\nfrom . import util\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": "except:", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Opera", "tion", "s", " ", "manipulate", " ", "Element", "s", ",", " ", "Hol", "o", "Map", "s", " ", "and", " ", "Lay", "outs", ",", " ", "typical", "ly", " ", "for", "\\", "10", ";", "the", " ", "purpose", "s", " ", "of", " ", "analys", "is", " ", "or", " ", "visualization", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "param_", "\\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_", "itertools_", "import_", "izip_", "as_", "zip_", "\\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_", "from_", "._", "dimension_", "import_", "View", "able", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "element_", "import_", "Element_", ",_", "Hol", "o", "Map_", ",_", "Grid", "Space_", ",_", "Colla", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "layout_", "import_", "Layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "overlay_", "import_", "Nd", "Overla", "y_", ",_", "Overla", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "spaces_", "import_", "Dynamic", "Map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "traversal", "_", "import_", "unique", "\\u", "dim", "keys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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_" ]
[ 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, 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 ]
Unused local variable
amarandon/smeuhsocial/apps/account/forms.py
[ { "content": " def clean_username(self):\n if not alnum_re.search(self.cleaned_data[\"username\"]):\n raise forms.ValidationError(\n _(\"Usernames can only contain letters, numbers and underscores.\"))\n try:\n user = User.objects.get(\n username__iexact=self.cleaned_data[\"username\"])\n except User.DoesNotExist:\n return self.cleaned_data[\"username\"]\n raise forms.ValidationError(\n _(\"This username is already taken. Please choose another.\"))", "metadata": "root.SignupForm.clean_username", "header": "['class', 'SignupForm', '(', 'GroupForm', ')', ':', '___EOS___']", "index": 142 } ]
[ { "span": "user ", "start_line": 147, "start_column": 12, "end_line": 147, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sign", "up", "Form_", "(_", "Group", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "aln", "um", "\\u", "re_", "._", "search_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "user", "name", "\"_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "User", "names", " ", "can", " ", "only", " ", "contain", " ", "letter", "s", ",", " ", "numbers", " ", "and", " ", "underscore", "s", ".\"_", ")_", ")_", "\\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_", "=_", "User_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user", "name", "\\u\\u", "iex", "act_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "user", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "User_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\"", "user", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "forms_", "._", "Validat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Thi", "s", " ", "user", "name", " ", "is", " ", "alr", "ead", "y", " ", "take", "n", ".", " ", "Ple", "ase", " ", "choose", " ", "anot", "her", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
sahana/eden/modules/s3db/msg.py
[ { "content": " def model(self):\n\n T = current.T\n db = current.db\n\n UNKNOWN_OPT = current.messages.UNKNOWN_OPT\n\n configure = self.configure\n define_table = self.define_table\n\n # Message priority\n msg_priority_opts = {3 : T(\"High\"),\n 2 : T(\"Medium\"),\n 1 : T(\"Low\"),\n }\n\n # ---------------------------------------------------------------------\n # Message Super Entity - all Inbound & Outbound Messages\n #\n\n message_types = Storage(msg_email = T(\"Email\"),\n msg_facebook = T(\"Facebook\"),\n msg_rss = T(\"RSS\"),\n msg_sms = T(\"SMS\"),\n msg_twitter = T(\"Twitter\"),\n msg_twitter_result = T(\"Twitter Search Results\"),\n )\n\n tablename = \"msg_message\"\n self.super_entity(tablename, \"message_id\",\n message_types,\n # Knowing which Channel Incoming Messages\n # came in on allows correlation to Outbound\n # messages (campaign_message, deployment_alert, etc)\n self.msg_channel_id(),\n s3_datetime(default=\"now\"),\n Field(\"body\", \"text\",\n label = T(\"Message\"),\n ),\n Field(\"from_address\",\n label = T(\"From\"),\n ),\n Field(\"to_address\",\n label = T(\"To\"),\n ),\n Field(\"inbound\", \"boolean\",\n default = False,\n label = T(\"Direction\"),\n represent = lambda direction: \\\n (direction and [T(\"In\")] or \\\n [T(\"Out\")])[0],\n ),\n )\n\n # @todo: make lazy_table\n table = db[tablename]\n table.instance_type.readable = True\n table.instance_type.writable = True\n\n configure(tablename,\n list_fields = [\"instance_type\",\n \"from_address\",\n \"to_address\",\n \"body\",\n \"inbound\",\n ],\n )\n\n # Reusable Field\n message_represent = S3Represent(lookup=tablename, fields=[\"body\"])\n message_id = S3ReusableField(\"message_id\", \"reference %s\" % tablename,\n ondelete = \"RESTRICT\",\n represent = message_represent,\n requires = IS_EMPTY_OR(\n IS_ONE_OF_EMPTY(db, \"msg_message.id\")),\n )\n\n self.add_components(tablename,\n msg_attachment = \"message_id\",\n deploy_response = \"message_id\",\n )\n\n # ---------------------------------------------------------------------\n # Outbound Messages\n #\n\n # Show only the supported messaging methods\n MSG_CONTACT_OPTS = current.msg.MSG_CONTACT_OPTS\n\n # Maximum number of retries to send a message\n MAX_SEND_RETRIES = current.deployment_settings.get_msg_max_send_retries()\n\n # Valid message outbox statuses\n MSG_STATUS_OPTS = {1 : T(\"Unsent\"),\n 2 : T(\"Sent\"),\n 3 : T(\"Draft\"),\n 4 : T(\"Invalid\"),\n 5 : T(\"Failed\"),\n }\n\n opt_msg_status = S3ReusableField(\"status\", \"integer\",\n notnull=True,\n requires = IS_IN_SET(MSG_STATUS_OPTS,\n zero=None),\n default = 1,\n label = T(\"Status\"),\n represent = lambda opt: \\\n MSG_STATUS_OPTS.get(opt,\n UNKNOWN_OPT))\n\n # Outbox - needs to be separate to Message since a single message\n # sent needs different outbox entries for each recipient\n tablename = \"msg_outbox\"\n define_table(tablename,\n # FK not instance\n message_id(),\n # Person/Group to send the message out to:\n self.super_link(\"pe_id\", \"pr_pentity\"),\n # If set used instead of picking up from pe_id:\n Field(\"address\"),\n Field(\"contact_method\", length=32,\n default = \"EMAIL\",\n label = T(\"Contact Method\"),\n represent = lambda opt: \\\n MSG_CONTACT_OPTS.get(opt, UNKNOWN_OPT),\n requires = IS_IN_SET(MSG_CONTACT_OPTS,\n zero=None),\n ),\n opt_msg_status(),\n # Used to loop through a PE to get it's members\n Field(\"system_generated\", \"boolean\",\n default = False,\n ),\n # Give up if we can't send after MAX_RETRIES\n Field(\"retries\", \"integer\",\n default = MAX_SEND_RETRIES,\n readable = False,\n writable = False,\n ),\n *s3_meta_fields())\n\n configure(tablename,\n list_fields = [\"id\",\n \"message_id\",\n \"pe_id\",\n \"status\",\n ],\n orderby = \"msg_outbox.created_on desc\",\n )\n\n # ---------------------------------------------------------------------\n # Pass names back to global scope (s3.*)\n return dict(msg_message_id = message_id,\n msg_message_represent = message_represent,\n )", "metadata": "root.S3MessageModel.model", "header": "['class', 'S3MessageModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 363 }, { "content": " def model(self):\n\n T = current.T\n db = current.db\n\n configure = self.configure\n define_table = self.define_table\n set_method = self.set_method\n\n # ---------------------------------------------------------------------\n # Twitter Channel\n #\n password_widget = S3PasswordWidget()\n tablename = \"msg_twitter_channel\"\n define_table(tablename,\n #Instance\n self.super_link(\"channel_id\", \"msg_channel\"),\n # @ToDo: Allow different Twitter accounts for different PEs (Orgs / Teams)\n #self.pr_pe_id(),\n Field(\"name\",\n label = T(\"Name\"),\n ),\n Field(\"description\",\n label = T(\"Description\"),\n ),\n Field(\"enabled\", \"boolean\",\n default = True,\n label = T(\"Enabled?\"),\n represent = s3_yes_no_represent,\n ),\n Field(\"login\", \"boolean\",\n default = False,\n label = T(\"Use for Login?\"),\n represent = s3_yes_no_represent,\n ),\n Field(\"twitter_account\",\n label = T(\"Twitter Account\"),\n ),\n # Get these from https://apps.twitter.com\n Field(\"consumer_key\", \"password\",\n label = T(\"Consumer Key\"),\n widget = password_widget,\n ),\n Field(\"consumer_secret\", \"password\",\n label = T(\"Consumer Secret\"),\n widget = password_widget,\n ),\n Field(\"access_token\", \"password\",\n label = T(\"Access Token\"),\n widget = password_widget,\n ),\n Field(\"access_token_secret\", \"password\",\n label = T(\"Access Token Secret\"),\n widget = password_widget,\n ),\n *s3_meta_fields())\n\n configure(tablename,\n onaccept = self.twitter_channel_onaccept,\n #onvalidation = self.twitter_channel_onvalidation\n super_entity = \"msg_channel\",\n )\n\n set_method(\"msg\", \"twitter_channel\",\n method = \"enable\",\n action = self.msg_channel_enable_interactive)\n\n set_method(\"msg\", \"twitter_channel\",\n method = \"disable\",\n action = self.msg_channel_disable_interactive)\n\n set_method(\"msg\", \"twitter_channel\",\n method = \"poll\",\n action = self.msg_channel_poll)\n\n # ---------------------------------------------------------------------\n # Twitter Messages: InBox & Outbox\n #\n tablename = \"msg_twitter\"\n define_table(tablename,\n # Instance\n self.super_link(\"message_id\", \"msg_message\"),\n self.msg_channel_id(),\n s3_datetime(default = \"now\",\n label = T(\"Posted on\"),\n ),\n Field(\"body\", length=140,\n label = T(\"Message\"),\n ),\n Field(\"from_address\", #notnull=True,\n label = T(\"From\"),\n represent = self.twitter_represent,\n requires = IS_NOT_EMPTY(),\n ),\n Field(\"to_address\",\n label = T(\"To\"),\n represent = self.twitter_represent,\n ),\n Field(\"inbound\", \"boolean\",\n default = False,\n label = T(\"Direction\"),\n represent = lambda direction: \\\n (direction and [T(\"In\")] or \\\n [T(\"Out\")])[0],\n ),\n Field(\"msg_id\", # Twitter Message ID\n readable = False,\n writable = False,\n ),\n *s3_meta_fields())\n\n configure(tablename,\n list_fields = [\"id\",\n #\"priority\",\n #\"category\",\n \"body\",\n \"from_address\",\n \"date\",\n #\"location_id\",\n ],\n #orderby = ~table.priority,\n super_entity = \"msg_message\",\n )\n\n # ---------------------------------------------------------------------\n return {}", "metadata": "root.S3TwitterModel.model", "header": "['class', 'S3TwitterModel', '(', 'S3Model', ')', ':', '___EOS___']", "index": 1710 }, { "content": " @staticmethod\n def twitter_search_poll(r, **attr):\n \"\"\"\n Perform a Search of Twitter\n\n S3Method for interactive requests\n \"\"\"\n\n id = r.id\n tablename = r.tablename\n current.s3task.async(\"msg_twitter_search\", args=[id])\n current.session.confirmation = \\\n current.T(\"The search request has been submitted, so new messages should appear shortly - refresh to see them\")\n # Filter results to this Search\n redirect(URL(f=\"twitter_result\",\n vars={\"~.search_id\": id}))", "metadata": "root.S3TwitterSearchModel.twitter_search_poll", "header": "['class', 'S3TwitterSearchModel', '(', 'S3ChannelModel', ')', ':', '___EOS___']", "index": 2070 }, { "content": " @staticmethod\n def twitter_keygraph(r, **attr):\n \"\"\"\n Prcoess Search Results with KeyGraph\n\n S3Method for interactive requests\n \"\"\"\n\n tablename = r.tablename\n current.s3task.async(\"msg_process_keygraph\", args=[r.id])\n current.session.confirmation = \\\n current.T(\"The search results are now being processed with KeyGraph\")\n # @ToDo: Link to KeyGraph results\n redirect(URL(f=\"twitter_result\"))", "metadata": "root.S3TwitterSearchModel.twitter_keygraph", "header": "['class', 'S3TwitterSearchModel', '(', 'S3ChannelModel', ')', ':', '___EOS___']", "index": 2088 } ]
[ { "span": "msg_priority_opts ", "start_line": 374, "start_column": 8, "end_line": 374, "end_column": 25 }, { "span": "db ", "start_line": 1713, "start_column": 8, "end_line": 1713, "end_column": 10 }, { "span": "tablename ", "start_line": 2079, "start_column": 8, "end_line": 2079, "end_column": 17 }, { "span": "tablename ", "start_line": 2096, "start_column": 8, "end_line": 2096, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "S", "3", "Messag", "e", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "current_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "OPT_", "=_", "current_", "._", "messages_", "._", "UNK", "NOW", "N", "\\u", "OPT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "=_", "self_", "._", "configure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "e\\u", "table_", "=_", "self_", "._", "defin", "e\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Messag", "e", " ", "priority_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "priorit", "y", "\\u", "opts_", "=_", "{_", "3_", ":_", "T_", "(_", "\"", "Hig", "h", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "T_", "(_", "\"", "Medi", "um", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "T_", "(_", "\"", "Lo", "w", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Messag", "e", " ", "Super", " ", "Entit", "y", " ", "-", " ", "all", " ", "Inbo", "und", " ", "&", " ", "Outbo", "und", " ", "Messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "types_", "=_", "Storage_", "(_", "msg", "\\u", "email_", "=_", "T_", "(_", "\"", "Ema", "il", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "facebook", "_", "=_", "T_", "(_", "\"", "Face", "book", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "rss_", "=_", "T_", "(_", "\"", "RSS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "sms_", "=_", "T_", "(_", "\"", "SMS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "twitter_", "=_", "T_", "(_", "\"", "Twit", "ter", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "twit", "ter", "\\u", "result_", "=_", "T_", "(_", "\"", "Twit", "ter", " ", "Sear", "ch", " ", "Result", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "\"", "msg", "\\u", "message", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "super", "\\u", "entity_", "(_", "tablename_", ",_", "\"", "message", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "types_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Kno", "wing", " ", "whi", "ch", " ", "Chan", "nel", " ", "Inco", "ming", " ", "Messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "came", " ", "in", " ", "on", " ", "allow", "s", " ", "correlation", " ", "to", " ", "Outbo", "und_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", "s", " ", "(", "camp", "aig", "n", "\\u", "message", ",", " ", "deploy", "ment", "\\u", "alert", ",", " ", "etc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "msg", "\\u", "channel", "\\u", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "datetime_", "(_", "default_", "=_", "\"", "now", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "body", "\"_", ",_", "\"", "text", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Messag", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "from", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Fro", "m", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "to", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "To", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "inbound", "\"_", ",_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Directi", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "lambda_", "direction_", ":_", "(_", "direction_", "and_", "[_", "T_", "(_", "\"", "In", "\"_", ")_", "]_", "or_", "[_", "T_", "(_", "\"", "Out", "\"_", ")_", "]_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "todo", ":", " ", "make", " ", "lazy", "\\u", "table_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "db_", "[_", "tablename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "instance", "\\u", "type_", "._", "readable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "instance", "\\u", "type_", "._", "writable_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "fields_", "=_", "[_", "\"", "instance", "\\u", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "inbound", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reu", "sab", "le", " ", "Field_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "represent_", "=_", "S", "3", "Represent", "_", "(_", "lookup_", "=_", "tablename_", ",_", "fields_", "=_", "[_", "\"", "body", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message", "\\u", "id_", "=_", "S", "3", "Reu", "sab", "le", "Field_", "(_", "\"", "message", "\\u", "id", "\"_", ",_", "\"", "reference", " ", "%", "s", "\"_", "%_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ondelete_", "=_", "\"", "RESTR", "ICT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "message", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "IS", "\\u", "EMP", "TY", "\\u", "OR_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IS", "\\u", "ONE", "\\u", "OF", "\\u", "EMPTY_", "(_", "db_", ",_", "\"", "msg", "\\u", "message", ".", "id", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "components_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "attachment_", "=_", "\"", "message", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "\\u", "response_", "=_", "\"", "message", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Outbo", "und", " ", "Messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "only", " ", "the", " ", "support", "ed", " ", "mess", "agin", "g", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "MS", "G", "\\u", "CONTACT", "\\u", "OPTS_", "=_", "current_", "._", "msg_", "._", "MS", "G", "\\u", "CONTACT", "\\u", "OPTS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Maxim", "um", " ", "number", " ", "of", " ", "retrie", "s", " ", "to", " ", "send", " ", "a", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "SEND", "\\u", "RETRIE", "S_", "=_", "current_", "._", "deploy", "ment", "\\u", "settings_", "._", "get", "\\u", "msg", "\\u", "max", "\\u", "send", "\\u", "retries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "message", " ", "outbox", " ", "statuses_", "\\u\\u\\uNL\\u\\u\\u_", "MS", "G", "\\u", "STATUS", "\\u", "OPTS_", "=_", "{_", "1_", ":_", "T_", "(_", "\"", "Unse", "nt", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "T_", "(_", "\"", "Sent", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "T_", "(_", "\"", "Dra", "ft", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "T_", "(_", "\"", "Inva", "lid", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "T_", "(_", "\"", "Fail", "ed", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "\\u", "msg", "\\u", "status_", "=_", "S", "3", "Reu", "sab", "le", "Field_", "(_", "\"", "status", "\"_", ",_", "\"", "integ", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notnull", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "IS", "\\u", "IN", "\\u", "SET_", "(_", "MS", "G", "\\u", "STATUS", "\\u", "OPTS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zero_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Status", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "lambda_", "opt_", ":_", "MS", "G", "\\u", "STATUS", "\\u", "OPTS_", "._", "get_", "(_", "opt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UNK", "NOW", "N", "\\u", "OPT_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Outbo", "x", " ", "-", " ", "need", "s", " ", "to", " ", "be", " ", "separate", " ", "to", " ", "Messag", "e", " ", "sinc", "e", " ", "a", " ", "single", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sent", " ", "need", "s", " ", "different", " ", "outbox", " ", "entri", "es", " ", "for", " ", "each", " ", "recipient_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "\"", "msg", "\\u", "outbox", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "e\\u", "table_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FK", " ", "not", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Person", "/", "Group", " ", "to", " ", "send", " ", "the", " ", "message", " ", "out", " ", "to", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "super", "\\u", "link_", "(_", "\"", "pe", "\\u", "id", "\"_", ",_", "\"", "pr", "\\u", "pent", "it", "y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "set", " ", "used", " ", "inst", "ead", " ", "of", " ", "pick", "ing", " ", "up", " ", "from", " ", "pe", "\\u", "id", ":_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "address", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "contact", "\\u", "method", "\"_", ",_", "length_", "=_", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "\"", "EMA", "IL", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Conta", "ct", " ", "Meth", "od", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "lambda_", "opt_", ":_", "MS", "G", "\\u", "CONTACT", "\\u", "OPTS_", "._", "get_", "(_", "opt_", ",_", "UNK", "NOW", "N", "\\u", "OPT_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "IS", "\\u", "IN", "\\u", "SET_", "(_", "MS", "G", "\\u", "CONTACT", "\\u", "OPTS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zero_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "opt", "\\u", "msg", "\\u", "status_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "to", " ", "loop", " ", "through", " ", "a", " ", "PE", " ", "to", " ", "get", " ", "it", "'", "s", " ", "members_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "system", "\\u", "generat", "ed", "\"_", ",_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "up", " ", "if", " ", "we", " ", "can", "'", "t", " ", "send", " ", "after", " ", "MAX", "\\u", "RETRIE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "retrie", "s", "\"_", ",_", "\"", "integ", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "MAX", "\\u", "SEND", "\\u", "RETRIE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "readable_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "writable_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "s3", "\\u", "meta", "\\u", "fields_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "fields_", "=_", "[_", "\"", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pe", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "status", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orderby_", "=_", "\"", "msg", "\\u", "outbox", ".", "created", "\\u", "on", " ", "desc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pass", " ", "names", " ", "back", " ", "to", " ", "global", " ", "scope", " ", "(", "s3", ".*)", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "dict_", "(_", "msg", "\\u", "message", "\\u", "id_", "=_", "message", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg", "\\u", "message", "\\u", "represent_", "=_", "message", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Twit", "ter", "Model_", "(_", "S", "3", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "current_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "=_", "self_", "._", "configure_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "e\\u", "table_", "=_", "self_", "._", "defin", "e\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "method_", "=_", "self_", "._", "set\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Twit", "ter", " ", "Channel_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "password", "\\u", "widget_", "=_", "S", "3", "Passw", "ord", "Widget_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "\"", "msg", "\\u", "twit", "ter", "\\u", "channel", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "e\\u", "table_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Instance_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "super", "\\u", "link_", "(_", "\"", "channel", "\\u", "id", "\"_", ",_", "\"", "msg", "\\u", "channel", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "To", "Do", ":", " ", "All", "ow", " ", "different", " ", "Twit", "ter", " ", "account", "s", " ", "for", " ", "different", " ", "PE", "s", " ", "(", "Org", "s", " ", "/", " ", "Teams", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "pr", "\\u", "pe", "\\u", "id", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Name", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "description", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Descripti", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "enable", "d", "\"_", ",_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Enable", "d", "?\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "s3", "\\u", "ye", "s", "\\u", "no", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "login", "\"_", ",_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Us", "e", " ", "for", " ", "Logi", "n", "?\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "s3", "\\u", "ye", "s", "\\u", "no", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "twit", "ter", "\\u", "account", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Twit", "ter", " ", "Account", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "these", " ", "from", " ", "https", "://", "apps", ".", "twit", "ter", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "consume", "r", "\\u", "key", "\"_", ",_", "\"", "password", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Consume", "r", " ", "Key", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "password", "\\u", "widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "consume", "r", "\\u", "secret", "\"_", ",_", "\"", "password", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Consume", "r", " ", "Sec", "ret", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "password", "\\u", "widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "access", "\\u", "token", "\"_", ",_", "\"", "password", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Access", " ", "Token", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "password", "\\u", "widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "access", "\\u", "token", "\\u", "secret", "\"_", ",_", "\"", "password", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Access", " ", "Token", " ", "Sec", "ret", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "password", "\\u", "widget_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "s3", "\\u", "meta", "\\u", "fields_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "onac", "cept", "_", "=_", "self_", "._", "twit", "ter", "\\u", "channel", "\\u", "onac", "cept", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "onv", "alid", "ation", " ", "=", " ", "self", ".", "twit", "ter", "\\u", "channel", "\\u", "onv", "alid", "ation_", "\\u\\u\\uNL\\u\\u\\u_", "super", "\\u", "entity_", "=_", "\"", "msg", "\\u", "channel", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "set\\u", "method_", "(_", "\"", "msg", "\"_", ",_", "\"", "twit", "ter", "\\u", "channel", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "enable", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "self_", "._", "msg", "\\u", "channel", "\\u", "enable", "\\u", "interactive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "set\\u", "method_", "(_", "\"", "msg", "\"_", ",_", "\"", "twit", "ter", "\\u", "channel", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "disable", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "self_", "._", "msg", "\\u", "channel", "\\u", "disable", "\\u", "interactive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "set\\u", "method_", "(_", "\"", "msg", "\"_", ",_", "\"", "twit", "ter", "\\u", "channel", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "\"", "poll", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "self_", "._", "msg", "\\u", "channel", "\\u", "poll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Twit", "ter", " ", "Messag", "es", ":", " ", "In", "Box", " ", "&", " ", "Outbo", "x_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "\"", "msg", "\\u", "twit", "ter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "e\\u", "table_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Instance_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "super", "\\u", "link_", "(_", "\"", "message", "\\u", "id", "\"_", ",_", "\"", "msg", "\\u", "message", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "msg", "\\u", "channel", "\\u", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "datetime_", "(_", "default_", "=_", "\"", "now", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Post", "ed", " ", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "body", "\"_", ",_", "length_", "=_", "140_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Messag", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "from", "\\u", "address", "\"_", ",_", "#", "notnull", "=", "Tru", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Fro", "m", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "self_", "._", "twit", "ter", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "IS", "\\u", "NOT", "\\u", "EMPTY_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "to", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "To", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "self_", "._", "twit", "ter", "\\u", "represent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "inbound", "\"_", ",_", "\"", "boolean", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "T_", "(_", "\"", "Directi", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "represent_", "=_", "lambda_", "direction_", ":_", "(_", "direction_", "and_", "[_", "T_", "(_", "\"", "In", "\"_", ")_", "]_", "or_", "[_", "T_", "(_", "\"", "Out", "\"_", ")_", "]_", ")_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "\"", "msg", "\\u", "id", "\"_", ",_", "#", " ", "Twit", "ter", " ", "Messag", "e", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "readable_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "writable_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "s3", "\\u", "meta", "\\u", "fields_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "configure_", "(_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "fields_", "=_", "[_", "\"", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "priorit", "y", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "category", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "from", "\\u", "address", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "date", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "location", "\\u", "id", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "orderb", "y", " ", "=", " ", "~", "table", ".", "priorit", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "super", "\\u", "entity_", "=_", "\"", "msg", "\\u", "message", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Twit", "ter", "Sear", "ch", "Model_", "(_", "S", "3", "Chan", "nel", "Model_", ")_", ":_", "\\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_", "twit", "ter", "\\u", "search", "\\u", "poll_", "(_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Perform", " ", "a", " ", "Sear", "ch", " ", "of", " ", "Twit", "ter", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "S", "3", "Meth", "od", " ", "for", " ", "interactive", " ", "request", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "r_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "r_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "s3", "task_", "._", "async_", "(_", "\"", "msg", "\\u", "twit", "ter", "\\u", "search", "\"_", ",_", "args_", "=_", "[_", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "session_", "._", "confirmation_", "=_", "current_", "._", "T_", "(_", "\"", "The", " ", "search", " ", "request", " ", "has", " ", "bee", "n", " ", "submitted", ",", " ", "so", " ", "new", " ", "message", "s", " ", "shou", "ld", " ", "appear", " ", "short", "ly", " ", "-", " ", "refre", "sh", " ", "to", " ", "see", " ", "them", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "results", " ", "to", " ", "this", " ", "Search_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "(_", "URL_", "(_", "f_", "=_", "\"", "twit", "ter", "\\u", "result", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vars_", "=_", "{_", "\"", "~", ".", "search", "\\u", "id", "\"_", ":_", "id_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Twit", "ter", "Sear", "ch", "Model_", "(_", "S", "3", "Chan", "nel", "Model_", ")_", ":_", "\\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_", "twit", "ter", "\\u", "key", "graph_", "(_", "r_", ",_", "**_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pr", "coe", "ss", " ", "Sear", "ch", " ", "Result", "s", " ", "with", " ", "Key", "Graph", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "S", "3", "Meth", "od", " ", "for", " ", "interactive", " ", "request", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "r_", "._", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "s3", "task_", "._", "async_", "(_", "\"", "msg", "\\u", "process", "\\u", "key", "graph", "\"_", ",_", "args_", "=_", "[_", "r_", "._", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "session_", "._", "confirmation_", "=_", "current_", "._", "T_", "(_", "\"", "The", " ", "search", " ", "results", " ", "are", " ", "now", " ", "bei", "ng", " ", "process", "ed", " ", "with", " ", "Key", "Graph", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "To", "Do", ":", " ", "Link", " ", "to", " ", "Key", "Graph", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "(_", "URL_", "(_", "f_", "=_", "\"", "twit", "ter", "\\u", "result", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 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, 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 ]
Variable defined multiple times
StackStorm/st2/st2reactor/st2reactor/rules/engine.py
[ { "content": " def get_matching_rules_for_trigger(self, trigger_instance):\n trigger = trigger_instance.trigger\n trigger = get_trigger_db_by_ref(trigger_instance.trigger)\n rules = Rule.query(trigger=trigger_instance.trigger, enabled=True)\n LOG.info('Found %d rules defined for trigger %s (type=%s)', len(rules), trigger['name'],\n trigger['type'])\n matcher = RulesMatcher(trigger_instance=trigger_instance,\n trigger=trigger, rules=rules)\n\n matching_rules = matcher.get_matching_rules()\n LOG.info('Matched %s rule(s) for trigger_instance %s (type=%s)', len(matching_rules),\n trigger['name'], trigger['type'])\n return matching_rules", "metadata": "root.RulesEngine.get_matching_rules_for_trigger", "header": "['class', 'RulesEngine', '(', 'object', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "trigger ", "start_line": 36, "start_column": 8, "end_line": 36, "end_column": 15 } ]
[ { "span": "trigger ", "start_line": 37, "start_column": 8, "end_line": 37, "end_column": 15 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Rule", "s", "Engine_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "matchi", "ng", "\\u", "rule", "s", "\\u", "for", "\\u", "trigger_", "(_", "self_", ",_", "trigger", "\\u", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trigger_", "=_", "trigger", "\\u", "instance_", "._", "trigger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trigger_", "=_", "get", "\\u", "trigger", "\\u", "db", "\\u", "by", "\\u", "ref_", "(_", "trigger", "\\u", "instance_", "._", "trigger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rules_", "=_", "Rule_", "._", "query_", "(_", "trigger_", "=_", "trigger", "\\u", "instance_", "._", "trigger_", ",_", "enabled_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "'", "Foun", "d", " ", "%", "d", " ", "rule", "s", " ", "defin", "ed", " ", "for", " ", "trigger", " ", "%", "s", " ", "(", "type", "=", "%", "s", ")'_", ",_", "len_", "(_", "rules_", ")_", ",_", "trigger_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger_", "[_", "'", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matcher_", "=_", "Rule", "s", "Matcher_", "(_", "trigger", "\\u", "instance_", "=_", "trigger", "\\u", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger_", "=_", "trigger_", ",_", "rules_", "=_", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matchi", "ng", "\\u", "rules_", "=_", "matcher_", "._", "get", "\\u", "matchi", "ng", "\\u", "rules_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "'", "Matched", " ", "%", "s", " ", "rule", "(", "s", ")", " ", "for", " ", "trigger", "\\u", "instance", " ", "%", "s", " ", "(", "type", "=", "%", "s", ")'_", ",_", "len_", "(_", "matchi", "ng", "\\u", "rules_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger_", "[_", "'", "name", "'_", "]_", ",_", "trigger_", "[_", "'", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "matchi", "ng", "\\u", "rules_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ioflo/ioflo/ioflo/trim/interior/plain/test/testSimulating.py
[ { "content": "def TestSalinity():\n \"\"\" \"\"\"\n\n #clear registries\n storing.Store.Clear()\n #deeding.Deed.Clear()\n doing.Doer.Clear()\n\n store = storing.Store(name = 'Test')\n\n print(\"\\nTesting Salinity Sensor Front Simulator\")\n sim = SalinitySensorSimulator(name = 'simulatorSensorSalinity', store = store,\n group = 'simulator.sensor.salinity', output = 'ctd',\n input = 'state.position',\n parms = dict(track = 45.0, north = 0.0, east = 0.0,\n middle = 32.0, spread = 4.0, rising = True, width = 500.0))\n\n output = store.fetch('ctd').update(salinity = 32.0)\n store.expose()\n sim._expose()\n\n for k in range(1, 100):\n print(\"\")\n store.advanceStamp(0.125)\n\n input = store.fetch('state.position').update(north = k * -50.0, east = 0.0)\n sim.update()\n sim._expose()", "metadata": "root.TestSalinity", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def TestMotion():\n \"\"\"\n\n \"\"\"\n #clear registries\n storing.Store.Clear()\n #deeding.Deed.Clear()\n doing.Doer.Clear()\n\n store = storing.Store(name = 'Test')\n #CreateActions(store)\n\n\n print(\"\\nTesting Motion Sim Controller\")\n simulator = SimulatorMotionUuv(name = 'simulatorMotionTest', store = store,\n group = 'simulator.motion.test',\n speed = 'state.speed', speedRate = 'state.speedRate',\n depth = 'state.depth', depthRate = 'state.depthRate',\n pitch = 'state.pitch', pitchRate = 'state.pitchRate',\n altitude = 'state.altitude',\n heading = 'state.heading', headingRate = 'state.headingRate',\n position = 'state.position',\n rpm = 'goal.rpm', stern = 'goal.stern', rudder = 'goal.rudder',\n current = 'scenario.current', bottom = 'scenario.bottom',\n prevPosition = 'state.position',\n parms = dict(rpmLimit = 1500.0, sternLimit = 20.0, rudderLimit = 20.0,\n gs = 0.0025, gpr = -0.5, ghr = -0.5))\n\n store.expose()\n\n rpm = store.fetch('goal.rpm').update(value = 500.0)\n stern = store.fetch('goal.stern').update(value = 0.0)\n rudder = store.fetch('goal.rudder').update(value = 0.0)\n current = store.fetch('scenario.current').update(north = 0.0, east = 0.0)\n bottom = store.fetch('scenario.bottom').update(value = 50.0)\n prevPosition = store.fetch('scenario.startposition').update(north = 0.0, east = 0.0)\n\n simulator.restart()\n simulator._expose()\n store.advanceStamp(0.125)\n simulator.update()\n simulator._expose()", "metadata": "root.TestMotion", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def Test():\n \"\"\"Module Common self test\n\n \"\"\"\n\n #clear registries\n print(\"\\nTesting Controllers\\n\")\n storing.Store.Clear()\n #deeding.Deed.Clear()\n doing.Doer.Clear()\n\n store = storing.Store(name = 'Test')\n store.expose()\n\n\n current = store.fetch('scenario.current').update(north = 0.0, east = 0.0)\n bottom = store.fetch('scenario.bottom').update(value = 50.0)\n prevPosition = store.fetch('state.position').update(north = 0.0, east = 0.0)\n\n headinggoal = store.fetch('goal.heading').update(value = 45.0)\n depthgoal = store.fetch('goal.depth').update(value = 5.0)\n speedgoal = store.fetch('goal.speed').update(value = 2.0)\n duration = 10.0\n\n simulatorMotionUuv.restart()\n\n controllerPidSpeed._expose()\n controllerPidHeading._expose()\n controllerPidDepth._expose()\n controllerPidPitch._expose()\n simulatorMotionUuv._expose()\n\n while (store.stamp <= duration):\n print(\"\")\n controllerPidSpeed.action()\n controllerPidHeading.action()\n controllerPidDepth.action()\n controllerPidPitch.action()\n simulatorMotionUuv.action()\n simulatorMotionUuv._expose()\n\n store.advanceStamp(0.125)", "metadata": "root.Test", "header": "['module', '___EOS___']", "index": 78 } ]
[ { "span": "output ", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 10 }, { "span": "input ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 13 }, { "span": "rpm ", "start_line": 63, "start_column": 4, "end_line": 63, "end_column": 7 }, { "span": "stern ", "start_line": 64, "start_column": 4, "end_line": 64, "end_column": 9 }, { "span": "rudder ", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 10 }, { "span": "current ", "start_line": 66, "start_column": 4, "end_line": 66, "end_column": 11 }, { "span": "bottom ", "start_line": 67, "start_column": 4, "end_line": 67, "end_column": 10 }, { "span": "prevPosition ", "start_line": 68, "start_column": 4, "end_line": 68, "end_column": 16 }, { "span": "current ", "start_line": 93, "start_column": 4, "end_line": 93, "end_column": 11 }, { "span": "bottom ", "start_line": 94, "start_column": 4, "end_line": 94, "end_column": 10 }, { "span": "prevPosition ", "start_line": 95, "start_column": 4, "end_line": 95, "end_column": 16 }, { "span": "headinggoal ", "start_line": 97, "start_column": 4, "end_line": 97, "end_column": 15 }, { "span": "depthgoal ", "start_line": 98, "start_column": 4, "end_line": 98, "end_column": 13 }, { "span": "speedgoal ", "start_line": 99, "start_column": 4, "end_line": 99, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "Test", "Sal", "init", "y_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "clear", " ", "registr", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "stor", "ing_", "._", "Store_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dee", "ding", ".", "De", "ed", ".", "Clear", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "doi", "ng_", "._", "Do", "er_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "stor", "ing_", "._", "Store_", "(_", "name_", "=_", "'", "Test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "Test", "ing", " ", "Sal", "init", "y", " ", "Sen", "sor", " ", "Front", " ", "Simul", "ator", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim_", "=_", "Sal", "init", "y", "Sen", "sor", "Simulator_", "(_", "name_", "=_", "'", "simulat", "or", "Sen", "sor", "Sal", "init", "y", "'_", ",_", "store_", "=_", "store_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "'", "simulat", "or", ".", "sensor", ".", "sali", "nit", "y", "'_", ",_", "output_", "=_", "'", "ctd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "'", "state", ".", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parms_", "=_", "dict_", "(_", "track_", "=_", "45.", "0_", ",_", "north_", "=_", "0.0_", ",_", "east_", "=_", "0.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "middle_", "=_", "32.", "0_", ",_", "spread_", "=_", "4.0_", ",_", "ris", "ing_", "=_", "True_", ",_", "width_", "=_", "500", ".0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "store_", "._", "fetch_", "(_", "'", "ctd", "'_", ")_", "._", "update_", "(_", "sali", "nit", "y_", "=_", "32.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "._", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "1_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "._", "advance", "Stamp_", "(_", "0.125_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "store_", "._", "fetch_", "(_", "'", "state", ".", "position", "'_", ")_", "._", "update_", "(_", "north_", "=_", "k_", "*_", "-_", "50.0_", ",_", "east_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sim_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Test", "Motion", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "clear", " ", "registr", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "stor", "ing_", "._", "Store_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dee", "ding", ".", "De", "ed", ".", "Clear", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "doi", "ng_", "._", "Do", "er_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "stor", "ing_", "._", "Store_", "(_", "name_", "=_", "'", "Test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Creat", "e", "Action", "s", "(", "store", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "Test", "ing", " ", "Motion", " ", "Sim", " ", "Controlle", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulator_", "=_", "Simul", "ator", "Motion", "Uu", "v_", "(_", "name_", "=_", "'", "simulat", "or", "Motion", "Test", "'_", ",_", "store_", "=_", "store_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "'", "simulat", "or", ".", "moti", "on", ".", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "speed_", "=_", "'", "state", ".", "speed", "'_", ",_", "speed", "Rate_", "=_", "'", "state", ".", "speed", "Rat", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depth_", "=_", "'", "state", ".", "depth", "'_", ",_", "depth", "Rate_", "=_", "'", "state", ".", "depth", "Rat", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pitch_", "=_", "'", "state", ".", "pitch", "'_", ",_", "pitch", "Rate_", "=_", "'", "state", ".", "pitch", "Rat", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "altitude_", "=_", "'", "state", ".", "alti", "tude", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "heading_", "=_", "'", "state", ".", "heading", "'_", ",_", "heading", "Rate_", "=_", "'", "state", ".", "heading", "Rat", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "'", "state", ".", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rpm_", "=_", "'", "goal", ".", "rpm", "'_", ",_", "ster", "n_", "=_", "'", "goal", ".", "ster", "n", "'_", ",_", "ru", "dde", "r_", "=_", "'", "goal", ".", "ru", "dde", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current_", "=_", "'", "scen", "ario", ".", "current", "'_", ",_", "bottom_", "=_", "'", "scen", "ario", ".", "bottom", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "Position_", "=_", "'", "state", ".", "position", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parms_", "=_", "dict_", "(_", "rpm", "Limit_", "=_", "150", "0.0_", ",_", "ster", "n", "Limit_", "=_", "20.0_", ",_", "ru", "dde", "r", "Limit_", "=_", "20.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gs_", "=_", "0.002", "5_", ",_", "gpr", "_", "=_", "-_", "0.5_", ",_", "gh", "r_", "=_", "-_", "0.5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "._", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rpm_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "rpm", "'_", ")_", "._", "update_", "(_", "value_", "=_", "500", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ster", "n_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "ster", "n", "'_", ")_", "._", "update_", "(_", "value_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ru", "dde", "r_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "ru", "dde", "r", "'_", ")_", "._", "update_", "(_", "value_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "=_", "store_", "._", "fetch_", "(_", "'", "scen", "ario", ".", "current", "'_", ")_", "._", "update_", "(_", "north_", "=_", "0.0_", ",_", "east_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "store_", "._", "fetch_", "(_", "'", "scen", "ario", ".", "bottom", "'_", ")_", "._", "update_", "(_", "value_", "=_", "50.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "Position_", "=_", "store_", "._", "fetch_", "(_", "'", "scen", "ario", ".", "startpo", "sition", "'_", ")_", "._", "update_", "(_", "north_", "=_", "0.0_", ",_", "east_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "simulator_", "._", "restart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulator_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "._", "advance", "Stamp_", "(_", "0.125_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulator_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulator_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\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\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Modul", "e", " ", "Common", " ", "self", " ", "test", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "clear", " ", "registr", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "Test", "ing", " ", "Controlle", "rs", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stor", "ing_", "._", "Store_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "dee", "ding", ".", "De", "ed", ".", "Clear", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "doi", "ng_", "._", "Do", "er_", "._", "Clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "=_", "stor", "ing_", "._", "Store_", "(_", "name_", "=_", "'", "Test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "store_", "._", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current_", "=_", "store_", "._", "fetch_", "(_", "'", "scen", "ario", ".", "current", "'_", ")_", "._", "update_", "(_", "north_", "=_", "0.0_", ",_", "east_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "store_", "._", "fetch_", "(_", "'", "scen", "ario", ".", "bottom", "'_", ")_", "._", "update_", "(_", "value_", "=_", "50.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "Position_", "=_", "store_", "._", "fetch_", "(_", "'", "state", ".", "position", "'_", ")_", "._", "update_", "(_", "north_", "=_", "0.0_", ",_", "east_", "=_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "heading", "goal_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "heading", "'_", ")_", "._", "update_", "(_", "value_", "=_", "45.", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "depth", "goal_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "depth", "'_", ")_", "._", "update_", "(_", "value_", "=_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "speed", "goal_", "=_", "store_", "._", "fetch_", "(_", "'", "goal", ".", "speed", "'_", ")_", "._", "update_", "(_", "value_", "=_", "2.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "10.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "simulat", "or", "Motion", "Uu", "v_", "._", "restart_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "controlle", "r", "Pid", "Speed_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Head", "ing_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Depth_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Pitch_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulat", "or", "Motion", "Uu", "v_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "store_", "._", "stamp_", "<=_", "duration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Speed_", "._", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Head", "ing_", "._", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Depth_", "._", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "controlle", "r", "Pid", "Pitch_", "._", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulat", "or", "Motion", "Uu", "v_", "._", "action_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simulat", "or", "Motion", "Uu", "v_", "._", "\\u", "expose_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "store_", "._", "advance", "Stamp_", "(_", "0.125_", ")_", "\\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,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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
lisa-lab/pylearn2/pylearn2/datasets/tests/test_utlc.py
[ { "content": "from __future__ import print_function\n\nimport unittest\n\nimport numpy\nimport scipy.sparse\n\nfrom pylearn2.testing.skip import skip_if_no_data\nimport pylearn2.datasets.utlc as utlc\n\n\n\n\n# @unittest.skip(\"Slow and needs >8 GB of RAM\")\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_ule():\n skip_if_no_data()\n # Test loading of transfer data\n train, valid, test, transfer = utlc.load_ndarray_dataset(\"ule\",\n normalize=True,\n transfer=True)\n assert train.shape[0] == transfer.shape[0]", "metadata": "root.test_ule", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def test_all_utlc():\n skip_if_no_data()\n # not testing rita, because it requires a lot of memorz and is slow\n for name in ['avicenna', 'harry', 'ule']:\n print(\"Loading \", name)\n train, valid, test = utlc.load_ndarray_dataset(name, normalize=True)\n print(\"dtype, max, min, mean, std\")\n print(train.dtype, train.max(), train.min(), train.mean(), train.std())\n assert isinstance(train, numpy.ndarray)\n assert isinstance(valid, numpy.ndarray)\n assert isinstance(test, numpy.ndarray)\n assert train.shape[1] == test.shape[1] == valid.shape[1]", "metadata": "root.test_all_utlc", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_sparse_ule():\n skip_if_no_data()\n # Test loading of transfer data\n train, valid, test, transfer = utlc.load_sparse_dataset(\"ule\",\n normalize=True,\n transfer=True)\n assert train.shape[0] == transfer.shape[0]", "metadata": "root.test_sparse_ule", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def test_all_sparse_utlc():\n skip_if_no_data()\n for name in ['harry', 'terry', 'ule']:\n print(\"Loading sparse \", name)\n train, valid, test = utlc.load_sparse_dataset(name, normalize=True)\n nb_elem = numpy.prod(train.shape)\n mi = train.data.min()\n ma = train.data.max()\n mi = min(0, mi)\n ma = max(0, ma)\n su = train.data.sum()\n mean = float(su) / nb_elem\n print(name, \"dtype, max, min, mean, nb non-zero, nb element, %sparse\")\n print(train.dtype, ma, mi, mean, train.nnz, end='')\n print(nb_elem, (nb_elem - float(train.nnz)) / nb_elem)\n print(name, \"max, min, mean, std (all stats on non-zero element)\")\n print(train.data.max(), train.data.min(), end='')\n print(train.data.mean(), train.data.std())\n assert scipy.sparse.issparse(train)\n assert scipy.sparse.issparse(valid)\n assert scipy.sparse.issparse(test)\n assert train.shape[1] == test.shape[1] == valid.shape[1]", "metadata": "root.test_all_sparse_utlc", "header": "['module', '___EOS___']", "index": 44 } ]
[ { "span": "import unittest", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "sparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "testing_", "._", "skip_", "import_", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyl", "earn", "2_", "._", "datasets_", "._", "utl", "c_", "as_", "utl", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "unittest", ".", "skip", "(\"", "Slow", " ", "and", " ", "need", "s", " ", ">", "8", " ", "GB", " ", "of", " ", "RAM", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "ule_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "load", "ing", " ", "of", " ", "transfer", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "train_", ",_", "valid_", ",_", "test_", ",_", "transfer_", "=_", "utl", "c_", "._", "load", "\\u", "ndar", "ray", "\\u", "dataset_", "(_", "\"", "ule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transfer_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train_", "._", "shape_", "[_", "0_", "]_", "==_", "transfer_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "utl", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "not", " ", "testi", "ng", " ", "rit", "a", ",", " ", "bec", "aus", "e", " ", "it", " ", "require", "s", " ", "a", " ", "lot", " ", "of", " ", "memo", "rz", " ", "and", " ", "is", " ", "slow_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "[_", "'", "avi", "cen", "na", "'_", ",_", "'", "har", "ry", "'_", ",_", "'", "ule", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Load", "ing", " ", "\"_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", ",_", "valid_", ",_", "test_", "=_", "utl", "c_", "._", "load", "\\u", "ndar", "ray", "\\u", "dataset_", "(_", "name_", ",_", "normalize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "dt", "ype", ",", " ", "max", ",", " ", "min", ",", " ", "mean", ",", " ", "std", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "train_", "._", "dtype_", ",_", "train_", "._", "max_", "(_", ")_", ",_", "train_", "._", "min_", "(_", ")_", ",_", "train_", "._", "mean_", "(_", ")_", ",_", "train_", "._", "std_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "train_", ",_", "numpy_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "valid_", ",_", "numpy_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "test_", ",_", "numpy_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train_", "._", "shape_", "[_", "1_", "]_", "==_", "test_", "._", "shape_", "[_", "1_", "]_", "==_", "valid_", "._", "shape_", "[_", "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_", "test\\u", "spars", "e\\u", "ule_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "load", "ing", " ", "of", " ", "transfer", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "train_", ",_", "valid_", ",_", "test_", ",_", "transfer_", "=_", "utl", "c_", "._", "load", "\\u", "spars", "e\\u", "dataset_", "(_", "\"", "ule", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "normalize_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transfer_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train_", "._", "shape_", "[_", "0_", "]_", "==_", "transfer_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "all", "\\u", "spars", "e\\u", "utl", "c_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "[_", "'", "har", "ry", "'_", ",_", "'", "terr", "y", "'_", ",_", "'", "ule", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Load", "ing", " ", "spars", "e", " ", "\"_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train_", ",_", "valid_", ",_", "test_", "=_", "utl", "c_", "._", "load", "\\u", "spars", "e\\u", "dataset_", "(_", "name_", ",_", "normalize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "elem_", "=_", "numpy_", "._", "prod_", "(_", "train_", "._", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mi_", "=_", "train_", "._", "data_", "._", "min_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma_", "=_", "train_", "._", "data_", "._", "max_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mi_", "=_", "min_", "(_", "0_", ",_", "mi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma_", "=_", "max_", "(_", "0_", ",_", "ma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "su_", "=_", "train_", "._", "data_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mean_", "=_", "float_", "(_", "su_", ")_", "/_", "nb", "\\u", "elem_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "name_", ",_", "\"", "dt", "ype", ",", " ", "max", ",", " ", "min", ",", " ", "mean", ",", " ", "nb", " ", "non", "-", "zero", ",", " ", "nb", " ", "element", ",", " ", "%", "spars", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "train_", "._", "dtype_", ",_", "ma_", ",_", "mi_", ",_", "mean_", ",_", "train_", "._", "nnz", "_", ",_", "end_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "nb", "\\u", "elem_", ",_", "(_", "nb", "\\u", "elem_", "-_", "float_", "(_", "train_", "._", "nnz", "_", ")_", ")_", "/_", "nb", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "name_", ",_", "\"", "max", ",", " ", "min", ",", " ", "mean", ",", " ", "std", " ", "(", "all", " ", "stats", " ", "on", " ", "non", "-", "zero", " ", "element", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "train_", "._", "data_", "._", "max_", "(_", ")_", ",_", "train_", "._", "data_", "._", "min_", "(_", ")_", ",_", "end_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "train_", "._", "data_", "._", "mean_", "(_", ")_", ",_", "train_", "._", "data_", "._", "std_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "scipy_", "._", "sparse_", "._", "iss", "parse_", "(_", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "scipy_", "._", "sparse_", "._", "iss", "parse_", "(_", "valid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "scipy_", "._", "sparse_", "._", "iss", "parse_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train_", "._", "shape_", "[_", "1_", "]_", "==_", "test_", "._", "shape_", "[_", "1_", "]_", "==_", "valid_", "._", "shape_", "[_", "1_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
soft-matter/pims/pims/tests/test_bioformats.py
[ { "content": " def test_getting_slice(self):\n self.check_skip()\n tmp = list(self.v[0:2])\n frame0, frame1 = tmp", "metadata": "root._image_series.test_getting_slice", "header": "['class', '_image_series', '(', '_image_single', ')', ':', '___EOS___']", "index": 72 } ]
[ { "span": "frame0,", "start_line": 75, "start_column": 8, "end_line": 75, "end_column": 14 }, { "span": "frame1 ", "start_line": 75, "start_column": 16, "end_line": 75, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "\\u", "image", "\\u", "series_", "(_", "\\u", "image", "\\u", "single_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "getti", "ng", "\\u", "slice_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "check", "\\u", "skip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp_", "=_", "list_", "(_", "self_", "._", "v_", "[_", "0_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame", "0_", ",_", "frame1_", "=_", "tmp_", "\\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, 0, 1, 2, 0, 2, 2, 2 ]
Unused import
nigelsmall/httpstream/setup.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Copyright 2012-2015 Nigel Small\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n\"\"\"\nHTTPStream is an HTTP client library for Python that is designed to allow\nincremental receipt and handling of web content.\n\"\"\"\n\n\ntry:\n from setuptools import setup\n from setuptools.extension import Extension\nexcept ImportError:\n from distutils.core import setup\n from distutils.extension import Extension\n\nfrom httpstream import __author__, __email__, __license__, __version__\n\n\nsetup(\n name=\"httpstream\",\n version=__version__,\n description=__doc__,\n long_description=open(\"README.rst\").read(),\n author=__author__,\n author_email=__email__,\n url=\"http://nigelsmall.com/httpstream\",\n packages=[\n \"httpstream\",\n\t\"httpstream.packages\",\n\t\"httpstream.packages.urimagic\",\n ],\n install_requires=[\n \"jsonstream>=1.0.0\",\n ],\n license=__license__,\n classifiers=[\n \"Development Status :: 5 - Production/Stable\",\n \"Intended Audience :: Developers\",\n \"License :: OSI Approved :: Apache Software License\",\n \"Operating System :: OS Independent\",\n \"Programming Language :: Python :: 2.7\",\n \"Programming Language :: Python :: 3.3\",\n \"Topic :: Internet :: WWW/HTTP\",\n \"Topic :: Software Development\",\n ],\n zip_safe=False,\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from setuptools.extension import Extension", "start_line": 26, "start_column": 4, "end_line": 26, "end_column": 46 }, { "span": "from distutils.extension import Extension", "start_line": 29, "start_column": 4, "end_line": 29, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", "-", "201", "5", " ", "Ni", "gel", " ", "Small", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "HTTP", "Stream", " ", "is", " ", "an", " ", "HTTP", " ", "client", " ", "librar", "y", " ", "for", " ", "Pyth", "on", " ", "tha", "t", " ", "is", " ", "design", "ed", " ", "to", " ", "allow", "\\", "10", ";", "incremental", " ", "receipt", " ", "and", " ", "handling", " ", "of", " ", "web", " ", "content", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "._", "extension_", "import_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "extension_", "import_", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "https", "tream_", "import_", "\\u\\u", "author\\u\\u_", ",_", "\\u\\u", "email\\u\\u_", ",_", "\\u\\u", "license\\u\\u_", ",_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "https", "tream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\\u\\u", "doc\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\\u\\u", "author\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\\u\\u", "email\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "ni", "gel", "small", ".", "com", "/", "https", "tream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "https", "tream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "https", "tream", ".", "package", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "https", "tream", ".", "package", "s", ".", "uri", "magic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "jsons", "tream", ">=", "1.0", ".0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\\u\\u", "license\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "Ap", "ache", " ", "Sof", "twa", "re", " ", "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", " ", "::", " ", "2.7", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Intern", "et", " ", "::", " ", "WW", "W", "/", "HTTP", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "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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 ]
Except block handles 'BaseException'
pytest-dev/pytest/_pytest/unittest.py
[ { "content": " def _addexcinfo(self, rawexcinfo):\n # unwrap potential exception info (see twisted trial support below)\n rawexcinfo = getattr(rawexcinfo, '_rawexcinfo', rawexcinfo)\n try:\n excinfo = _pytest._code.ExceptionInfo(rawexcinfo)\n except TypeError:\n try:\n try:\n l = traceback.format_exception(*rawexcinfo)\n l.insert(0, \"NOTE: Incompatible Exception Representation, \"\n \"displaying natively:\\n\\n\")\n pytest.fail(\"\".join(l), pytrace=False)\n except (pytest.fail.Exception, KeyboardInterrupt):\n raise\n except:\n pytest.fail(\"ERROR: Unknown Incompatible Exception \"\n \"representation:\\n%r\" %(rawexcinfo,), pytrace=False)\n except KeyboardInterrupt:\n raise\n except pytest.fail.Exception:\n excinfo = _pytest._code.ExceptionInfo()\n self.__dict__.setdefault('_excinfo', []).append(excinfo)", "metadata": "root.TestCaseFunction._addexcinfo", "header": "['class', 'TestCaseFunction', '(', 'pytest', '.', 'Function', ')', ':', '___EOS___']", "index": 98 } ]
[ { "span": "except:", "start_line": 112, "start_column": 16, "end_line": 112, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Case", "Function_", "(_", "pytest_", "._", "Function_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "adde", "xc", "info_", "(_", "self_", ",_", "raw", "excinfo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unwrap", " ", "potenti", "al", " ", "exception", " ", "info", " ", "(", "see", " ", "twist", "ed", " ", "tria", "l", " ", "support", " ", "belo", "w", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "excinfo_", "=_", "getattr_", "(_", "raw", "excinfo_", ",_", "'\\u", "raw", "exc", "info", "'_", ",_", "raw", "excinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "excinfo_", "=_", "\\u", "pytest_", "._", "\\u", "code_", "._", "Except", "ion", "Info_", "(_", "raw", "excinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "l_", "=_", "traceback_", "._", "format\\u", "exception_", "(_", "*_", "raw", "excinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "insert_", "(_", "0_", ",_", "\"", "NOTE", ":", " ", "Incomp", "atible", " ", "Except", "ion", " ", "Representation", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "ing", " ", "nativ", "el", "y", ":\\\\", "n", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pytest_", "._", "fail_", "(_", "\"\"_", "._", "join_", "(_", "l_", ")_", ",_", "pyt", "race_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "pytest_", "._", "fail_", "._", "Exception_", ",_", "Key", "board", "Interrupt_", ")_", ":_", "\\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_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pytest_", "._", "fail_", "(_", "\"", "ERROR", ":", " ", "Un", "know", "n", " ", "Incomp", "atible", " ", "Except", "ion", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "represent", "ation", ":\\\\", "n", "%", "r", "\"_", "%_", "(_", "raw", "excinfo_", ",_", ")_", ",_", "pyt", "race_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pytest_", "._", "fail_", "._", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "excinfo_", "=_", "\\u", "pytest_", "._", "\\u", "code_", "._", "Except", "ion", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "setdefault_", "(_", "'\\u", "exc", "info", "'_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "excinfo_", ")_", "\\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, 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 ]
Implicit string concatenation in a list
seanthegeek/phishforall/client/search.py
[ { "content": "from os import path\ntry:\n from os import scandir, walk\nexcept ImportError:\n from scandir import scandir, walk\n\nextensions = dict(documents=[\n \"pdf\",\n \"rtf\",\n \"doc\",\n \"dot\",\n \"docx\",\n \"docm\",\n \"dotm\",\n \"docb\",\n \"xls\",\n \"xlt\",\n \"xlm\",\n \"xlsx\",\n \"xlsm\",\n \"xltx\",\n \"xltm\",\n \"xlsb\",\n \"xla\",\n \"xlam\",\n \"xll\",\n \"xlw\",\n \"ppt\",\n \"pot\",\n \"ppt\",\n \"pps\",\n \"pptx\"\n \"pptm\",\n \"potx\",\n \"potm\",\n \"ppam\",\n \"ppsx\",\n \"ppsm\",\n \"sldx\",\n \"sdm\",\n \"mpd\",\n \"mpp\",\n \"mpt\",\n \"mpc\",\n \"mpv\",\n \"mxm\",\n \"vsd\",\n \"vsdx\",\n \"odt\",\n \"ott\",\n \"odm\",\n \"oth\",\n \"ods\",\n \"ots\",\n \"odg\",\n \"otg\",\n \"cdp\",\n \"otp\",\n \"odf\",\n \"oxt\"\n], plain_text=[\n \"txt\",\n \"csv\",\n \"html\"\n], databases=[\n \"db\",\n \"odb\",\n \"sqlite\",\n \"sql\",\n \"db3\",\n \"dbf\",\n \"sdb\",\n \"ibd\",\n \"db-journal\",\n \"db3\",\n \"dbf\",\n \"myd\",\n \"rsd\",\n \"sdf\",\n \"s3db\",\n \"ade\",\n \"adp\",\n \"adn\",\n \"accdb\",\n \"accdr\",\n \"accdt\"\n \"accda\"\n \"mdb\",\n \"cdb\",\n \"mda\",\n \"mda\",\n \"mdn\",\n \"mdt\",\n \"mdw\",\n \"mdf\",\n \"mde\",\n \"accde\",\n \"mam\",\n \"maq\",\n \"mar\",\n \"mat\",\n \"maf\"\n], images=[\n \"jpg\",\n \"jpeg\",\n \"exif\",\n \"tiff\",\n \"gif\",\n \"bmp\",\n \"png\"\n \"ppm\",\n \"pgm\",\n \"pbm\",\n \"pnm\",\n \"webp\",\n \"bgp\",\n \"svg\",\n \"psd\"\n], audio=[\n \"3gp\",\n \"act\",\n \"aiff\",\n \"acc\",\n \"ape\",\n \"au\",\n \"awb\",\n \"dct\",\n \"dvf\",\n \"flac\",\n \"gsm\",\n \"iklax\",\n \"ivs\",\n \"m4a\",\n \"m4p\",\n \"mp3\",\n \"mpc\",\n \"mpc\",\n \"msv\",\n \"ogg\",\n \"oga\",\n \"opus\",\n \"ra\",\n \"rm\",\n \"sln\",\n \"vox\",\n \"wav\",\n \"wma\",\n \"wv\"\n], video=[\n \"webm\",\n \"flv\",\n \"vob\",\n \"ogv\",\n \"ogg\",\n \"drc\",\n \"gifv\",\n \"mng\",\n \"avi\",\n \"mov\",\n \"qt\",\n \"wmv\",\n \"rm\",\n \"rmvb\",\n \"asf\",\n \"mp4\",\n \"m4p\",\n \"m4v\",\n \"mpg\",\n \"mp2\",\n \"mpeg\",\n \"mpe\",\n \"mpv\",\n \"mpg\",\n \"mpeg\",\n \"m2v\",\n \"m4v\",\n \"svi\",\n \"3gp\",\n \"mxf\",\n \"nsv\",\n \"f4v\",\n \"f4p\",\n \"f4a\",\n \"f4b\"\n], archives=[\n \"zip\",\n \"rar\",\n \"ace\",\n \"7z\",\n \"tar\"\n \"gz\",\n \"bz2\",\n \"iso\",\n \"dmg\"\n],emails=[\n \"msg\",\n \"eml\",\n \"pst\"\n], p2p=[\n \"torrent\"\n], pki=[\n \"key\",\n \"csr\",\n \"pem\",\n \"p7b\"\n], exes=[\n \"exe\",\n \"com\",\n \"msi\",\n \"bat\",\n \"ps1\",\n \"sh\",\n \"pkg\"\n], cad=[\n \"hpgl\",\n \"igs\",\n \"step\",\n \"stp\",\n \"fas\",\n\n], source=[\n \"h\",\n \"c\",\n \"cpp\"\n \"java\",\n \"asp\",\n \"aspx\",\n \"vcproj\",\n \"vbw\",\n \"cs\",\n \"fs\",\n \"bat\",\n \"vbs\",\n \"csx\",\n \"ps1\",\n \"cgi\",\n \"lua\",\n \"pl\",\n \"pm\",\n \"prl\",\n \"py\",\n \"axd\",\n \"php\",\n \"php3\",\n \"json\",\n \"do\",\n \"js\",\n \"css\",\n \"html\",\n \"asm\",\n \"asi\",\n \"sh\"\n]\n)\n\nall_extensions = []\n\nfor ext_type in extensions:\n all_extensions += extensions[ext_type]\n\nall_extensions = set(all_extensions)\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "\"pptx\"\n \"pptm\",", "start_line": 31, "start_column": 4, "end_line": 32, "end_column": 10 }, { "span": "\"accdt\"\n \"accda\"\n \"mdb\",", "start_line": 85, "start_column": 4, "end_line": 87, "end_column": 9 }, { "span": "\"png\"\n \"ppm\",", "start_line": 109, "start_column": 4, "end_line": 110, "end_column": 9 }, { "span": "\"tar\"\n \"gz\",", "start_line": 189, "start_column": 4, "end_line": 190, "end_column": 8 }, { "span": "\"cpp\"\n \"java\",", "start_line": 223, "start_column": 4, "end_line": 224, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "os_", "import_", "scan", "dir_", ",_", "walk_", "\\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_", "scan", "dir_", "import_", "scan", "dir_", ",_", "walk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extensions_", "=_", "dict_", "(_", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pdf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rt", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "doc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dot", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "docx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "doc", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dot", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "doc", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xls", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xls", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xls", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "tx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "tm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xls", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xla", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xla", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "xl", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pot", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pps", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppt", "x", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppt", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pot", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pot", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppa", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pps", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pps", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sld", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sd", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mx", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vs", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vs", "dx", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "od", "t", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ott", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "od", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oth", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ods", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ots", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "od", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ot", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cdp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "otp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "od", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ox", "t", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "plain", "\\u", "text_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "csv", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "html", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "databases_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "db", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "odb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sql", "ite", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sql", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "db", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dbf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sdb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ib", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "db", "-", "journal", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "db", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dbf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "myd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rsd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sdf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "s3", "db", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ade", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ad", "p", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ad", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "db", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "dr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "dt", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "da", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mdb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cdb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mda", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mda", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "md", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mdt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "md", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "md", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mde", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "de", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mam", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ma", "q", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mat", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "maf", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "images_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "jp", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "jpeg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "exif", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tiff", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gif", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bm", "p", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "png", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ppm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pgm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pbm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pn", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "webp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bgp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "svg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "psd", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "audio_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "3", "gp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "act", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "aif", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ape", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "au", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "aw", "b", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dct", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dv", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flac", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gsm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ik", "la", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "iv", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m4", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m4", "p", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpc", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "msv", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ogg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "oga", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "opu", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ra", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sl", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vox", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wav", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wma", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wv", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "video_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "webm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fl", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vob", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "og", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ogg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dr", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gif", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mn", "g", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "avi", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mov", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "qt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wm", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rm", "vb", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m4", "p", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m4", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpeg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpe", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mp", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mpeg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m2", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "m4", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sv", "i", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "3", "gp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mx", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ns", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "f4", "v", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "f4", "p", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "f4", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "f4", "b", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "archives", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "zip", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ace", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "7", "z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tar", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gz", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bz2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "iso", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "dmg", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "emails_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "msg", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "em", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pst", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "p2p", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "torr", "ent", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "pki", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "csr", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pe", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "p", "7b", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "exe", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "exe", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "msi", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bat", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ps", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sh", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pkg", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "cad", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hp", "gl", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ig", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "step", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fas", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "source_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cpp", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "java", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asp", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vc", "proj", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vb", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bat", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vb", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cs", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ps", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cgi", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lua", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pl", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pr", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ax", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "php", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "php", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "json", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "do", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "js", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "css", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "html", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asm", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asi", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sh", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "all", "\\u", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ext", "\\u", "type_", "in_", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "extensions_", "+=_", "extensions_", "[_", "ext", "\\u", "type_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u",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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/assembly.py
[ { "content": " def _connect(self, src, dest):\n \"\"\"Handle one connection destination. This should only be called via\n the connect() function, never directly.\n \"\"\"\n try:\n try:\n srcexpr, destexpr = self._check_connect(src, dest)\n\n self._connections.append((srcexpr, destexpr))\n\n destval = destexpr.evaluate()\n if isinstance(destval, ndarray) and destval.size == 0:\n destexpr.set(srcexpr.evaluate(), self)\n\n self._check_dest(srcexpr, destexpr)\n\n except AttributeError as err:\n exc_type, value, traceback = sys.exc_info()\n\n invalid_vars = srcexpr.get_unresolved() + destexpr.get_unresolved()\n parts = invalid_vars[0].rsplit('.', 1)\n\n parent = repr(self.name) if self.name else 'top level assembly'\n vname = repr(parts[0])\n\n if len(parts) > 1:\n parent = repr(parts[0])\n vname = repr(parts[1])\n\n msg = \"{parent} has no variable {vname}\"\n msg = msg.format(parent=parent, vname=vname)\n\n raise exc_type, exc_type(msg), traceback\n except:\n info = sys.exc_info()\n self.reraise_exception(\"Can't connect '%s' to '%s': \" %\n (src, dest), info)\n\n self.config_changed()", "metadata": "root.Assembly._connect", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 595 }, { "content": " def setup_depgraph(self, dgraph=None):\n # create our depgraph\n self._depgraph = DependencyGraph()\n\n # add all of the components and their var nodes, and any of\n # our own variables as boundary var nodes.\n for name in self.list_inputs():\n self._depgraph.add_boundary_var(self, name,\n iotype='in')\n\n for name in self.list_outputs():\n self._depgraph.add_boundary_var(self, name,\n iotype='out')\n\n for cname in self.list_containers():\n obj = getattr(self, cname)\n if cname not in self._depgraph and has_interface(obj, IComponent):\n self._depgraph.add_component(cname, obj)\n\n # add our connections to the graph. Some connections, e.g.,\n # connections with unit conversions and connections involving\n # multivariable source expressions, will require the creation of\n # PseudoComponents. These must also be represented in the graph.\n for srcexpr, destexpr in self._connections:\n src = srcexpr.text\n dest = destexpr.text\n try:\n pcomp_type = self._needs_pseudo(srcexpr, destexpr)\n if pcomp_type:\n if pcomp_type == 'units':\n pseudocomp = UnitConversionPComp(self, srcexpr, destexpr,\n pseudo_type=pcomp_type)\n else:\n pseudocomp = PseudoComponent(self, srcexpr, destexpr,\n pseudo_type=pcomp_type)\n pseudocomp.activate(self)\n else:\n pseudocomp = None\n self._depgraph.check_connect(src, dest)\n dcomps = destexpr.get_referenced_compnames()\n scomps = srcexpr.get_referenced_compnames()\n for dname in dcomps:\n if dname in scomps:\n raise RuntimeError(\"Both refer to the same component.\")\n for cname in chain(dcomps, scomps):\n comp = getattr(self, cname)\n if has_interface(comp, IComponent):\n comp.config_changed(update_parent=False)\n\n for vname in chain(srcexpr.get_referenced_varpaths(copy=False),\n destexpr.get_referenced_varpaths(copy=False)):\n if not self.contains(vname):\n raise AttributeError(\"Can't find '%s'\" % vname)\n\n self._depgraph.connect(self, src, dest)\n except:\n self.reraise_exception(\"Can't connect '%s' to '%s': \" %\n (src, dest), sys.exc_info())\n\n # add connections for params, constraints, etc.\n for cname in self.list_containers():\n obj = getattr(self, cname)\n if hasattr(obj, 'get_parameters'):\n for param in obj.get_parameters().values():\n self._depgraph.add_param(obj.name, tuple(param.targets))\n\n if hasattr(obj, 'get_constraints'):\n for constraint in obj.get_constraints().values():\n constraint.activate(obj)\n\n if hasattr(obj, 'get_2sided_constraints'):\n for constraint in obj.get_2sided_constraints().values():\n constraint.activate(obj)\n\n if hasattr(obj, 'get_objectives'):\n for objective in obj.get_objectives().values():\n objective.activate(obj)\n\n if hasattr(obj, 'get_responses'):\n for res in obj.get_responses().values():\n res.activate(obj)\n\n for comp in self.get_comps():\n if has_interface(comp, IDriver) or has_interface(comp, IAssembly):\n comp.setup_depgraph(self._depgraph)", "metadata": "root.Assembly.setup_depgraph", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1203 }, { "content": " def get_all_local_vars(self):\n \"\"\"Return the set of all variables in this Assembly and any\n of its children that are local to the current MPI process.\n \"\"\"\n all_locs = set()\n all_locs.update(self.list_inputs())\n all_locs.update(self.list_outputs())\n\n for s in [self._system] + list(self._system.local_subsystems(recurse=True)):\n if isinstance(s, SimpleSystem):\n try:\n obj = self.get(s.name)\n except:\n continue\n if has_interface(obj, IAssembly):\n all_locs.update(['.'.join([obj.name, n])\n for n in obj.get_all_local_vars()])\n elif has_interface(obj, IComponent):\n lvars = ['.'.join([obj.name, n])\n for n in obj.list_inputs() +\n obj.list_outputs()]\n for i, v in enumerate(lvars):\n if v in s.distrib_idxs:\n lvars[i] = (v,) # wrap in tuple to indicate its a distrib var\n all_locs.update(lvars)\n\n elif isinstance(s, ParamSystem):\n all_locs.add(s.name)\n\n return all_locs", "metadata": "root.Assembly.get_all_local_vars", "header": "['class', 'Assembly', '(', 'Component', ')', ':', '___EOS___']", "index": 1589 } ]
[ { "span": "except:", "start_line": 628, "start_column": 8, "end_line": 628, "end_column": 15 }, { "span": "except:", "start_line": 1258, "start_column": 12, "end_line": 1258, "end_column": 19 }, { "span": "except:", "start_line": 1601, "start_column": 16, "end_line": 1601, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "one", " ", "connecti", "on", " ", "destinat", "ion", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "be", " ", "call", "ed", " ", "via", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "connect", "()", " ", "function", ",", " ", "neve", "r", " ", "direct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "src", "expr_", ",_", "dest", "expr_", "=_", "self_", "._", "\\u", "check", "\\u", "connect_", "(_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "connections_", "._", "append_", "(_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "val_", "=_", "dest", "expr_", "._", "evaluate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "dest", "val_", ",_", "ndarray_", ")_", "and_", "dest", "val_", "._", "size_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dest", "expr_", "._", "set_", "(_", "src", "expr_", "._", "evaluate_", "(_", ")_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "dest_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "type_", ",_", "value_", ",_", "traceback_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invalid", "\\u", "vars_", "=_", "src", "expr_", "._", "get", "\\u", "unresolv", "ed_", "(_", ")_", "+_", "dest", "expr_", "._", "get", "\\u", "unresolv", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "invalid", "\\u", "vars_", "[_", "0_", "]_", "._", "rsplit_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "repr_", "(_", "self_", "._", "name_", ")_", "if_", "self_", "._", "name_", "else_", "'", "top", " ", "level", " ", "assem", "bly", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vname_", "=_", "repr_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parent_", "=_", "repr_", "(_", "parts_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vname_", "=_", "repr_", "(_", "parts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "\"{", "parent", "}", " ", "has", " ", "no", " ", "variab", "le", " ", "{", "vn", "ame", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "msg_", "._", "format_", "(_", "parent_", "=_", "parent_", ",_", "vname_", "=_", "vname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "exc", "\\u", "type_", ",_", "exc", "\\u", "type_", "(_", "msg_", ")_", ",_", "traceback_", "\\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 ", " _", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reraise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "connect", " ", "'%", "s", "'", " ", "to", " ", "'%", "s", "':", " ", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src_", ",_", "dest_", ")_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "config", "\\u", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "dep", "graph_", "(_", "self_", ",_", "dgr", "aph", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "our", " ", "dep", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "=_", "Dependenc", "y", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "all", " ", "of", " ", "the", " ", "component", "s", " ", "and", " ", "thei", "r", " ", "var", " ", "nodes", ",", " ", "and", " ", "any", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "our", " ", "own", " ", "variab", "les", " ", "as", " ", "bound", "ary", " ", "var", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "bound", "ary", "\\u", "var_", "(_", "self_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iot", "ype_", "=_", "'", "in", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "bound", "ary", "\\u", "var_", "(_", "self_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iot", "ype_", "=_", "'", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cname_", "not_", "in_", "self_", "._", "\\u", "dep", "graph_", "and_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "component_", "(_", "cname_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "our", " ", "connections", " ", "to", " ", "the", " ", "graph", ".", " ", " ", "Some", " ", "connections", ",", " ", "e", ".", "g", ".,", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "connections", " ", "with", " ", "unit", " ", "conversions", " ", "and", " ", "connections", " ", "involv", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multiv", "aria", "ble", " ", "source", " ", "express", "ion", "s", ",", " ", "will", " ", "require", " ", "the", " ", "creati", "on", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pse", "udo", "Compo", "nent", "s", ".", " ", " ", "The", "se", " ", "must", " ", "als", "o", " ", "be", " ", "represent", "ed", " ", "in", " ", "the", " ", "graph", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "src", "expr_", ",_", "dest", "expr_", "in_", "self_", "._", "\\u", "connections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src_", "=_", "src", "expr_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest_", "=_", "dest", "expr_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pco", "mp", "\\u", "type_", "=_", "self_", "._", "\\u", "need", "s", "\\u", "pseudo", "_", "(_", "src", "expr_", ",_", "dest", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pco", "mp", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "pco", "mp", "\\u", "type_", "==_", "'", "unit", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pseudo", "comp_", "=_", "Unit", "Conversion", "PC", "omp", "_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pseudo", "\\u", "type_", "=_", "pco", "mp", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pseudo", "comp_", "=_", "Pse", "udo", "Component_", "(_", "self_", ",_", "src", "expr_", ",_", "dest", "expr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pseudo", "\\u", "type_", "=_", "pco", "mp", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pseudo", "comp_", "._", "activate_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pseudo", "comp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dep", "graph_", "._", "check", "\\u", "connect_", "(_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dco", "mps_", "=_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sco", "mps_", "=_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "comp", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dname_", "in_", "dco", "mps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "dname_", "in_", "sco", "mps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Bot", "h", " ", "refer", " ", "to", " ", "the", " ", "same", " ", "component", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "chain_", "(_", "dco", "mps_", ",_", "sco", "mps_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comp_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comp_", "._", "config", "\\u", "changed_", "(_", "update", "\\u", "parent_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "vname_", "in_", "chain_", "(_", "src", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", "copy_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "expr_", "._", "get", "\\u", "referenced", "\\u", "var", "paths_", "(_", "copy_", "=_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "contains_", "(_", "vname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "Can", "'", "t", " ", "find", " ", "'%", "s", "'\"_", "%_", "vname_", ")_", "\\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", "dep", "graph_", "._", "connect_", "(_", "self_", ",_", "src_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reraise", "\\u", "exception_", "(_", "\"", "Can", "'", "t", " ", "connect", " ", "'%", "s", "'", " ", "to", " ", "'%", "s", "':", " ", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "src_", ",_", "dest_", ")_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "connections", " ", "for", " ", "params", ",", " ", "constraint", "s", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cname_", "in_", "self_", "._", "list", "\\u", "containers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "getattr_", "(_", "self_", ",_", "cname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "parameter", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "param_", "in_", "obj_", "._", "get", "\\u", "parameters_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "dep", "graph_", "._", "add", "\\u", "param_", "(_", "obj_", "._", "name_", ",_", "tuple_", "(_", "param_", "._", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "constraint", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "constraint_", "in_", "obj_", "._", "get", "\\u", "constraints_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "constraint_", "._", "activate_", "(_", "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_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "2s", "ide", "d\\u", "constraint", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "constraint_", "in_", "obj_", "._", "get", "\\u", "2s", "ide", "d\\u", "constraints_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "constraint_", "._", "activate_", "(_", "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_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "objectives", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "objective_", "in_", "obj_", "._", "get", "\\u", "objectives", "_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "objective_", "._", "activate_", "(_", "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_", "hasattr_", "(_", "obj_", ",_", "'", "get", "\\u", "response", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "res_", "in_", "obj_", "._", "get", "\\u", "responses_", "(_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "._", "activate_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "comp_", "in_", "self_", "._", "get", "\\u", "comps_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "has", "\\u", "interface_", "(_", "comp_", ",_", "ID", "river", "_", ")_", "or_", "has", "\\u", "interface_", "(_", "comp_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comp_", "._", "setup", "\\u", "dep", "graph_", "(_", "self_", "._", "\\u", "dep", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Asse", "mbly", "_", "(_", "Component_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "all", "\\u", "local", "\\u", "vars_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "set", " ", "of", " ", "all", " ", "variab", "les", " ", "in", " ", "this", " ", "Asse", "mbly", " ", "and", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "its", " ", "child", "ren", " ", "tha", "t", " ", "are", " ", "local", " ", "to", " ", "the", " ", "current", " ", "MPI", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "self_", "._", "list", "\\u", "inputs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "self_", "._", "list", "\\u", "outputs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "[_", "self_", "._", "\\u", "system_", "]_", "+_", "list_", "(_", "self_", "._", "\\u", "system_", "._", "local", "\\u", "subsystem", "s_", "(_", "recurse_", "=_", "True_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "Simple", "System_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "=_", "self_", "._", "get_", "(_", "s_", "._", "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 ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IA", "sse", "mbly", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "all", "\\u", "locs_", "._", "update_", "(_", "[_", "'.'_", "._", "join_", "(_", "[_", "obj_", "._", "name_", ",_", "n_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "obj_", "._", "get", "\\u", "all", "\\u", "local", "\\u", "vars_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "has", "\\u", "interface_", "(_", "obj_", ",_", "IC", "omp", "one", "nt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lv", "ars_", "=_", "[_", "'.'_", "._", "join_", "(_", "[_", "obj_", "._", "name_", ",_", "n_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "obj_", "._", "list", "\\u", "inputs_", "(_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "list", "\\u", "outputs_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "lv", "ars_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "v_", "in_", "s_", "._", "distri", "b", "\\u", "idxs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "lv", "ars_", "[_", "i_", "]_", "=_", "(_", "v_", ",_", ")_", "#", " ", "wrap", " ", "in", " ", "tuple", " ", "to", " ", "indicat", "e", " ", "its", " ", "a", " ", "distri", "b", " ", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "all", "\\u", "locs_", "._", "update_", "(_", "lv", "ars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "s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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
python-beaver/python-beaver/beaver/tests/test_glob_sections.py
[ { "content": " def test_globs(self):\n files = [os.path.realpath(x) for x in glob.glob('tests/logs/0x[0-9]*.log')]\n for file in self.beaver_config.getfilepaths():\n self.assertTrue(file in files)", "metadata": "root.ConfigTests.test_globs", "header": "['class', 'ConfigTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 } ]
[ { "span": "self.assertTrue(file in files)", "start_line": 22, "start_column": 12, "end_line": 22, "end_column": 42 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Config", "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", "globs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "=_", "[_", "os_", "._", "path_", "._", "realpath_", "(_", "x_", ")_", "for_", "x_", "in_", "glob_", "._", "glob_", "(_", "'", "tests", "/", "logs", "/", "0", "x", "[", "0", "-", "9", "]*", ".", "log", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file_", "in_", "self_", "._", "bea", "ver", "\\u", "config_", "._", "getfile", "paths_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "file_", "in_", "files_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Imprecise assert
ffunenga/pipgh/tests/cli/test_main.py
[ { "content": " def test_init_doc(self):\n doc = pipgh.__doc__\n self.assertTrue(doc != None)\n self.assertTrue('Usage:' in doc)\n self.assertTrue('Commands:' in doc)\n self.assertTrue('Options:' in doc)\n self.assertTrue('Examples:' in doc)", "metadata": "root.TestMain.test_init_doc", "header": "['class', 'TestMain', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_cli_fails_output(self):\n # pipgh [--auth] search (...)\n # pipgh [--auth] show (...)\n # pipgh install (...)\n # pipgh [-h | --help | --version]\n argvs = [\n ([], pipgh.pipgh.USAGE_MESSAGE),\n ([], pipgh.__version__),\n (['-h'], pipgh.pipgh.USAGE_MESSAGE),\n (['--help'], pipgh.pipgh.USAGE_MESSAGE),\n (['-h'], pipgh.pipgh.HELP_MESSAGE.strip()),\n (['--help'], pipgh.pipgh.HELP_MESSAGE.strip()),\n (['--version'], pipgh.__version__),\n ]\n for idx, (argv, output) in enumerate(argvs):\n try:\n pipgh.main(argv, dry_run=True)\n except SystemExit as e:\n args = e.args\n else:\n _err = 'ArgvCase#%d %s failed to SystemExit' % (idx, str(argv))\n raise AssertionError(_err)\n try:\n self.assertTrue(output in args[0])\n except AssertionError as e:\n _err = 'ArgvCase#%d %s failed SystemExit\\'s output'\n e.args = (_err % (idx, str(argv)),)\n raise", "metadata": "root.TestMain.test_cli_fails_output", "header": "['class', 'TestMain', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 } ]
[ { "span": "self.assertTrue(doc != None)", "start_line": 11, "start_column": 8, "end_line": 11, "end_column": 36 }, { "span": "self.assertTrue('Usage:' in doc)", "start_line": 12, "start_column": 8, "end_line": 12, "end_column": 40 }, { "span": "self.assertTrue('Commands:' in doc)", "start_line": 13, "start_column": 8, "end_line": 13, "end_column": 43 }, { "span": "self.assertTrue('Options:' in doc)", "start_line": 14, "start_column": 8, "end_line": 14, "end_column": 42 }, { "span": "self.assertTrue('Examples:' in doc)", "start_line": 15, "start_column": 8, "end_line": 15, "end_column": 43 }, { "span": "self.assertTrue(output in args[0])", "start_line": 70, "start_column": 16, "end_line": 70, "end_column": 50 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Main_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "init", "\\u", "doc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "pip", "gh_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "doc_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Us", "age", ":'_", "in_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Command", "s", ":'_", "in_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Optio", "ns", ":'_", "in_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Exam", "ples", ":'_", "in_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Main_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cli", "\\u", "fail", "s", "\\u", "output_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pip", "gh", " ", "[-", "-", "auth", "]", " ", "search", " ", "(...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pip", "gh", " ", "[-", "-", "auth", "]", " ", "show", " ", "(...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pip", "gh", " ", "install", " ", "(...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pip", "gh", " ", "[-", "h", " ", "|", " ", "--", "help", " ", "|", " ", "--", "version", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argv", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "]_", ",_", "pip", "gh_", "._", "pip", "gh_", "._", "USAGE", "\\u", "MESSAGE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "]_", ",_", "pip", "gh_", "._", "\\u\\u", "version\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'-", "h", "'_", "]_", ",_", "pip", "gh_", "._", "pip", "gh_", "._", "USAGE", "\\u", "MESSAGE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "help", "'_", "]_", ",_", "pip", "gh_", "._", "pip", "gh_", "._", "USAGE", "\\u", "MESSAGE_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'-", "h", "'_", "]_", ",_", "pip", "gh_", "._", "pip", "gh_", "._", "HELP", "\\u", "MESSAGE_", "._", "strip_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "help", "'_", "]_", ",_", "pip", "gh_", "._", "pip", "gh_", "._", "HELP", "\\u", "MESSAGE_", "._", "strip_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "[_", "'--", "version", "'_", "]_", ",_", "pip", "gh_", "._", "\\u\\u", "version\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "(_", "argv_", ",_", "output_", ")_", "in_", "enumerate_", "(_", "argv", "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 ", " _", "pip", "gh_", "._", "main_", "(_", "argv_", ",_", "dry", "\\u", "run_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "e_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "err_", "=_", "'", "Arg", "v", "Case", "#", "%", "d", " ", "%", "s", " ", "fail", "ed", " ", "to", " ", "System", "Exi", "t", "'_", "%_", "(_", "idx_", ",_", "str_", "(_", "argv_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Assert", "ion", "Error_", "(_", "\\u", "err_", ")_", "\\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_", "._", "assert", "True_", "(_", "output_", "in_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "err_", "=_", "'", "Arg", "v", "Case", "#", "%", "d", " ", "%", "s", " ", "fail", "ed", " ", "System", "Exi", "t", "\\\\'", "s", " ", "output", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "args_", "=_", "(_", "\\u", "err_", "%_", "(_", "idx_", ",_", "str_", "(_", "argv_", ")_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
snare/voltron/voltron/plugins/debugger/dbg_vdb.py
[ { "content": " @lock_host\n def command(self, command=None):\n \"\"\"\n Execute a command in the debugger.\n\n `command` is the command string to execute.\n \"\"\"\n if command:\n # well, this is hacky...\n # hook the canvas to capture a command's output\n oldcan = self._vdb.canvas\n newcan = envi.memcanvas.StringMemoryCanvas(self._vdb.memobj, self._vdb.symobj)\n try:\n self._vdb.canvas = newcan\n self._vdb.onecmd(command)\n finally:\n self._vdb.canvas = oldcan\n return str(newcan).rstrip(\"\\n\")\n else:\n raise Exception(\"No command specified\")\n\n return res", "metadata": "root.VDBAdaptor.command", "header": "['class', 'VDBAdaptor', '(', 'DebuggerAdaptor', ')', ':', '___EOS___']", "index": 376 } ]
[ { "span": "return res", "start_line": 397, "start_column": 12, "end_line": 397, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "VD", "BA", "dap", "tor_", "(_", "Debugger", "Adapt", "or_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lock", "\\u", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "command_", "(_", "self_", ",_", "command_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Execut", "e", " ", "a", " ", "command", " ", "in", " ", "the", " ", "debugg", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "command", "`", " ", "is", " ", "the", " ", "command", " ", "string", " ", "to", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "well", ",", " ", "this", " ", "is", " ", "hack", "y", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hook", " ", "the", " ", "canv", "as", " ", "to", " ", "captur", "e", " ", "a", " ", "command", "'", "s", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oldc", "an_", "=_", "self_", "._", "\\u", "vdb", "_", "._", "canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "an_", "=_", "envi", "_", "._", "memc", "anv", "as_", "._", "String", "Memo", "ry", "Canvas_", "(_", "self_", "._", "\\u", "vdb", "_", "._", "memo", "bj_", ",_", "self_", "._", "\\u", "vdb", "_", "._", "sym", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "vdb", "_", "._", "canvas_", "=_", "newc", "an_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vdb", "_", "._", "one", "cmd_", "(_", "command_", ")_", "\\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", "vdb", "_", "._", "canvas_", "=_", "oldc", "an_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "newc", "an_", ")_", "._", "rstrip_", "(_", "\"\\\\", "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 ", " _", "raise_", "Exception_", "(_", "\"", "No", " ", "command", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2 ]
Unused import
ithinksw/philo/philo/contrib/julian/migrations/0001_initial.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'julian.calendar': {\n 'Meta': {'unique_together': \"(('name', 'site', 'language'),)\", 'object_name': 'Calendar'},\n 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'events': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"'calendars'\", 'blank': 'True', 'to': \"orm['julian.Event']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'language': ('django.db.models.fields.CharField', [], {'default': \"'en'\", 'max_length': '5'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['sites.Site']\"}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'db_index': 'True'})\n },\n 'julian.calendarview': {\n 'Meta': {'object_name': 'CalendarView'},\n 'calendar': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['julian.Calendar']\"}),\n 'event_detail_page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'calendar_detail_related'\", 'to': \"orm['philo.Page']\"}),\n 'events_per_page': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'feed_length': ('django.db.models.fields.PositiveIntegerField', [], {'default': '15', 'null': 'True', 'blank': 'True'}),\n 'feed_suffix': ('django.db.models.fields.CharField', [], {'default': \"'feed'\", 'max_length': '255'}),\n 'feed_type': ('django.db.models.fields.CharField', [], {'default': \"'text/calendar'\", 'max_length': '50'}),\n 'feeds_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'index_page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'calendar_index_related'\", 'to': \"orm['philo.Page']\"}),\n 'item_description_template': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'julian_calendarview_description_related'\", 'null': 'True', 'to': \"orm['philo.Template']\"}),\n 'item_title_template': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'julian_calendarview_title_related'\", 'null': 'True', 'to': \"orm['philo.Template']\"}),\n 'location_archive_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_location_archive_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'location_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_location_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'location_permalink_base': ('django.db.models.fields.CharField', [], {'default': \"'locations'\", 'max_length': '30'}),\n 'owner_archive_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_owner_archive_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'owner_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_owner_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'owner_permalink_base': ('django.db.models.fields.CharField', [], {'default': \"'owners'\", 'max_length': '30'}),\n 'tag_archive_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_tag_archive_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'tag_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_tag_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"}),\n 'tag_permalink_base': ('django.db.models.fields.CharField', [], {'default': \"'tags'\", 'max_length': '30'}),\n 'timespan_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'calendar_timespan_related'\", 'null': 'True', 'to': \"orm['philo.Page']\"})\n },\n 'julian.event': {\n 'Meta': {'unique_together': \"(('site', 'created'),)\", 'object_name': 'Event'},\n 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),\n 'description': ('philo.models.fields.TemplateField', [], {}),\n 'end_date': ('django.db.models.fields.DateField', [], {}),\n 'end_time': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'location_content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\", 'null': 'True', 'blank': 'True'}),\n 'location_pk': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'owned_events'\", 'to': \"orm['auth.User']\"}),\n 'parent_event': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['julian.Event']\", 'null': 'True', 'blank': 'True'}),\n 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['sites.Site']\"}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),\n 'start_date': ('django.db.models.fields.DateField', [], {}),\n 'start_time': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),\n 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': \"'events'\", 'null': 'True', 'symmetrical': 'False', 'to': \"orm['philo.Tag']\"})\n },\n 'julian.location': {\n 'Meta': {'object_name': 'Location'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})\n },\n 'philo.attribute': {\n 'Meta': {'unique_together': \"(('key', 'entity_content_type', 'entity_object_id'), ('value_content_type', 'value_object_id'))\", 'object_name': 'Attribute'},\n 'entity_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'attribute_entity_set'\", 'to': \"orm['contenttypes.ContentType']\"}),\n 'entity_object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),\n 'value_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'attribute_value_set'\", 'null': 'True', 'to': \"orm['contenttypes.ContentType']\"}),\n 'value_object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})\n },\n 'philo.node': {\n 'Meta': {'object_name': 'Node'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'children'\", 'null': 'True', 'to': \"orm['philo.Node']\"}),\n 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),\n 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'view_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'node_view_set'\", 'to': \"orm['contenttypes.ContentType']\"}),\n 'view_object_id': ('django.db.models.fields.PositiveIntegerField', [], {})\n },\n 'philo.page': {\n 'Meta': {'object_name': 'Page'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'pages'\", 'to': \"orm['philo.Template']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n },\n 'philo.tag': {\n 'Meta': {'ordering': \"('name',)\", 'object_name': 'Tag'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})\n },\n 'philo.template': {\n 'Meta': {'object_name': 'Template'},\n 'code': ('philo.models.fields.TemplateField', [], {}),\n 'documentation': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'mimetype': ('django.db.models.fields.CharField', [], {'default': \"'text/html'\", 'max_length': '255'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'children'\", 'null': 'True', 'to': \"orm['philo.Template']\"}),\n 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),\n 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})\n },\n 'sites.site': {\n 'Meta': {'ordering': \"('domain',)\", 'object_name': 'Site', 'db_table': \"'django_site'\"},\n 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),\n 'root_node': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'sites'\", 'null': 'True', 'to': \"orm['philo.Node']\"})\n }\n }\n\n complete_apps = ['julian']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def forwards(self, orm):\n \n # Adding model 'Location'\n db.create_table('julian_location', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255, db_index=True)),\n ))\n db.send_create_signal('julian', ['Location'])\n\n # Adding model 'Event'\n db.create_table('julian_event', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('start_date', self.gf('django.db.models.fields.DateField')()),\n ('start_time', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),\n ('end_date', self.gf('django.db.models.fields.DateField')()),\n ('end_time', self.gf('django.db.models.fields.TimeField')(null=True, blank=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),\n ('slug', self.gf('django.db.models.fields.SlugField')(max_length=255, db_index=True)),\n ('location_content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'], null=True, blank=True)),\n ('location_pk', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('description', self.gf('philo.models.fields.TemplateField')()),\n ('parent_event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['julian.Event'], null=True, blank=True)),\n ('owner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='owned_events', to=orm['auth.User'])),\n ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),\n ('last_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),\n ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'])),\n ))\n db.send_create_signal('julian', ['Event'])\n\n # Adding unique constraint on 'Event', fields ['site', 'created']\n db.create_unique('julian_event', ['site_id', 'created'])\n\n # Adding M2M table for field tags on 'Event'\n db.create_table('julian_event_tags', (\n ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),\n ('event', models.ForeignKey(orm['julian.event'], null=False)),\n ('tag', models.ForeignKey(orm['philo.tag'], null=False))\n ))\n db.create_unique('julian_event_tags', ['event_id', 'tag_id'])\n\n # Adding model 'Calendar'\n db.create_table('julian_calendar', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),\n ('slug', self.gf('django.db.models.fields.SlugField')(max_length=100, db_index=True)),\n ('description', self.gf('django.db.models.fields.TextField')(blank=True)),\n ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'])),\n ('language', self.gf('django.db.models.fields.CharField')(default='en', max_length=5)),\n ))\n db.send_create_signal('julian', ['Calendar'])\n\n # Adding unique constraint on 'Calendar', fields ['name', 'site', 'language']\n db.create_unique('julian_calendar', ['name', 'site_id', 'language'])\n\n # Adding M2M table for field events on 'Calendar'\n db.create_table('julian_calendar_events', (\n ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),\n ('calendar', models.ForeignKey(orm['julian.calendar'], null=False)),\n ('event', models.ForeignKey(orm['julian.event'], null=False))\n ))\n db.create_unique('julian_calendar_events', ['calendar_id', 'event_id'])\n\n # Adding model 'CalendarView'\n db.create_table('julian_calendarview', (\n ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),\n ('feed_type', self.gf('django.db.models.fields.CharField')(default='text/calendar', max_length=50)),\n ('feed_suffix', self.gf('django.db.models.fields.CharField')(default='feed', max_length=255)),\n ('feeds_enabled', self.gf('django.db.models.fields.BooleanField')(default=True)),\n ('feed_length', self.gf('django.db.models.fields.PositiveIntegerField')(default=15, null=True, blank=True)),\n ('item_title_template', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='julian_calendarview_title_related', null=True, to=orm['philo.Template'])),\n ('item_description_template', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='julian_calendarview_description_related', null=True, to=orm['philo.Template'])),\n ('calendar', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['julian.Calendar'])),\n ('index_page', self.gf('django.db.models.fields.related.ForeignKey')(related_name='calendar_index_related', to=orm['philo.Page'])),\n ('event_detail_page', self.gf('django.db.models.fields.related.ForeignKey')(related_name='calendar_detail_related', to=orm['philo.Page'])),\n ('timespan_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_timespan_related', null=True, to=orm['philo.Page'])),\n ('tag_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_tag_related', null=True, to=orm['philo.Page'])),\n ('location_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_location_related', null=True, to=orm['philo.Page'])),\n ('owner_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_owner_related', null=True, to=orm['philo.Page'])),\n ('tag_archive_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_tag_archive_related', null=True, to=orm['philo.Page'])),\n ('location_archive_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_location_archive_related', null=True, to=orm['philo.Page'])),\n ('owner_archive_page', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='calendar_owner_archive_related', null=True, to=orm['philo.Page'])),\n ('tag_permalink_base', self.gf('django.db.models.fields.CharField')(default='tags', max_length=30)),\n ('owner_permalink_base', self.gf('django.db.models.fields.CharField')(default='owners', max_length=30)),\n ('location_permalink_base', self.gf('django.db.models.fields.CharField')(default='locations', max_length=30)),\n ('events_per_page', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True)),\n ))\n db.send_create_signal('julian', ['CalendarView'])", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": " def backwards(self, orm):\n \n # Removing unique constraint on 'Calendar', fields ['name', 'site', 'language']\n db.delete_unique('julian_calendar', ['name', 'site_id', 'language'])\n\n # Removing unique constraint on 'Event', fields ['site', 'created']\n db.delete_unique('julian_event', ['site_id', 'created'])\n\n # Deleting model 'Location'\n db.delete_table('julian_location')\n\n # Deleting model 'Event'\n db.delete_table('julian_event')\n\n # Removing M2M table for field tags on 'Event'\n db.delete_table('julian_event_tags')\n\n # Deleting model 'Calendar'\n db.delete_table('julian_calendar')\n\n # Removing M2M table for field events on 'Calendar'\n db.delete_table('julian_calendar_events')\n\n # Deleting model 'CalendarView'\n db.delete_table('julian_calendarview')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 98 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "julia", "n", ".", "calendar", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "name", "',", " ", "'", "site", "',", " ", "'", "language", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Cal", "enda", "r", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "events", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "s", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "julia", "n", ".", "Event", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "language", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "en", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "sites", ".", "Site", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "julia", "n", ".", "calendar", "view", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Cal", "enda", "r", "View", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "calendar", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "julia", "n", ".", "Cal", "enda", "r", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "event", "\\u", "deta", "il", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "deta", "il", "\\u", "relate", "d", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "events", "\\u", "per", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "length", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "15", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "suff", "ix", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "feed", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "text", "/", "calendar", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "feed", "s", "\\u", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "index", "\\u", "relate", "d", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "item", "\\u", "description", "\\u", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "julia", "n", "\\u", "calendar", "view", "\\u", "description", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "item", "\\u", "title", "\\u", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "julia", "n", "\\u", "calendar", "view", "\\u", "title", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "\\u", "archive", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "location", "\\u", "archive", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "location", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "\\u", "permalink", "\\u", "base", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "location", "s", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "archive", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "owner", "\\u", "archive", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "owner", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "\\u", "permalink", "\\u", "base", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "owner", "s", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "\\u", "archive", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "tag", "\\u", "archive", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "tag", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "\\u", "permalink", "\\u", "base", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "tags", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timespan", "\\u", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "calendar", "\\u", "timespan", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "julia", "n", ".", "event", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "site", "',", " ", "'", "created", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Event", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "Templa", "te", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "\\u", "pk", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "owned", "\\u", "events", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "\\u", "event", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "julia", "n", ".", "Event", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "sites", ".", "Site", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "events", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Ta", "g", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "julia", "n", ".", "location", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Locat", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "attribute", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "key", "',", " ", "'", "entity", "\\u", "content", "\\u", "type", "',", " ", "'", "entity", "\\u", "object\\u", "id", "')", ",", " ", "('", "value", "\\u", "content", "\\u", "type", "',", " ", "'", "value", "\\u", "object\\u", "id", "'))", "\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Attribute", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "entity", "\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "value", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "node", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Node", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Node", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "node", "\\u", "view", "\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "page", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Page", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "page", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "tag", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ta", "g", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "template", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Templa", "te", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "Templa", "te", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "documentation", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "text", "/", "html", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sites", ".", "site", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "domain", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Site", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "site", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domain", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "node", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "sites", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Node", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "julia", "n", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Locat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "location", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slug", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ")_", "(_", "unique_", "=_", "True_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "julia", "n", "'_", ",_", "[_", "'", "Locat", "ion", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "event", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "start", "\\u", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "start", "\\u", "time", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Time", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "end", "\\u", "date", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "end", "\\u", "time", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Time", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slug", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "\\u", "content", "\\u", "type", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "contenttype", "s", ".", "Conten", "t", "Type", "'_", "]_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "\\u", "pk", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "self_", "._", "gf_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "Templa", "te", "Field", "'_", ")_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "parent", "\\u", "event", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "julia", "n", ".", "Event", "'_", "]_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "owner", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "owned", "\\u", "events", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "auth", ".", "User", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "last", "\\u", "modifi", "ed", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "auto", "\\u", "now_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "site", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "sites", ".", "Site", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "julia", "n", "'_", ",_", "[_", "'", "Event", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Event", "',", " ", "fields", " ", "['", "site", "',", " ", "'", "created", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "event", "'_", ",_", "[_", "'", "site", "\\u", "id", "'_", ",_", "'", "created", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "tags", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "event", "\\u", "tags", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "auto", "\\u", "created_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "'", "julia", "n", ".", "event", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tag", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "'", "phil", "o", ".", "tag", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "event", "\\u", "tags", "'_", ",_", "[_", "'", "event", "\\u", "id", "'_", ",_", "'", "tag", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Cal", "enda", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "100_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "slug", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ")_", "(_", "max", "\\u", "length_", "=_", "100_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ")_", "(_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "site", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "sites", ".", "Site", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "language", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "en", "'_", ",_", "max", "\\u", "length_", "=_", "5_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "julia", "n", "'_", ",_", "[_", "'", "Cal", "enda", "r", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Cal", "enda", "r", "',", " ", "fields", " ", "['", "name", "',", " ", "'", "site", "',", " ", "'", "language", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "calendar", "'_", ",_", "[_", "'", "name", "'_", ",_", "'", "site", "\\u", "id", "'_", ",_", "'", "language", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "events", " ", "on", " ", "'", "Cal", "enda", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "\\u", "events", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "auto", "\\u", "created_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "calendar", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "'", "julia", "n", ".", "calendar", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "'_", ",_", "models_", "._", "Fore", "ign", "Key_", "(_", "orm_", "[_", "'", "julia", "n", ".", "event", "'_", "]_", ",_", "null_", "=_", "False_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "create", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "calendar", "\\u", "events", "'_", ",_", "[_", "'", "calendar", "\\u", "id", "'_", ",_", "'", "event", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "model", " ", "'", "Cal", "enda", "r", "View", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "create", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "view", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ")_", "(_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "feed", "\\u", "type", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "text", "/", "calendar", "'_", ",_", "max", "\\u", "length_", "=_", "50_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "feed", "\\u", "suff", "ix", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "feed", "'_", ",_", "max", "\\u", "length_", "=_", "255_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "feed", "s", "\\u", "enable", "d", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ")_", "(_", "default_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "feed", "\\u", "length", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "default_", "=_", "15_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "item", "\\u", "title", "\\u", "template", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "julia", "n", "\\u", "calendar", "view", "\\u", "title", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Templa", "te", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "item", "\\u", "description", "\\u", "template", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "julia", "n", "\\u", "calendar", "view", "\\u", "description", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Templa", "te", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "calendar", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "to_", "=_", "orm_", "[_", "'", "julia", "n", ".", "Cal", "enda", "r", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "index", "\\u", "relate", "d", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "event", "\\u", "deta", "il", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "deta", "il", "\\u", "relate", "d", "'_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "timespan", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "timespan", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tag", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "tag", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "location", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "owner", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "owner", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tag", "\\u", "archive", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "tag", "\\u", "archive", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "\\u", "archive", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "location", "\\u", "archive", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "owner", "\\u", "archive", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "calendar", "\\u", "owner", "\\u", "archive", "\\u", "relate", "d", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Page", "'_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "tag", "\\u", "permalink", "\\u", "base", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "tags", "'_", ",_", "max", "\\u", "length_", "=_", "30_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "owner", "\\u", "permalink", "\\u", "base", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "owner", "s", "'_", ",_", "max", "\\u", "length_", "=_", "30_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "location", "\\u", "permalink", "\\u", "base", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ")_", "(_", "default_", "=_", "'", "location", "s", "'_", ",_", "max", "\\u", "length_", "=_", "30_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "events", "\\u", "per", "\\u", "page", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "send", "\\u", "create", "\\u", "signal_", "(_", "'", "julia", "n", "'_", ",_", "[_", "'", "Cal", "enda", "r", "View", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Cal", "enda", "r", "',", " ", "fields", " ", "['", "name", "',", " ", "'", "site", "',", " ", "'", "language", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "calendar", "'_", ",_", "[_", "'", "name", "'_", ",_", "'", "site", "\\u", "id", "'_", ",_", "'", "language", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "unique", " ", "constraint", " ", "on", " ", "'", "Event", "',", " ", "fields", " ", "['", "site", "',", " ", "'", "created", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "unique_", "(_", "'", "julia", "n", "\\u", "event", "'_", ",_", "[_", "'", "site", "\\u", "id", "'_", ",_", "'", "created", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Locat", "ion", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "event", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "tags", " ", "on", " ", "'", "Event", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "event", "\\u", "tags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Cal", "enda", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "M2", "M", " ", "table", " ", "for", " ", "field", " ", "events", " ", "on", " ", "'", "Cal", "enda", "r", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "\\u", "events", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "model", " ", "'", "Cal", "enda", "r", "View", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "table_", "(_", "'", "julia", "n", "\\u", "calendar", "view", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pingali/dgit/dgitcore/datasets/common.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nThis is the core module for manipulating the dataset metadata\n\"\"\"\nimport os, sys, copy, fnmatch, re, shutil\nimport yaml, json, tempfile, mimetypes\nimport webbrowser, traceback, collections\nimport subprocess, string, random, pipes\nfrom collections import OrderedDict\nimport shelve, getpass\nfrom datetime import datetime\nfrom hashlib import sha256\nimport mimetypes\nimport platform\nimport uuid, shutil\nimport boto3, glob2\nimport subprocess\nfrom dateutil import parser\ntry:\n from urllib.parse import urlparse\nexcept:\n from urlparse import urlparse\nfrom ..config import get_config\nfrom ..plugins.common import plugins_get_mgr\nfrom ..helper import bcolors, clean_str, cd, compute_sha256, run, clean_name, log_repo_action \nfrom ..exceptions import *\nfrom .history import get_history, get_diffs\nfrom .validation import validate\n\n#####################################################\n# Exports\n#####################################################\n\n__all__ = [\n 'lookup',\n 'list_repos',\n 'shellcmd',\n 'log', 'show', 'push', 'pull', 'commit',\n 'stash', 'drop', 'status', 'post',\n 'clone', 'init', 'diff',\n 'remote', 'delete'\n]\n\n#####################################################\n# Repo independent commands...\n#####################################################\n\n\n\n#####################################################\n# Repo specific generic commands\n#####################################################\n\n\n\n#####################################################\n# Repo specific simple commands\n#####################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#####################################################\n# Initialize a repo\n#####################################################\n\n\n\n\n\n###########################################################\n# Post metadata to a server\n###########################################################\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def lookup(username, reponame):\n \"\"\"\n Lookup a repo based on username reponame\n \"\"\"\n\n mgr = plugins_get_mgr()\n\n # XXX This should be generalized to all repo managers.\n repomgr = mgr.get(what='repomanager', name='git')\n repo = repomgr.lookup(username=username,\n reponame=reponame)\n return repo", "metadata": "root.lookup", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def list_repos(remote=False):\n \"\"\"\n List repos\n\n Parameters\n ----------\n\n remote: Flag\n \"\"\"\n mgr = plugins_get_mgr()\n\n if not remote:\n repomgr = mgr.get(what='repomanager', name='git')\n repos = repomgr.get_repo_list()\n repos.sort()\n return repos\n else:\n raise Exception(\"Not supported yet\")", "metadata": "root.list_repos", "header": "['module', '___EOS___']", "index": 59 }, { "content": "@log_repo_action \ndef shellcmd(repo, args):\n \"\"\"\n Run a shell command within the repo's context\n\n Parameters\n ----------\n\n repo: Repository object\n args: Shell command\n \"\"\"\n with cd(repo.rootdir):\n result = run(args)\n return result", "metadata": "root.shellcmd", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def datapackage_exists(repo):\n \"\"\"\n Check if the datapackage exists...\n \"\"\"\n datapath = os.path.join(repo.rootdir, \"datapackage.json\")\n return os.path.exists(datapath)", "metadata": "root.datapackage_exists", "header": "['module', '___EOS___']", "index": 98 }, { "content": "def generic_repo_cmd(repo, cmd, *args):\n # print(\"Running generic command\", cmd, args)\n return repo.run(cmd, *args)", "metadata": "root.generic_repo_cmd", "header": "['module', '___EOS___']", "index": 108 }, { "content": "@log_repo_action \ndef log(repo, args=[]):\n \"\"\"\n Log of the changes executed until now\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'log', args)", "metadata": "root.log", "header": "['module', '___EOS___']", "index": 113 }, { "content": "@log_repo_action \ndef show(repo, args=[]):\n \"\"\"\n Show commit details\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'show', args)", "metadata": "root.show", "header": "['module', '___EOS___']", "index": 126 }, { "content": "@log_repo_action \ndef remote(repo, args=[]):\n \"\"\"\n Show remote\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'remote', args)", "metadata": "root.remote", "header": "['module', '___EOS___']", "index": 139 }, { "content": "@log_repo_action \ndef push(repo, args=[]):\n \"\"\"\n Push changes to the backend\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'push', args)", "metadata": "root.push", "header": "['module', '___EOS___']", "index": 152 }, { "content": "@log_repo_action \ndef pull(repo, args=[]):\n \"\"\"\n Pull changes from the backend\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'pull', args)", "metadata": "root.pull", "header": "['module', '___EOS___']", "index": 165 }, { "content": "@log_repo_action \ndef commit(repo, args=[]):\n \"\"\"\n Commit changes to the data repository\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'commit', args)", "metadata": "root.commit", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def drop(repo, args=[]):\n \"\"\"\n Drop the repository (new to dgit)\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'drop', args)", "metadata": "root.drop", "header": "['module', '___EOS___']", "index": 191 }, { "content": "@log_repo_action \ndef stash(repo, args=[]):\n \"\"\"\n Stash the changes\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'stash', args)", "metadata": "root.stash", "header": "['module', '___EOS___']", "index": 203 }, { "content": "@log_repo_action \ndef diff(repo, args=[]):\n \"\"\"\n Diff between versions\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n return generic_repo_cmd(repo, 'diff', args)", "metadata": "root.diff", "header": "['module', '___EOS___']", "index": 216 }, { "content": "@log_repo_action \ndef status(repo, args=[]):\n \"\"\"\n Show status of the repo\n\n Parameters\n ----------\n\n repo: Repository object (result of lookup)\n details: Show internal details of the repo\n args: Parameters to be passed to git status command\n\n \"\"\"\n\n result = generic_repo_cmd(repo, 'status', args)\n return result", "metadata": "root.status", "header": "['module', '___EOS___']", "index": 229 }, { "content": "@log_repo_action \ndef delete(repo, args=[]):\n \"\"\"\n Delete files\n\n Parameters\n ----------\n\n repo: Repository object\n args: Arguments to git command\n \"\"\"\n\n # Remove the files \n result = generic_repo_cmd(repo, 'delete', args)\n if result['status'] != 'success': \n return status \n\n with cd(repo.rootdir): \n \n package = repo.package \n resources = package['resources'] \n\n cleaned_resources = []\n for r in resources: \n relativepath = r['relativepath'] \n sha256 = r['sha256'] \n if relativepath not in ['', None]: \n if not os.path.exists(relativepath): \n # This file does not exist on disk. \n print(\"Skipping\", relativepath) \n continue \n cleaned_resources.append(r) \n \n package['resources'] = cleaned_resources \n repo.package = package \n \n with open('datapackage.json', 'w') as fd: \n fd.write(json.dumps(repo.package, indent=4))\n\n return {\n 'status': 'success',\n 'message': ''\n }", "metadata": "root.delete", "header": "['module', '___EOS___']", "index": 246 }, { "content": "def bootstrap_datapackage(repo, force=False,\n options=None, noinput=False):\n \"\"\"\n Create the datapackage file..\n \"\"\"\n\n print(\"Bootstrapping datapackage\")\n\n # get the directory\n tsprefix = datetime.now().date().isoformat()\n\n # Initial data package json\n package = OrderedDict([\n ('title', ''),\n ('description', ''),\n ('username', repo.username),\n ('reponame', repo.reponame),\n ('name', str(repo)),\n ('title', \"\"),\n ('description', \"\"),\n ('keywords', []),\n ('resources', []),\n ('creator', getpass.getuser()),\n ('createdat', datetime.now().isoformat()),\n ('remote-url', repo.remoteurl)\n ])\n\n if options is not None:\n package['title'] = options['title']\n package['description'] = options['description']\n else:\n if noinput:\n raise IncompleteParameters(\"Option field with title and description\")\n\n for var in ['title', 'description']:\n value = ''\n while value in ['',None]:\n value = input('Your Repo ' + var.title() + \": \")\n if len(value) == 0:\n print(\"{} cannot be empty. Please re-enter.\".format(var.title()))\n\n package[var] = value\n\n\n # Now store the package...\n (handle, filename) = tempfile.mkstemp()\n with open(filename, 'w') as fd:\n fd.write(json.dumps(package, indent=4))\n\n repo.package = package\n\n return filename", "metadata": "root.bootstrap_datapackage", "header": "['module', '___EOS___']", "index": 296 }, { "content": "def init(username, reponame, setup,\n force=False, options=None,\n noinput=False):\n \"\"\"\n Initialize an empty repository with datapackage.json\n\n Parameters\n ----------\n\n username: Name of the user\n reponame: Name of the repo\n setup: Specify the 'configuration' (git only, git+s3 backend etc)\n force: Force creation of the files\n options: Dictionary with content of dgit.json, if available.\n noinput: Automatic operation with no human interaction\n \"\"\"\n\n mgr = plugins_get_mgr()\n repomgr = mgr.get(what='repomanager', name='git')\n\n backendmgr = None\n if setup == 'git+s3':\n backendmgr = mgr.get(what='backend', name='s3')\n\n repo = repomgr.init(username, reponame, force, backendmgr)\n\n # Now bootstrap the datapackage.json metadata file and copy it in...\n\n # Insert a gitignore with .dgit directory in the repo. This\n # directory will be used to store partial results\n (handle, gitignore) = tempfile.mkstemp()\n with open(gitignore, 'w') as fd:\n fd.write(\".dgit\")\n\n # Try to bootstrap. If you cant, cleanup and return\n try:\n filename = bootstrap_datapackage(repo, force, options, noinput)\n except Exception as e:\n repomgr.drop(repo,[])\n os.unlink(gitignore)\n raise e\n\n repo.run('add_files',\n [\n {\n 'relativepath': 'datapackage.json',\n 'localfullpath': filename,\n },\n {\n 'relativepath': '.gitignore',\n 'localfullpath': gitignore,\n },\n ])\n\n\n # Cleanup temp files\n os.unlink(filename)\n os.unlink(gitignore)\n\n args = ['-a', '-m', 'Bootstrapped the repo']\n repo.run('commit', args)\n \n return repo", "metadata": "root.init", "header": "['module', '___EOS___']", "index": 349 }, { "content": "def clone(url):\n \"\"\"\n Clone a URL. Examples include:\n\n - [email protected]:pingali/dgit.git\n - https://github.com:pingali/dgit.git\n - s3://mybucket/git/pingali/dgit.git\n\n Parameters\n ----------\n\n url: URL of the repo\n\n \"\"\"\n backend = None\n backendmgr = None\n if url.startswith('s3'):\n backendtype = 's3'\n elif url.startswith(\"http\") or url.startswith(\"git\"):\n backendtype = 'git'\n else:\n backendtype = None\n\n mgr = plugins_get_mgr()\n repomgr = mgr.get(what='repomanager', name='git')\n backendmgr = mgr.get(what='backend', name=backendtype)\n\n # print(\"Testing {} with backend {}\".format(url, backendmgr))\n if backendmgr is not None and not backendmgr.url_is_valid(url):\n raise InvalidParameters(\"Invalid URL\")\n\n key = repomgr.clone(url, backendmgr)\n\n # Insert a datapackage if it doesnt already exist...\n repo = repomgr.lookup(key=key)\n if not datapackage_exists(repo):\n filename = bootstrap_datapackage(repo)\n repo.run('add_files',\n [\n {\n 'relativepath': 'datapackage.json',\n 'localfullpath': filename,\n },\n ])\n os.unlink(filename)\n args = ['-a', '-m', 'Bootstrapped the repo']\n repo.run('commit', args)\n\n return repo", "metadata": "root.clone", "header": "['module', '___EOS___']", "index": 413 }, { "content": "def annotate_metadata_data(repo, task, patterns=[\"*\"], size=0):\n \"\"\"\n Update metadata with the content of the files\n \"\"\"\n\n mgr = plugins_get_mgr() \n keys = mgr.search('representation')['representation']\n representations = [mgr.get_by_key('representation', k) for k in keys]\n\n matching_files = repo.find_matching_files(patterns)\n package = repo.package\n rootdir = repo.rootdir\n files = package['resources']\n for f in files:\n relativepath = f['relativepath']\n if relativepath in matching_files:\n path = os.path.join(rootdir, relativepath)\n if task == 'preview':\n print(\"Adding preview for \", relativepath)\n f['content'] = open(path).read()[:size]\n elif task == 'schema':\n for r in representations: \n if r.can_process(path): \n print(\"Adding schema for \", path)\n f['schema'] = r.get_schema(path)\n break ", "metadata": "root.annotate_metadata_data", "header": "['module', '___EOS___']", "index": 469 }, { "content": "def annotate_metadata_code(repo, files):\n \"\"\"\n Update metadata with the commit information\n \"\"\"\n\n package = repo.package\n package['code'] = []\n for p in files:\n matching_files = glob2.glob(\"**/{}\".format(p))\n for f in matching_files:\n absf = os.path.abspath(f)\n print(\"Add commit data for {}\".format(f))\n package['code'].append(OrderedDict([\n ('script', f),\n ('permalink', repo.manager.permalink(repo, absf)),\n ('mimetypes', mimetypes.guess_type(absf)[0]),\n ('sha256', compute_sha256(absf))\n ]))", "metadata": "root.annotate_metadata_code", "header": "['module', '___EOS___']", "index": 496 }, { "content": "def annotate_metadata_action(repo):\n \"\"\"\n Update metadata with the action history \n \"\"\"\n package = repo.package \n\n print(\"Including history of actions\")\n with cd(repo.rootdir): \n filename = \".dgit/log.json\" \n if os.path.exists(filename): \n history = open(filename).readlines() \n actions = []\n for a in history: \n try: \n a = json.loads(a)\n for x in ['code']: \n if x not in a or a[x] == None: \n a[x] = \"...\"\n actions.append(a)\n except:\n pass \n package['actions'] = actions", "metadata": "root.annotate_metadata_action", "header": "['module', '___EOS___']", "index": 516 }, { "content": "def annotate_metadata_platform(repo):\n \"\"\"\n Update metadata host information\n \"\"\"\n\n print(\"Added platform information\")\n package = repo.package\n mgr = plugins_get_mgr()\n repomgr = mgr.get(what='instrumentation', name='platform')\n package['platform'] = repomgr.get_metadata()", "metadata": "root.annotate_metadata_platform", "header": "['module', '___EOS___']", "index": 539 }, { "content": "def annotate_metadata_diffs(repo):\n\n print(\"Computing schema changes\")\n with cd(repo.rootdir):\n get_diffs(repo.package['history'])", "metadata": "root.annotate_metadata_diffs", "header": "['module', '___EOS___']", "index": 550 }, { "content": "def annotate_metadata_validation(repo):\n\n print(\"Adding validation information\")\n # Collect the validation results by relativepath\n results = validate(repo)\n fileresults = {}\n for r in results:\n filename = r['target']\n if filename not in fileresults:\n fileresults[filename] = []\n fileresults[filename].append(r)\n\n for r in repo.package['resources']:\n path = r['relativepath']\n if path in fileresults:\n r['validation'] = fileresults[path]", "metadata": "root.annotate_metadata_validation", "header": "['module', '___EOS___']", "index": 556 }, { "content": "def annotate_metadata_dependencies(repo):\n \"\"\"\n Collect information from the dependent repo's\n \"\"\"\n\n options = repo.options\n\n if 'dependencies' not in options:\n print(\"No dependencies\")\n return []\n\n repos = []\n dependent_repos = options['dependencies']\n for d in dependent_repos:\n if \"/\" not in d:\n print(\"Invalid dependency specification\")\n (username, reponame) = d.split(\"/\")\n try:\n repos.append(repo.manager.lookup(username, reponame))\n except:\n print(\"Repository does not exist. Please create one\", d)\n\n package = repo.package\n package['dependencies'] = []\n for r in repos:\n package['dependencies'].append({\n 'username': r.username,\n 'reponame': r.reponame,\n })", "metadata": "root.annotate_metadata_dependencies", "header": "['module', '___EOS___']", "index": 573 }, { "content": "def post(repo, args=[]):\n \"\"\"\n Post to metadata server\n\n Parameters\n ----------\n\n repo: Repository object (result of lookup)\n \"\"\"\n\n mgr = plugins_get_mgr()\n keys = mgr.search(what='metadata')\n keys = keys['metadata']\n\n if len(keys) == 0:\n return\n\n # Incorporate pipeline information...\n if 'pipeline' in repo.options:\n for name, details in repo.options['pipeline'].items():\n patterns = details['files']\n matching_files = repo.find_matching_files(patterns)\n matching_files.sort()\n details['files'] = matching_files\n for i, f in enumerate(matching_files):\n r = repo.get_resource(f)\n if 'pipeline' not in r:\n r['pipeline'] = []\n r['pipeline'].append(name + \" [Step {}]\".format(i))\n\n if 'metadata-management' in repo.options:\n\n print(\"Collecting all the required metadata to post\")\n metadata = repo.options['metadata-management']\n\n # Add data repo history\n if 'include-data-history' in metadata and metadata['include-data-history']:\n repo.package['history'] = get_history(repo.rootdir)\n\n # Add action history \n if 'include-action-history' in metadata and metadata['include-action-history']:\n annotate_metadata_action(repo) \n\n # Add data repo history\n if 'include-preview' in metadata:\n annotate_metadata_data(repo,\n task='preview',\n patterns=metadata['include-preview']['files'],\n size=metadata['include-preview']['length'])\n\n if (('include-schema' in metadata) and metadata['include-schema']):\n annotate_metadata_data(repo, task='schema')\n\n if 'include-code-history' in metadata:\n annotate_metadata_code(repo, files=metadata['include-code-history'])\n\n if 'include-platform' in metadata:\n annotate_metadata_platform(repo)\n\n if 'include-validation' in metadata:\n annotate_metadata_validation(repo)\n\n if 'include-dependencies' in metadata:\n annotate_metadata_dependencies(repo)\n\n history = repo.package.get('history',None)\n if (('include-tab-diffs' in metadata) and\n metadata['include-tab-diffs'] and\n history is not None):\n annotate_metadata_diffs(repo)\n\n # Insert options as well\n repo.package['config'] = repo.options\n\n try:\n for k in keys:\n # print(\"Key\", k)\n metadatamgr = mgr.get_by_key('metadata', k)\n url = metadatamgr.url\n o = urlparse(url)\n print(\"Posting to \", o.netloc)\n response = metadatamgr.post(repo)\n if isinstance(response, str):\n print(\"Error while posting:\", response)\n elif response.status_code in [400]:\n content = response.json()\n print(\"Error while posting:\")\n for k in content:\n print(\" \", k,\"- \", \",\".join(content[k]))\n except NetworkError as e:\n print(\"Unable to reach metadata server!\")\n except NetworkInvalidConfiguration as e:\n print(\"Invalid network configuration in the INI file\")\n print(e.message)\n except Exception as e:\n print(\"Could not post. Unknown error\")\n print(e)", "metadata": "root.post", "header": "['module', '___EOS___']", "index": 603 } ]
[ { "span": "import os, sys, copy, fnmatch, re, shutil", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 41 }, { "span": "import yaml, json, tempfile, mimetypes", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 38 }, { "span": "import webbrowser, traceback, collections", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 41 }, { "span": "import subprocess, string, random, pipes", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 40 }, { "span": "import shelve, getpass", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 22 }, { "span": "import platform", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 15 }, { "span": "import uuid, shutil", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 19 }, { "span": "import boto3, glob2", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 19 }, { "span": "import subprocess", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 17 }, { "span": "from dateutil import parser", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "is", " ", "the", " ", "core", " ", "module", " ", "for", " ", "manipulati", "ng", " ", "the", " ", "dataset", " ", "metadata", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "copy_", ",_", "fnmatch_", ",_", "re_", ",_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", ",_", "json_", ",_", "tempfile_", ",_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", ",_", "traceback_", ",_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", ",_", "string_", ",_", "random_", ",_", "pipes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shelve", "_", ",_", "getpass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "hashlib_", "import_", "sha256_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", ",_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "boto3_", ",_", "glob", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "import_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urlparse_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "._", "config_", "import_", "get", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "plugins_", "._", "common_", "import_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "helper_", "import_", "bcolors_", ",_", "clean", "\\u", "str_", ",_", "cd_", ",_", "compute", "\\u", "sha256_", ",_", "run_", ",_", "clean", "\\u", "name_", ",_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "history_", "import_", "get", "\\u", "history_", ",_", "get", "\\u", "diffs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "validation_", "import_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Export", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "look", "up", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "\\u", "repos", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shellc", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "'_", ",_", "'", "show", "'_", ",_", "'", "push", "'_", ",_", "'", "pull", "'_", ",_", "'", "commit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stash", "'_", ",_", "'", "drop", "'_", ",_", "'", "status", "'_", ",_", "'", "post", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clone", "'_", ",_", "'", "init", "'_", ",_", "'", "diff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remote", "'_", ",_", "'", "delete", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "independent", " ", "command", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "specific", " ", "gener", "ic", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rep", "o", " ", "specific", " ", "simple", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "a", " ", "repo_", "\\u\\u\\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_", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Post", " ", "metadata", " ", "to", " ", "a", " ", "server_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "lookup_", "(_", "username_", ",_", "repon", "ame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Look", "up", " ", "a", " ", "repo", " ", "based", " ", "on", " ", "user", "name", " ", "repon", "ame", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "generaliz", "ed", " ", "to", " ", "all", " ", "repo", " ", "manage", "rs", "._", "\\u\\u\\uNL\\u\\u\\u_", "repo", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "repo", "manage", "r", "'_", ",_", "name_", "=_", "'", "git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "=_", "repo", "mgr_", "._", "lookup_", "(_", "username_", "=_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repon", "ame_", "=_", "repon", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "repo_", "\\u\\u\\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_", "list", "\\u", "repos_", "(_", "remote_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "repos", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "remote", ":", " ", "Fla", "g", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "remote_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "repo", "manage", "r", "'_", ",_", "name_", "=_", "'", "git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "=_", "repo", "mgr_", "._", "get", "\\u", "repo", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "repos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Not", " ", "support", "ed", " ", "ye", "t", "\"_", ")_", "\\u\\u\\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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "shellc", "md_", "(_", "repo_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "a", " ", "shell", " ", "command", " ", "within", " ", "the", " ", "repo", "'", "s", " ", "context", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Shel", "l", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "run_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "datap", "ack", "age", "\\u", "exists_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "the", " ", "datap", "ack", "age", " ", "exist", "s", "...", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datapath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "repo_", "._", "rootdir_", ",_", "\"", "datap", "ack", "age", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "exists_", "(_", "datapath_", ")_", "\\u\\u\\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_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "cmd_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Run", "ning", " ", "gener", "ic", " ", "command", "\",", " ", "cmd", ",", " ", "args", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repo_", "._", "run_", "(_", "cmd_", ",_", "*_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "log_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Log", " ", "of", " ", "the", " ", "change", "s", " ", "executed", " ", "unti", "l", " ", "now", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "log", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "show_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "commit", " ", "deta", "il", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "show", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remote_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "remote", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "remote", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "push_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Push", " ", "change", "s", " ", "to", " ", "the", " ", "back", "end", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "push", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pull_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pul", "l", " ", "change", "s", " ", "from", " ", "the", " ", "back", "end", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "pull", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "commit_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Commi", "t", " ", "change", "s", " ", "to", " ", "the", " ", "data", " ", "repos", "itor", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "commit", "'_", ",_", "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_", "drop_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Drop", " ", "the", " ", "repos", "itor", "y", " ", "(", "new", " ", "to", " ", "dg", "it", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "drop", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "stash", "_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sta", "sh", " ", "the", " ", "change", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "stash", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "diff_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Diff", " ", "bet", "ween", " ", "version", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "diff", "'_", ",_", "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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "status_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "status", " ", "of", " ", "the", " ", "repo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", " ", "(", "result", " ", "of", " ", "look", "up", ")", "\\", "10", ";", " ", " ", " ", " ", "deta", "il", "s", ":", " ", "Show", " ", "internal", " ", "deta", "il", "s", " ", "of", " ", "the", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Parameter", "s", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "git", " ", "status", " ", "command", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "status", "'_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\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_", "@_", "log", "\\u", "repo", "\\u", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "files", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "args", ":", " ", "Arg", "ument", "s", " ", "to", " ", "git", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "files", " _", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "gener", "ic", "\\u", "repo", "\\u", "cmd_", "(_", "repo_", ",_", "'", "delete", "'_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "[_", "'", "status", "'_", "]_", "!=_", "'", "success", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "=_", "package_", "[_", "'", "resource", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clean", "ed", "\\u", "resources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "resources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "path_", "=_", "r_", "[_", "'", "relative", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha256_", "=_", "r_", "[_", "'", "sha2", "56", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relative", "path_", "not_", "in_", "[_", "''_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "relative", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", " ", "on", " ", "disk", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "Ski", "ppi", "ng", "\"_", ",_", "relative", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean", "ed", "\\u", "resources_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package_", "[_", "'", "resource", "s", "'_", "]_", "=_", "clean", "ed", "\\u", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "package_", "=_", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "'", "datap", "ack", "age", ".", "json", "'_", ",_", "'", "w", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "repo_", "._", "package_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "''_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "boots", "trap", "\\u", "datap", "ack", "age_", "(_", "repo_", ",_", "force_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "None_", ",_", "noin", "put_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "datap", "ack", "age", " ", "file", "..", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Boots", "trap", "ping", " ", "datap", "ack", "age", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "tsp", "refix", "_", "=_", "datetime_", "._", "now_", "(_", ")_", "._", "date_", "(_", ")_", "._", "isoformat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initial", " ", "data", " ", "package", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "=_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "title", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "user", "name", "'_", ",_", "repo_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "repon", "ame", "'_", ",_", "repo_", "._", "repon", "ame_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "name", "'_", ",_", "str_", "(_", "repo_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "title", "'_", ",_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "keywords", "'_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "resource", "s", "'_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "creat", "or", "'_", ",_", "getpass_", "._", "getuser", "_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "created", "at", "'_", ",_", "datetime_", "._", "now_", "(_", ")_", "._", "isoformat_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "remote", "-", "url", "'_", ",_", "repo_", "._", "remote", "url_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "[_", "'", "title", "'_", "]_", "=_", "options_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "[_", "'", "description", "'_", "]_", "=_", "options_", "[_", "'", "description", "'_", "]_", "\\u\\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_", "noin", "put_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Incomp", "lete", "Parameters_", "(_", "\"", "Optio", "n", " ", "field", " ", "with", " ", "title", " ", "and", " ", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "var_", "in_", "[_", "'", "title", "'_", ",_", "'", "description", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "value_", "in_", "[_", "''_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "input_", "(_", "'", "You", "r", " ", "Rep", "o", " ", "'_", "+_", "var_", "._", "title_", "(_", ")_", "+_", "\":", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "value_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"{}", " ", "cann", "ot", " ", "be", " ", "empty", ".", " ", "Ple", "ase", " ", "re", "-", "enter", ".\"_", "._", "format_", "(_", "var_", "._", "title_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package_", "[_", "var_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "store", " ", "the", " ", "package", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "handle_", ",_", "filename_", ")_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "package_", ",_", "indent_", "=_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "._", "package_", "=_", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "username_", ",_", "repon", "ame_", ",_", "setup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "force_", "=_", "False_", ",_", "options_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "noin", "put_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "an", " ", "empty", " ", "repos", "itor", "y", " ", "with", " ", "datap", "ack", "age", ".", "json", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", "Name", " ", "of", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "repon", "ame", ":", " ", "Name", " ", "of", " ", "the", " ", "repo", "\\", "10", ";", " ", " ", " ", " ", "setup", ":", " ", "Speci", "fy", " ", "the", " ", "'", "configura", "tion", "'", " ", "(", "git", " ", "only", ",", " ", "git", "+", "s3", " ", "back", "end", " ", "etc", ")", "\\", "10", ";", " ", " ", " ", " ", "force", ":", " ", "Force", " ", "creati", "on", " ", "of", " ", "the", " ", "files", "\\", "10", ";", " ", " ", " ", " ", "options", ":", " ", "Dict", "ionar", "y", " ", "with", " ", "content", " ", "of", " ", "dg", "it", ".", "json", ",", " ", "if", " ", "avail", "able", ".", "\\", "10", ";", " ", " ", " ", " ", "noin", "put", ":", " ", "Automat", "ic", " ", "operati", "on", " ", "with", " ", "no", " ", "human", " ", "interacti", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "repo", "manage", "r", "'_", ",_", "name_", "=_", "'", "git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "mgr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "setup_", "==_", "'", "git", "+", "s3", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "end", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "back", "end", "'_", ",_", "name_", "=_", "'", "s3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "=_", "repo", "mgr_", "._", "init_", "(_", "username_", ",_", "repon", "ame_", ",_", "force_", ",_", "back", "end", "mgr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "boots", "trap", " ", "the", " ", "datap", "ack", "age", ".", "json", " ", "metadata", " ", "file", " ", "and", " ", "copy", " ", "it", " ", "in", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "a", " ", "giti", "gnor", "e", " ", "with", " ", ".", "dg", "it", " ", "director", "y", " ", "in", " ", "the", " ", "repo", ".", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "y", " ", "will", " ", "be", " ", "used", " ", "to", " ", "store", " ", "partial", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "handle_", ",_", "giti", "gnor", "e_", ")_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "giti", "gnor", "e_", ",_", "'", "w", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "._", "write_", "(_", "\".", "dg", "it", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "boots", "trap", ".", " ", "If", " ", "you", " ", "cant", ",", " ", "clean", "up", " ", "and", " ", "return_", "\\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 ", " _", "filename_", "=_", "boots", "trap", "\\u", "datap", "ack", "age_", "(_", "repo_", ",_", "force_", ",_", "options_", ",_", "noin", "put_", ")_", "\\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 ", " _", "repo", "mgr_", "._", "drop_", "(_", "repo_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "giti", "gnor", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "._", "run_", "(_", "'", "add", "\\u", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relative", "path", "'_", ":_", "'", "datap", "ack", "age", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "localf", "ull", "path", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relative", "path", "'_", ":_", "'.", "giti", "gnor", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "localf", "ull", "path", "'_", ":_", "giti", "gnor", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clean", "up", " ", "temp", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "giti", "gnor", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "'-", "a", "'_", ",_", "'-", "m", "'_", ",_", "'", "Boots", "trap", "ped", " ", "the", " ", "repo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "run_", "(_", "'", "commit", "'_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "repo_", "\\u\\u\\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_", "clone_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clone", " ", "a", " ", "URL", ".", " ", "Exam", "ples", " ", "include", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "git", "@", "git", "hub", ".", "com", ":", "ping", "ali", "/", "dg", "it", ".", "git", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "https", "://", "git", "hub", ".", "com", ":", "ping", "ali", "/", "dg", "it", ".", "git", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "s3", "://", "myb", "ucket", "/", "git", "/", "ping", "ali", "/", "dg", "it", ".", "git", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "url", ":", " ", "URL", " ", "of", " ", "the", " ", "repo", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "mgr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "url_", "._", "startswith_", "(_", "'", "s3", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "endt", "ype_", "=_", "'", "s3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "url_", "._", "startswith_", "(_", "\"", "http", "\"_", ")_", "or_", "url_", "._", "startswith_", "(_", "\"", "git", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "endt", "ype_", "=_", "'", "git", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "endt", "ype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "repo", "manage", "r", "'_", ",_", "name_", "=_", "'", "git", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "back", "end", "'_", ",_", "name_", "=_", "back", "endt", "ype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(\"", "Test", "ing", " ", "{}", " ", "with", " ", "back", "end", " ", "{}", "\".", "format", "(", "url", ",", " ", "back", "end", "mgr", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "back", "end", "mgr_", "is_", "not_", "None_", "and_", "not_", "back", "end", "mgr_", "._", "url", "\\u", "is", "\\u", "valid_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inva", "lid", "Parameters_", "(_", "\"", "Inva", "lid", " ", "URL", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "repo", "mgr_", "._", "clone_", "(_", "url_", ",_", "back", "end", "mgr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "a", " ", "datap", "ack", "age", " ", "if", " ", "it", " ", "doesnt", " ", "alr", "ead", "y", " ", "exist", "..._", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "repo", "mgr_", "._", "lookup_", "(_", "key_", "=_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "datap", "ack", "age", "\\u", "exists_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "boots", "trap", "\\u", "datap", "ack", "age_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "run_", "(_", "'", "add", "\\u", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "relative", "path", "'_", ":_", "'", "datap", "ack", "age", ".", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "localf", "ull", "path", "'_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "'-", "a", "'_", ",_", "'-", "m", "'_", ",_", "'", "Boots", "trap", "ped", " ", "the", " ", "repo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo_", "._", "run_", "(_", "'", "commit", "'_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "repo_", "\\u\\u\\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_", "annot", "ate", "\\u", "metadata", "\\u", "data_", "(_", "repo_", ",_", "task_", ",_", "patterns_", "=_", "[_", "\"*\"_", "]_", ",_", "size_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "metadata", " ", "with", " ", "the", " ", "content", " ", "of", " ", "the", " ", "files", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "mgr_", "._", "search_", "(_", "'", "represent", "ation", "'_", ")_", "[_", "'", "represent", "ation", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "representations", "_", "=_", "[_", "mgr_", "._", "get", "\\u", "by", "\\u", "key_", "(_", "'", "represent", "ation", "'_", ",_", "k_", ")_", "for_", "k_", "in_", "keys_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "matchi", "ng", "\\u", "files_", "=_", "repo_", "._", "find", "\\u", "matchi", "ng", "\\u", "files_", "(_", "patterns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rootdir_", "=_", "repo_", "._", "rootdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "package_", "[_", "'", "resource", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "path_", "=_", "f_", "[_", "'", "relative", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "relative", "path_", "in_", "matchi", "ng", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "rootdir_", ",_", "relative", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task_", "==_", "'", "previe", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Add", "ing", " ", "previe", "w", " ", "for", " ", "\"_", ",_", "relative", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "[_", "'", "content", "'_", "]_", "=_", "open_", "(_", "path_", ")_", "._", "read_", "(_", ")_", "[_", ":_", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task_", "==_", "'", "schema", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "r_", "in_", "representations", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "r_", "._", "can", "\\u", "process_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "\"", "Add", "ing", " ", "schema", " ", "for", " ", "\"_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "[_", "'", "schema", "'_", "]_", "=_", "r_", "._", "get", "\\u", "schema_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "annot", "ate", "\\u", "metadata", "\\u", "code_", "(_", "repo_", ",_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "metadata", " ", "with", " ", "the", " ", "commit", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "[_", "'", "code", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "matchi", "ng", "\\u", "files_", "=_", "glob", "2_", "._", "glob_", "(_", "\"**", "/{}\"_", "._", "format_", "(_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "matchi", "ng", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abs", "f_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Add", " ", "commit", " ", "data", " ", "for", " ", "{}\"_", "._", "format_", "(_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "[_", "'", "code", "'_", "]_", "._", "append_", "(_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "script", "'_", ",_", "f_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "permalink", "'_", ",_", "repo_", "._", "manager_", "._", "permalink", "_", "(_", "repo_", ",_", "abs", "f_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "mime", "types", "'_", ",_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "abs", "f_", ")_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "sha2", "56", "'_", ",_", "compute", "\\u", "sha256_", "(_", "abs", "f_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "annot", "ate", "\\u", "metadata", "\\u", "action_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "metadata", " ", "with", " ", "the", " ", "action", " ", "histo", "ry", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Includi", "ng", " ", "histo", "ry", " ", "of", " ", "action", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "\".", "dg", "it", "/", "log", ".", "json", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "history_", "=_", "open_", "(_", "filename_", ")_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "history_", ":_", "\\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_", "=_", "json_", "._", "loads_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "[_", "'", "code", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "x_", "not_", "in_", "a_", "or_", "a_", "[_", "x_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "a_", "[_", "x_", "]_", "=_", "\"...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actions_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "package_", "[_", "'", "action", "s", "'_", "]_", "=_", "actions_", "\\u\\u\\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_", "annot", "ate", "\\u", "metadata", "\\u", "platform_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "metadata", " ", "host", " ", "informati", "on", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Added", " ", "platform", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "mgr_", "=_", "mgr_", "._", "get_", "(_", "what_", "=_", "'", "instrument", "ation", "'_", ",_", "name_", "=_", "'", "platform", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "[_", "'", "platform", "'_", "]_", "=_", "repo", "mgr_", "._", "get", "\\u", "metadata_", "(_", ")_", "\\u\\u\\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_", "annot", "ate", "\\u", "metadata", "\\u", "diffs_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Comp", "uti", "ng", " ", "schema", " ", "change", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "cd_", "(_", "repo_", "._", "rootdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "diffs_", "(_", "repo_", "._", "package_", "[_", "'", "histo", "ry", "'_", "]_", ")_", "\\u\\u\\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_", "annot", "ate", "\\u", "metadata", "\\u", "validation_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Add", "ing", " ", "validation", " ", "informati", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Collect", " ", "the", " ", "validation", " ", "results", " ", "by", " ", "relative", "path_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "validate_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filer", "esult", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "r_", "[_", "'", "target", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", "not_", "in_", "filer", "esult", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filer", "esult", "s_", "[_", "filename_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filer", "esult", "s_", "[_", "filename_", "]_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "repo_", "._", "package_", "[_", "'", "resource", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "r_", "[_", "'", "relative", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", "in_", "filer", "esult", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "validation", "'_", "]_", "=_", "filer", "esult", "s_", "[_", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "annot", "ate", "\\u", "metadata", "\\u", "dependencies_", "(_", "repo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Collect", " ", "informati", "on", " ", "from", " ", "the", " ", "dependent", " ", "repo", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "repo_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "dependen", "cies", "'_", "not_", "in_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "No", " ", "dependen", "cies", "\"_", ")_", "\\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_", "repos_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependent", "\\u", "repos_", "=_", "options_", "[_", "'", "dependen", "cies", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "dependent", "\\u", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"/\"_", "not_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Inva", "lid", " ", "dependen", "cy", " ", "specifica", "tion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "username_", ",_", "repon", "ame_", ")_", "=_", "d_", "._", "split_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repos_", "._", "append_", "(_", "repo_", "._", "manager_", "._", "lookup_", "(_", "username_", ",_", "repon", "ame_", ")_", ")_", "\\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_", "(_", "\"", "Repos", "itor", "y", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "Ple", "ase", " ", "create", " ", "one", "\"_", ",_", "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_", "package_", "=_", "repo_", "._", "package_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "[_", "'", "dependen", "cies", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "repos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "package_", "[_", "'", "dependen", "cies", "'_", "]_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "r_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "repon", "ame", "'_", ":_", "r_", "._", "repon", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "repo_", ",_", "args_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Post", " ", "to", " ", "metadata", " ", "server", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "Repos", "itor", "y", " ", "object", " ", "(", "result", " ", "of", " ", "look", "up", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mgr_", "=_", "plugin", "s", "\\u", "get", "\\u", "mgr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "mgr_", "._", "search_", "(_", "what_", "=_", "'", "metadata", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "keys_", "[_", "'", "metadata", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "keys_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inco", "rpor", "ate", " ", "pipeline", " ", "informati", "on", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "pipeline", "'_", "in_", "repo_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "details_", "in_", "repo_", "._", "options_", "[_", "'", "pipeline", "'_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patterns_", "=_", "details_", "[_", "'", "files", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matchi", "ng", "\\u", "files_", "=_", "repo_", "._", "find", "\\u", "matchi", "ng", "\\u", "files_", "(_", "patterns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matchi", "ng", "\\u", "files_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "details_", "[_", "'", "files", "'_", "]_", "=_", "matchi", "ng", "\\u", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "f_", "in_", "enumerate_", "(_", "matchi", "ng", "\\u", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "repo_", "._", "get", "\\u", "resource_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "pipeline", "'_", "not_", "in_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "r_", "[_", "'", "pipeline", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", "[_", "'", "pipeline", "'_", "]_", "._", "append_", "(_", "name_", "+_", "\"", " ", "[", "Step", " ", "{}", "]\"_", "._", "format_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "metadata", "-", "manage", "ment", "'_", "in_", "repo_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Collecti", "ng", " ", "all", " ", "the", " ", "require", "d", " ", "metadata", " ", "to", " ", "post", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "=_", "repo_", "._", "options_", "[_", "'", "metadata", "-", "manage", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "data", " ", "repo", " ", "history_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "include", "-", "data", "-", "histo", "ry", "'_", "in_", "metadata_", "and_", "metadata_", "[_", "'", "include", "-", "data", "-", "histo", "ry", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo_", "._", "package_", "[_", "'", "histo", "ry", "'_", "]_", "=_", "get", "\\u", "history_", "(_", "repo_", "._", "rootdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "action", " ", "histo", "ry", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "action", "-", "histo", "ry", "'_", "in_", "metadata_", "and_", "metadata_", "[_", "'", "include", "-", "action", "-", "histo", "ry", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "action_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "data", " ", "repo", " ", "history_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "previe", "w", "'_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "data_", "(_", "repo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "'", "previe", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "patterns_", "=_", "metadata_", "[_", "'", "include", "-", "previe", "w", "'_", "]_", "[_", "'", "files", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "metadata_", "[_", "'", "include", "-", "previe", "w", "'_", "]_", "[_", "'", "length", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "'", "include", "-", "schema", "'_", "in_", "metadata_", ")_", "and_", "metadata_", "[_", "'", "include", "-", "schema", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "data_", "(_", "repo_", ",_", "task_", "=_", "'", "schema", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "code", "-", "histo", "ry", "'_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "code_", "(_", "repo_", ",_", "files_", "=_", "metadata_", "[_", "'", "include", "-", "code", "-", "histo", "ry", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "platform", "'_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "platform_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "validation", "'_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "validation_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "dependen", "cies", "'_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "dependencies_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "history_", "=_", "repo_", "._", "package_", "._", "get_", "(_", "'", "histo", "ry", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "'", "include", "-", "tab", "-", "diffs", "'_", "in_", "metadata_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "[_", "'", "include", "-", "tab", "-", "diffs", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "history_", "is_", "not_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "annot", "ate", "\\u", "metadata", "\\u", "diffs_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "options", " ", "as", " ", "well_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "repo_", "._", "package_", "[_", "'", "config", "'_", "]_", "=_", "repo_", "._", "options_", "\\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 ", " _", "for_", "k_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "(\"", "Key", "\",", " ", "k", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata", "mgr_", "=_", "mgr_", "._", "get", "\\u", "by", "\\u", "key_", "(_", "'", "metadata", "'_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "metadata", "mgr_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "urlparse_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Post", "ing", " ", "to", " ", "\"_", ",_", "o_", "._", "netloc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "metadata", "mgr_", "._", "post_", "(_", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "response_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", " ", "whi", "le", " ", "posting", ":\"_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "._", "status", "\\u", "code_", "in_", "[_", "400_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Error", " ", "whi", "le", " ", "posting", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", " ", " ", " ", "\"_", ",_", "k_", ",_", "\"-", " ", "\"_", ",_", "\",\"_", "._", "join_", "(_", "content_", "[_", "k_", "]_", ")_", ")_", "\\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_", "Network", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Una", "ble", " ", "to", " ", "reach", " ", "metadata", " ", "server", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Network", "Inva", "lid", "Configuration_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Inva", "lid", " ", "network", " ", "configura", "tion", " ", "in", " ", "the", " ", "INI", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "e_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cou", "ld", " ", "not", " ", "post", ".", " ", "Un", "know", "n", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "e_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
chrisdev/wagtail-cookiecutter-foundation/{{cookiecutter.repo_name}}/products/models.py
[ { "content": "from django.db import models\nfrom django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n\nfrom wagtail.wagtailcore.models import Page, Orderable\nfrom wagtail.wagtailcore.fields import RichTextField\nfrom wagtail.wagtailimages.edit_handlers import ImageChooserPanel\nfrom wagtail.wagtailimages.models import Image\n\n\nfrom wagtail.wagtailadmin.edit_handlers import (\n FieldPanel, MultiFieldPanel, InlinePanel\n)\nfrom wagtail.wagtailsearch import index\nfrom wagtail.wagtailsnippets.models import register_snippet\nfrom wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel\n\nfrom modelcluster.fields import ParentalKey\nfrom modelcluster.tags import ClusterTaggableManager\nfrom taggit.models import Tag, TaggedItemBase\nfrom utils.models import LinkFields, RelatedLink, CarouselItem\n\n\n# Product page\n\n\n\nProductIndexPage.content_panels = [\n FieldPanel('title', classname=\"full title\"),\n FieldPanel('subtitle'),\n FieldPanel('intro', classname=\"full\"),\n InlinePanel('related_links', label=\"Related links\"),\n]\n\n\n\n\n\n\n\nProductPage.content_panels = [\n FieldPanel('title', classname=\"title\"),\n FieldPanel('price', classname=\"full\"),\n FieldPanel('description', classname=\"full\"),\n ImageChooserPanel('image'),\n FieldPanel('tags'),\n InlinePanel('related_links', label=\"Related links\"),\n]\n\nProductPage.promote_panels = [\n MultiFieldPanel(Page.promote_panels, \"Common page configuration\"),\n ImageChooserPanel('feed_image'),\n]", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProductIndexPageRelatedLink(Orderable, RelatedLink):\n page = ParentalKey('products.ProductIndexPage', related_name='related_links')", "metadata": "root.ProductIndexPageRelatedLink", "header": "['module', '___EOS___']", "index": 23 }, { "content": "class ProductIndexPage(Page):\n subtitle = models.CharField(max_length=255, blank=True)\n intro = RichTextField(blank=True)\n\n indexed_fields = ('intro', )\n\n\n", "metadata": "root.ProductIndexPage", "header": "['module', '___EOS___']", "index": 27 }, { "content": " @property\n def products(self):\n # Get list of live blog pages that are descendants of this page\n products = ProductPage.objects.live().descendant_of(self)\n\n return products", "metadata": "root.ProductIndexPage.products", "header": "['class', 'ProductIndexPage', '(', 'Page', ')', ':', '___EOS___']", "index": 33 }, { "content": " @property\n def tag_list(self):\n tag_ids = ProductPageTag.objects.all().values_list('tag_id', flat=True)\n return Tag.objects.filter(pk__in=tag_ids)", "metadata": "root.ProductIndexPage.tag_list", "header": "['class', 'ProductIndexPage', '(', 'Page', ')', ':', '___EOS___']", "index": 40 }, { "content": " def get_context(self, request):\n # Get products\n products = self.products\n # Filter by tag\n tag = request.GET.get('tag')\n if tag:\n products = products.filter(tags__name=tag)\n\n # Pagination\n page = request.GET.get('page')\n paginator = Paginator(products, 12) # Show 10 products per page\n try:\n products = paginator.page(page)\n except PageNotAnInteger:\n products = paginator.page(1)\n except EmptyPage:\n products = paginator.page(paginator.num_pages)\n\n # Update template context\n context = super(ProductIndexPage, self).get_context(request)\n context['products'] = products\n return context", "metadata": "root.ProductIndexPage.get_context", "header": "['class', 'ProductIndexPage', '(', 'Page', ')', ':', '___EOS___']", "index": 45 }, { "content": "class ProductPageRelatedLink(Orderable, RelatedLink):\n page = ParentalKey('products.ProductPage', related_name='related_links')", "metadata": "root.ProductPageRelatedLink", "header": "['module', '___EOS___']", "index": 76 }, { "content": "class ProductPageTag(TaggedItemBase):\n content_object = ParentalKey(\n 'products.ProductPage', related_name='tagged_items'\n )\n ", "metadata": "root.ProductPageTag", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def __unicode__(self):\n return self.name", "metadata": "root.ProductPageTag.__unicode__", "header": "['class', 'ProductPageTag', '(', 'TaggedItemBase', ')', ':', '___EOS___']", "index": 85 }, { "content": "class ProductPage(Page):\n price = models.CharField(max_length=255, blank=True)\n description = RichTextField(blank=True)\n tags = ClusterTaggableManager(through=ProductPageTag, blank=True)\n image = models.ForeignKey(\n Image,\n null=True,\n blank=True,\n on_delete=models.SET_NULL,\n related_name='+'\n )\n feed_image = models.ForeignKey(\n Image,\n null=True,\n blank=True,\n on_delete=models.SET_NULL,\n related_name='+'\n )\n\n indexed_fields = ('title', 'intro', 'biography')", "metadata": "root.ProductPage", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "from wagtail.wagtailsearch import index", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 39 }, { "span": "from wagtail.wagtailsnippets.models import register_snippet", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 59 }, { "span": "from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 69 }, { "span": "from utils.models import LinkFields, RelatedLink, CarouselItem", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 62 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "paginator_", "import_", "Paginator_", ",_", "Emp", "ty", "Page_", ",_", "Page", "Not", "An", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wagtail_", "._", "wagtailcore_", "._", "models_", "import_", "Page_", ",_", "Order", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtailcore_", "._", "fields_", "import_", "Rich", "Text", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "images_", "._", "edit", "\\u", "handlers_", "import_", "Image", "Choose", "r", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "images_", "._", "models_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "admin_", "._", "edit", "\\u", "handlers_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", ",_", "Multi", "Field", "Panel_", ",_", "In", "line", "Panel_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "search_", "import_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "snippets_", "._", "models_", "import_", "register", "\\u", "snippet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wagtail_", "._", "wagtail", "snippets_", "._", "edit", "\\u", "handlers_", "import_", "Snippet", "Choose", "r", "Panel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "model", "cluster_", "._", "fields_", "import_", "Parent", "al", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "model", "cluster_", "._", "tags_", "import_", "Cluster", "Tagg", "able", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagg", "it_", "._", "models_", "import_", "Tag_", ",_", "Tagg", "ed", "Item", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "._", "models_", "import_", "Link", "Fields_", ",_", "Rela", "ted", "Link_", ",_", "Car", "ouse", "l", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Product", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "Product", "Index", "Page_", "._", "content", "\\u", "panels_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "title", "'_", ",_", "classname_", "=_", "\"", "full", " ", "title", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "subtit", "le", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "intro", "'_", ",_", "classname_", "=_", "\"", "full", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Panel_", "(_", "'", "relate", "d\\u", "link", "s", "'_", ",_", "label_", "=_", "\"", "Rela", "ted", " ", "link", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Product", "Page_", "._", "content", "\\u", "panels_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "title", "'_", ",_", "classname_", "=_", "\"", "title", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "price", "'_", ",_", "classname_", "=_", "\"", "full", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "description", "'_", ",_", "classname_", "=_", "\"", "full", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "Choose", "r", "Panel_", "(_", "'", "image", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "Panel_", "(_", "'", "tags", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Panel_", "(_", "'", "relate", "d\\u", "link", "s", "'_", ",_", "label_", "=_", "\"", "Rela", "ted", " ", "link", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Product", "Page_", "._", "promote", "\\u", "panels_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Multi", "Field", "Panel_", "(_", "Page_", "._", "promote", "\\u", "panels_", ",_", "\"", "Common", " ", "page", " ", "configura", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Image", "Choose", "r", "Panel_", "(_", "'", "feed", "\\u", "image", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Product", "Index", "Page", "Rela", "ted", "Link_", "(_", "Order", "able_", ",_", "Rela", "ted", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "Parent", "al", "Key_", "(_", "'", "products", ".", "Product", "Index", "Page", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "relate", "d\\u", "link", "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_", "class_", "Product", "Index", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subtitle_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intro_", "=_", "Rich", "Text", "Field_", "(_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "indexe", "d\\u", "fields_", "=_", "(_", "'", "intro", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Product", "Index", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "products_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "list", " ", "of", " ", "live", " ", "blog", " ", "page", "s", " ", "tha", "t", " ", "are", " ", "descendants", " ", "of", " ", "this", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "Product", "Page_", "._", "objects_", "._", "live_", "(_", ")_", "._", "descendant", "\\u", "of_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "products_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Product", "Index", "Page_", "(_", "Page_", ")_", ":_", "\\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_", "tag", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag", "\\u", "ids_", "=_", "Product", "Page", "Tag_", "._", "objects_", "._", "all_", "(_", ")_", "._", "values", "\\u", "list_", "(_", "'", "tag", "\\u", "id", "'_", ",_", "flat_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Tag_", "._", "objects_", "._", "filter_", "(_", "pk", "\\u\\u", "in_", "=_", "tag", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Product", "Index", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "self_", "._", "products_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Filter", " ", "by", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "products_", "._", "filter_", "(_", "tags", "\\u\\u", "name_", "=_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pagination", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "page", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paginator_", "=_", "Paginator_", "(_", "products_", ",_", "12_", ")_", "#", " ", "Show", " ", "10", " ", "products", " ", "per", " ", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "paginator_", "._", "page_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Page", "Not", "An", "Integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "paginator_", "._", "page_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Page_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "products_", "=_", "paginator_", "._", "page_", "(_", "paginator_", "._", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "template", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "super_", "(_", "Product", "Index", "Page_", ",_", "self_", ")_", "._", "get", "\\u", "context_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "products", "'_", "]_", "=_", "products_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Product", "Page", "Rela", "ted", "Link_", "(_", "Order", "able_", ",_", "Rela", "ted", "Link_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "Parent", "al", "Key_", "(_", "'", "products", ".", "Product", "Page", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "relate", "d\\u", "link", "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_", "class_", "Product", "Page", "Tag_", "(_", "Tagg", "ed", "Item", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content", "\\u", "object_", "=_", "Parent", "al", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "products", ".", "Product", "Page", "'_", ",_", "relate", "d\\u", "name_", "=_", "'", "tagg", "ed", "\\u", "items", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Product", "Page", "Tag_", "(_", "Tagg", "ed", "Item", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "unicode\\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]_", "module_", "\\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_", "Product", "Page_", "(_", "Page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "price_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "255_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "Rich", "Text", "Field_", "(_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "Cluster", "Tagg", "able", "Manager_", "(_", "through_", "=_", "Product", "Page", "Tag_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "null_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blank_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "delete_", "=_", "models_", "._", "SET", "\\u", "NULL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relate", "d\\u", "name_", "=_", "'+'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feed", "\\u", "image_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "null_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blank_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "delete_", "=_", "models_", "._", "SET", "\\u", "NULL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relate", "d\\u", "name_", "=_", "'+'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "indexe", "d\\u", "fields_", "=_", "(_", "'", "title", "'_", ",_", "'", "intro", "'_", ",_", "'", "bio", "graph", "y", "'_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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Application.py
[ { "content": "import collections\nimport copy\nfrom .Utils import _write_complex_object\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Application(object):\n \"\"\"Data contract class for type Application.\n \"\"\"\n _defaults = collections.OrderedDict([\n ('ai.application.ver', None)\n ])\n \n \n \n \n ", "metadata": "root.Application", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self):\n \"\"\"Initializes a new instance of the class.\n \"\"\"\n self._values = {\n }\n self._initialize()", "metadata": "root.Application.__init__", "header": "['class', 'Application', '(', 'object', ')', ':', '___EOS___']", "index": 11 }, { "content": " @property\n def ver(self):\n \"\"\"The ver property.\n \n Returns:\n (string). the property value. (defaults to: None)\n \"\"\"\n if 'ai.application.ver' in self._values:\n return self._values['ai.application.ver']\n return self._defaults['ai.application.ver']", "metadata": "root.Application.ver", "header": "['class', 'Application', '(', 'object', ')', ':', '___EOS___']", "index": 18 }, { "content": " @ver.setter\n def ver(self, value):\n \"\"\"The ver property.\n \n Args:\n value (string). the property value.\n \"\"\"\n if value == self._defaults['ai.application.ver'] and 'ai.application.ver' in self._values:\n del self._values['ai.application.ver']\n else:\n self._values['ai.application.ver'] = value", "metadata": "root.Application.ver", "header": "['class', 'Application', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": " def _initialize(self):\n \"\"\"Initializes the current instance of the object.\n \"\"\"\n pass", "metadata": "root.Application._initialize", "header": "['class', 'Application', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def write(self):\n \"\"\"Writes the contents of this object and returns the content as a dict object.\n \n Returns:\n (dict). the object that represents the same data as the current instance.\n \"\"\"\n return _write_complex_object(self._defaults, self._values)", "metadata": "root.Application.write", "header": "['class', 'Application', '(', 'object', ')', ':', '___EOS___']", "index": 46 } ]
[ { "span": "import copy", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "Utils_", "import_", "\\u", "write", "\\u", "complex", "\\u", "object_", "\\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_", "Application_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Data", " ", "contract", " ", "class", " ", "for", " ", "type", " ", "Applica", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "defaults_", "=_", "collections_", "._", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", ",_", "None_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Application_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "es", " ", "a", " ", "new", " ", "instance", " ", "of", " ", "the", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "initialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "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_", "ver_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "ver", " ", "property", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "(", "string", ").", " ", "the", " ", "property", " ", "value", ".", " ", "(", "default", "s", " ", "to", ":", " ", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "in_", "self_", "._", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "values_", "[_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "defaults_", "[_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "ver_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ver_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "ver", " ", "property", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "(", "string", ").", " ", "the", " ", "property", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "self_", "._", "\\u", "defaults_", "[_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "]_", "and_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "in_", "self_", "._", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "values_", "[_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "]_", "\\u\\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", "values_", "[_", "'", "ai", ".", "applica", "tion", ".", "ver", "'_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "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", "initialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "es", " ", "the", " ", "current", " ", "instance", " ", "of", " ", "the", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", "s", " ", "the", " ", "content", "s", " ", "of", " ", "this", " ", "object", " ", "and", " ", "return", "s", " ", "the", " ", "content", " ", "as", " ", "a", " ", "dict", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "(", "dict", ").", " ", "the", " ", "object", " ", "tha", "t", " ", "represent", "s", " ", "the", " ", "same", " ", "data", " ", "as", " ", "the", " ", "current", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "write", "\\u", "complex", "\\u", "object_", "(_", "self_", "._", "\\u", "defaults_", ",_", "self_", "._", "\\u", "values_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
xraypy/xraylarch/win32/setup_freeze.py
[ { "content": "\"\"\"\nsetup.py script for cx_Freeze\n\nUsage:\n python setup_freeze.py bdist_mac --iconfile=GSEMap.icns\n\nthen use disk utility to make a .dmg\n\"\"\"\n\nfrom cx_Freeze import setup, Executable\n\nimport os, sys\nimport wx\nimport wx.lib.agw.flatnotebook\nimport numpy, scipy, matplotlib\nmatplotlib.use('WXAgg')\nimport sqlalchemy\n\nfrom scipy.sparse.csgraph import _validation\nfrom scipy.io import netcdf\nnetcdf_open = netcdf.netcdf_file\n\nimport wxmplot\nfrom wxmplot.plotframe import PlotFrame\nimport larch\n\nimport Image\nimport epics\nimport Carbon\n\nlibca = epics.ca.initialize_libca()\nmpl_data_files = matplotlib.get_py2exe_datafiles()\n\nresource_files = ['../COPYING']\n## also: use\n## if getattr(sys, 'frozen', None) == 'macosx_app':\n## in lib/site_config.py to specify plugin path\n\nplugin_files = []\npsrc = \"/usr/share/larch\"\nfor dname in os.listdir('%s/plugins' % psrc):\n pname = '%s/plugins/%s' % (psrc, dname)\n if os.path.isdir(pname):\n flist = ['%s/%s' % (pname, f) for f in os.listdir(pname) if not f.endswith('.pyc')]\n plugin_files.append((\"larch/plugins/%s\" % dname, flist))\n\n\ndll_files = [(\"larch/dlls/darwin/\",\n ['%s/dlls/darwin/%s' % (psrc, f) for f in os.listdir('%s/dlls/darwin' % psrc)]\n )]\n\nDATA_FILES = []\n\nexe_opts = {# 'packages': ['wx', 'numpy','sqlalchemy'],\n 'includes': ['Carbon', 'Carbon.Appearance', 'ConfigParser',\n 'Image', 'ctypes', 'epics', 'epics.devices',\n 'fpformat', 'h5py', 'h5py._objects',\n 'h5py._proxy', 'h5py.defs', 'h5py.utils',\n 'matplotlib', 'numpy', 'scipy',\n 'scipy.constants', 'scipy.fftpack',\n 'scipy.io.matlab.mio5_utils',\n 'scipy.io.matlab.streams', 'scipy.io.netcdf',\n 'scipy.optimize', 'scipy.signal',\n 'skimage', 'skimage.exposure', 'wxutils',\n 'scipy.sparse.csgraph._validation', 'sqlalchemy',\n 'sqlalchemy.dialects.sqlite', 'sqlalchemy.orm',\n 'sqlalchemy.pool', 'sqlite3', 'wx', 'wx._core',\n 'wx.lib', 'wx.lib.agw', 'wx.lib.agw.flatnotebook',\n 'wx.lib.colourselect', 'wx.lib.masked',\n 'wx.lib.mixins', 'wx.lib.mixins.inspection',\n 'wx.lib.agw.pycollapsiblepane',\n 'wx.lib.newevent', 'wx.py', 'wxmplot', 'wxversion',\n 'xdrlib', 'xml.etree', 'xml.etree.cElementTree'],\n 'excludes': ['Tkinter', '_tkinter', 'Tkconstants', 'tcl',\n '_imagingtk', 'PIL._imagingtk', 'ImageTk',\n 'PIL.ImageTk', 'FixTk''_gtkagg', '_tkagg',\n 'matplotlib.tests',\n 'qt', 'PyQt4Gui', 'email', 'IPython'],\n # 'iconfile': 'GSEMap.icns',\n }\n\nappname = 'GSEMapViewer'\nappvers = '1.1'\nsetup(name = appname,\n version = appvers,\n description = \"GSECARS XRM MapViewer\",\n options = {'build_exe': exe_opts},\n data_files = mpl_data_files + dll_files, ## + plugin_files\n executables = [Executable('../bin/GSE_MapViewer', base=None)])\n\n# contents = 'build/%s-%s.app/Contents' % (appname, appvers)\n# contents = contents.replace(' ', '\\ ')\n# \n# def sys(cmd):\n# print ' >> ', cmd\n# os.system(cmd)\n# \n# sys(\"cp -pr GSEMap.icns %s/Resources/.\" % contents)\n# sys(\"cp -pr ../dlls/darwin/* %s/MacOS/.\" % contents)\n# \n# try:\n# os.makedirs(\"%s/Resources/larch/\" % contents)\n# except:\n# pass\n# \n# for subdir in ('modules', 'plugins', 'dlls'):\n# sys(\"cp -pr ../%s %s/Resources/larch/.\" % (subdir, contents))\n# \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os, sys", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 14 }, { "span": "import wx", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 9 }, { "span": "import wx.lib.agw.flatnotebook", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 30 }, { "span": "import numpy, scipy, matplotlib", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 31 }, { "span": "import sqlalchemy", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 17 }, { "span": "from scipy.sparse.csgraph import _validation", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 44 }, { "span": "import wxmplot", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 14 }, { "span": "from wxmplot.plotframe import PlotFrame", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 39 }, { "span": "import larch", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 12 }, { "span": "import Image", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 12 }, { "span": "import Carbon", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "setup", ".", "py", " ", "script", " ", "for", " ", "cx", "\\u", "Freez", "e", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", " ", " ", " ", " ", "python", " ", "setup", "\\u", "freez", "e", ".", "py", " ", "bdist", "\\u", "mac", " ", "--", "icon", "file", "=", "GS", "EM", "ap", ".", "ic", "ns", "\\", "10", ";", "\\", "10", ";", "then", " ", "use", " ", "disk", " ", "utility", " ", "to", " ", "make", " ", "a", " ", ".", "dmg", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cx", "\\u", "Freez", "e_", "import_", "setup_", ",_", "Executable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wx_", "._", "lib_", "._", "ag", "w_", "._", "flat", "notebook_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", ",_", "scipy_", ",_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matplotlib_", "._", "use_", "(_", "'", "WX", "Agg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlalchemy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scipy_", "._", "sparse_", "._", "cs", "graph_", "import_", "\\u", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "io_", "import_", "netcdf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "netcdf", "\\u", "open_", "=_", "netcdf", "_", "._", "netcdf", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "wx", "mplo", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "wx", "mplo", "t_", "._", "plot", "frame_", "import_", "Plot", "Frame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lar", "ch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "epic", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Car", "bon", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "libc", "a_", "=_", "epic", "s_", "._", "ca_", "._", "initialize", "\\u", "libc", "a_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mpl", "\\u", "data\\u", "files_", "=_", "matplotlib_", "._", "get", "\\u", "py2", "exe", "\\u", "datafile", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "\\u", "files_", "=_", "[_", "'../", "COPY", "ING", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "als", "o", ":", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "if", " ", "getattr", "(", "sys", ",", " ", "'", "frozen", "',", " ", "Non", "e", ")", " ", "==", " ", "'", "macos", "x", "\\u", "app", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "in", " ", "lib", "/", "site", "\\u", "config", ".", "py", " ", "to", " ", "speci", "fy", " ", "plugin", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "psr", "c_", "=_", "\"/", "usr", "/", "share", "/", "lar", "ch", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "dname_", "in_", "os_", "._", "listdir_", "(_", "'%", "s", "/", "plugin", "s", "'_", "%_", "psr", "c_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pname_", "=_", "'%", "s", "/", "plugin", "s", "/", "%", "s", "'_", "%_", "(_", "psr", "c_", ",_", "dname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "pname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flist_", "=_", "[_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "pname_", ",_", "f_", ")_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "pname_", ")_", "if_", "not_", "f_", "._", "endswith_", "(_", "'.", "pyc", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin", "\\u", "files_", "._", "append_", "(_", "(_", "\"", "lar", "ch", "/", "plugin", "s", "/", "%", "s", "\"_", "%_", "dname_", ",_", "flist_", ")_", ")_", "\\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_", "dll", "\\u", "files_", "=_", "[_", "(_", "\"", "lar", "ch", "/", "dll", "s", "/", "dar", "win", "/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'%", "s", "/", "dll", "s", "/", "dar", "win", "/", "%", "s", "'_", "%_", "(_", "psr", "c_", ",_", "f_", ")_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "'%", "s", "/", "dll", "s", "/", "dar", "win", "'_", "%_", "psr", "c_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DATA", "\\u", "FILES_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exe", "\\u", "opts_", "=_", "{_", "#", " ", "'", "package", "s", "':", " ", "['", "wx", "',", " ", "'", "nump", "y", "','", "sqla", "lche", "my", "']", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "include", "s", "'_", ":_", "[_", "'", "Car", "bon", "'_", ",_", "'", "Car", "bon", ".", "Appearance", "'_", ",_", "'", "Config", "Parser", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Image", "'_", ",_", "'", "ctype", "s", "'_", ",_", "'", "epic", "s", "'_", ",_", "'", "epic", "s", ".", "device", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fp", "format", "'_", ",_", "'", "h5", "py", "'_", ",_", "'", "h5", "py", ".\\u", "object", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "h5", "py", ".\\u", "proxy", "'_", ",_", "'", "h5", "py", ".", "def", "s", "'_", ",_", "'", "h5", "py", ".", "util", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mat", "plotlib", "'_", ",_", "'", "nump", "y", "'_", ",_", "'", "sci", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ".", "constant", "s", "'_", ",_", "'", "sci", "py", ".", "fft", "pack", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ".", "io", ".", "matlab", ".", "mio", "5", "\\u", "util", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ".", "io", ".", "matlab", ".", "stream", "s", "'_", ",_", "'", "sci", "py", ".", "io", ".", "netcdf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ".", "optimize", "'_", ",_", "'", "sci", "py", ".", "signal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ski", "mage", "'_", ",_", "'", "ski", "mage", ".", "exposure", "'_", ",_", "'", "wx", "util", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sci", "py", ".", "spars", "e", ".", "cs", "graph", ".\\u", "validation", "'_", ",_", "'", "sqla", "lche", "my", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sqla", "lche", "my", ".", "dialect", "s", ".", "sql", "ite", "'_", ",_", "'", "sqla", "lche", "my", ".", "orm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sqla", "lche", "my", ".", "pool", "'_", ",_", "'", "sql", "ite", "3", "'_", ",_", "'", "wx", "'_", ",_", "'", "wx", ".\\u", "core", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wx", ".", "lib", "'_", ",_", "'", "wx", ".", "lib", ".", "ag", "w", "'_", ",_", "'", "wx", ".", "lib", ".", "ag", "w", ".", "flat", "notebook", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wx", ".", "lib", ".", "colour", "select", "'_", ",_", "'", "wx", ".", "lib", ".", "mask", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wx", ".", "lib", ".", "mix", "ins", "'_", ",_", "'", "wx", ".", "lib", ".", "mix", "ins", ".", "inspection", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wx", ".", "lib", ".", "ag", "w", ".", "pyco", "lla", "psi", "ble", "pane", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wx", ".", "lib", ".", "newe", "vent", "'_", ",_", "'", "wx", ".", "py", "'_", ",_", "'", "wx", "mplo", "t", "'_", ",_", "'", "wx", "version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xdr", "lib", "'_", ",_", "'", "xml", ".", "etree", "'_", ",_", "'", "xml", ".", "etree", ".", "c", "Element", "Tree", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "excludes", "'_", ":_", "[_", "'", "Tk", "inter", "'_", ",_", "'\\u", "tkin", "ter", "'_", ",_", "'", "Tk", "constant", "s", "'_", ",_", "'", "tcl", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "imagin", "gtk", "'_", ",_", "'", "PI", "L", ".\\u", "imagin", "gtk", "'_", ",_", "'", "Image", "Tk", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PI", "L", ".", "Image", "Tk", "'_", ",_", "'", "Fix", "Tk", "'_", "'\\u", "gtk", "agg", "'_", ",_", "'\\u", "tk", "agg", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mat", "plotlib", ".", "tests", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qt", "'_", ",_", "'", "Py", "Qt", "4", "Gui", "'_", ",_", "'", "email", "'_", ",_", "'", "IP", "yth", "on", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "icon", "file", "':", " ", "'", "GS", "EM", "ap", ".", "ic", "ns", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "appname_", "=_", "'", "GS", "EM", "ap", "View", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "vers_", "=_", "'", "1.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup_", "(_", "name_", "=_", "appname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "app", "vers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "GS", "EC", "AR", "S", " ", "XR", "M", " ", "Map", "View", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "'", "build", "\\u", "exe", "'_", ":_", "exe", "\\u", "opts_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "files_", "=_", "mpl", "\\u", "data\\u", "files_", "+_", "dll", "\\u", "files_", ",_", "##", " ", " ", "+", " ", "plugin", "\\u", "files_", "\\u\\u\\uNL\\u\\u\\u_", "executable", "s_", "=_", "[_", "Executable", "_", "(_", "'../", "bin", "/", "GS", "E", "\\u", "Map", "View", "er", "'_", ",_", "base_", "=_", "None_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", "s", " ", "=", " ", "'", "build", "/", "%", "s", "-%", "s", ".", "app", "/", "Conten", "ts", "'", " ", "%", " ", "(", "app", "name", ",", " ", "app", "vers", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", "s", " ", "=", " ", "content", "s", ".", "replace", "('", " ", "',", " ", "'\\\\", " ", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "sys", "(", "cmd", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'", " ", ">>", " ", "',", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "os", ".", "system", "(", "cmd", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", "(\"", "cp", " ", "-", "pr", " ", "GS", "EM", "ap", ".", "ic", "ns", " ", " ", "%", "s", "/", "Reso", "urc", "es", "/.", "\"", " ", "%", " ", "content", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", "(\"", "cp", " ", "-", "pr", " ", "..", "/", "dll", "s", "/", "dar", "win", "/*", " ", "%", "s", "/", "Mac", "OS", "/.", "\"", " ", "%", " ", "content", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "os", ".", "maked", "irs", "(\"", "%", "s", "/", "Reso", "urc", "es", "/", "lar", "ch", "/\"", " ", "%", " ", "content", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "subdir", " ", "in", " ", "('", "module", "s", "',", " ", "'", "plugin", "s", "',", " ", "'", "dll", "s", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sys", "(\"", "cp", " ", "-", "pr", " ", "..", "/", "%", "s", " ", " ", " ", "%", "s", "/", "Reso", "urc", "es", "/", "lar", "ch", "/.", "\"", " ", "%", " ", "(", "subdir", ",", " ", "content", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 2, 0, 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, 0, 1, 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, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
douban/dpark/dpark/env.py
[ { "content": "import os\nimport logging\nimport time\nimport socket\nimport shutil\nimport uuid\n\nimport zmq\n\nfrom dpark import util\nimport dpark.conf as conf\n\nlogger = logging.getLogger(__name__)\n\n\n\nenv = DparkEnv()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DparkEnv:\n environ = {}\n\n\n\n\n", "metadata": "root.DparkEnv", "header": "['module', '___EOS___']", "index": 15 }, { "content": " @classmethod\n def register(cls, name, value):\n cls.environ[name] = value", "metadata": "root.DparkEnv.register", "header": "['class', 'DparkEnv', ':', '___EOS___']", "index": 18 }, { "content": " @classmethod\n def get(cls, name, default=None):\n return cls.environ.get(name, default)", "metadata": "root.DparkEnv.get", "header": "['class', 'DparkEnv', ':', '___EOS___']", "index": 22 }, { "content": " def __init__(self):\n self.started = False", "metadata": "root.DparkEnv.__init__", "header": "['class', 'DparkEnv', ':', '___EOS___']", "index": 26 }, { "content": " def start(self, isMaster, environ={}):\n if self.started:\n return\n logger.debug(\"start env in %s: %s %s\", os.getpid(), isMaster, environ)\n self.isMaster = isMaster\n if isMaster:\n roots = conf.DPARK_WORK_DIR\n if isinstance(roots, str):\n roots = roots.split(',')\n name = '%s-%s' % (socket.gethostname(), uuid.uuid4())\n self.workdir = [os.path.join(root, name) for root in roots]\n try:\n for d in self.workdir:\n util.mkdir_p(d)\n except OSError as e:\n if environ.get('is_local', False):\n raise e\n\n self.environ['SERVER_URI'] = 'file://' + self.workdir[0]\n self.environ['WORKDIR'] = self.workdir\n self.environ['COMPRESS'] = util.COMPRESS\n else:\n self.environ.update(environ)\n if self.environ['COMPRESS'] != util.COMPRESS:\n raise Exception(\"no %s available\" % self.environ['COMPRESS'])\n\n self.ctx = zmq.Context()\n\n from dpark.tracker import TrackerServer, TrackerClient\n if isMaster:\n self.trackerServer = TrackerServer()\n self.trackerServer.start()\n addr = self.trackerServer.addr\n env.register('TrackerAddr', addr)\n else:\n addr = env.get('TrackerAddr')\n\n self.trackerClient = TrackerClient(addr)\n\n from dpark.cache import CacheTracker\n self.cacheTracker = CacheTracker()\n\n from dpark.shuffle import LocalFileShuffle, MapOutputTracker\n LocalFileShuffle.initialize(isMaster)\n self.mapOutputTracker = MapOutputTracker()\n from dpark.shuffle import ParallelShuffleFetcher\n self.shuffleFetcher = ParallelShuffleFetcher(2)\n\n from dpark.broadcast import start_manager\n start_manager(isMaster)\n\n self.started = True\n logger.debug(\"env started\")", "metadata": "root.DparkEnv.start", "header": "['class', 'DparkEnv', ':', '___EOS___']", "index": 29 }, { "content": " def stop(self):\n if not getattr(self, 'started', False):\n return\n logger.debug(\"stop env in %s\", os.getpid())\n self.shuffleFetcher.stop()\n self.cacheTracker.stop()\n self.mapOutputTracker.stop()\n if self.isMaster:\n self.trackerServer.stop()\n from dpark.broadcast import stop_manager\n stop_manager()\n\n logger.debug(\"cleaning workdir ...\")\n for d in self.workdir:\n shutil.rmtree(d, True)\n logger.debug(\"done.\")\n\n self.started = False", "metadata": "root.DparkEnv.stop", "header": "['class', 'DparkEnv', ':', '___EOS___']", "index": 83 } ]
[ { "span": "import time", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dpa", "rk_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dpa", "rk_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "=_", "Dp", "ark", "Env_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Dp", "ark", "Env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "environ_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Dp", "ark", "Env_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "environ_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dp", "ark", "Env_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "cls_", ",_", "name_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "environ_", "._", "get_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dp", "ark", "Env_", ":_", "\\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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dp", "ark", "Env_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ",_", "is", "Master_", ",_", "environ_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "started_", ":_", "\\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_", "logger_", "._", "debug_", "(_", "\"", "start", " ", "env", " ", "in", " ", "%", "s", ":", " ", "%", "s", " ", "%", "s", "\"_", ",_", "os_", "._", "getpid_", "(_", ")_", ",_", "is", "Master_", ",_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "Master_", "=_", "is", "Master_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roots_", "=_", "conf_", "._", "DP", "AR", "K", "\\u", "WORK", "\\u", "DIR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "roots_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "roots_", "=_", "roots_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "'%", "s", "-%", "s", "'_", "%_", "(_", "socket_", "._", "gethostname_", "(_", ")_", ",_", "uuid_", "._", "uuid4_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "workdir_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", "for_", "root_", "in_", "roots_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "d_", "in_", "self_", "._", "workdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "util_", "._", "mkd", "ir", "\\u", "p_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "environ_", "._", "get_", "(_", "'", "is", "\\u", "local", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "environ_", "[_", "'", "SERVER", "\\u", "URI", "'_", "]_", "=_", "'", "file", "://'_", "+_", "self_", "._", "workdir_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ_", "[_", "'", "WORK", "DIR", "'_", "]_", "=_", "self_", "._", "workdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environ_", "[_", "'", "COMPRESS", "'_", "]_", "=_", "util_", "._", "COMPRESS", "_", "\\u\\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_", "._", "environ_", "._", "update_", "(_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "environ_", "[_", "'", "COMPRESS", "'_", "]_", "!=_", "util_", "._", "COMPRESS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "no", " ", "%", "s", " ", "avail", "able", "\"_", "%_", "self_", "._", "environ_", "[_", "'", "COMPRESS", "'_", "]_", ")_", "\\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_", "._", "ctx_", "=_", "zmq_", "._", "Context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dpa", "rk_", "._", "tracker_", "import_", "Track", "er", "Server_", ",_", "Track", "er", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "track", "er", "Server_", "=_", "Track", "er", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "track", "er", "Server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "self_", "._", "track", "er", "Server_", "._", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "register_", "(_", "'", "Track", "er", "Add", "r", "'_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "env_", "._", "get_", "(_", "'", "Track", "er", "Add", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "track", "er", "Client_", "=_", "Track", "er", "Client_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dpa", "rk_", "._", "cache_", "import_", "Cache", "Tracker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "Tracker_", "=_", "Cache", "Tracker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dpa", "rk_", "._", "shuffle_", "import_", "Local", "File", "Shuffle", "_", ",_", "Map", "Output", "Tracker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Local", "File", "Shuffle", "_", "._", "initialize_", "(_", "is", "Master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "Output", "Tracker_", "=_", "Map", "Output", "Tracker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dpa", "rk_", "._", "shuffle_", "import_", "Parallel", "Shuffle", "Fetcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shu", "ffle", "Fetcher_", "=_", "Parallel", "Shuffle", "Fetcher_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dpa", "rk_", "._", "broadcast_", "import_", "start", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "manager_", "(_", "is", "Master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "started_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "env", " ", "start", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dp", "ark", "Env_", ":_", "\\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 ", " _", "if_", "not_", "getattr_", "(_", "self_", ",_", "'", "start", "ed", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "stop", " ", "env", " ", "in", " ", "%", "s", "\"_", ",_", "os_", "._", "getpid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shu", "ffle", "Fetcher_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "Tracker_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "Output", "Tracker_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "is", "Master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "track", "er", "Server_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "dpa", "rk_", "._", "broadcast_", "import_", "stop", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "clean", "ing", " ", "workdir", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "self_", "._", "workdir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "d_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "don", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 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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 ]
Unused import
thasso/pyjip/jip/__init__.py
[ { "content": "#!/usr/bin/env python\n\"\"\"JIP script execution and pipeline system\"\"\"\nimport jip.logger\nfrom jip.logger import log_level\nfrom jip.tools import tool, pytool, pipeline, Scanner, ValidationError, Tool,\\\n ToolNotFoundException\nfrom jip.jobs import set_state\nfrom jip.jobs import create_groups, create_jobs, create_executions\nfrom jip.jobs import run_job\nfrom jip.jobs import submit_job\nfrom jip.pipelines import Pipeline\nfrom jip.profiles import Profile\nfrom jip.configuration import Config\nfrom jip.options import ParserException\nfrom jip.db import STATE_DONE, STATE_QUEUED, STATE_CANCELED, STATE_HOLD, \\\n STATE_FAILED\n\n__version__ = \"0.6\"\n\nconfig = Config()\nscanner = Scanner(jip_path=config.get('jip_path'),\n jip_modules=config.get('jip_modules', []))\nfind = scanner.find\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import jip.logger", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 17 }, { "span": "from jip.logger import log_level", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 32 }, { "span": "from jip.tools import tool, pytool, pipeline, Scanner, ValidationError, Tool,\\\n ToolNotFoundException", "start_line": 4, "start_column": 0, "end_line": 5, "end_column": 25 }, { "span": "from jip.jobs import set_state", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 30 }, { "span": "from jip.jobs import create_groups, create_jobs, create_executions", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 66 }, { "span": "from jip.jobs import run_job", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 28 }, { "span": "from jip.jobs import submit_job", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 31 }, { "span": "from jip.pipelines import Pipeline", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 34 }, { "span": "from jip.profiles import Profile", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 32 }, { "span": "from jip.options import ParserException", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 39 }, { "span": "from jip.db import STATE_DONE, STATE_QUEUED, STATE_CANCELED, STATE_HOLD, \\\n STATE_FAILED", "start_line": 14, "start_column": 0, "end_line": 15, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "JI", "P", " ", "script", " ", "executi", "on", " ", "and", " ", "pipeline", " ", "system", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ji", "p_", "._", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "logger_", "import_", "log", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "tools_", "import_", "tool_", ",_", "pyto", "ol_", ",_", "pipeline_", ",_", "Scanner_", ",_", "Validat", "ion", "Error_", ",_", "Tool_", ",_", "Tool", "Not", "Foun", "d", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "jobs_", "import_", "set\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "jobs_", "import_", "create", "\\u", "groups_", ",_", "create", "\\u", "jobs_", ",_", "create", "\\u", "executions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "jobs_", "import_", "run", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "jobs_", "import_", "submit", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "pipeline", "s_", "import_", "Pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "profiles_", "import_", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "configuration_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "options_", "import_", "Parser", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ji", "p_", "._", "db_", "import_", "STATE", "\\u", "DONE_", ",_", "STATE", "\\u", "QUEUE", "D_", ",_", "STATE", "\\u", "CANCEL", "ED_", ",_", "STATE", "\\u", "HOLD", "_", ",_", "STATE", "\\u", "FAILED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "0.", "6", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scanner_", "=_", "Scanner_", "(_", "ji", "p", "\\u", "path_", "=_", "config_", "._", "get_", "(_", "'", "ji", "p", "\\u", "path", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ji", "p", "\\u", "modules_", "=_", "config_", "._", "get_", "(_", "'", "ji", "p", "\\u", "module", "s", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "find_", "=_", "scanner_", "._", "find_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 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, 2, 0, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 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, 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, 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 ]
Except block handles 'BaseException'
Djacket/djacket/core/backend/git/http.py
[ { "content": " def get_http_info_refs(self):\n \"\"\"\n Returns a HttpResponse for info/refs requests.\n \"\"\"\n\n try:\n self.set_response_header()\n self.set_response_first_line()\n self.set_response_payload(GIT_HTTP_INFO_REFS)\n return self\n except BaseException as e:\n return get_http_error(e)", "metadata": "root.GitResponse.get_http_info_refs", "header": "['class', 'GitResponse', '(', 'HttpResponse', ')', ':', '___EOS___']", "index": 134 }, { "content": " def get_http_service_rpc(self):\n \"\"\"\n Returns a HttpResponse to 'git-upload-pack', 'git-receive-pack' requests.\n \"\"\"\n\n try:\n self.set_response_header()\n if self.service == GIT_SERVICE_RECEIVE_PACK:\n self.set_response_payload(GIT_HTTP_SERVICE_RECEIVE_PACK)\n elif self.service == GIT_SERVICE_UPLOAD_PACK:\n self.set_response_payload(GIT_HTTP_SERVICE_UPLOAD_PACK)\n return self\n except BaseException as e:\n return get_http_error(e)", "metadata": "root.GitResponse.get_http_service_rpc", "header": "['class', 'GitResponse', '(', 'HttpResponse', ')', ':', '___EOS___']", "index": 148 } ]
[ { "span": "except BaseException as e:", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 34 }, { "span": "except BaseException as e:", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 34 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Git", "Response_", "(_", "Http", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "http", "\\u", "info", "\\u", "refs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Http", "Respons", "e", " ", "for", " ", "info", "/", "refs", " ", "request", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "response", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "response", "\\u", "first", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "response", "\\u", "payload_", "(_", "GIT", "\\u", "HTTP", "\\u", "INFO", "\\u", "REF", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "http", "\\u", "error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Response_", "(_", "Http", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "http", "\\u", "service", "\\u", "rpc_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Http", "Respons", "e", " ", "to", " ", "'", "git", "-", "upload", "-", "pack", "',", " ", "'", "git", "-", "receive", "-", "pack", "'", " ", "request", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "response", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "service_", "==_", "GIT", "\\u", "SERV", "ICE", "\\u", "RECEIVE", "\\u", "PACK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "response", "\\u", "payload_", "(_", "GIT", "\\u", "HTTP", "\\u", "SERV", "ICE", "\\u", "RECEIVE", "\\u", "PACK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "service_", "==_", "GIT", "\\u", "SERV", "ICE", "\\u", "UPLOAD", "\\u", "PACK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "response", "\\u", "payload_", "(_", "GIT", "\\u", "HTTP", "\\u", "SERV", "ICE", "\\u", "UPLOAD", "\\u", "PACK", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "http", "\\u", "error_", "(_", "e_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
apache/climate/obs4MIPs/Toolbox/ESGFresources.py
[ { "content": " def __init__(self,rcFile):\n '''\n Read CMIP5 Table and convert into a dictionary\n strip quote double quote, leading and trailing white space\n from key and value.\n '''\n f=open( rcFile, 'r')\n lines=f.readlines()\n f.close()\n\n self.resources=dict([(key.strip(), value.strip(),) \n for line in lines if line != '\\n' \\\n and line[0] != \"#\" \n for (key, value) in\n [line.strip().\\\n replace(\"'\",\"\").\\\n replace(\"\\\"\",\"\").\\\n rstrip().\\\n split(\"=\")]])\n\n for key in self.resources.keys():\n self.resources[key]=self.resources[key].replace(\"\\\\\",\"\\\"\")\n \n self.xcl=None\n try:\n self.xcl=self.resources['excel_file']\n rc=self.ReadXCL()\n except:\n pass", "metadata": "root.ESGFresources.__init__", "header": "['class', 'ESGFresources', ':', '___EOS___']", "index": 32 }, { "content": " def ReadXCL(self):\n '''\n Read Excel Table and fill rc variable related field.\n '''\n try:\n import xlrd\n except:\n print \"****** Could not find xlrd Python Package ****\"\n print \"****** Please install xlrd package to read excel files ****\"\n\n if( os.path.isfile(self.xcl) ):\n\t\twb=xlrd.open_workbook(self.xcl)\n else:\n print \"****** Could not find \"+self.xcl+\" file ****\"\n print \"****** Please check excel file name ****\"\n raise NameError(self.xcl)\n\n sheet=wb.sheet_by_name('Variables')\n\n self.resources['cmor_var'] = [ sheet.row( i )[ 0 ].value.\\\n encode('ascii','ignore') \\\n for i in arange(sheet.nrows-2) + 2 ]\n\n self.resources['original_var'] = [ sheet.row( i )[ 1 ].value.\\\n encode('ascii','ignore') \\\n for i in arange(sheet.nrows-2) + 2 ]\n\n self.resources['original_units']=[ sheet.row( i )[ 2 ].value.\\\n encode('ascii','ignore') \\\n for i in arange(sheet.nrows-2) + 2 ]\n\n self.resources['level'] =[ sheet.row( i )[ 3 ].value.\\\n encode('ascii','ignore') \\\n for i in arange(sheet.nrows-2) + 2]\n \n self.resources['equation'] =[ sheet.row( i )[ 6 ].value.\\\n encode('ascii','ignore') \\\n for i in arange(sheet.nrows-2) + 2 ]\n\n # -----------------------------------------------------------------\n # Make sure it is a string. The main program will call eval on it.\n # -----------------------------------------------------------------\n self.resources['cmor_var'] = str(self.resources['cmor_var'] )\n self.resources['original_var'] = str(self.resources['original_var'])\n self.resources['original_units'] =str(self.resources['original_units'])\n self.resources['equation'] =str(self.resources['equation'])\n self.resources['level'] =str(self.resources['level'])\n return 1", "metadata": "root.ESGFresources.ReadXCL", "header": "['class', 'ESGFresources', ':', '___EOS___']", "index": 78 }, { "content": "def movefiles(rc): \n '''\n Change CMIP5 directory struture to obs4MIPS directory structure.\n Create new path and rename files following with new convention \n Remove old directory tree.\n '''\n # ----------------------\n # New path for obs4MIPS\n # ----------------------\n path = rc['institute_id' ] + '/' + \\\n rc['instrument' ] + '/' + \\\n rc['project_id' ] + '/' + \\\n rc['product' ] + '/' + \\\n rc['modeling_realm' ] + '/' + \\\n rc['cvrt_cmor_var' ] + '/' + \\\n rc['frequency' ] + '/' + \\\n rc['data_structure' ] + '/' + \\\n rc['institute_id' ] + '/' + \\\n rc['instrument' ] \n \n # -------------------------------------------------------------\n # For TRMM data set version_directory is set to 'false' so that\n # no version will be created in the directory\n # -------------------------------------------------------------\n try:\n rc['version_directory'] == 'false'\n pass\n except:\n path += '/V' + rc['processing_version'] + '/'\n\n # -----------------------------\n # Make sure the directory exist \n # ------------------------------\n try:\n os.makedirs(path)\n except:\n None\n\n # -----------------\n # Rename all files\n # -----------------\n cmorpath = rc['project_id' ] + '/' + \\\n rc['product' ] + '/' + \\\n rc['institute_id'] + '/' \n\n # -----------------\n # Manage attributes\n # -----------------\n for r,d,f in os.walk(cmorpath):\n for files in f:\n if files.endswith(\".nc\"):\n filetimestamp = files.split('_')[-1].strip(\".nc\")\n file = os.path.join(r,files)\n print file\n # -----------------\n # Delete attributes\n # ------------------\n Attr=CMORAttributes( file )\n DelGlbAttributes=eval(rc['DelGlbAttributes'].\\\n replace('\\\\','\\''))\n for attribute in DelGlbAttributes:\n print \"Deleting attribute: %s\" % attribute\n Attr.GlbDel(attribute)\n # -----------------\n # set attributes\n # ------------------\n SetGlbAttributes=eval(rc['SetGlbAttributes'].\\\n replace('\\\\','\\''))\n for (attribute,Value) in SetGlbAttributes:\n print \"Assigning attribute (%s,%s)\" % (attribute,Value)\n Attr.GlbSet(attribute,Value)\n Attr.close()\n\n source = ''\n if( rc['source_fn'] == 'SYNOPTIC' ):\n source = rc['SYNOPTIC']+\"z_\"\n elif( rc['source_fn'] != '' ):\n source = rc['source_fn'].split('_')[0] + '_'\n \n newfilename = rc['cvrt_cmor_var' ] + '_' + \\\n rc['instrument' ] + '-' + \\\n source + \\\n rc['processing_level' ] + '_v'+ \\\n rc['processing_version'] + '_' + \\\n filetimestamp + '.nc'\n \n newfilename = os.path.join(path,newfilename)\n # -----------\n # Move files\n # -----------\n print file\n print newfilename\n os.rename(file,newfilename)\n\n \n # ----------------\n # Remove cmor path\n # ----------------\n shutil.rmtree( rc['project_id'] )\n return 0", "metadata": "root.movefiles", "header": "['module', '___EOS___']", "index": 133 } ]
[ { "span": "except:", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 15 }, { "span": "except:", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 15 }, { "span": "except:", "start_line": 160, "start_column": 4, "end_line": 160, "end_column": 11 }, { "span": "except:", "start_line": 168, "start_column": 4, "end_line": 168, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "ES", "GF", "resources_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "rc", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "CM", "IP", "5", " ", "Table", " ", "and", " ", "convert", " ", "int", "o", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "strip", " ", "quote", " ", "double", " ", "quote", ",", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "white", " ", "space", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "key", " ", "and", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "rc", "File_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "f_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "=_", "dict_", "(_", "[_", "(_", "key_", "._", "strip_", "(_", ")_", ",_", "value_", "._", "strip_", "(_", ")_", ",_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "lines_", "if_", "line_", "!=_", "'\\\\", "n", "'_", "and_", "line_", "[_", "0_", "]_", "!=_", "\"#\"_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "key_", ",_", "value_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "line_", "._", "strip_", "(_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"\"_", ")_", "._", "replace_", "(_", "\"\\\\\"\"_", ",_", "\"\"_", ")_", "._", "rstrip_", "(_", ")_", "._", "split_", "(_", "\"=\"_", ")_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "resources_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "resources_", "[_", "key_", "]_", "=_", "self_", "._", "resources_", "[_", "key_", "]_", "._", "replace_", "(_", "\"\\\\\\\\\"_", ",_", "\"\\\\\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "xc", "l_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xc", "l_", "=_", "self_", "._", "resources_", "[_", "'", "exce", "l\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", "=_", "self_", "._", "Read", "XC", "L_", "(_", ")_", "\\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_", "ES", "GF", "resources_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Read", "XC", "L_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "Exce", "l", " ", "Table", " ", "and", " ", "fill", " ", "rc", " ", "variab", "le", " ", "relate", "d", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "xlr", "d_", "\\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_", "\"****", "**", " ", "Cou", "ld", " ", "not", " ", "find", " ", "xlr", "d", " ", "Pyth", "on", " ", "Packa", "ge", " ", "****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"****", "**", " ", "Ple", "ase", " ", "install", " ", "xlr", "d", " ", "package", " ", "to", " ", "read", " ", "exce", "l", " ", "files", " ", "****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "os_", "._", "path_", "._", "isfile_", "(_", "self_", "._", "xc", "l_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "wb_", "=_", "xlr", "d_", "._", "open", "\\u", "workbook_", "(_", "self_", "._", "xc", "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 ", " _", "print_", "\"****", "**", " ", "Cou", "ld", " ", "not", " ", "find", " ", "\"_", "+_", "self_", "._", "xc", "l_", "+_", "\"", " ", "file", " ", "****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"****", "**", " ", "Ple", "ase", " ", "check", " ", "exce", "l", " ", "file", " ", "name", " ", "****", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Name", "Error_", "(_", "self_", "._", "xc", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sheet_", "=_", "wb_", "._", "sheet", "\\u", "by", "\\u", "name_", "(_", "'", "Varia", "bles", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "cmo", "r", "\\u", "var", "'_", "]_", "=_", "[_", "sheet_", "._", "row_", "(_", "i_", ")_", "[_", "0_", "]_", "._", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", "for_", "i_", "in_", "arange_", "(_", "sheet_", "._", "nrows_", "-_", "2_", ")_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "var", "'_", "]_", "=_", "[_", "sheet_", "._", "row_", "(_", "i_", ")_", "[_", "1_", "]_", "._", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", "for_", "i_", "in_", "arange_", "(_", "sheet_", "._", "nrows_", "-_", "2_", ")_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "unit", "s", "'_", "]_", "=_", "[_", "sheet_", "._", "row_", "(_", "i_", ")_", "[_", "2_", "]_", "._", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", "for_", "i_", "in_", "arange_", "(_", "sheet_", "._", "nrows_", "-_", "2_", ")_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "level", "'_", "]_", "=_", "[_", "sheet_", "._", "row_", "(_", "i_", ")_", "[_", "3_", "]_", "._", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", "for_", "i_", "in_", "arange_", "(_", "sheet_", "._", "nrows_", "-_", "2_", ")_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "equation", "'_", "]_", "=_", "[_", "sheet_", "._", "row_", "(_", "i_", ")_", "[_", "6_", "]_", "._", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", "for_", "i_", "in_", "arange_", "(_", "sheet_", "._", "nrows_", "-_", "2_", ")_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "it", " ", "is", " ", "a", " ", "string", ".", " ", "The", " ", "main", " ", "program", " ", "will", " ", "call", " ", "eval", " ", "on", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "cmo", "r", "\\u", "var", "'_", "]_", "=_", "str_", "(_", "self_", "._", "resources_", "[_", "'", "cmo", "r", "\\u", "var", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "var", "'_", "]_", "=_", "str_", "(_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "var", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "unit", "s", "'_", "]_", "=_", "str_", "(_", "self_", "._", "resources_", "[_", "'", "original", "\\u", "unit", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "equation", "'_", "]_", "=_", "str_", "(_", "self_", "._", "resources_", "[_", "'", "equation", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "resources_", "[_", "'", "level", "'_", "]_", "=_", "str_", "(_", "self_", "._", "resources_", "[_", "'", "level", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "files_", "(_", "rc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Change", " ", "CM", "IP", "5", " ", "director", "y", " ", "stru", "ture", " ", "to", " ", "obs", "4", "MIPS", " ", "director", "y", " ", "structure", ".", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "new", " ", "path", " ", "and", " ", "rename", " ", "files", " ", "follow", "ing", " ", "with", " ", "new", " ", "convention", " ", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "old", " ", "director", "y", " ", "tree", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "New", " ", "path", " ", "for", " ", "obs", "4", "MIPS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "rc_", "[_", "'", "institu", "te", "\\u", "id", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "instrument", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "project", "\\u", "id", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "product", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "modeling", "\\u", "real", "m", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "cv", "rt", "\\u", "cmo", "r", "\\u", "var", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "freque", "nc", "y", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "data\\u", "structure", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "institu", "te", "\\u", "id", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "instrument", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "TR", "MM", " ", "data", " ", "set", " ", "version", "\\u", "director", "y", " ", "is", " ", "set", " ", "to", " ", "'", "fal", "se", "'", " ", "so", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "version", " ", "will", " ", "be", " ", "created", " ", "in", " ", "the", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", "[_", "'", "version", "\\u", "director", "y", "'_", "]_", "==_", "'", "fal", "se", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\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 ", " _", "path_", "+=_", "'/", "V", "'_", "+_", "rc_", "[_", "'", "process", "ing", "\\u", "version", "'_", "]_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "-_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "director", "y", " ", "exist", " _", "\\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 ", " _", "os_", "._", "makedirs_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rename", " ", "all", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmo", "rpath", "_", "=_", "rc_", "[_", "'", "project", "\\u", "id", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "product", "'_", "]_", "+_", "'/'_", "+_", "rc_", "[_", "'", "institu", "te", "\\u", "id", "'_", "]_", "+_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manage", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", ",_", "d_", ",_", "f_", "in_", "os_", "._", "walk_", "(_", "cmo", "rpath", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "files_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "files_", "._", "endswith_", "(_", "\".", "nc", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filet", "imes", "tamp", "_", "=_", "files_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", "\".", "nc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "r_", ",_", "files_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "Attr_", "=_", "CM", "ORA", "ttr", "ibut", "es_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Del", "Gl", "b", "Attributes_", "=_", "eval_", "(_", "rc_", "[_", "'", "Del", "Gl", "b", "Attribute", "s", "'_", "]_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'\\\\''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attribute_", "in_", "Del", "Gl", "b", "Attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Del", "eti", "ng", " ", "attribute", ":", " ", "%", "s", "\"_", "%_", "attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Attr_", "._", "Gl", "b", "Del", "_", "(_", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Set", "Gl", "b", "Attributes_", "=_", "eval_", "(_", "rc_", "[_", "'", "Set", "Gl", "b", "Attribute", "s", "'_", "]_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'\\\\''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "attribute_", ",_", "Value_", ")_", "in_", "Set", "Gl", "b", "Attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"", "Assign", "ing", " ", "attribute", " ", "(%", "s", ",%", "s", ")\"_", "%_", "(_", "attribute_", ",_", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Attr_", "._", "Gl", "b", "Set_", "(_", "attribute_", ",_", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Attr_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "rc_", "[_", "'", "source", "\\u", "fn", "'_", "]_", "==_", "'", "SYN", "OPTI", "C", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "source_", "=_", "rc_", "[_", "'", "SYN", "OPTI", "C", "'_", "]_", "+_", "\"", "z", "\\u\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "rc_", "[_", "'", "source", "\\u", "fn", "'_", "]_", "!=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "source_", "=_", "rc_", "[_", "'", "source", "\\u", "fn", "'_", "]_", "._", "split_", "(_", "'\\u'_", ")_", "[_", "0_", "]_", "+_", "'\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newfile", "name_", "=_", "rc_", "[_", "'", "cv", "rt", "\\u", "cmo", "r", "\\u", "var", "'_", "]_", "+_", "'\\u'_", "+_", "rc_", "[_", "'", "instrument", "'_", "]_", "+_", "'-'_", "+_", "source_", "+_", "rc_", "[_", "'", "process", "ing", "\\u", "level", "'_", "]_", "+_", "'\\u", "v", "'_", "+_", "rc_", "[_", "'", "process", "ing", "\\u", "version", "'_", "]_", "+_", "'\\u'_", "+_", "filet", "imes", "tamp", "_", "+_", "'.", "nc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "newfile", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "newfile", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "file_", ",_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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n s = \"123\"\n x = ('a' + 'b').strip()\n (\" \" + s).rstrip()\n #self.fail(\"Callfunc over expressions, #591\")", "metadata": "root.CompileTest.test_callfunc_expressions", "header": "['class', 'CompileTest', '(', 'UnitTest', '.', 'UnitTest', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_subscript_tuple(self):\n d = {}\n d[(1,2)] = 3\n x = d[1,2]\n d[3,4] = 5\n #self.fail(\"Tuple subscripts issue #496\")", "metadata": "root.CompileTest.test_subscript_tuple", "header": "['class', 'CompileTest', '(', 'UnitTest', '.', 'UnitTest', ')', ':', '___EOS___']", "index": 41 } ]
[ { "span": "x ", "start_line": 29, "start_column": 8, "end_line": 29, "end_column": 9 }, { "span": "x ", "start_line": 44, "start_column": 8, "end_line": 44, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Compil", "e", "Test_", "(_", "Unit", "Test_", "._", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "call", "func", "\\u", "expressions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"", "123", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "(_", "'", "a", "'_", "+_", "'", "b", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "\"", " ", " ", " ", " ", "\"_", "+_", "s_", ")_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "fail", "(\"", "Call", "func", " ", "over", " ", "express", "ion", "s", ",", " ", "#", "591", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Compil", "e", "Test_", "(_", "Unit", "Test_", "._", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subscript", "\\u", "tuple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "(_", "1_", ",_", "2_", ")_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "d_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "3_", ",_", "4_", "]_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "fail", "(\"", "Tup", "le", " ", "subscript", "s", " ", "issue", " ", "#", "496", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
b3mb4m/shellsploit-framework/shell/inject/Linux86/inject.py
[ { "content": "def injectmex86(pid, shellcode):\n from sys import platform\n\n if platform.startswith('win'):\n print (\"\\nPtrace not working on windows machines ..\\n\")\n return False\n else:\n try:\n from ptrace.debugger.debugger import PtraceDebugger\n from ptrace.debugger.debugger import PtraceProcess\n except ImportError: \n print (\"\\nYou must install ptrace library before use this script.\\n\")\n return False\n else:\n try:\n dbg = PtraceDebugger()\n process = dbg.addProcess(int(pid), False)\n eip = process.getInstrPointer()\n bytes = process.writeBytes(eip, shellcode.replace(\"\\\\x\", \"\").decode(\"hex\"))\n process.setreg(\"ebx\", 0)\n process.cont()\n except Exception as error:\n print (error)\n print (\"\\nPlease do not forget report !\\n\")\n else:\n print (\"\\nInject complate !\\n\")", "metadata": "root.injectmex86", "header": "['module', '___EOS___']", "index": 9 } ]
[ { "span": "bytes ", "start_line": 27, "start_column": 16, "end_line": 27, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "inject", "me", "x8", "6_", "(_", "pid_", ",_", "shellcode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sys_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "Pt", "race", " ", "not", " ", "working", " ", "on", " ", "windows", " ", "machine", "s", " ", "..", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ptr", "ace_", "._", "debugger_", "._", "debugger_", "import_", "Pt", "race", "Debugger", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ptr", "ace_", "._", "debugger_", "._", "debugger_", "import_", "Pt", "race", "Process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "You", " ", "must", " ", "install", " ", "ptr", "ace", " ", "librar", "y", " ", "bef", "ore", " ", "use", " ", "this", " ", "script", ".\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbg_", "=_", "Pt", "race", "Debugger", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "=_", "dbg_", "._", "add", "Process_", "(_", "int_", "(_", "pid_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eip", "_", "=_", "process_", "._", "get", "Instr", "Pointer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes_", "=_", "process_", "._", "write", "Bytes_", "(_", "eip", "_", ",_", "shellcode_", "._", "replace_", "(_", "\"\\\\\\\\", "x", "\"_", ",_", "\"\"_", ")_", "._", "decode_", "(_", "\"", "hex", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "._", "setre", "g_", "(_", "\"", "eb", "x", "\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "._", "cont_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "Ple", "ase", " ", "do", " ", "not", " ", "forget", " ", "report", " ", "!\\\\", "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 ", " _", "print_", "(_", "\"\\\\", "n", "Inject", " ", "compl", "ate", " ", "!\\\\", "n", "\"_", ")_" ]
[ 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, 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 ]
Unused local variable
lukesneeringer/django-pgfields/tests/composite/tests.py
[ { "content": " def test_invalid_composite_instance_init(self):\n \"\"\"Test that if I send duplicate values to a CompositeInstance,\n that we raise the appropriate exception.\n \"\"\"\n with self.assertRaises(TypeError):\n monarch = Monarch('King', title='King', name='Elessar', suffix=2)", "metadata": "root.CompositeTestCase.test_invalid_composite_instance_init", "header": "['class', 'CompositeTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def test_invalid_composite_instance_key(self):\n \"\"\"Test that an invalid composite instance key raises a KeyError\n as expected.\n \"\"\"\n with self.assertRaises(KeyError):\n monarch = Monarch(title='King', label='Elessar', suffix=2)", "metadata": "root.CompositeTestCase.test_invalid_composite_instance_key", "header": "['class', 'CompositeTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_related_field_raises(self):\n \"\"\"Test that we cannot create a CompositeField subclass with\n any sort of RelatedField as a member.\n \"\"\"\n with self.assertRaises(TypeError):\n class CitizenField(models.CompositeField):\n first_name = models.CharField(max_length=20)\n last_name = models.CharField(max_length=30)\n resident_of = models.ForeignKey(Monarchy)\n with self.assertRaises(TypeError):\n class CitizenField(models.CompositeField):\n first_name = models.CharField(max_length=20)\n last_name = models.CharField(max_length=30)\n authors = models.ManyToManyField(Author)", "metadata": "root.CompositeTestCase.test_related_field_raises", "header": "['class', 'CompositeTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 105 } ]
[ { "span": "monarch ", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 19 }, { "span": "monarch ", "start_line": 103, "start_column": 12, "end_line": 103, "end_column": 19 }, { "span": "CitizenField(", "start_line": 115, "start_column": 18, "end_line": 115, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Composit", "e", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "composi", "te", "\\u", "instance", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "if", " ", "I", " ", "send", " ", "duplicat", "e", " ", "values", " ", "to", " ", "a", " ", "Composit", "e", "Insta", "nce", ",", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "we", " ", "raise", " ", "the", " ", "appropr", "iate", " ", "exception", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mona", "rch", "_", "=_", "Mon", "arch_", "(_", "'", "King", "'_", ",_", "title_", "=_", "'", "King", "'_", ",_", "name_", "=_", "'", "Ele", "ssa", "r", "'_", ",_", "suffix_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Composit", "e", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "composi", "te", "\\u", "instance", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "an", " ", "invalid", " ", "composi", "te", " ", "instance", " ", "key", " ", "raise", "s", " ", "a", " ", "Key", "Error", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mona", "rch", "_", "=_", "Mon", "arch_", "(_", "title_", "=_", "'", "King", "'_", ",_", "label_", "=_", "'", "Ele", "ssa", "r", "'_", ",_", "suffix_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Composit", "e", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "relate", "d\\u", "field", "\\u", "raises_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "we", " ", "cann", "ot", " ", "create", " ", "a", " ", "Composit", "e", "Field", " ", "subclass", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "sort", " ", "of", " ", "Rela", "ted", "Field", " ", "as", " ", "a", " ", "member", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Cit", "ize", "n", "Field_", "(_", "models_", "._", "Composit", "e", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resident", "\\u", "of_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Mon", "arch", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Cit", "ize", "n", "Field_", "(_", "models_", "._", "Composit", "e", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "name_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authors_", "=_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "Author_", ")_", "\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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, 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 ]
Except block handles 'BaseException'
pgiri/asyncoro/py2/asyncoro/__init__.py
[ { "content": "\"\"\"\nThis file is part of asyncoro; see http://asyncoro.sourceforge.net\nfor details.\n\nThis module provides framework for concurrent, asynchronous network\nprogramming with coroutines, asynchronous completions and message\npassing. Other modules in asyncoro download package provide API for\ndistributed programming, asynchronous pipes, distributed concurrent\ncommunicating processes.\n\"\"\"\n\n__author__ = \"Giridhar Pemmasani ([email protected])\"\n__email__ = \"[email protected]\"\n__copyright__ = \"Copyright (c) 2012-2014 Giridhar Pemmasani\"\n__contributors__ = []\n__maintainer__ = \"Giridhar Pemmasani ([email protected])\"\n__license__ = \"MIT\"\n__url__ = \"http://asyncoro.sourceforge.net\"\n__status__ = \"Production\"\n__version__ = \"4.0\"\n\n__all__ = ['AsyncSocket', 'AsynCoroSocket', 'Coro', 'AsynCoro',\n 'Lock', 'RLock', 'Event', 'Condition', 'Semaphore',\n 'HotSwapException', 'MonitorException', 'Location', 'Channel',\n 'CategorizeMessages', 'AsyncThreadPool', 'AsyncDBCursor',\n 'MetaSingleton', 'logger', 'serialize', 'unserialize']\n\nimport time\nimport threading\nimport functools\nimport socket\nimport inspect\nimport traceback\nimport select\nimport sys\nimport types\nimport struct\nimport re\nimport logging\nimport errno\nimport platform\nimport ssl\nfrom heapq import heappush, heappop\nfrom bisect import bisect_left\nimport Queue as queue\nimport atexit\nimport collections\nimport cPickle as pickle\nimport copy\n\nif platform.system() == 'Windows':\n from errno import WSAEINPROGRESS as EINPROGRESS\n from errno import WSAEWOULDBLOCK as EWOULDBLOCK\n from errno import WSAEINVAL as EINVAL\n from time import clock as _time\n _time()\nelse:\n from errno import EINPROGRESS\n from errno import EWOULDBLOCK\n from errno import EINVAL\n from time import time as _time\n\n\n\n\n\n\n\n\n\n\nlogger = Logger('asyncoro')\n\n\n\n\nif platform.system() == 'Windows':\n # use IOCP if pywin32 (http://pywin32.sf.net) is installed\n try:\n import win32file\n import win32event\n import pywintypes\n import winerror\n except:\n logger.warning('Could not load pywin32 for I/O Completion Ports; '\n 'using inefficient polling for sockets')\n else:\n # for UDP we need 'select' polling (pywin32 doesn't yet support\n # UDP); _AsyncPoller below is combination of the other\n # _AsyncPoller for epoll/poll/kqueue/select and _SelectNotifier\n # below. (Un)fortunately, most of it is duplicate code\n\n\n\n\nif not isinstance(getattr(sys.modules[__name__], '_AsyncNotifier', None), MetaSingleton):\n\n\n\n AsyncSocket = _AsyncSocket\n _AsyncNotifier = _AsyncPoller\n\n\nAsynCoroSocket = AsyncSocket\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 }, { "content": " def _async_recv(self, bufsize, *args):\n \"\"\"Internal use only; use 'recv' with 'yield' instead.\n\n Asynchronous version of socket recv method.\n \"\"\"\n def _recv(self, bufsize, *args):\n try:\n buf = self._rsock.recv(bufsize, *args)\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n pass\n else:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = None\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n except:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = None\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n else:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = None\n coro, self._read_coro = self._read_coro, None\n coro._proceed_(buf)\n\n self._read_task = functools.partial(_recv, self, bufsize, *args)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n self._notifier.add(self, _AsyncPoller._Read)\n if self._certfile and self._rsock.pending():\n try:\n buf = self._rsock.recv(bufsize)\n except socket.error as err:\n if err.args[0] != EWOULDBLOCK:\n self._read_task = None\n self._notifier.clear(self, _AsyncPoller._Read)\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n else:\n if buf:\n self._read_task = None\n self._notifier.clear(self, _AsyncPoller._Read)\n coro, self._read_coro = self._read_coro, None\n coro._proceed_(buf)", "metadata": "root._AsyncSocket._async_recv", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 361 }, { "content": " def _async_recvall(self, bufsize, *args):\n \"\"\"Internal use only; use 'recvall' with 'yield' instead.\n\n Receive exactly bufsize bytes. If socket's timeout is set and\n it expires before all the data could be read, it returns\n partial data read if any data has been read at all. If no data\n has been read before timeout, then it causes 'socket.timeout'\n exception to be thrown.\n \"\"\"\n def _recvall(self, view, *args):\n try:\n recvd = self._rsock.recv_into(view, len(view), *args)\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n pass\n else:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n except:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n else:\n if recvd:\n view = view[recvd:]\n if len(view) == 0:\n buf = str(self._read_result)\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n coro._proceed_(buf)\n else:\n if self._timeout:\n self._notifier._del_timeout(self)\n self._notifier._add_timeout(self)\n self._read_task = functools.partial(_recvall, self, view, *args)\n else:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n coro._proceed_('')\n\n self._read_result = bytearray(bufsize)\n view = memoryview(self._read_result)\n self._read_task = functools.partial(_recvall, self, view, *args)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n self._notifier.add(self, _AsyncPoller._Read)\n if self._certfile and self._rsock.pending():\n try:\n recvd = self._rsock.recv_into(view, bufsize)\n except socket.error as err:\n if err.args[0] != EWOULDBLOCK:\n self._read_task = self._read_result = None\n self._notifier.clear(self, _AsyncPoller._Read)\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n else:\n if recvd == bufsize:\n buf = str(self._read_result)\n self._read_task = self._read_result = None\n self._notifier.clear(self, _AsyncPoller._Read)\n coro, self._read_coro = self._read_coro, None\n coro._proceed_(buf)\n elif recvd:\n view = view[recvd:]\n self._read_task = functools.partial(_recvall, self, view, *args)", "metadata": "root._AsyncSocket._async_recvall", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 408 }, { "content": " def _async_recvfrom(self, *args):\n \"\"\"Internal use only; use 'recvfrom' with 'yield' instead.\n\n Asynchronous version of socket recvfrom method.\n \"\"\"\n def _recvfrom(self, *args):\n try:\n res = self._rsock.recvfrom(*args)\n except:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = None\n coro, self._read_coro = self._read_coro, None\n coro.throw(*sys.exc_info())\n else:\n self._notifier.clear(self, _AsyncPoller._Read)\n self._read_task = None\n coro, self._read_coro = self._read_coro, None\n coro._proceed_(res)\n\n self._read_task = functools.partial(_recvfrom, self, *args)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n self._notifier.add(self, _AsyncPoller._Read)", "metadata": "root._AsyncSocket._async_recvfrom", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 495 }, { "content": " def _async_send(self, *args):\n \"\"\"Internal use only; use 'send' with 'yield' instead.\n\n Asynchronous version of socket send method.\n \"\"\"\n def _send(self, *args):\n try:\n sent = self._rsock.send(*args)\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n pass\n else:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n except:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n else:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro._proceed_(sent)\n\n self._write_task = functools.partial(_send, self, *args)\n self._write_coro = AsynCoro.cur_coro()\n self._write_coro._await_()\n self._notifier.add(self, _AsyncPoller._Write)", "metadata": "root._AsyncSocket._async_send", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 519 }, { "content": " def _async_sendto(self, *args):\n \"\"\"Internal use only; use 'sendto' with 'yield' instead.\n\n Asynchronous version of socket sendto method.\n \"\"\"\n def _sendto(self, *args):\n try:\n sent = self._rsock.sendto(*args)\n except:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n else:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro._proceed_(sent)\n\n self._write_task = functools.partial(_sendto, self, *args)\n self._write_coro = AsynCoro.cur_coro()\n self._write_coro._await_()\n self._notifier.add(self, _AsyncPoller._Write)", "metadata": "root._AsyncSocket._async_sendto", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 551 }, { "content": " def _async_sendall(self, data):\n \"\"\"Internal use only; use 'sendall' with 'yield' instead.\n\n Asynchronous version of socket sendall method. If socket's\n timeout is set and it expires before all the data could be\n sent, it returns the length of data sent if any data is\n sent. If no data has been sent before timeout, then it causes\n 'socket.timeout' exception to be thrown.\n \"\"\"\n def _sendall(self, data_len):\n try:\n sent = self._rsock.send(self._write_result)\n if sent < 0:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = self._write_result = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n pass\n else:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = self._write_result = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n except:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = self._write_result = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(*sys.exc_info())\n else:\n if sent > 0:\n self._write_result = self._write_result[sent:]\n if len(self._write_result) == 0:\n self._notifier.clear(self, _AsyncPoller._Write)\n self._write_task = self._write_result = None\n coro, self._write_coro = self._write_coro, None\n coro._proceed_(None)\n elif self._timeout:\n self._notifier._del_timeout(self)\n self._notifier._add_timeout(self)\n\n self._write_result = buffer(data)\n self._write_task = functools.partial(_sendall, self, len(data))\n self._write_coro = AsynCoro.cur_coro()\n self._write_coro._await_()\n self._notifier.add(self, _AsyncPoller._Write)", "metadata": "root._AsyncSocket._async_sendall", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 575 }, { "content": " def _async_accept(self):\n \"\"\"Internal use only; use 'accept' with 'yield' instead.\n\n Asynchronous version of socket accept method. Socket in\n returned pair is asynchronous socket (instance of\n AsyncSocket with blocking=False).\n \"\"\"\n def _accept(self):\n conn, addr = self._rsock.accept()\n self._read_task = None\n self._notifier.unregister(self)\n\n if self._certfile:\n if not self.ssl_server_ctx and hasattr(ssl, 'create_default_context'):\n self.ssl_server_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\n self.ssl_server_ctx.load_cert_chain(certfile=self._certfile,\n keyfile=self._keyfile)\n\n def _ssl_handshake(conn, addr):\n try:\n conn._rsock.do_handshake()\n except ssl.SSLError as err:\n if (err.args[0] == ssl.SSL_ERROR_WANT_READ or\n err.args[0] == ssl.SSL_ERROR_WANT_WRITE):\n pass\n else:\n conn._read_task = conn._write_task = None\n coro, conn._read_coro = conn._read_coro, None\n conn._write_coro = None\n conn.close()\n coro.throw(*sys.exc_info())\n except:\n conn._read_task = conn._write_task = None\n coro, conn._read_coro = conn._read_coro, None\n conn._write_coro = None\n conn.close()\n coro.throw(*sys.exc_info())\n else:\n conn._read_task = conn._write_task = None\n coro, conn._read_coro = conn._read_coro, None\n conn._notifier.clear(conn)\n coro._proceed_((conn, addr))\n conn = AsyncSocket(conn, blocking=False, keyfile=self._keyfile,\n certfile=self._certfile, ssl_version=self._ssl_version)\n try:\n if self.ssl_server_ctx:\n conn._rsock = self.ssl_server_ctx.wrap_socket(conn._rsock,\n server_side=True,\n do_handshake_on_connect=False)\n else:\n conn._rsock = ssl.wrap_socket(conn._rsock, certfile=self._certfile,\n keyfile=self._keyfile,\n ssl_version=self._ssl_version,\n server_side=True,\n do_handshake_on_connect=False)\n except:\n coro, self._read_coro = self._read_coro, None\n conn.close()\n coro.throw(*sys.exc_info())\n else:\n conn._read_task = conn._write_task = functools.partial(_ssl_handshake, conn, addr)\n conn._read_coro = conn._write_coro = self._read_coro\n self._read_coro = None\n conn._notifier.add(conn, _AsyncPoller._Read | _AsyncPoller._Write)\n conn._read_task()\n else:\n coro, self._read_coro = self._read_coro, None\n conn = AsyncSocket(conn, blocking=False)\n coro._proceed_((conn, addr))\n\n self._read_task = functools.partial(_accept, self)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n self._notifier.add(self, _AsyncPoller._Read)", "metadata": "root._AsyncSocket._async_accept", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 637 }, { "content": " def _async_connect(self, *args):\n \"\"\"Internal use only; use 'connect' with 'yield' instead.\n\n Asynchronous version of socket connect method.\n \"\"\"\n def _connect(self, *args):\n err = self._rsock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)\n if err:\n self._notifier.unregister(self)\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n coro.throw(socket.error(err))\n elif self._certfile:\n def _ssl_handshake(self):\n try:\n self._rsock.do_handshake()\n except ssl.SSLError as err:\n if (err.args[0] == ssl.SSL_ERROR_WANT_READ or\n err.args[0] == ssl.SSL_ERROR_WANT_WRITE):\n pass\n else:\n self._read_task = self._write_task = None\n coro, self._write_coro = self._write_coro, None\n self._read_coro = None\n self.close()\n coro.throw(*sys.exc_info())\n except:\n self._read_task = self._write_task = None\n coro, self._write_coro = self._write_coro, None\n self._read_coro = None\n self.close()\n coro.throw(*sys.exc_info())\n else:\n self._notifier.clear(self)\n self._read_task = self._write_task = None\n coro, self._write_coro = self._write_coro, None\n self._read_coro = None\n coro._proceed_(0)\n\n try:\n # TODO: provide 'ca_certs' as special parameter to 'accept'?\n # For now this setup wrks for self-signed certs\n self._rsock = ssl.wrap_socket(self._rsock, ca_certs=self._certfile,\n cert_reqs=ssl.CERT_REQUIRED, server_side=False,\n do_handshake_on_connect=False)\n except:\n coro, self._write_coro = self._write_coro, None\n self.close()\n coro.throw(*sys.exc_info())\n else:\n self._read_task = self._write_task = functools.partial(_ssl_handshake, self)\n self._read_coro = self._write_coro\n self._notifier.add(self, _AsyncPoller._Read)\n self._write_task()\n else:\n self._write_task = None\n coro, self._write_coro = self._write_coro, None\n self._notifier.clear(self, _AsyncPoller._Write)\n coro._proceed_(0)\n\n self._write_task = functools.partial(_connect, self, *args)\n self._write_coro = AsynCoro.cur_coro()\n self._write_coro._await_()\n self._notifier.add(self, _AsyncPoller._Write)\n try:\n self._rsock.connect(*args)\n except socket.error as e:\n if e.args[0] == EINPROGRESS or e.args[0] == EWOULDBLOCK:\n pass\n else:\n raise", "metadata": "root._AsyncSocket._async_connect", "header": "['class', '_AsyncSocket', '(', 'object', ')', ':', '___EOS___']", "index": 712 }, { "content": " def _iocp_connect(self, host_port):\n \"\"\"Internal use only; use 'connect' with 'yield' instead.\n \"\"\"\n def _connect(self, err, n):\n def _ssl_handshake(self, err, n):\n try:\n self._rsock.do_handshake()\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n err, n = win32file.WSARecv(self._fileno, self._read_result,\n self._read_overlap, 0)\n elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n err, n = win32file.WSASend(self._fileno, '', self._read_overlap, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro = self._read_coro\n self.close()\n if coro:\n coro.throw(*sys.exc_info())\n except:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro = self._read_coro\n self.close()\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_(0)\n\n if err:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n if err == winerror.ERROR_OPERATION_ABORTED:\n self._read_coro = None\n else:\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro.throw(socket.error(err))\n else:\n self._rsock.setsockopt(socket.SOL_SOCKET,\n win32file.SO_UPDATE_CONNECT_CONTEXT, '')\n if self._certfile:\n self._rsock = ssl.wrap_socket(self._rsock, ca_certs=self._certfile,\n cert_reqs=ssl.CERT_REQUIRED,\n server_side=False,\n do_handshake_on_connect=False)\n self._read_result = win32file.AllocateReadBuffer(0)\n self._read_overlap.object = functools.partial(_ssl_handshake, self)\n self._read_overlap.object(None, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_(0)\n\n # ConnectEX requires socket to be bound!\n try:\n self._rsock.bind(('0.0.0.0', 0))\n except socket.error as exc:\n if exc[0] != EINVAL:\n raise\n self._read_overlap.object = functools.partial(_connect, self)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n if self._timeout:\n self._notifier._add_timeout(self)\n err, n = win32file.ConnectEx(self._rsock, host_port, self._read_overlap)\n if err and err != winerror.ERROR_IO_PENDING:\n self._read_overlap.object = self._read_result = self._read_coro = None\n raise socket.error(err)", "metadata": "root.AsyncSocket._iocp_connect", "header": "['class', 'AsyncSocket', '(', '_AsyncSocket', ')', ':', '___EOS___']", "index": 1451 }, { "content": " def _iocp_accept(self):\n \"\"\"Internal use only; use 'accept' with 'yield'\n instead. Socket in returned pair is asynchronous\n socket (instance of AsyncSocket with blocking=False).\n \"\"\"\n def _accept(self, conn, err, n):\n def _ssl_handshake(self, conn, addr, err, n):\n try:\n conn._rsock.do_handshake()\n except ssl.SSLError as err:\n if err.args[0] == ssl.SSL_ERROR_WANT_READ:\n err, n = win32file.WSARecv(conn._fileno, self._read_result,\n self._read_overlap, 0)\n elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:\n err, n = win32file.WSASend(conn._fileno, '', self._read_overlap, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n conn.close()\n if coro:\n coro.throw(*sys.exc_info())\n except:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n conn.close()\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_((conn, addr))\n\n if err:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if err != winerror.ERROR_OPERATION_ABORTED and coro:\n coro.throw(socket.error(err))\n else:\n family, laddr, raddr = win32file.GetAcceptExSockaddrs(conn, self._read_result)\n # TODO: unpack raddr if family != AF_INET\n conn._rsock.setsockopt(socket.SOL_SOCKET, win32file.SO_UPDATE_ACCEPT_CONTEXT,\n struct.pack('P', self._fileno))\n if self._certfile:\n if not self.ssl_server_ctx and hasattr(ssl, 'create_default_context'):\n self.ssl_server_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\n self.ssl_server_ctx.load_cert_chain(certfile=self._certfile,\n keyfile=self._keyfile)\n\n if self.ssl_server_ctx:\n conn._rsock = self.ssl_server_ctx.wrap_socket(conn._rsock,\n server_side=True,\n do_handshake_on_connect=False)\n else:\n conn._rsock = ssl.wrap_socket(conn._rsock, certfile=self._certfile,\n keyfile=self._keyfile,\n server_side=True,\n ssl_version=self._ssl_version,\n do_handshake_on_connect=False)\n\n self._read_result = win32file.AllocateReadBuffer(0)\n self._read_overlap.object = functools.partial(_ssl_handshake, self,\n conn, raddr)\n self._read_overlap.object(None, 0)\n else:\n if self._timeout and self._notifier:\n self._notifier._del_timeout(self)\n self._read_overlap.object = self._read_result = None\n coro, self._read_coro = self._read_coro, None\n if coro:\n coro._proceed_((conn, raddr))\n\n sock = socket.socket(self._rsock.family, self._rsock.type, self._rsock.proto)\n conn = AsyncSocket(sock, keyfile=self._keyfile, certfile=self._certfile,\n ssl_version=self._ssl_version)\n self._read_result = win32file.AllocateReadBuffer(win32file.CalculateSocketEndPointSize(sock))\n self._read_overlap.object = functools.partial(_accept, self, conn)\n self._read_coro = AsynCoro.cur_coro()\n self._read_coro._await_()\n if self._timeout:\n self._notifier._add_timeout(self)\n err = win32file.AcceptEx(self._fileno, conn._fileno, self._read_result,\n self._read_overlap)\n if err and err != winerror.ERROR_IO_PENDING:\n self._read_overlap.object = self._read_result = self._read_coro = None\n raise socket.error(err)", "metadata": "root.AsyncSocket._iocp_accept", "header": "['class', 'AsyncSocket', '(', '_AsyncSocket', ')', ':', '___EOS___']", "index": 1533 }, { "content": " def poll(self, timeout):\n \"\"\"Calls 'task' method of registered fds when there is a\n read/write event for it.\n \"\"\"\n\n if timeout == 0:\n poll_timeout = timeout\n elif self._timeouts:\n poll_timeout = self._timeouts[0][0] - _time()\n if timeout is not None:\n poll_timeout = min(timeout, poll_timeout)\n poll_timeout *= self.timeout_multiplier\n elif timeout is None:\n poll_timeout = _AsyncPoller._Block\n else:\n poll_timeout = timeout * self.timeout_multiplier\n\n try:\n events = self._poller.poll(poll_timeout)\n except:\n logger.debug('poll failed')\n logger.debug(traceback.format_exc())\n # prevent tight loops\n time.sleep(5)\n return\n try:\n for fileno, event in events:\n fd = self._fds.get(fileno, None)\n if fd is None:\n if event != _AsyncPoller._Hangup:\n logger.debug('invalid fd for event %s', event)\n continue\n if event & _AsyncPoller._Read:\n if fd._read_task is None:\n logger.debug('fd %s is not registered for read; unregistering it',\n fd._fileno)\n self.unregister(fd)\n else:\n fd._read_task()\n elif event & _AsyncPoller._Write:\n if fd._write_task is None:\n logger.debug('fd %s is not registered for write; unregistering it',\n fd._fileno)\n self.unregister(fd)\n else:\n fd._write_task()\n elif event & _AsyncPoller._Hangup:\n fd._eof()\n elif event & _AsyncPoller._Error:\n logger.warning('error on fd %s', fd._fileno)\n self.unregister(fd)\n except:\n logger.debug(traceback.format_exc())\n\n if self._timeouts:\n now = _time()\n while self._timeouts and self._timeouts[0][0] <= now:\n fd_timeout, fd = self._timeouts.pop(0)\n if fd._timeout_id == fd_timeout:\n fd._timeout_id = None\n fd._timed_out()", "metadata": "root._AsyncPoller.poll", "header": "['class', '_AsyncPoller', '(', 'object', ')', ':', '___EOS___']", "index": 1712 }, { "content": " def terminate(self):\n self.cmd_wsock.close()\n self.cmd_rsock.close()\n if len(self._timeouts):\n logger.warning('pending timeouts: %s', len(self._timeouts))\n if hasattr(self._poller, 'terminate'):\n self._poller.terminate()\n for fd in self._fds.itervalues():\n try:\n self._poller.unregister(fd._fileno)\n except:\n logger.warning('unregister of %s failed with %s',\n fd._fileno, traceback.format_exc())\n fd._notifier = None\n self._poller = None\n self._timeouts = []\n self._fds = {}\n self.__class__.__instance = None", "metadata": "root._AsyncPoller.terminate", "header": "['class', '_AsyncPoller', '(', 'object', ')', ':', '___EOS___']", "index": 1774 }, { "content": " def hot_swap(self, target, *args, **kwargs):\n \"\"\"Replaces coro's generator function with given target(*args, **kwargs).\n\n The new generator starts executing from the beginning. If\n there are any pending messages, they will not be reset, so new\n generator can process them (or clear them with successive\n 'receive' calls with timeout=0 until it returns\n 'alarm_value').\n \"\"\"\n try:\n generator = Coro.__get_generator(self, target, *args, **kwargs)\n except:\n logger.warning('%s is not a generator!', target.__name__)\n return -1\n self._swap_generator = generator\n return Coro._asyncoro._swap_generator(self)", "metadata": "root.Coro.hot_swap", "header": "['class', 'Coro', '(', 'object', ')', ':', '___EOS___']", "index": 2516 }, { "content": " def __init__(self, name, transform=None):\n \"\"\"'name' must be unique across all channels.\n\n 'transform' is a function that can either filter or\n transform a message. If the function returns 'None', the\n message is filtered (ignored). The function is called with\n first parameter set to channel name and second parameter set\n to the message.\n \"\"\"\n\n if not Channel._asyncoro:\n Channel._asyncoro = AsynCoro.instance()\n self._name = name\n self._location = Channel._asyncoro._location\n if transform is not None:\n try:\n argspec = inspect.getargspec(transform)\n assert len(argspec.args) == 2\n except:\n logger.warning('invalid \"transform\" function ignored')\n transform = None\n self._transform = transform\n self._subscribers = set()\n self._subscribe_event = Event()\n Channel._asyncoro._lock.acquire()\n if name in Channel._asyncoro._channels:\n Channel._asyncoro._lock.release()\n logger.warning('duplicate channel \"%s\"!', name)\n else:\n Channel._asyncoro._channels[name] = self\n Channel._asyncoro._lock.release()", "metadata": "root.Channel.__init__", "header": "['class', 'Channel', '(', 'object', ')', ':', '___EOS___']", "index": 2659 }, { "content": " def set_transform(self, transform):\n if self._location != Channel._asyncoro._location:\n return -1\n try:\n argspec = inspect.getargspec(transform)\n assert len(argspec.args) == 2\n except:\n logger.warning('invalid \"transform\" function ignored')\n return -1\n self._transform = transform\n return 0", "metadata": "root.Channel.set_transform", "header": "['class', 'Channel', '(', 'object', ')', ':', '___EOS___']", "index": 2747 }, { "content": " def send(self, message):\n \"\"\"Message is sent to currently registered subscribers.\n\n Can also be used on remote channels.\n \"\"\"\n if self._location == Channel._asyncoro._location:\n if self._transform:\n try:\n message = self._transform(self._name, message)\n except:\n message = None\n if message is None:\n return 0\n invalid = []\n for subscriber in self._subscribers:\n if subscriber.send(message) != 0:\n invalid.append(subscriber)\n if invalid:\n def _unsub(self, subscriber, coro=None):\n logger.debug('remote subscriber %s is not valid; unsubscribing it', subscriber)\n yield self.unsubscribe(subscriber)\n for subscriber in invalid:\n Coro(_unsub, self, subscriber)\n else:\n # remote channel\n request = _NetRequest('send', kwargs={'channel': self._name, 'message': message},\n dst=self._location, timeout=5)\n # request is queued for asynchronous processing\n if _Peer.send_req(request) != 0:\n logger.warning('remote channel at %s may not be valid', self._location)\n return -1\n return 0", "metadata": "root.Channel.send", "header": "['class', 'Channel', '(', 'object', ')', ':', '___EOS___']", "index": 2842 }, { "content": " def deliver(self, message, timeout=None, n=0):\n \"\"\"Must be used with 'yield' as 'rcvd = yield channel.deliver(message)'.\n\n Blocking 'send': Wait until message can be delivered to at\n least 'n' subscribers before timeout. Returns number of\n end-point recipients (coroutines) the message is delivered to;\n i.e., in case of heirarchical channels, it is the sum of\n recipients of all the channels.\n\n Can also be used on remote channels.\n \"\"\"\n if not isinstance(n, int) or n < 0:\n raise StopIteration(-1)\n if self._location == Channel._asyncoro._location:\n if self._transform:\n try:\n message = self._transform(self._name, message)\n except:\n message = None\n if message is None:\n raise StopIteration(0)\n if n:\n while len(self._subscribers) < n:\n start = _time()\n self._subscribe_event.clear()\n if (yield self._subscribe_event.wait(timeout)) is False:\n raise StopIteration(0)\n if timeout is not None:\n timeout -= _time() - start\n if timeout <= 0:\n raise StopIteration(0)\n # during delivery, _subscribers may change, so make copy\n subscribers = list(self._subscribers)\n info = {'reply': 0, 'pending': len(subscribers), 'success': 0,\n 'done': Event(), 'invalid': []}\n\n def _deliver(subscriber, info, timeout, n, coro=None):\n try:\n reply = yield subscriber.deliver(message, timeout=timeout)\n if reply > 0:\n info['reply'] += reply\n info['success'] += 1\n if n > 0 and info['success'] >= n:\n info['done'].set()\n elif reply < 0:\n info['invalid'].append(subscriber)\n except:\n pass\n info['pending'] -= 1\n if info['pending'] == 0:\n info['done'].set()\n for subscriber in subscribers:\n if isinstance(subscriber, Coro) and self._location == subscriber._location:\n if subscriber.send(message) == 0:\n info['reply'] += 1\n info['success'] += 1\n info['pending'] -= 1\n else:\n # channel/remote coro\n Coro(_deliver, subscriber, info, timeout, n)\n if info['pending'] == 0:\n info['done'].set()\n if n == 0 or info['success'] < n:\n yield info['done'].wait(timeout)\n\n if info['invalid']:\n def _unsub(self, subscriber, coro=None):\n logger.debug('remote subscriber %s is not valid; unsubscribing it', subscriber)\n yield self.unsubscribe(subscriber)\n for subscriber in info['invalid']:\n Coro(_unsub, self, subscriber)\n\n raise StopIteration(info['reply'])\n else:\n # remote channel\n request = _NetRequest('deliver', kwargs={'channel': self._name, 'message': message,\n 'n': n},\n dst=self._location, timeout=timeout)\n request.reply = -1\n reply = yield Channel._asyncoro._sync_reply(request, alarm_value=0)\n if reply is None:\n reply = -1\n # if reply < 0:\n # logger.warning('remote channel \"%s\" at %s may have gone away!',\n # self._name, self._location)\n raise StopIteration(reply)", "metadata": "root.Channel.deliver", "header": "['class', 'Channel', '(', 'object', ')', ':', '___EOS___']", "index": 2875 }, { "content": " def _schedule(self):\n \"\"\"Internal use only.\n \"\"\"\n while not self._quit:\n # process I/O events\n self._notifier.poll(0)\n self._lock.acquire()\n if not self._scheduled:\n if self._timeouts:\n timeout = self._timeouts[0][0] - _time()\n else:\n timeout = None\n self._polling = True\n self._lock.release()\n self._notifier.poll(timeout)\n self._lock.acquire()\n self._polling = False\n if self._timeouts:\n # wake up timed suspends; pollers may timeout slightly\n # earlier, so give a bit of slack\n now = _time() + 0.0001\n while self._timeouts and self._timeouts[0][0] <= now:\n timeout, cid, alarm_value = heappop(self._timeouts)\n assert timeout <= now\n coro = self._coros.get(cid, None)\n if not coro or coro._timeout != timeout:\n continue\n if coro._state not in (AsynCoro._AwaitIO_, AsynCoro._Suspended,\n AsynCoro._AwaitMsg_):\n logger.warning('coro %s/%s is in state %s for resume; ignored',\n coro._name, coro._id, coro._state)\n continue\n coro._timeout = None\n self._suspended.discard(cid)\n self._scheduled.add(cid)\n coro._state = AsynCoro._Scheduled\n coro._value = alarm_value\n scheduled = [self._coros[cid] for cid in self._scheduled]\n self._lock.release()\n\n for coro in scheduled:\n coro._state = AsynCoro._Running\n AsynCoro.__cur_coro = coro\n\n try:\n if coro._exceptions:\n exc = coro._exceptions.pop(0)\n if exc[0] == GeneratorExit:\n # assert str(exc[1]) == 'close'\n coro._generator.close()\n retval = coro._value\n else:\n retval = coro._generator.throw(*exc)\n else:\n retval = coro._generator.send(coro._value)\n except:\n self._lock.acquire()\n exc = sys.exc_info()\n if exc[0] == StopIteration:\n v = exc[1].args\n if v:\n if len(v) == 1:\n coro._value = v[0]\n else:\n coro._value = v\n coro._exceptions = []\n elif exc[0] == HotSwapException:\n v = exc[1].args\n if isinstance(v, tuple) and len(v) == 1 and inspect.isgenerator(v[0]) and \\\n coro._hot_swappable and not coro._callers:\n try:\n coro._generator.close()\n except:\n logger.warning('closing %s/%s raised exception: %s',\n coro._name, coro._id, traceback.format_exc())\n coro._generator = v[0]\n coro._name = coro._generator.__name__\n coro._exceptions = []\n coro._value = None\n # coro._msgs is not reset, so new\n # coroutine can process pending messages\n coro._state = AsynCoro._Scheduled\n else:\n logger.warning('invalid HotSwapException from %s/%s ignored',\n coro._name, coro._id)\n self._lock.release()\n continue\n else:\n coro._exceptions.append(exc)\n\n if coro._callers:\n # return to caller\n caller = coro._callers.pop(-1)\n coro._generator = caller[0]\n if coro._swap_generator and not coro._callers and coro._hot_swappable:\n coro._exceptions.append((HotSwapException,\n HotSwapException(coro._swap_generator)))\n coro._swap_generator = None\n coro._state = AsynCoro._Scheduled\n elif coro._exceptions:\n # exception in callee, restore saved value\n coro._value = caller[1]\n self._suspended.discard(coro._id)\n self._scheduled.add(coro._id)\n coro._state = AsynCoro._Scheduled\n elif coro._state == AsynCoro._Running:\n coro._state = AsynCoro._Scheduled\n else:\n if coro._exceptions:\n exc = coro._exceptions[0]\n assert isinstance(exc, tuple)\n if len(exc) == 2:\n exc = ''.join(traceback.format_exception_only(*exc))\n else:\n exc = ''.join(traceback.format_exception(*exc))\n logger.warning('uncaught exception in %s:\\n%s', coro, exc)\n try:\n coro._generator.close()\n except:\n logger.warning('closing %s raised exception: %s',\n coro._name, traceback.format_exc())\n # delete this coro\n if coro._state not in (AsynCoro._Scheduled, AsynCoro._Running):\n logger.warning('coro \"%s\" is in state: %s', coro._name, coro._state)\n monitors = list(coro._monitors)\n for monitor in monitors:\n if monitor._location == self._location:\n if coro._exceptions:\n exc = MonitorException(coro, coro._exceptions[0])\n else:\n exc = MonitorException(coro, (StopIteration, coro._value))\n if self._coros.get(monitor._id, None) == monitor:\n monitor.send(exc)\n else:\n logger.warning('monitor for %s/%s has gone away!',\n coro._name, coro._id)\n coro._monitors.discard(monitor)\n else:\n # remote monitor; prepare serializable data\n if coro._exceptions:\n exc = coro._exceptions[0][:2]\n try:\n serialize(exc[1])\n except pickle.PicklingError:\n # send only the type\n exc = (exc[0], type(exc[1].args[0]))\n exc = MonitorException(coro, exc)\n coro._exceptions = []\n else:\n exc = coro._value\n try:\n serialize(exc)\n except pickle.PicklingError:\n exc = type(exc)\n exc = MonitorException(coro, (StopIteration, exc))\n monitor.send(exc)\n if not coro._monitors or not coro._exceptions:\n coro._msgs.clear()\n coro._monitors.clear()\n coro._exceptions = []\n if self._coros.pop(coro._id, None) != coro:\n logger.warning('invalid coro: %s, %s', coro._id, coro._state)\n if coro._daemon is True:\n self._daemons -= 1\n elif coro._monitors:\n # a (local) monitor can restart it with hot_swap\n coro._hot_swappable = True\n coro._exceptions = []\n coro._state = None\n coro._generator = None\n if coro._complete:\n coro._complete.set()\n else:\n coro._complete = 0\n self._scheduled.discard(coro._id)\n if len(self._coros) == self._daemons:\n self._complete.set()\n self._lock.release()\n else:\n self._lock.acquire()\n if coro._state == AsynCoro._Running:\n coro._state = AsynCoro._Scheduled\n # if this coroutine is suspended, don't update\n # the value; when it is resumed, it will be\n # updated with the 'update' value\n coro._value = retval\n\n if isinstance(retval, types.GeneratorType):\n # push current generator onto stack and activate\n # new generator\n coro._callers.append((coro._generator, coro._value))\n coro._generator = retval\n coro._value = None\n self._lock.release()\n AsynCoro.__cur_coro = None\n\n self._lock.acquire()\n for coro in self._coros.itervalues():\n logger.debug('terminating Coro %s/%s%s', coro._name, coro._id,\n ' (daemon)' if coro._daemon else '')\n AsynCoro.__cur_coro = coro\n coro._state = AsynCoro._Running\n while coro._generator:\n try:\n coro._generator.close()\n except:\n logger.warning('closing %s raised exception: %s',\n coro._generator.__name__, traceback.format_exc())\n if coro._callers:\n coro._generator, coro._value = coro._callers.pop(-1)\n else:\n coro._generator = None\n if coro._complete:\n coro._complete.set()\n else:\n coro._complete = 0\n self._scheduled = set()\n self._suspended = set()\n self._timeouts = []\n self._coros = {}\n self._channels = {}\n self.__class__.__instance = None\n self._quit = True\n self._notifier.terminate()\n self._lock.release()\n logger.debug('AsynCoro %sterminated', ('%s ' % self._location) if self._location else '')\n while self._atexit:\n func, fargs, fkwargs = self._atexit.pop()\n try:\n func(*fargs, **fkwargs)\n except:\n logger.warning('running %s failed:', func.__name__)\n logger.warning(traceback.format_exc())\n self._complete.set()\n logger.shutdown()\n time.sleep(0.1)", "metadata": "root.AsynCoro._schedule", "header": "['class', 'AsynCoro', '(', 'object', ')', ':', '___EOS___']", "index": 3354 }, { "content": " def _tasklet(self):\n while 1:\n item = self._task_queue.get(block=True)\n if item is None:\n self._task_queue.task_done()\n break\n coro, target, args, kwargs = item\n try:\n val = target(*args, **kwargs)\n coro._proceed_(val)\n except:\n coro.throw(*sys.exc_info())\n finally:\n self._task_queue.task_done()", "metadata": "root.AsyncThreadPool._tasklet", "header": "['class', 'AsyncThreadPool', '(', 'object', ')', ':', '___EOS___']", "index": 3685 } ]
[ { "span": "except:", "start_line": 872, "start_column": 4, "end_line": 872, "end_column": 11 }, { "span": "except:", "start_line": 377, "start_column": 12, "end_line": 377, "end_column": 19 }, { "span": "except:", "start_line": 428, "start_column": 12, "end_line": 428, "end_column": 19 }, { "span": "except:", "start_line": 503, "start_column": 12, "end_line": 503, "end_column": 19 }, { "span": "except:", "start_line": 535, "start_column": 12, "end_line": 535, "end_column": 19 }, { "span": "except:", "start_line": 559, "start_column": 12, "end_line": 559, "end_column": 19 }, { "span": "except:", "start_line": 600, "start_column": 12, "end_line": 600, "end_column": 19 }, { "span": "except:", "start_line": 668, "start_column": 20, "end_line": 668, "end_column": 27 }, { "span": "except:", "start_line": 692, "start_column": 16, "end_line": 692, "end_column": 23 }, { "span": "except:", "start_line": 738, "start_column": 20, "end_line": 738, "end_column": 27 }, { "span": "except:", "start_line": 757, "start_column": 16, "end_line": 757, "end_column": 23 }, { "span": "except:", "start_line": 1472, "start_column": 24, "end_line": 1472, "end_column": 31 }, { "span": "except:", "start_line": 1556, "start_column": 24, "end_line": 1556, "end_column": 31 }, { "span": "except:", "start_line": 1731, "start_column": 12, "end_line": 1731, "end_column": 19 }, { "span": "except:", "start_line": 1763, "start_column": 12, "end_line": 1763, "end_column": 19 }, { "span": "except:", "start_line": 1784, "start_column": 16, "end_line": 1784, "end_column": 23 }, { "span": "except:", "start_line": 2527, "start_column": 8, "end_line": 2527, "end_column": 15 }, { "span": "except:", "start_line": 2677, "start_column": 12, "end_line": 2677, "end_column": 19 }, { "span": "except:", "start_line": 2753, "start_column": 8, "end_line": 2753, "end_column": 15 }, { "span": "except:", "start_line": 2851, "start_column": 16, "end_line": 2851, "end_column": 23 }, { "span": "except:", "start_line": 2921, "start_column": 16, "end_line": 2921, "end_column": 23 }, { "span": "except:", "start_line": 3409, "start_column": 16, "end_line": 3409, "end_column": 23 }, { "span": "except:", "start_line": 3426, "start_column": 28, "end_line": 3426, "end_column": 35 }, { "span": "except:", "start_line": 3472, "start_column": 28, "end_line": 3472, "end_column": 35 }, { "span": "except:", "start_line": 3559, "start_column": 16, "end_line": 3559, "end_column": 23 }, { "span": "except:", "start_line": 3584, "start_column": 12, "end_line": 3584, "end_column": 19 }, { "span": "except:", "start_line": 3695, "start_column": 12, "end_line": 3695, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "async", "oro", ";", " ", "see", " ", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "\\", "10", ";", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "frame", "work", " ", "for", " ", "concurrent", ",", " ", "async", "hronous", " ", "network", "\\", "10", ";", "program", "ming", " ", "with", " ", "coroutine", "s", ",", " ", "async", "hronous", " ", "completion", "s", " ", "and", " ", "message", "\\", "10", ";", "passi", "ng", ".", " ", "Ot", "her", " ", "module", "s", " ", "in", " ", "async", "oro", " ", "download", " ", "package", " ", "provide", " ", "API", " ", "for", "\\", "10", ";", "distributed", " ", "program", "ming", ",", " ", "async", "hronous", " ", "pipe", "s", ",", " ", "distributed", " ", "concurrent", "\\", "10", ";", "communicati", "ng", " ", "process", "es", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "\"", "pg", "iri", "@", "ya", "hoo", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2014", " ", "Gir", "id", "har", " ", "Pe", "mma", "sani", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "contributor", "s\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "Gir", "id", "har", " ", "Pe", "mma", "sani", " ", "(", "pg", "iri", "@", "ya", "hoo", ".", "com", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "MIT", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "url", "\\u\\u_", "=_", "\"", "http", "://", "async", "oro", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "status\\u\\u_", "=_", "\"", "Product", "ion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "4.0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Async", "Sock", "et", "'_", ",_", "'", "As", "yn", "Cor", "o", "Sock", "et", "'_", ",_", "'", "Cor", "o", "'_", ",_", "'", "As", "yn", "Cor", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Lock", "'_", ",_", "'", "RL", "ock", "'_", ",_", "'", "Event", "'_", ",_", "'", "Cond", "ition", "'_", ",_", "'", "Semaphore", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Hot", "Swa", "p", "Except", "ion", "'_", ",_", "'", "Monitor", "Except", "ion", "'_", ",_", "'", "Locat", "ion", "'_", ",_", "'", "Chan", "nel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Categori", "ze", "Messag", "es", "'_", ",_", "'", "Async", "Thread", "Poo", "l", "'_", ",_", "'", "Async", "DB", "Curs", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "Singleton", "'_", ",_", "'", "logg", "er", "'_", ",_", "'", "serialize", "'_", ",_", "'", "unse", "rial", "ize", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heapq_", "import_", "heapp", "ush_", ",_", "heapp", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bisect_", "import_", "bisect", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "as_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "atexit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "errno_", "import_", "WS", "AE", "IN", "PROGRESS", "_", "as_", "EIN", "PROGRESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "errno_", "import_", "WS", "AE", "WO", "UL", "DB", "LOCK_", "as_", "EW", "OU", "LDB", "LOCK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "errno_", "import_", "WS", "AE", "INV", "AL_", "as_", "EIN", "VAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "clock_", "as_", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "errno_", "import_", "EIN", "PROGRESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "errno_", "import_", "EW", "OU", "LDB", "LOCK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "errno_", "import_", "EIN", "VAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "time_", "as_", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "logger_", "=_", "Logger_", "(_", "'", "async", "oro", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Window", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "IOC", "P", " ", "if", " ", "pywi", "n", "32", " ", "(", "http", "://", "pywi", "n", "32.", "sf", ".", "net", ")", " ", "is", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "win32", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pywi", "ntype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wine", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "load", " ", "pywi", "n", "32", " ", "for", " ", "I", "/", "O", " ", "Completi", "on", " ", "Port", "s", ";", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "usi", "ng", " ", "ine", "ffic", "ient", " ", "polling", " ", "for", " ", "socket", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "UD", "P", " ", "we", " ", "need", " ", "'", "select", "'", " ", "polling", " ", "(", "pywi", "n", "32", " ", "doe", "sn", "'", "t", " ", "ye", "t", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "UD", "P", ");", " ", "\\u", "Async", "Poller", " ", "belo", "w", " ", "is", " ", "combinat", "ion", " ", "of", " ", "the", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "Async", "Poller", " ", "for", " ", "epo", "ll", "/", "poll", "/", "kq", "ueue", "/", "select", " ", "and", " ", "\\u", "Select", "Notifier_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "belo", "w", ".", " ", "(", "Un", ")", "fort", "unat", "el", "y", ",", " ", "most", " ", "of", " ", "it", " ", "is", " ", "duplicat", "e", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "getattr_", "(_", "sys_", "._", "modules_", "[_", "\\u\\u", "name\\u\\u_", "]_", ",_", "'\\u", "Async", "Notifi", "er", "'_", ",_", "None_", ")_", ",_", "Meta", "Singleton_", ")_", ":_", "\\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_", "Async", "Socket_", "=_", "\\u", "Async", "Socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Async", "Notifier_", "=_", "\\u", "Async", "Poller", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "As", "yn", "Cor", "o", "Socket_", "=_", "Async", "Socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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]_", "class_", "\\u", "Async", "Socket_", "(_", "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", "async", "\\u", "recv_", "(_", "self_", ",_", "bufsize_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "recv", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "recv", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "recv_", "(_", "self_", ",_", "bufsize_", ",_", "*_", "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 ", " _", "buf_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "recv_", "(_", "bufsize_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "buf_", ")_", "\\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", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "recv_", ",_", "self_", ",_", "bufsize_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", "and_", "self_", "._", "\\u", "rs", "ock_", "._", "pending_", "(_", ")_", ":_", "\\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 ", " _", "buf_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "recv_", "(_", "bufsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "!=_", "EW", "OU", "LDB", "LOCK_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "buf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "recv", "all_", "(_", "self_", ",_", "bufsize_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "recv", "all", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Receive", " ", "exact", "ly", " ", "buf", "size", " ", "bytes", ".", " ", "If", " ", "socket", "'", "s", " ", "timeo", "ut", " ", "is", " ", "set", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "expir", "es", " ", "bef", "ore", " ", "all", " ", "the", " ", "data", " ", "coul", "d", " ", "be", " ", "read", ",", " ", "it", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "partial", " ", "data", " ", "read", " ", "if", " ", "any", " ", "data", " ", "has", " ", "bee", "n", " ", "read", " ", "at", " ", "all", ".", " ", "If", " ", "no", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "bee", "n", " ", "read", " ", "bef", "ore", " ", "timeo", "ut", ",", " ", "then", " ", "it", " ", "caus", "es", " ", "'", "socket", ".", "timeo", "ut", "'", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "to", " ", "be", " ", "throw", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "recv", "all_", "(_", "self_", ",_", "view_", ",_", "*_", "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 ", " _", "recv", "d_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "recv", "\\u", "into_", "(_", "view_", ",_", "len_", "(_", "view_", ")_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "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", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "recv", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "view_", "=_", "view_", "[_", "recv", "d_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "view_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "buf_", "=_", "str_", "(_", "self_", "._", "\\u", "read", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "recv", "all_", ",_", "self_", ",_", "view_", ",_", "*_", "args_", ")_", "\\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_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\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_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "bytearray_", "(_", "bufsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "memory", "view_", "(_", "self_", "._", "\\u", "read", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "recv", "all_", ",_", "self_", ",_", "view_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", "and_", "self_", "._", "\\u", "rs", "ock_", "._", "pending_", "(_", ")_", ":_", "\\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 ", " _", "recv", "d_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "recv", "\\u", "into_", "(_", "view_", ",_", "bufsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "!=_", "EW", "OU", "LDB", "LOCK_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "recv", "d_", "==_", "bufsize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "buf_", "=_", "str_", "(_", "self_", "._", "\\u", "read", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "recv", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "view_", "=_", "view_", "[_", "recv", "d_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "recv", "all_", ",_", "self_", ",_", "view_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "recv", "from_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "recv", "from", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "recv", "from", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "recv", "from_", "(_", "self_", ",_", "*_", "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 ", " _", "res_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "recv", "from_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "recv", "from_", ",_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "send_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "send", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "send", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "send_", "(_", "self_", ",_", "*_", "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 ", " _", "sent_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "send_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\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", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "sent_", ")_", "\\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", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "send_", ",_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "sendto_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "send", "to", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "send", "to", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "sendto_", "(_", "self_", ",_", "*_", "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 ", " _", "sent_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "sendto_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "sent_", ")_", "\\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", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "sendto_", ",_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "sendall_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "send", "all", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "send", "all", " ", "method", ".", " ", "If", " ", "socket", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "timeo", "ut", " ", "is", " ", "set", " ", "and", " ", "it", " ", "expir", "es", " ", "bef", "ore", " ", "all", " ", "the", " ", "data", " ", "coul", "d", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "sent", ",", " ", "it", " ", "return", "s", " ", "the", " ", "length", " ", "of", " ", "data", " ", "sent", " ", "if", " ", "any", " ", "data", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "sent", ".", " ", "If", " ", "no", " ", "data", " ", "has", " ", "bee", "n", " ", "sent", " ", "bef", "ore", " ", "timeo", "ut", ",", " ", "then", " ", "it", " ", "caus", "es", "\\", "10", ";", " ", " ", " ", " ", "'", "socket", ".", "timeo", "ut", "'", " ", "exception", " ", "to", " ", "be", " ", "throw", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "sendall_", "(_", "self_", ",_", "data\\u", "len_", ")_", ":_", "\\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 ", " _", "sent_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "send_", "(_", "self_", "._", "\\u", "write", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sent_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\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", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sent_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "self_", "._", "\\u", "write", "\\u", "result_", "[_", "sent_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "write", "\\u", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "result_", "=_", "buffer_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "sendall_", ",_", "self_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "accept_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "accept", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "accept", " ", "method", ".", " ", "Sock", "et", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", " ", "pair", " ", "is", " ", "async", "hronous", " ", "socket", " ", "(", "instance", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "Async", "Sock", "et", " ", "with", " ", "blockin", "g", "=", "Fal", "se", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "accept_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", ",_", "addr_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "accept_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "unregister_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "and_", "hasattr_", "(_", "ssl_", ",_", "'", "create", "\\u", "default", "\\u", "context", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "=_", "ssl_", "._", "create", "\\u", "default", "\\u", "context_", "(_", "ssl_", "._", "Pur", "pose_", "._", "CLIENT", "\\u", "AUTH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "load", "\\u", "cert", "\\u", "chain_", "(_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "conn_", ",_", "addr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "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 ", " ", " _", "conn_", "._", "\\u", "read", "\\u", "task_", "=_", "conn_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "conn_", "._", "\\u", "read", "\\u", "coro_", "=_", "conn_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "write", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "read", "\\u", "task_", "=_", "conn_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "conn_", "._", "\\u", "read", "\\u", "coro_", "=_", "conn_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "write", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "read", "\\u", "task_", "=_", "conn_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "conn_", "._", "\\u", "read", "\\u", "coro_", "=_", "conn_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "notifier_", "._", "clear_", "(_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "=_", "Async", "Socket_", "(_", "conn_", ",_", "blocking_", "=_", "False_", ",_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "conn_", "._", "\\u", "read", "\\u", "task_", "=_", "conn_", "._", "\\u", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "conn_", ",_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "read", "\\u", "coro_", "=_", "conn_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "notifier_", "._", "add_", "(_", "conn_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", "|_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "\\u", "read", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "Async", "Socket_", "(_", "conn_", ",_", "blocking_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "accept_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "async", "\\u", "connect_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "connect", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Async", "hronous", " ", "version", " ", "of", " ", "socket", " ", "connect", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "connect_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "self_", "._", "\\u", "rs", "ock_", "._", "gets", "ock", "opt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "unregister_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "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_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "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", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "provide", " ", "'", "ca", "\\u", "cert", "s", "'", " ", "as", " ", "special", " ", "parameter", " ", "to", " ", "'", "accept", "'?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "now", " ", "this", " ", "setup", " ", "wr", "ks", " ", "for", " ", "self", "-", "sign", "ed", " ", "certs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "self_", "._", "\\u", "rs", "ock_", ",_", "ca", "\\u", "certs_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "\\u", "reqs_", "=_", "ssl_", "._", "CERT", "\\u", "REQUIRED_", ",_", "server", "\\u", "side_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "task_", "=_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "self_", "._", "\\u", "write", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "clear_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "task_", "=_", "functools_", "._", "partial_", "(_", "\\u", "connect_", ",_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "add_", "(_", "self_", ",_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "rs", "ock_", "._", "connect_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "args_", "[_", "0_", "]_", "==_", "EIN", "PROGRESS", "_", "or_", "e_", "._", "args_", "[_", "0_", "]_", "==_", "EW", "OU", "LDB", "LOCK_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Socket_", "(_", "\\u", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ioc", "p", "\\u", "connect_", "(_", "self_", ",_", "host", "\\u", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "connect", "'", " ", "with", " ", "'", "yield", "'", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "connect_", "(_", "self_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AR", "ec", "v_", "(_", "self_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AS", "end_", "(_", "self_", "._", "\\u", "fileno_", ",_", "''_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "==_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "win32", "file_", "._", "SO", "\\u", "UPDATE", "\\u", "CONNECT", "\\u", "CONTEXT_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "self_", "._", "\\u", "rs", "ock_", ",_", "ca", "\\u", "certs_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "\\u", "reqs_", "=_", "ssl_", "._", "CERT", "\\u", "REQUIRED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Connect", "EX", " ", "require", "s", " ", "socket", " ", "to", " ", "be", " ", "bound", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "rs", "ock_", "._", "bind_", "(_", "(_", "'", "0.", "0.", "0.", "0", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "exc_", "[_", "0_", "]_", "!=_", "EIN", "VAL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "connect_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err_", ",_", "n_", "=_", "win32", "file_", "._", "Connect", "Ex_", "(_", "self_", "._", "\\u", "rs", "ock_", ",_", "host", "\\u", "port_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "and_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "IO", "\\u", "PENDING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "socket_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Socket_", "(_", "\\u", "Async", "Socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ioc", "p", "\\u", "accept_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ";", " ", "use", " ", "'", "accept", "'", " ", "with", " ", "'", "yield", "'", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", ".", " ", "Sock", "et", " ", "in", " ", "return", "ed", " ", "pair", " ", "is", " ", "async", "hronous", "\\", "10", ";", " ", " ", " ", " ", "socket", " ", "(", "instance", " ", "of", " ", "Async", "Sock", "et", " ", "with", " ", "blockin", "g", "=", "Fal", "se", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "accept_", "(_", "self_", ",_", "conn_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "def_", "\\u", "ssl", "\\u", "handshake", "_", "(_", "self_", ",_", "conn_", ",_", "addr_", ",_", "err_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "._", "do", "\\u", "handshake", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "ssl_", "._", "SS", "LE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "READ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AR", "ec", "v_", "(_", "conn_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "err_", "._", "args_", "[_", "0_", "]_", "==_", "ssl_", "._", "SS", "L", "\\u", "ERROR", "\\u", "WAN", "T", "\\u", "WRITE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err_", ",_", "n_", "=_", "win32", "file_", "._", "WS", "AS", "end_", "(_", "conn_", "._", "\\u", "fileno_", ",_", "''_", ",_", "self_", "._", "\\u", "read", "\\u", "overlap_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "OPERATION", "\\u", "ABORT", "ED_", "and_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "throw_", "(_", "socket_", "._", "error_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "family_", ",_", "lad", "dr_", ",_", "rad", "dr_", "=_", "win32", "file_", "._", "Get", "Accept", "Ex", "Sock", "addrs_", "(_", "conn_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "unpack", " ", "rad", "dr", " ", "if", " ", "famil", "y", " ", "!=", " ", "AF", "\\u", "INET_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "\\u", "rs", "ock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "win32", "file_", "._", "SO", "\\u", "UPDATE", "\\u", "ACCEPT", "\\u", "CONTEXT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "struct_", "._", "pack_", "(_", "'", "P", "'_", ",_", "self_", "._", "\\u", "fileno_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "certfile", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "and_", "hasattr_", "(_", "ssl_", ",_", "'", "create", "\\u", "default", "\\u", "context", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "=_", "ssl_", "._", "create", "\\u", "default", "\\u", "context_", "(_", "ssl_", "._", "Pur", "pose_", "._", "CLIENT", "\\u", "AUTH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "load", "\\u", "cert", "\\u", "chain_", "(_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "self_", "._", "ssl", "\\u", "server", "\\u", "ctx_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "conn_", "._", "\\u", "rs", "ock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "conn_", "._", "\\u", "rs", "ock_", ",_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "\\u", "side_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "do", "\\u", "handshake", "\\u", "on", "\\u", "connect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "ssl", "\\u", "handshake", "_", ",_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conn_", ",_", "rad", "dr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "(_", "None_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "self_", "._", "\\u", "timeout_", "and_", "self_", "._", "\\u", "notifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "notifier_", "._", "\\u", "del", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", ",_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "(_", "conn_", ",_", "rad", "dr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "self_", "._", "\\u", "rs", "ock_", "._", "family_", ",_", "self_", "._", "\\u", "rs", "ock_", "._", "type_", ",_", "self_", "._", "\\u", "rs", "ock_", "._", "proto_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "Async", "Socket_", "(_", "sock_", ",_", "keyfile_", "=_", "self_", "._", "\\u", "keyfile_", ",_", "certfile", "_", "=_", "self_", "._", "\\u", "certfile", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "self_", "._", "\\u", "ssl", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "win32", "file_", "._", "Allocate", "Read", "Buffer_", "(_", "win32", "file_", "._", "Calculat", "e", "Sock", "et", "End", "Point", "Size_", "(_", "sock_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "functools_", "._", "partial_", "(_", "\\u", "accept_", ",_", "self_", ",_", "conn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "As", "yn", "Cor", "o_", "._", "cur", "\\u", "coro_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "coro_", "._", "\\u", "await", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "notifier_", "._", "\\u", "add", "\\u", "timeout_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "err_", "=_", "win32", "file_", "._", "Accept", "Ex_", "(_", "self_", "._", "\\u", "fileno_", ",_", "conn_", "._", "\\u", "fileno_", ",_", "self_", "._", "\\u", "read", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "\\u", "overlap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err_", "and_", "err_", "!=_", "wine", "rror_", "._", "ERROR", "\\u", "IO", "\\u", "PENDING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "read", "\\u", "overlap_", "._", "object_", "=_", "self_", "._", "\\u", "read", "\\u", "result_", "=_", "self_", "._", "\\u", "read", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "socket_", "._", "error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Poller", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "poll_", "(_", "self_", ",_", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calls", " ", "'", "task", "'", " ", "method", " ", "of", " ", "register", "ed", " ", "fds", " ", "whe", "n", " ", "there", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "read", "/", "write", " ", "event", " ", "for", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "timeout_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "timeouts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "timeout_", "=_", "self_", "._", "\\u", "timeouts", "_", "[_", "0_", "]_", "[_", "0_", "]_", "-_", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "poll", "\\u", "timeout_", "=_", "min_", "(_", "timeout_", ",_", "poll", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "poll", "\\u", "timeout_", "*=_", "self_", "._", "timeo", "ut", "\\u", "multiplier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "timeout_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "timeout_", "=_", "\\u", "Async", "Poller", "_", "._", "\\u", "Block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "timeout_", "=_", "timeout_", "*_", "self_", "._", "timeo", "ut", "\\u", "multiplier_", "\\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 ", " _", "events_", "=_", "self_", "._", "\\u", "poller_", "._", "poll_", "(_", "poll", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "poll", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prevent", " ", "tig", "ht", " ", "loops_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fileno_", ",_", "event_", "in_", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "=_", "self_", "._", "\\u", "fds_", "._", "get_", "(_", "fileno_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fd_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "event_", "!=_", "\\u", "Async", "Poller", "_", "._", "\\u", "Hang", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "'", "invalid", " ", "fd", " ", "for", " ", "event", " ", "%", "s", "'_", ",_", "event_", ")_", "\\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_", "event_", "&_", "\\u", "Async", "Poller", "_", "._", "\\u", "Read_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fd_", "._", "\\u", "read", "\\u", "task_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "'", "fd", " ", "%", "s", " ", "is", " ", "not", " ", "register", "ed", " ", "for", " ", "read", ";", " ", "unregister", "ing", " ", "it", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "._", "\\u", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unregister_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "._", "\\u", "read", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "&_", "\\u", "Async", "Poller", "_", "._", "\\u", "Write_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "fd_", "._", "\\u", "write", "\\u", "task_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "debug_", "(_", "'", "fd", " ", "%", "s", " ", "is", " ", "not", " ", "register", "ed", " ", "for", " ", "write", ";", " ", "unregister", "ing", " ", "it", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "._", "\\u", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unregister_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "._", "\\u", "write", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "&_", "\\u", "Async", "Poller", "_", "._", "\\u", "Hang", "up_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "._", "\\u", "eof_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "&_", "\\u", "Async", "Poller", "_", "._", "\\u", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "error", " ", "on", " ", "fd", " ", "%", "s", "'_", ",_", "fd_", "._", "\\u", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unregister_", "(_", "fd_", ")_", "\\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 ", " _", "logger_", "._", "debug_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeouts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "timeouts", "_", "and_", "self_", "._", "\\u", "timeouts", "_", "[_", "0_", "]_", "[_", "0_", "]_", "<=_", "now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd", "\\u", "timeout_", ",_", "fd_", "=_", "self_", "._", "\\u", "timeouts", "_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fd_", "._", "\\u", "timeo", "ut", "\\u", "id_", "==_", "fd", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "._", "\\u", "timeo", "ut", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "\\u", "timed", "\\u", "out_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Async", "Poller", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "terminate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd", "\\u", "ws", "ock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd", "\\u", "rs", "ock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "timeouts", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "pend", "ing", " ", "timeouts", ":", " ", "%", "s", "'_", ",_", "len_", "(_", "self_", "._", "\\u", "timeouts", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "\\u", "poller_", ",_", "'", "terminate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "poller_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "fd_", "in_", "self_", "._", "\\u", "fds_", "._", "itervalues_", "(_", ")_", ":_", "\\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", "poller_", "._", "unregister_", "(_", "fd_", "._", "\\u", "fileno_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warning_", "(_", "'", "unregister", " ", "of", " ", "%", "s", " ", "fail", "ed", " ", "with", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fd_", "._", "\\u", "fileno_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", "._", "\\u", "notifier_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "poller_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "timeouts", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fds_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "o_", "(_", "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_", "hot", "\\u", "swap_", "(_", "self_", ",_", "target_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", "s", " ", "coro", "'", "s", " ", "generat", "or", " ", "function", " ", "with", " ", "give", "n", " ", "target", "(*", "args", ",", " ", "**", "kwarg", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "new", " ", "generat", "or", " ", "starts", " ", "executi", "ng", " ", "from", " ", "the", " ", "beginn", "ing", ".", " ", "If", "\\", "10", ";", " ", " ", " ", " ", "there", " ", "are", " ", "any", " ", "pend", "ing", " ", "message", "s", ",", " ", "the", "y", " ", "will", " ", "not", " ", "be", " ", "reset", ",", " ", "so", " ", "new", "\\", "10", ";", " ", " ", " ", " ", "generat", "or", " ", "can", " ", "process", " ", "them", " ", "(", "or", " ", "clear", " ", "them", " ", "with", " ", "success", "ive", "\\", "10", ";", " ", " ", " ", " ", "'", "receive", "'", " ", "calls", " ", "with", " ", "timeo", "ut", "=", "0", " ", "unti", "l", " ", "it", " ", "return", "s", "\\", "10", ";", " ", " ", " ", " ", "'", "alarm", "\\u", "value", "')", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generator_", "=_", "Cor", "o_", "._", "\\u\\u", "get", "\\u", "generator_", "(_", "self_", ",_", "target_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'%", "s", " ", "is", " ", "not", " ", "a", " ", "generat", "or", "!'_", ",_", "target_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "swap", "\\u", "generator_", "=_", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Cor", "o_", "._", "\\u", "async", "oro", "_", "._", "\\u", "swap", "\\u", "generator_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "transform_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"'", "name", "'", " ", "must", " ", "be", " ", "unique", " ", "acro", "ss", " ", "all", " ", "channel", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "transform", "'", " ", "is", " ", "a", " ", "function", " ", "tha", "t", " ", "can", " ", "eit", "her", " ", "filter", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "transform", " ", "a", " ", "message", ".", " ", "If", " ", "the", " ", "function", " ", "return", "s", " ", "'", "Non", "e", "',", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "is", " ", "filter", "ed", " ", "(", "ignore", "d", ").", " ", "The", " ", "function", " ", "is", " ", "call", "ed", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "parameter", " ", "set", " ", "to", " ", "channel", " ", "name", " ", "and", " ", "second", " ", "parameter", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "Channel_", "._", "\\u", "async", "oro", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Channel_", "._", "\\u", "async", "oro", "_", "=_", "As", "yn", "Cor", "o_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "location_", "=_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "transform_", "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 ", " _", "argspec_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "argspec_", "._", "args_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "\"", "transform", "\"", " ", "function", " ", "ignore", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transform_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "transform_", "=_", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subscribers_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subscribe", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "channels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warning_", "(_", "'", "duplicat", "e", " ", "channel", " ", "\"%", "s", "\"!", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "channels_", "[_", "name_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "transform_", "(_", "self_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "location_", "!=_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argspec_", "=_", "inspect_", "._", "getargs", "pec_", "(_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "argspec_", "._", "args_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "\"", "transform", "\"", " ", "function", " ", "ignore", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "transform_", "=_", "transform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Messag", "e", " ", "is", " ", "sent", " ", "to", " ", "currentl", "y", " ", "register", "ed", " ", "subscribers", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "als", "o", " ", "be", " ", "used", " ", "on", " ", "remote", " ", "channel", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "location_", "==_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "transform_", ":_", "\\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 ", " ", "_", "message_", "=_", "self_", "._", "\\u", "transform_", "(_", "self_", "._", "\\u", "name_", ",_", "message_", ")_", "\\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 ", " ", "_", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", "is_", "None_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "invalid_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subscriber_", "in_", "self_", "._", "\\u", "subscribers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "subscriber_", "._", "send_", "(_", "message_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "invalid_", "._", "append_", "(_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "invalid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "uns", "ub_", "(_", "self_", ",_", "subscriber_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "remote", " ", "subscribe", "r", " ", "%", "s", " ", "is", " ", "not", " ", "valid", ";", " ", "uns", "ubs", "cri", "bing", " ", "it", "'_", ",_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "unsubscribe_", "(_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subscriber_", "in_", "invalid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "\\u", "uns", "ub_", ",_", "self_", ",_", "subscriber_", ")_", "\\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_", "#", " ", "remote", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "\\u", "Net", "Request_", "(_", "'", "send", "'_", ",_", "kwargs_", "=_", "{_", "'", "channel", "'_", ":_", "self_", "._", "\\u", "name_", ",_", "'", "message", "'_", ":_", "message_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dst_", "=_", "self_", "._", "\\u", "location_", ",_", "timeout_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "request", " ", "is", " ", "queue", "d", " ", "for", " ", "async", "hronous", " ", "processing_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "Peer", "_", "._", "send", "\\u", "req_", "(_", "request_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "remote", " ", "channel", " ", "at", " ", "%", "s", " ", "may", " ", "not", " ", "be", " ", "valid", "'_", ",_", "self_", "._", "\\u", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Channel_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deliver", "_", "(_", "self_", ",_", "message_", ",_", "timeout_", "=_", "None_", ",_", "n_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mus", "t", " ", "be", " ", "used", " ", "with", " ", "'", "yield", "'", " ", "as", " ", "'", "rcv", "d", " ", "=", " ", "yield", " ", "channel", ".", "deliver", "(", "message", ")'", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Block", "ing", " ", "'", "send", "':", " ", "Wait", " ", "unti", "l", " ", "message", " ", "can", " ", "be", " ", "deliver", "ed", " ", "to", " ", "at", "\\", "10", ";", " ", " ", " ", " ", "leas", "t", " ", "'", "n", "'", " ", "subscribers", " ", "bef", "ore", " ", "timeo", "ut", ".", " ", "Return", "s", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "end", "-", "point", " ", "recip", "ients", " ", "(", "coroutine", "s", ")", " ", "the", " ", "message", " ", "is", " ", "deliver", "ed", " ", "to", ";", "\\", "10", ";", " ", " ", " ", " ", "i", ".", "e", ".,", " ", "in", " ", "case", " ", "of", " ", "hei", "rar", "chic", "al", " ", "channel", "s", ",", " ", "it", " ", "is", " ", "the", " ", "sum", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "recip", "ients", " ", "of", " ", "all", " ", "the", " ", "channel", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "als", "o", " ", "be", " ", "used", " ", "on", " ", "remote", " ", "channel", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "n_", ",_", "int_", ")_", "or_", "n_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "location_", "==_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "transform_", ":_", "\\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 ", " ", "_", "message_", "=_", "self_", "._", "\\u", "transform_", "(_", "self_", "._", "\\u", "name_", ",_", "message_", ")_", "\\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 ", " ", "_", "message_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Sto", "p", "Iteration_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "len_", "(_", "self_", "._", "\\u", "subscribers_", ")_", "<_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "start_", "=_", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "subscribe", "\\u", "event_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "yield_", "self_", "._", "\\u", "subscribe", "\\u", "event_", "._", "wait_", "(_", "timeout_", ")_", ")_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Sto", "p", "Iteration_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "timeout_", "-=_", "\\u", "time_", "(_", ")_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Sto", "p", "Iteration_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dur", "ing", " ", "delivery", ",", " ", "\\u", "subscribers", " ", "may", " ", "change", ",", " ", "so", " ", "make", " ", "copy_", "\\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_", "subscribers_", "=_", "list_", "(_", "self_", "._", "\\u", "subscribers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "{_", "'", "repl", "y", "'_", ":_", "0_", ",_", "'", "pend", "ing", "'_", ":_", "len_", "(_", "subscribers_", ")_", ",_", "'", "success", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "don", "e", "'_", ":_", "Event_", "(_", ")_", ",_", "'", "invalid", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "deliver", "_", "(_", "subscriber_", ",_", "info_", ",_", "timeout_", ",_", "n_", ",_", "coro_", "=_", "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 ", " ", "_", "reply_", "=_", "yield_", "subscriber_", "._", "deliver", "_", "(_", "message_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reply_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "[_", "'", "repl", "y", "'_", "]_", "+=_", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "'", "success", "'_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ">_", "0_", "and_", "info_", "[_", "'", "success", "'_", "]_", ">=_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "[_", "'", "don", "e", "'_", "]_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reply_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "[_", "'", "invalid", "'_", "]_", "._", "append_", "(_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "[_", "'", "pend", "ing", "'_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "[_", "'", "pend", "ing", "'_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "[_", "'", "don", "e", "'_", "]_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subscriber_", "in_", "subscribers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "subscriber_", ",_", "Cor", "o_", ")_", "and_", "self_", "._", "\\u", "location_", "==_", "subscriber_", "._", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "subscriber_", "._", "send_", "(_", "message_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info_", "[_", "'", "repl", "y", "'_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "'", "success", "'_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "[_", "'", "pend", "ing", "'_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "channel", "/", "remote", " ", "coro_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "\\u", "deliver", "_", ",_", "subscriber_", ",_", "info_", ",_", "timeout_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info_", "[_", "'", "pend", "ing", "'_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "[_", "'", "don", "e", "'_", "]_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "==_", "0_", "or_", "info_", "[_", "'", "success", "'_", "]_", "<_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "info_", "[_", "'", "don", "e", "'_", "]_", "._", "wait_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info_", "[_", "'", "invalid", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "uns", "ub_", "(_", "self_", ",_", "subscriber_", ",_", "coro_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "remote", " ", "subscribe", "r", " ", "%", "s", " ", "is", " ", "not", " ", "valid", ";", " ", "uns", "ubs", "cri", "bing", " ", "it", "'_", ",_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "unsubscribe_", "(_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "subscriber_", "in_", "info_", "[_", "'", "invalid", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Cor", "o_", "(_", "\\u", "uns", "ub_", ",_", "self_", ",_", "subscriber_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "(_", "info_", "[_", "'", "repl", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remote", " ", "channel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "\\u", "Net", "Request_", "(_", "'", "deliver", "'_", ",_", "kwargs_", "=_", "{_", "'", "channel", "'_", ":_", "self_", "._", "\\u", "name_", ",_", "'", "message", "'_", ":_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "'_", ":_", "n_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dst_", "=_", "self_", "._", "\\u", "location_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "reply_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "yield_", "Channel_", "._", "\\u", "async", "oro", "_", "._", "\\u", "sync", "\\u", "reply_", "(_", "request_", ",_", "alarm", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reply_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reply_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "repl", "y", " ", "<", " ", "0", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "er", ".", "warn", "ing", "('", "remote", " ", "channel", " ", "\"%", "s", "\"", " ", "at", " ", "%", "s", " ", "may", " ", "have", " ", "gone", " ", "awa", "y", "!'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "self", ".\\u", "name", ",", " ", "self", ".\\u", "location", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Sto", "p", "Iteration_", "(_", "reply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "As", "yn", "Cor", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "schedule_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Intern", "al", " ", "use", " ", "only", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "\\u", "quit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "I", "/", "O", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "notifier_", "._", "poll_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "schedule", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "timeouts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", "=_", "self_", "._", "\\u", "timeouts", "_", "[_", "0_", "]_", "[_", "0_", "]_", "-_", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "polling", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "poll_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "polling", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "timeouts", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "wake", " ", "up", " ", "timed", " ", "suspend", "s", ";", " ", "polle", "rs", " ", "may", " ", "timeo", "ut", " ", "slight", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ear", "lie", "r", ",", " ", "so", " ", "give", " ", "a", " ", "bit", " ", "of", " ", "slack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "\\u", "time_", "(_", ")_", "+_", "0.0001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "timeouts", "_", "and_", "self_", "._", "\\u", "timeouts", "_", "[_", "0_", "]_", "[_", "0_", "]_", "<=_", "now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", ",_", "cid_", ",_", "alarm", "\\u", "value_", "=_", "heapp", "op_", "(_", "self_", "._", "\\u", "timeouts", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "timeout_", "<=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "=_", "self_", "._", "\\u", "coros", "_", "._", "get_", "(_", "cid_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "coro_", "or_", "coro_", "._", "\\u", "timeout_", "!=_", "timeout_", ":_", "\\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_", "coro_", "._", "\\u", "state_", "not_", "in_", "(_", "As", "yn", "Cor", "o_", "._", "\\u", "Await", "IO", "\\u_", ",_", "As", "yn", "Cor", "o_", "._", "\\u", "Suspend", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "As", "yn", "Cor", "o_", "._", "\\u", "Await", "Msg", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "coro", " ", "%", "s", "/", "%", "s", " ", "is", " ", "in", " ", "state", " ", "%", "s", " ", "for", " ", "resum", "e", ";", " ", "ignore", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "id_", ",_", "coro_", "._", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coro_", "._", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "suspended", "_", "._", "discard_", "(_", "cid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d_", "._", "add_", "(_", "cid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "value_", "=_", "alarm", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schedule", "d_", "=_", "[_", "self_", "._", "\\u", "coros", "_", "[_", "cid_", "]_", "for_", "cid_", "in_", "self_", "._", "\\u", "schedule", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "coro_", "in_", "schedule", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "As", "yn", "Cor", "o_", "._", "\\u\\u", "cur", "\\u", "coro_", "=_", "coro_", "\\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_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "coro_", "._", "\\u", "exceptions_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exc_", "[_", "0_", "]_", "==_", "Generat", "or", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "str", "(", "exc", "[", "1", "])", " ", "==", " ", "'", "close", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "generator_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "=_", "coro_", "._", "\\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 ", " ", " _", "retval_", "=_", "coro_", "._", "\\u", "generator_", "._", "throw_", "(_", "*_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "retval_", "=_", "coro_", "._", "\\u", "generator_", "._", "send_", "(_", "coro_", "._", "\\u", "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 ", " ", "_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exc_", "[_", "0_", "]_", "==_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "exc_", "[_", "1_", "]_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "v_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "value_", "=_", "v_", "[_", "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 ", " ", " _", "coro_", "._", "\\u", "value_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coro_", "._", "\\u", "exceptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "exc_", "[_", "0_", "]_", "==_", "Hot", "Swa", "p", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "exc_", "[_", "1_", "]_", "._", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "v_", ",_", "tuple_", ")_", "and_", "len_", "(_", "v_", ")_", "==_", "1_", "and_", "inspect_", "._", "is", "generator_", "(_", "v_", "[_", "0_", "]_", ")_", "and_", "coro_", "._", "\\u", "hot", "\\u", "swapp", "able_", "and_", "not_", "coro_", "._", "\\u", "caller", "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 ", " ", " _", "coro_", "._", "\\u", "generator_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "clos", "ing", " ", "%", "s", "/", "%", "s", " ", "raise", "d", " ", "exception", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "id_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coro_", "._", "\\u", "generator_", "=_", "v_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "name_", "=_", "coro_", "._", "\\u", "generator_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "exceptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "coro", ".\\u", "msgs", " ", "is", " ", "not", " ", "reset", ",", " ", "so", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coroutine", " ", "can", " ", "process", " ", "pend", "ing", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "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 ", " ", " _", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "Hot", "Swa", "p", "Except", "ion", " ", "from", " ", "%", "s", "/", "%", "s", " ", "ignore", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "exceptions_", "._", "append_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "coro_", "._", "\\u", "caller", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "to", " ", "caller_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "caller_", "=_", "coro_", "._", "\\u", "caller", "s_", "._", "pop_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "generator_", "=_", "caller_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", "._", "\\u", "swap", "\\u", "generator_", "and_", "not_", "coro_", "._", "\\u", "caller", "s_", "and_", "coro_", "._", "\\u", "hot", "\\u", "swapp", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "exceptions_", "._", "append_", "(_", "(_", "Hot", "Swa", "p", "Exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hot", "Swa", "p", "Exception_", "(_", "coro_", "._", "\\u", "swap", "\\u", "generator_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "swap", "\\u", "generator_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exception", " ", "in", " ", "callee", ",", " ", "restore", " ", "saved", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "value_", "=_", "caller_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "suspended", "_", "._", "discard_", "(_", "coro_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d_", "._", "add_", "(_", "coro_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "coro_", "._", "\\u", "state_", "==_", "As", "yn", "Cor", "o_", "._", "\\u", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", "\\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_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "coro_", "._", "\\u", "exceptions_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "exc_", ",_", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "exc_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception", "\\u", "only_", "(_", "*_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception_", "(_", "*_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "warning_", "(_", "'", "unca", "ugh", "t", " ", "exception", " ", "in", " ", "%", "s", ":\\\\", "n", "%", "s", "'_", ",_", "coro_", ",_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "generator_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "clos", "ing", " ", "%", "s", " ", "raise", "d", " ", "exception", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "name_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "this", " ", "coro_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "coro_", "._", "\\u", "state_", "not_", "in_", "(_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", ",_", "As", "yn", "Cor", "o_", "._", "\\u", "Running_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "coro", " ", "\"%", "s", "\"", " ", "is", " ", "in", " ", "state", ":", " ", "%", "s", "'_", ",_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "monitors_", "=_", "list_", "(_", "coro_", "._", "\\u", "monitors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "monitor_", "in_", "monitors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "monitor_", "._", "\\u", "location_", "==_", "self_", "._", "\\u", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "Monitor", "Exception_", "(_", "coro_", ",_", "coro_", "._", "\\u", "exceptions_", "[_", "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 ", " ", " _", "exc_", "=_", "Monitor", "Exception_", "(_", "coro_", ",_", "(_", "Sto", "p", "Iteration_", ",_", "coro_", "._", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "coros", "_", "._", "get_", "(_", "monitor_", "._", "\\u", "id_", ",_", "None_", ")_", "==_", "monitor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "monitor_", "._", "send_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "monit", "or", " ", "for", " ", "%", "s", "/", "%", "s", " ", "has", " ", "gone", " ", "awa", "y", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "monitors_", "._", "discard_", "(_", "monitor_", ")_", "\\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_", "#", " ", "remote", " ", "monit", "or", ";", " ", "prepar", "e", " ", "serializable", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "coro_", "._", "\\u", "exceptions_", "[_", "0_", "]_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "serialize_", "(_", "exc_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pickle_", "._", "Pickl", "ing", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "send", " ", "only", " ", "the", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "exc_", "=_", "(_", "exc_", "[_", "0_", "]_", ",_", "type_", "(_", "exc_", "[_", "1_", "]_", "._", "args_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc_", "=_", "Monitor", "Exception_", "(_", "coro_", ",_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "exceptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "exc_", "=_", "coro_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "serialize_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "pickle_", "._", "Pickl", "ing", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "exc_", "=_", "type_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc_", "=_", "Monitor", "Exception_", "(_", "coro_", ",_", "(_", "Sto", "p", "Iteration_", ",_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "monitor_", "._", "send_", "(_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "coro_", "._", "\\u", "monitors_", "or_", "not_", "coro_", "._", "\\u", "exceptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "msgs_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "monitors_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "exceptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "coros", "_", "._", "pop_", "(_", "coro_", "._", "\\u", "id_", ",_", "None_", ")_", "!=_", "coro_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "warning_", "(_", "'", "invalid", " ", "coro", ":", " ", "%", "s", ",", " ", "%", "s", "'_", ",_", "coro_", "._", "\\u", "id_", ",_", "coro_", "._", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "coro_", "._", "\\u", "daemon_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "daemon", "s_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "coro_", "._", "\\u", "monitors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "(", "local", ")", " ", "monit", "or", " ", "can", " ", "restart", " ", "it", " ", "with", " ", "hot", "\\u", "swap_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "hot", "\\u", "swapp", "able_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "exceptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "generator_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", "._", "\\u", "complete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "complete_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "complete_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d_", "._", "discard_", "(_", "coro_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "coros", "_", ")_", "==_", "self_", "._", "\\u", "daemon", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "complete_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "coro_", "._", "\\u", "state_", "==_", "As", "yn", "Cor", "o_", "._", "\\u", "Running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Schedule", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "this", " ", "coroutine", " ", "is", " ", "suspended", ",", " ", "don", "'", "t", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "value", ";", " ", "whe", "n", " ", "it", " ", "is", " ", "resum", "ed", ",", " ", "it", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "d", " ", "with", " ", "the", " ", "'", "update", "'", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "value_", "=_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "retval_", ",_", "types_", "._", "Generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "push", " ", "current", " ", "generat", "or", " ", "onto", " ", "stack", " ", "and", " ", "activate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "generator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "coro_", "._", "\\u", "caller", "s_", "._", "append_", "(_", "(_", "coro_", "._", "\\u", "generator_", ",_", "coro_", "._", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "generator_", "=_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "As", "yn", "Cor", "o_", "._", "\\u\\u", "cur", "\\u", "coro_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "coro_", "in_", "self_", "._", "\\u", "coros", "_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "termina", "ting", " ", "Cor", "o", " ", "%", "s", "/", "%", "s", "%", "s", "'_", ",_", "coro_", "._", "\\u", "name_", ",_", "coro_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "(", "daemon", ")'_", "if_", "coro_", "._", "\\u", "daemon_", "else_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "As", "yn", "Cor", "o_", "._", "\\u\\u", "cur", "\\u", "coro_", "=_", "coro_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "state_", "=_", "As", "yn", "Cor", "o_", "._", "\\u", "Running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "coro_", "._", "\\u", "generator_", ":_", "\\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 ", " ", "_", "coro_", "._", "\\u", "generator_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "warning_", "(_", "'", "clos", "ing", " ", "%", "s", " ", "raise", "d", " ", "exception", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "coro_", "._", "\\u", "generator_", "._", "\\u\\u", "name\\u\\u_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "coro_", "._", "\\u", "caller", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "coro_", "._", "\\u", "generator_", ",_", "coro_", "._", "\\u", "value_", "=_", "coro_", "._", "\\u", "caller", "s_", "._", "pop_", "(_", "-_", "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 ", " ", "_", "coro_", "._", "\\u", "generator_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "coro_", "._", "\\u", "complete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "\\u", "complete_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coro_", "._", "\\u", "complete_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "schedule", "d_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "suspended", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "timeouts", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "coros", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "channels_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "quit_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "notifier_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "As", "yn", "Cor", "o", " ", "%", "ster", "minat", "ed", "'_", ",_", "(_", "'%", "s", " ", "'_", "%_", "self_", "._", "\\u", "location_", ")_", "if_", "self_", "._", "\\u", "location_", "else_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "\\u", "atexit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", ",_", "far", "gs_", ",_", "fk", "war", "gs_", "=_", "self_", "._", "\\u", "atexit_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "(_", "*_", "far", "gs_", ",_", "**_", "fk", "war", "gs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "runn", "ing", " ", "%", "s", " ", "fail", "ed", ":'_", ",_", "func_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "warning_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "complete_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Async", "Thread", "Pool_", "(_", "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", "taskl", "et_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "self_", "._", "\\u", "task", "\\u", "queue_", "._", "get_", "(_", "block_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "task", "\\u", "queue_", "._", "task", "\\u", "done_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coro_", ",_", "target_", ",_", "args_", ",_", "kwargs_", "=_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "target_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coro_", "._", "\\u", "proceed", "\\u_", "(_", "val_", ")_", "\\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 ", " _", "coro_", "._", "throw_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\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arm import RobotArm \nfrom QRCode2 import QRCode2\n\nbot_config = lib.get_config()\narm_config = bot_config[\"dagu_arm\"]\narm = RobotArm(arm_config)\n\n\nwhile True:\n print \"Commands: \" \n print \"1: Set Angles\"\n print \"2: Move to hopper pos\"\n print \"3: Set Hopper\" \n print \"4: Empty hopper\" \n print \"5: Calibrate rail\"\n print \"6: Pinch \"\n print \"7: Let go \"\n print \"8: Reset the arm and rail\"\n print \"9: Check color in bin\"\n print \"10: Tier Grab \"\n print \"11: Turn Light On \"\n print \"12: Turn Light Off \"\n print \"13: Grab QR \"\n print \"14: Grab Color \" \n print \"15: Find block with IR\"\n print \"16: Check Hopper Colors\"\n \n\n Command = input(\"Command: \")\n if Command == 16:\n arm.check_hopper()\n \n if Command == 15:\n arm.FindBlockWithIR() \n \n if Command == 13: \n arm.GrabQR()\n \n if Command == 14:\n arm.GrabColor() \n \n if Command == 12:\n arm.TurnOffLight()\n \n if Command == 11:\n \n arm.TurnOnLight()\n \n if Command == 10:\n arm.competition_solver_barge('B') \n \n if Command == -1: \n print \"Good Bye!\"\n break\n \n if Command == 1:\n arm.demo_set_angles()\n \n if Command == 2:\n Pos = input(\"which bin to go to: \")\n arm.rail.Orientor(Pos)\n \n if Command == 3:\n i = 0\n while i < 4:\n Color = raw_input(\"Block color: \") \n qr = QRCode2(0,Color,0)\n arm.hopper[i]=qr \n i=i+1 \n \n if Command == 4:\n Color = raw_input(\"Which color: \")\n arm.reset_home_position() \n arm.FindAndGetBlock(Color)\n \n if Command == 5:\n arm.rail.CalibrateRail() \n \n if Command == 6: \n arm.grab()\n \n if Command == 7:\n arm.release()\n \n if Command == 8:\n arm.reset_home_position()\n \n if Command == 9: \n \n arm.check_hopper()\n print arm.hopper \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os ", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 }, { "span": "import sys ", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 }, { "span": "from time import sleep ", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 22 } ]
[]
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_", "from_", "time_", "import_", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bot_", "._", "lib_", "._", "lib_", "as_", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot", "\\u", "arm_", "import_", "Robot", "Arm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "QR", "Code", "2_", "import_", "QR", "Code", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bot", "\\u", "config_", "=_", "lib_", "._", "get", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm", "\\u", "config_", "=_", "bot", "\\u", "config_", "[_", "\"", "dag", "u\\u", "arm", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm_", "=_", "Robot", "Arm_", "(_", "arm", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Command", "s", ":", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "1", ":", " ", " ", "Set", " ", "Angles", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "2", ":", " ", " ", "Move", " ", "to", " ", "hop", "per", " ", "pos", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "3", ":", " ", " ", "Set", " ", "Hop", "per", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "4", ":", " ", " ", "Emp", "ty", " ", "hop", "per", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "5", ":", " ", " ", "Calibrat", "e", " ", "rail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "6", ":", " ", " ", "Pin", "ch", " ", " ", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "7", ":", " ", " ", "Let", " ", "go", " ", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "8", ":", " ", " ", "Reset", " ", "the", " ", "arm", " ", "and", " ", "rail", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "9", ":", " ", " ", "Check", " ", "color", " ", "in", " ", "bin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "10", ":", " ", "Tier", " ", "Grab", " ", " ", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "11", ":", " ", "Turn", " ", "Light", " ", "On", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "1", "2", ":", " ", "Turn", " ", "Light", " ", "Off", " ", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "13", ":", " ", "Grab", " ", "QR", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "14", ":", " ", "Grab", " ", "Color", " ", " ", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "15", ":", " ", "Fin", "d", " ", "block", " ", "with", " ", "IR", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "16", ":", " ", "Check", " ", "Hop", "per", " ", "Color", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Command_", "=_", "input_", "(_", "\"", "Command", ":", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Command_", "==_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "check", "\\u", "hop", "per_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "15_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "Fin", "d", "Block", "With", "IR_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "13_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "Grab", "QR", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "14_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "Grab", "Color_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "Turn", "Off", "Light_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "11_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "Turn", "On", "Light_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "competition", "\\u", "solve", "r", "\\u", "bar", "ge_", "(_", "'", "B", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Good", " ", "By", "e", "!\"_", "\\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_", "Command_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "demo", "\\u", "set\\u", "angles_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Pos_", "=_", "input_", "(_", "\"", "whi", "ch", " ", "bin", " ", "to", " ", "go", " ", "to", ":", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm_", "._", "rail", "_", "._", "Orient", "or_", "(_", "Pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Color_", "=_", "raw", "\\u", "input_", "(_", "\"", "Block", " ", "color", ":", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "=_", "QR", "Code", "2_", "(_", "0_", ",_", "Color_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm_", "._", "hop", "per_", "[_", "i_", "]_", "=_", "qr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "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_", "Command_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Color_", "=_", "raw", "\\u", "input_", "(_", "\"", "Whi", "ch", " ", "color", ":", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm_", "._", "reset", "\\u", "home", "\\u", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arm_", "._", "Fin", "d", "And", "Get", "Block_", "(_", "Color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "rail", "_", "._", "Calibrat", "e", "Rai", "l_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "grab_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "reset", "\\u", "home", "\\u", "position_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Command_", "==_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arm_", "._", "check", "\\u", "hop", "per_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "arm_", "._", "hop", "per_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
mikemaccana/imeveryone/usermessages.py
[ { "content": " def makepreviewpic(self,imagefile,imageconfig):\n '''Reduce images larger than a certain size'''\n myimage = Image.open(imagefile)\n width,height = myimage.size\n aspect = float(width) / float(height)\n maxwidth = imageconfig.as_int('maxwidth')\n maxheight = imageconfig.as_int('maxheight')\n maxsize = (maxwidth,maxheight)\n # Don't bother if image is already smaller\n if width < maxwidth and height < maxheight:\n logging.info('Small image, using existing pic at: '+imagefile)\n self.preview = imagefile\n # Resize, save, return preview file name\n else:\n myimage.thumbnail(maxsize,Image.ANTIALIAS)\n newfilename = imagefile.replace('cache','thumbs').split('.')[-2]+'_preview.'+imagefile.split('.')[-1]\n try:\n myimage.save(newfilename)\n logging.info('Saved preview pic to: '+newfilename)\n self.preview = newfilename\n except:\n pass\n return", "metadata": "root.Message.makepreviewpic", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 255 }, { "content": " def checklinksandembeds(self,config):\n '''Process any links in the text'''\n maxwidth = config['images'].as_int('maxwidth')\n maxheight = config['images'].as_int('maxheight')\n linkre = re.compile(r\"(http://[^ ]+)\")\n for link in linkre.findall(self.posttext):\n # lopp through links gettng embeds\n logging.info('Getting embed data for link: '+link)\n try:\n self.embedcode = getembedcode(link, maxwidth=maxwidth, maxheight=maxheight)\n if self.embedcode:\n logging.info('Embed data found!')\n else:\n logging.info('Embed data not found!') \n except:\n logging.warn('Getting embed data for link failed - most likely embedly 404')\n pass\n self.original = self.posttext\n self.posttext = linkre.sub('', self.posttext)\n return", "metadata": "root.Message.checklinksandembeds", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 331 }, { "content": " def checkporn(self,config):\n '''Check images for porn'''\n def savegrayscale(imagefile):\n '''Convert image to greyscale and save'''\n adultimage = Image.open(imagefile)\n adultimage = ImageOps.grayscale(adultimage)\n adultimage.save(imagefile)\n return\n if self.localfile and config['images'].as_bool('enabled') and config['images'].as_bool('adult'):\n count = 1\n response = {}\n while count < 3:\n try:\n logging.info('Checking for porn, try '+str(count))\n response = pifilter.checkimage(\n self.localfile,\n config['posting']['pifilter']['customerid'],\n aggressive = config['posting']['pifilter'].as_bool('aggressive')\n )\n break\n except:\n logging.error('Could not open pifilter URL')\n time.sleep(5)\n count = count+1\n if 'result' in response:\n if response['result']:\n logging.warn('message submission '+str(self._id)+' with image '+self.localfile+' is porn.')\n # Make a greyscale version and use that instead\n if config['images']['adultaction'] in ['gray','grey']:\n savegrayscale(self.localfile)\n logging.info('Saving greyscale version...')\n else:\n self.useralerts.append(config['alerts']['porn'])\n else:\n logging.info('image is clean')\n else:\n # No response from pifilter\n pass\n return", "metadata": "root.Message.checkporn", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 352 } ]
[ { "span": "except:", "start_line": 275, "start_column": 12, "end_line": 275, "end_column": 19 }, { "span": "except:", "start_line": 345, "start_column": 12, "end_line": 345, "end_column": 19 }, { "span": "except:", "start_line": 372, "start_column": 16, "end_line": 372, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "makep", "review", "pic_", "(_", "self_", ",_", "imagef", "ile_", ",_", "image", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Reduce", " ", "images", " ", "large", "r", " ", "than", " ", "a", " ", "cert", "ain", " ", "size", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myi", "mage_", "=_", "Image_", "._", "open_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", ",_", "height_", "=_", "myi", "mage_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect_", "=_", "float_", "(_", "width_", ")_", "/_", "float_", "(_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxw", "idth_", "=_", "image", "config_", "._", "as", "\\u", "int_", "(_", "'", "maxw", "idt", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "height_", "=_", "image", "config_", "._", "as", "\\u", "int_", "(_", "'", "max", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxsize_", "=_", "(_", "maxw", "idth_", ",_", "max", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "bot", "her", " ", "if", " ", "image", " ", "is", " ", "alr", "ead", "y", " ", "small", "er_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "width_", "<_", "maxw", "idth_", "and_", "height_", "<_", "max", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Small", " ", "image", ",", " ", "usi", "ng", " ", "exist", "ing", " ", "pic", " ", "at", ":", " ", "'_", "+_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "preview_", "=_", "imagef", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Resize", ",", " ", "save", ",", " ", "return", " ", "previe", "w", " ", "file", " ", "name_", "\\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 ", " _", "myi", "mage_", "._", "thumbnail_", "(_", "maxsize_", ",_", "Image_", "._", "ANTI", "ALIAS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newfile", "name_", "=_", "imagef", "ile_", "._", "replace_", "(_", "'", "cache", "'_", ",_", "'", "thumbs", "'_", ")_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "2_", "]_", "+_", "'\\u", "previe", "w", ".'_", "+_", "imagef", "ile_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myi", "mage_", "._", "save_", "(_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Save", "d", " ", "previe", "w", " ", "pic", " ", "to", ":", " ", "'_", "+_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "preview_", "=_", "newfile", "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_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "link", "sande", "mbed", "s_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Process", " ", "any", " ", "link", "s", " ", "in", " ", "the", " ", "text", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxw", "idth_", "=_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "int_", "(_", "'", "maxw", "idt", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "height_", "=_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "int_", "(_", "'", "max", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "re_", "=_", "re_", "._", "compile_", "(_", "r", "\"(", "http", "://", "[", "^", " ", "]+)\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "link_", "in_", "link", "re_", "._", "findall_", "(_", "self_", "._", "post", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lop", "p", " ", "through", " ", "link", "s", " ", "gett", "ng", " ", "embeds", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Get", "ting", " ", "embed", " ", "data", " ", "for", " ", "link", ":", " ", "'_", "+_", "link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "embed", "code_", "=_", "gete", "mbed", "code_", "(_", "link_", ",_", "maxw", "idth_", "=_", "maxw", "idth_", ",_", "max", "height_", "=_", "max", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "embed", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "'", "Emb", "ed", " ", "data", " ", "found", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "'", "Emb", "ed", " ", "data", " ", "not", " ", "found", "!'_", ")_", "\\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 ", " _", "logging_", "._", "warn_", "(_", "'", "Get", "ting", " ", "embed", " ", "data", " ", "for", " ", "link", " ", "fail", "ed", " ", "-", " ", "most", " ", "like", "ly", " ", "embed", "ly", " ", "404", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "original_", "=_", "self_", "._", "post", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "text_", "=_", "link", "re_", "._", "sub_", "(_", "''_", ",_", "self_", "._", "post", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "checkp", "orn", "_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "images", " ", "for", " ", "por", "n", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "grayscale", "_", "(_", "imagef", "ile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Convert", " ", "image", " ", "to", " ", "grey", "scale", " ", "and", " ", "save", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "=_", "Image_", "._", "open_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "=_", "Image", "Ops_", "._", "grayscale", "_", "(_", "adult", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "._", "save_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "localf", "ile_", "and_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", "and_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "adult", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "count_", "<_", "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 ", " ", "_", "logging_", "._", "info_", "(_", "'", "Check", "ing", " ", "for", " ", "por", "n", ",", " ", "try", " ", "'_", "+_", "str_", "(_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pif", "ilter_", "._", "check", "image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "localf", "ile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "pif", "ilter", "'_", "]_", "[_", "'", "customer", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aggre", "ssi", "ve_", "=_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "pif", "ilter", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "aggre", "ssi", "ve", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\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 ", " ", "_", "logging_", "._", "error_", "(_", "'", "Cou", "ld", " ", "not", " ", "open", " ", "pif", "ilter", " ", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "result", "'_", "in_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "[_", "'", "result", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "warn_", "(_", "'", "message", " ", "subm", "ission", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "+_", "'", " ", "with", " ", "image", " ", "'_", "+_", "self_", "._", "localf", "ile_", "+_", "'", " ", "is", " ", "por", "n", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "grey", "scale", " ", "version", " ", "and", " ", "use", " ", "tha", "t", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "[_", "'", "images", "'_", "]_", "[_", "'", "adult", "action", "'_", "]_", "in_", "[_", "'", "gray", "'_", ",_", "'", "grey", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "save", "grayscale", "_", "(_", "self_", "._", "localf", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sav", "ing", " ", "grey", "scale", " ", "version", "...'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "por", "n", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "'", "image", " ", "is", " ", "clean", "'_", ")_", "\\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_", "#", " ", "No", " ", "response", " ", "from", " ", "pif", "ilter_", "\\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_", "\\u\\u\\uDEDENT\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Nordeus/pushkin/pushkin/tests/test_server_json.py
[ { "content": "import pytest\nfrom pushkin import pushkin_cli\nimport tornado.web\nfrom pushkin import context\nfrom pushkin.database import database\nfrom pushkin.request.request_processor import RequestProcessor\nfrom pushkin.requesthandlers.events import JsonEventHandler\nfrom pushkin.requesthandlers.notifications import JsonNotificationHandler\nfrom pushkin import test_config_ini_path\nfrom pushkin import config\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": "@pytest.fixture\ndef setup_database():\n database.create_database()", "metadata": "root.setup_database", "header": "['module', '___EOS___']", "index": 12 }, { "content": "@pytest.fixture\ndef mock_processor(mocker):\n '''Mock request processor'''\n mocker.patch('pushkin.request.request_processor.RequestProcessor.submit')\n mocker.patch('pushkin.context.main_logger')", "metadata": "root.mock_processor", "header": "['module', '___EOS___']", "index": 17 }, { "content": "@pytest.fixture\ndef app():\n pushkin_cli.CONFIGURATION_FILENAME = test_config_ini_path\n pushkin_cli.init()\n return pushkin_cli.create_app()", "metadata": "root.app", "header": "['module', '___EOS___']", "index": 24 }, { "content": "@pytest.fixture\ndef notification_batch_json():\n ''' Return a valid json request '''\n return '''\n {\n \"notifications\": [\n {\n \"login_id\" : 1338,\n \"title\" : \"Msg title\",\n \"content\" : \"Text of a message\",\n \"screen\" : \"some_screen_id\"\n }\n ]\n }\n '''", "metadata": "root.notification_batch_json", "header": "['module', '___EOS___']", "index": 30 }, { "content": "@pytest.fixture\ndef post_notification_url(base_url):\n return base_url + config.json_notification_handler_url", "metadata": "root.post_notification_url", "header": "['module', '___EOS___']", "index": 46 }, { "content": "@pytest.fixture\ndef event_batch_json():\n ''' Return a valid json request '''\n return '''\n {\n \"events\": [\n {\n \"user_id\" : 123,\n \"event_id\" : 1,\n \"timestamp\" : 12345,\n \"pairs\": {\n \"some_constant\" : \"6\",\n \"world_id\" : \"1\"\n }\n }\n ]\n }\n '''", "metadata": "root.event_batch_json", "header": "['module', '___EOS___']", "index": 50 }, { "content": "@pytest.fixture\ndef post_event_url(base_url):\n return base_url + config.json_event_handler_url", "metadata": "root.post_event_url", "header": "['module', '___EOS___']", "index": 70 }, { "content": "@pytest.mark.gen_test\[email protected](\"input\", [\n (''),\n ('asd'),\n])\ndef test_post_notification_empty_request(setup_database, mock_processor, http_client, post_notification_url, input):\n '''Test that server responds with 400 if invalid parameter is supplied to post_notification request'''\n request = tornado.httpclient.HTTPRequest(post_notification_url, method='POST', body=input)\n with pytest.raises(tornado.httpclient.HTTPError):\n yield http_client.fetch(request)\n assert not context.request_processor.submit.called", "metadata": "root.test_post_notification_empty_request", "header": "['module', '___EOS___']", "index": 75 }, { "content": "@pytest.mark.gen_test\ndef test_post_notification(setup_database, mock_processor, http_client, post_notification_url,\n notification_batch_json):\n '''Test that a valid request is succesfully parsed in post_notification'''\n request = tornado.httpclient.HTTPRequest(post_notification_url, method='POST', body=notification_batch_json)\n response = yield http_client.fetch(request)\n assert response.code == 200\n assert context.request_processor.submit.called", "metadata": "root.test_post_notification", "header": "['module', '___EOS___']", "index": 88 }, { "content": "@pytest.mark.gen_test\[email protected](\"input\", [\n (''),\n ('asd'),\n])\ndef test_post_event_empty_request(setup_database, mock_processor, http_client, post_event_url, input):\n '''Test that server responds with 400 if invalid parameter is supplied to post_event request'''\n request = tornado.httpclient.HTTPRequest(post_event_url, method='POST', body=input)\n with pytest.raises(tornado.httpclient.HTTPError):\n yield http_client.fetch(request)\n assert not context.request_processor.submit.called", "metadata": "root.test_post_event_empty_request", "header": "['module', '___EOS___']", "index": 98 }, { "content": "@pytest.mark.gen_test\ndef test_post_event(setup_database, mock_processor, http_client, post_event_url, event_batch_json):\n '''Test that a valid request is succesfully parsed in post_event'''\n context.request_processor.submit.return_value = True\n request = tornado.httpclient.HTTPRequest(post_event_url, method='POST', body=event_batch_json)\n response = yield http_client.fetch(request)\n assert response.code == 200\n assert context.request_processor.submit.called", "metadata": "root.test_post_event", "header": "['module', '___EOS___']", "index": 111 }, { "content": "@pytest.mark.gen_test\ndef test_post_event_service_unavailable(setup_database, mock_processor, http_client, post_event_url, event_batch_json,\n app):\n '''Test that service_unavailable is returned if server load is more that expected'''\n context.request_processor.submit.return_value = False\n request = tornado.httpclient.HTTPRequest(post_event_url, method='POST', body=event_batch_json)\n RequestProcessor.submit.return_value = False\n with pytest.raises(tornado.httpclient.HTTPError):\n yield http_client.fetch(request)", "metadata": "root.test_post_event_service_unavailable", "header": "['module', '___EOS___']", "index": 121 } ]
[ { "span": "from pushkin.requesthandlers.events import JsonEventHandler", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 59 }, { "span": "from pushkin.requesthandlers.notifications import JsonNotificationHandler", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 73 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "import_", "push", "kin", "\\u", "cli_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tornado_", "._", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "._", "database_", "import_", "database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "._", "request_", "._", "request", "\\u", "processor_", "import_", "Request", "Processor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "._", "request", "handlers_", "._", "events_", "import_", "Js", "on", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "._", "request", "handlers_", "._", "notifications_", "import_", "Js", "on", "Notifi", "cation", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "import_", "test\\u", "config", "\\u", "ini", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "push", "kin", "_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "setup", "\\u", "database_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "database_", "._", "create", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mock", "\\u", "processor_", "(_", "mocker_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Moc", "k", " ", "request", " ", "process", "or", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "push", "kin", ".", "request", ".", "request", "\\u", "process", "or", ".", "Request", "Process", "or", ".", "submit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mocker_", "._", "patch_", "(_", "'", "push", "kin", ".", "context", ".", "main", "\\u", "logg", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "app_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "push", "kin", "\\u", "cli_", "._", "CONFIGURATION", "\\u", "FILENAME_", "=_", "test\\u", "config", "\\u", "ini", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "kin", "\\u", "cli_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "push", "kin", "\\u", "cli_", "._", "create", "\\u", "app_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "notification", "\\u", "batch", "\\u", "json_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Return", " ", "a", " ", "valid", " ", "json", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'''", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "notification", "s", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "login", "\\u", "id", "\"", " ", ":", " ", "133", "8", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "title", "\"", " ", ":", " ", "\"", "Msg", " ", "title", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "content", "\"", " ", ":", " ", "\"", "Text", " ", "of", " ", "a", " ", "message", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "screen", "\"", " ", ":", " ", "\"", "some", "\\u", "screen", "\\u", "id", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post", "\\u", "notification", "\\u", "url_", "(_", "base", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base", "\\u", "url_", "+_", "config_", "._", "json", "\\u", "notification", "\\u", "handler", "\\u", "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_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "event", "\\u", "batch", "\\u", "json_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Return", " ", "a", " ", "valid", " ", "json", " ", "request", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'''", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "events", "\":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "user", "\\u", "id", "\"", " ", ":", " ", "123", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "event", "\\u", "id", "\"", " ", ":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "timestamp", "\"", " ", ":", " ", "12345", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "pair", "s", "\":", " ", "{", "\\", "10", ";", " ", " ", "\"", "some", "\\u", "constant", "\"", " ", ":", " ", "\"", "6", "\",", "\\", "10", ";", " ", " ", "\"", "world", "\\u", "id", "\"", " ", ":", " ", "\"", "1", "\"", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "fixture_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post", "\\u", "event", "\\u", "url_", "(_", "base", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "base", "\\u", "url_", "+_", "config_", "._", "json", "\\u", "event", "\\u", "handler", "\\u", "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_", "@_", "pytest_", "._", "mark_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "\"", "input", "\"_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "asd", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "notification", "\\u", "empty", "\\u", "request_", "(_", "setup", "\\u", "database_", ",_", "mock", "\\u", "processor_", ",_", "http", "\\u", "client_", ",_", "post", "\\u", "notification", "\\u", "url_", ",_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "tha", "t", " ", "server", " ", "respond", "s", " ", "with", " ", "400", " ", "if", " ", "invalid", " ", "parameter", " ", "is", " ", "supplie", "d", " ", "to", " ", "post", "\\u", "notification", " ", "request", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "post", "\\u", "notification", "\\u", "url_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "http", "\\u", "client_", "._", "fetch_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "notification_", "(_", "setup", "\\u", "database_", ",_", "mock", "\\u", "processor_", ",_", "http", "\\u", "client_", ",_", "post", "\\u", "notification", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notification", "\\u", "batch", "\\u", "json_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "tha", "t", " ", "a", " ", "valid", " ", "request", " ", "is", " ", "succe", "sfu", "ll", "y", " ", "parsed", " ", "in", " ", "post", "\\u", "notification", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "post", "\\u", "notification", "\\u", "url_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "notification", "\\u", "batch", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "http", "\\u", "client_", "._", "fetch_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "._", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "parametrize_", "(_", "\"", "input", "\"_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "asd", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "event", "\\u", "empty", "\\u", "request_", "(_", "setup", "\\u", "database_", ",_", "mock", "\\u", "processor_", ",_", "http", "\\u", "client_", ",_", "post", "\\u", "event", "\\u", "url_", ",_", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "tha", "t", " ", "server", " ", "respond", "s", " ", "with", " ", "400", " ", "if", " ", "invalid", " ", "parameter", " ", "is", " ", "supplie", "d", " ", "to", " ", "post", "\\u", "event", " ", "request", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "post", "\\u", "event", "\\u", "url_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "http", "\\u", "client_", "._", "fetch_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "event_", "(_", "setup", "\\u", "database_", ",_", "mock", "\\u", "processor_", ",_", "http", "\\u", "client_", ",_", "post", "\\u", "event", "\\u", "url_", ",_", "event", "\\u", "batch", "\\u", "json_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "tha", "t", " ", "a", " ", "valid", " ", "request", " ", "is", " ", "succe", "sfu", "ll", "y", " ", "parsed", " ", "in", " ", "post", "\\u", "event", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "return", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "post", "\\u", "event", "\\u", "url_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "event", "\\u", "batch", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "http", "\\u", "client_", "._", "fetch_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "response_", "._", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "post", "\\u", "event", "\\u", "service", "\\u", "unava", "ilab", "le_", "(_", "setup", "\\u", "database_", ",_", "mock", "\\u", "processor_", ",_", "http", "\\u", "client_", ",_", "post", "\\u", "event", "\\u", "url_", ",_", "event", "\\u", "batch", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "tha", "t", " ", "service", "\\u", "unava", "ilab", "le", " ", "is", " ", "return", "ed", " ", "if", " ", "server", " ", "load", " ", "is", " ", "more", " ", "tha", "t", " ", "expected", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "request", "\\u", "processor_", "._", "submit_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "post", "\\u", "event", "\\u", "url_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "event", "\\u", "batch", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Request", "Processor_", "._", "submit_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Error_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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
caktus/django-comps/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# django-comps documentation build configuration file, created by\n# sphinx-quickstart on Wed Jul 25 21:12:10 2012.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.insert(0, os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = []\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'django-comps'\ncopyright = u'2012, David Ray'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.3'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.3.0'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\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 = 'django-compsdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\nlatex_elements = {\n# The paper size ('letterpaper' or 'a4paper').\n#'papersize': 'letterpaper',\n\n# The font size ('10pt', '11pt' or '12pt').\n#'pointsize': '10pt',\n\n# Additional stuff for the LaTeX preamble.\n#'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'django-comps.tex', u'django-comps Documentation',\n u'David Ray', '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', 'django-comps', u'django-comps Documentation',\n [u'David Ray'], 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', 'django-comps', u'django-comps Documentation',\n u'David Ray', 'django-comps', 'A rapid prototyping facilitator.',\n 'Miscellaneous'),\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "django", "-", "comps", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "We", "d", " ", "Ju", "l", " ", "25", " ", "21", ":", "1", "2", ":", "10", " ", "2012", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\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", "'", "django", "-", "comps", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2012", ",", " ", "Dav", "id", " ", "Ray", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.", "3.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "=_", "'", "django", "-", "comps", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "django", "-", "comps", ".", "tex", "'_", ",_", "u", "'", "django", "-", "comps", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Dav", "id", " ", "Ray", "'_", ",_", "'", "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", "'_", ",_", "'", "django", "-", "comps", "'_", ",_", "u", "'", "django", "-", "comps", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Dav", "id", " ", "Ray", "'_", "]_", ",_", "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", "'_", ",_", "'", "django", "-", "comps", "'_", ",_", "u", "'", "django", "-", "comps", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Dav", "id", " ", "Ray", "'_", ",_", "'", "django", "-", "comps", "'_", ",_", "'", "A", " ", "rapid", " ", "protot", "ypi", "ng", " ", "facilit", "ator", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Insecure temporary file
binhex/moviegrabber/lib/site-packages/Cheetah/FileUtils.py
[ { "content": " def __init__(self, files, patternOrRE, replacement,\n recordResults=True):\n\n \n if isinstance(patternOrRE, basestring):\n self._regex = re.compile(patternOrRE)\n else:\n self._regex = patternOrRE\n if isinstance(replacement, basestring):\n self._subber = _GenSubberFunc(replacement).subberFunc()\n else:\n self._subber = replacement\n\n self._pattern = pattern = self._regex.pattern\n self._files = files\n self._results = {}\n self._recordResults = recordResults\n\n ## see if we should use pgrep to do the file matching\n self._usePgrep = False\n if (os.popen3('pgrep')[2].read()).startswith('Usage:'):\n ## now check to make sure pgrep understands the pattern\n tmpFile = mktemp()\n open(tmpFile, 'w').write('#')\n if not (os.popen3('pgrep \"' + pattern + '\" ' + tmpFile)[2].read()):\n # it didn't print an error msg so we're ok\n self._usePgrep = True\n os.remove(tmpFile)\n\n self._run()", "metadata": "root.FindAndReplace.__init__", "header": "['class', 'FindAndReplace', ':', '___EOS___']", "index": 220 } ]
[ { "span": "mktemp()", "start_line": 242, "start_column": 22, "end_line": 242, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Inse", "cure", "_", "temporar", "y_", "file_", "[SEP]_", "class_", "Fin", "d", "And", "Replace", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "files_", ",_", "pattern", "Or", "RE_", ",_", "replacement_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "Results_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pattern", "Or", "RE_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "pattern", "Or", "RE_", ")_", "\\u\\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", "regex_", "=_", "pattern", "Or", "RE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "replacement_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "subb", "er_", "=_", "\\u", "Gen", "Sub", "ber", "Func_", "(_", "replacement_", ")_", "._", "subb", "er", "Func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "subb", "er_", "=_", "replacement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pattern_", "=_", "pattern_", "=_", "self_", "._", "\\u", "regex_", "._", "pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "files_", "=_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "results_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "record", "Results_", "=_", "record", "Results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "see", " ", "if", " ", "we", " ", "shou", "ld", " ", "use", " ", "pgr", "ep", " ", "to", " ", "do", " ", "the", " ", "file", " ", "matching_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "use", "Pg", "rep_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "os_", "._", "popen", "3_", "(_", "'", "pgr", "ep", "'_", ")_", "[_", "2_", "]_", "._", "read_", "(_", ")_", ")_", "._", "startswith_", "(_", "'", "Us", "age", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "now", " ", "check", " ", "to", " ", "make", " ", "sure", " ", "pgr", "ep", " ", "underst", "ands", " ", "the", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "File_", "=_", "mktemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "File_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "os_", "._", "popen", "3_", "(_", "'", "pgr", "ep", " ", "\"'_", "+_", "pattern_", "+_", "'\"", " ", "'_", "+_", "tmp", "File_", ")_", "[_", "2_", "]_", "._", "read_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "did", "n", "'", "t", " ", "print", " ", "an", " ", "error", " ", "msg", " ", "so", " ", "we", "'", "re", " ", "ok_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "use", "Pg", "rep_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "remove_", "(_", "tmp", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
CollabQ/CollabQ/settings.py
[ { "content": "# Copyright 2009 Google Inc.\n# Copyright 2010 http://www.collabq.com\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 re\nimport os\nimport os.path\nimport sys\n\n# for python 2.6\nif sys.version.startswith('2.6'):\n import logging\n logging.logMultiprocessing = 0\n\n\nROOT_PATH = os.path.dirname(__file__)\n\n###\n# Django related settings\n###\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n ('Jose Maria Zambrana Arze', '[email protected]'),\n)\n\nMANAGERS = ADMINS\n\n#POBoxPress owner Settings\n# TODO(zero): review this\nADMINS_POBOX = []\nCREATE_CHANNELS_FROM_POSTS = False\n\n# This stuff is always going to be the same for an App Engine instance\nDATABASE_ENGINE = 'appengine' # 'appengine' is the only supported engine\nDATABASE_NAME = '' # Not used with appengine\nDATABASE_USER = '' # Not used with appengine\nDATABASE_PASSWORD = '' # Not used with appengine\nDATABASE_HOST = '' # Not used with appengine\nDATABASE_PORT = '' # Not used with appengine\n\n# The appengine_django code doesn't care about the address of memcached\n# because it is a built in API for App Engine\nCACHE_BACKEND = 'memcached://'\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# If running in a Windows environment this must be set to the same as your\n# system time zone.\nTIME_ZONE = 'UTC-8'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = '8066e3870fb8eacf192789c415a0a3e8'\n\n# List of callables that know how to import templates from various sources.\nTEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.load_template_source',\n 'django.template.loaders.app_directories.load_template_source',\n # 'django.template.loaders.eggs.load_template_source',\n)\n\nMIDDLEWARE_CLASSES = (\n 'middleware.domain.DomainMiddleware',\n 'middleware.auth.AuthenticationMiddleware',\n 'middleware.exception.ExceptionMiddleware',\n 'middleware.verify.VerifyInstallMiddleware',\n 'middleware.cache.CacheMiddleware',\n 'middleware.strip_whitespace.WhitespaceMiddleware',\n 'middleware.profile.ProfileMiddleware',\n)\n\nROOT_URLCONF = 'urls'\n\n# The default theme to use\nDEFAULT_THEME = 'innogems'\nTHEME_TEMPLATES = os.path.join(os.path.join(ROOT_PATH, 'templates'), DEFAULT_THEME)\n\n# Where the templates live, you probably don't want to change this unless you\n# know what you're doing\nTEMPLATE_DIRS = (\n THEME_TEMPLATES,\n ROOT_PATH,\n)\n\n\nTEMPLATE_CONTEXT_PROCESSORS = (\n 'django.core.context_processors.debug',\n 'django.core.context_processors.request',\n 'common.context_processors.settings',\n 'common.context_processors.flash',\n 'common.context_processors.components',\n)\n\n# Only apps under INSTALLED_APPS will be automatically tested via \n# `python manage.py test` and the profiling code takes this list into\n# account while filtering calls\nINSTALLED_APPS = (\n 'appengine_django',\n 'common',\n 'actor',\n 'api',\n 'channel',\n 'explore',\n 'join',\n 'flat',\n 'login',\n 'front',\n 'invite',\n 'confirm',\n 'components',\n)\n\n# We override the default test runner so that we can be Totally Awesome\nTEST_RUNNER = 'common.test.runner.run_tests'\n\n\n####\n#\n# Below this is custom for CollabQ (not related to Django)\n#\n####\n\n\n# This is a dynamic setting so that we can check whether we have been run\n# locally, it is used mainly for making special testing-only tweaks. Ideally\n# we wouldn't need this, but the alternatives so far have been tricky.\nMANAGE_PY = os.path.exists('manage.py')\n\n# This is the colloquial name for an entry, mostly used for branding purposes\nPOST_NAME = 'xpress'\n\n\n\n# This is the domain where this is installed on App Engine. It will be\n# necessary to know this if you plan on enabling SSL for login and join.\nAPP_ID = 'collabq'\nGAE_DOMAIN = '%s.appspot.com' % APP_ID\nNS_DOMAIN = GAE_DOMAIN\n\n# Enabling this means we expect to be spending most of our time on a \n# Hosted domain\nHOSTED_DOMAIN_ENABLED = False\n\n# This is the domain you intend to serve your site from, when using hosted\n# domains. If SSL is enabled for login and join those requests will still \n# go to the GAE_DOMAIN above.\nHOSTED_DOMAIN = 'example.com'\n\n# App Engine requires you to serve with a subdomain\nDEFAULT_HOSTED_SUBDOMAIN = 'www'\n\n# DOMAIN will be used wherever a url to this site needs to be created\n# NS_DOMAIN will be used as the domain part of actor identifiers. \n# Note that changing this once you have deployed the site will likely result \n# in catastrophic failure.\nif HOSTED_DOMAIN_ENABLED:\n #DOMAIN = '%s.%s' % (DEFAULT_HOSTED_SUBDOMAIN, HOSTED_DOMAIN)\n DOMAIN = '%s.%s' % (DEFAULT_HOSTED_SUBDOMAIN, HOSTED_DOMAIN)\nelse:\n DOMAIN = GAE_DOMAIN\n\n\n\n\n# Subdomains aren't supported all that nicely by App Engine yet, so you\n# probably won't be able to enable WILDCARD_SUBDOMAINS below, but you can \n# still set up your app to use some of the static subdomains below.\n# Subdomains are ignored unless HOSTED_DOMAIN_ENABLED is True.\nSUBDOMAINS_ENABLED = False\nWILDCARD_USER_SUBDOMAINS_ENABLED = False\n\n# These are defined as { subdomain : url_conf, ...}\nINSTALLED_SUBDOMAINS = {\n 'api': 'api.urls', # api-only urlconf\n 'm': 'urls', # default urlconf, but allow the subdomain\n }\n\n# Enable SSL support for login and join, if using HOSTED_DOMAIN_ENABLED\n# this means you will be redirecting through https://GAE_DOMAIN/login\n# and https://GAE_DOMAIN/join for those respective actions.\nSSL_LOGIN_ENABLED = False\n\n#\n# Appearance / Theme\n#\n\n#\n# Cookie\n#\n\n# Cookie settings, pretty self explanatory, you shouldn't need to touch these.\nUSER_COOKIE = 'user'\nPASSWORD_COOKIE = 'password'\nCOOKIE_DOMAIN = '.%s' % DOMAIN\nCOOKIE_PATH = '/'\n\n#\n# Blog\n#\n\n# Do you want /blog to redirect to your blog?\nBLOG_ENABLED = False\n\n# Where is your blog?\nBLOG_URL = 'http://example.com'\nBLOG_FEED_URL = 'http://example.com/feeds'\n\n\n#\n# API\n#\n\n# Setting this to True will make the public API accept all requests as being \n# from ROOT with no regard to actual authentication.\n# Never this set to True on a production site.\nAPI_DISABLE_VERIFICATION = False\n\n# These next three determine which OAuth Signature Methods to allow.\nAPI_ALLOW_RSA_SHA1 = True\nAPI_ALLOW_HMAC_SHA1 = True\nAPI_ALLOW_PLAINTEXT = False\n\n# These three determine whether the ROOT use should be allowed to use these\n# methods, if any at all. Setting all of these to False will disable the \n# ROOT user from accessing the public API\nAPI_ALLOW_ROOT_RSA_SHA1 = True\nAPI_ALLOW_ROOT_HMAC_SHA1 = True\nAPI_ALLOW_ROOT_PLAINTEXT = False\n\n# OAuth consumer key and secret values\nROOT_TOKEN_KEY = 'ROOT_TOKEN_KEY'\nROOT_TOKEN_SECRET = 'ROOT_TOKEN_SECRET'\nROOT_CONSUMER_KEY = 'ROOT_CONSUMER_KEY'\nROOT_CONSUMER_SECRET = 'ROOT_CONSUMER_SECRET'\n\n# Allow support for legacy API authentication\nAPI_ALLOW_LEGACY_AUTH = False\nLEGACY_SECRET_KEY = 'I AM ALSO SECRET'\n\n#\n# SMS\n#\n\n# Enabling SMS will require a bit more than just making this True.\nSMS_ENABLED = False\n\n# Most SMS vendors will provide a service that will post messages to a url\n# on your site when an SMS has been received on their end, this setting allows\n# you to add a secret value to that must exist in that url to prevent \n# malicious use.\nSMS_VENDOR_SECRET = 'SMS_VENDOR'\n\n# Valid numbers on which you expect to receive SMS\nSMS_TARGET = '00000'\n\n# Whitelist regular expression for allowable mobile-terminated targets\nSMS_MT_WHITELIST = re.compile('\\+\\d+')\n\n# Blacklist regular expression for blocked mobile-terminated targets\nSMS_MT_BLACKLIST = None\n\n# Turn on test mode for SMS\nSMS_TEST_ONLY = False\n\n# Numbers to use when testing live SMS so you don't spam all your users\nSMS_TEST_NUMBERS = []\n\n\n#\n# XMPP / IM\n#\n\n# Enabling IM will require a bit more than just making this True.\nIM_ENABLED = False\n\n# This is the id (JID) of the IM bot that you will use to communicate with\n# users of the IM interface\nIM_BOT = '[email protected]'\n\n# Turn on test mode for IM\nIM_TEST_ONLY = False\n\n# JIDs to allow when testing live XMPP so you don't spam all your users\nIM_TEST_JIDS = []\n\n# Enable to send plain text messages only. Default is to send both plain\n# text and html.\nIM_PLAIN_TEXT_ONLY = False\n\n# Truncate entry title in comments. None or 140+ means no truncation.\nIM_MAX_LENGTH_OF_ENTRY_TITLES_FOR_COMMENTS = 40\n\n#\n# Task Queue\n#\n\n# Enabling the queue will allow you to process posts with larger numbers\n# of followers but will require you to set up a cron job that will continuously\n# ping a special url to make sure the queue gets processed\nQUEUE_ENABLED = True\n\n# The secret to use for your cron job that processes your queue\nQUEUE_VENDOR_SECRET = 'SECRET'\n\n\n#\n# Throttling Config\n#\n\n# This will control the max number of SMS to send over a 30-day period\nTHROTTLE_SMS_GLOBAL_MONTH = 10000\n\n\n\n\n# Settings for remote services\nIMAGE_UPLOAD_ENABLED = False\nIMAGE_UPLOAD_URL = 'upload.example.com'\n\nMAX_AVATAR_UPLOAD_KB = 300\n\n# Settings for Google Contacts import\nGOOGLE_CONTACTS_IMPORT_ENABLED = False\n\n\n\nFEEDS_ENABLED = False\nMARK_AS_SPAM_ENABLED = True\nPRESS_ENABLED = False\nBADGES_ENABLED = True\nHIDE_COMMENTS_ENABLED = True\nMULTIADMIN_ENABLED = True\nPRIVATE_CHANNELS_ENABLED = False\nMARKDOWN_ENABLED = False\n# Lists nicks of users participating in conversations underneath comment\n# areas for posts. Clicking list items inserts @nicks into comment box.\n# The list shows a maximum of 25 nicks.\nCOMMENT_QUICKLINKS_ENABLED = True\n# If enabled, adds support for using access keys 1-9 to insert @nicks into\n# comment box. Requires COMMENT_QUICKLINKS_ENABLED.\nCOMMENT_QUICKLINKS_ACCESSKEYS_ENABLED = False\n\nPROFILE_DB = False\n\n# Limit of avatar photo size in kilobytes\nMAX_AVATAR_PHOTO_KB = 200\n\nMAX_ACTIVATIONS = 10\n\n# Email Test mode\nEMAIL_TEST_ONLY = False\n\n# Allowed email addresses for testing\nEMAIL_TEST_ADDRESSES = []\n\n# Email limiting, if this is set it will restrict users to those with \n# email addresses in this domain\nEMAIL_LIMIT_DOMAIN = None\n\n\n\n# Gdata Stuff\nGDATA_CONSUMER_KEY = ''\nGDATA_CONSUMER_SECRET = ''\n\n\nDEFAULT_FROM_EMAIL = '[email protected]'\nDEFAULT_UNITTEST_TO_EMAIL = '[email protected]'\n\nPROFILING_DATA_PATH = 'profiling/prof_db.csv'\n\nDEFAULT_MEMBERS = []\n\nDEFAULT_TAXONOMY = 'tag_geo'\nDEFAULT_TAG = \"/%s\" % DEFAULT_TAXONOMY\nROOT_TAG = \"/%s\" % DEFAULT_TAXONOMY\n\n# Set up the settings for the dev server if we are running it\nif MANAGE_PY:\n try:\n from dev_settings import *\n except ImportError:\n pass\n\n# Allow local overrides, useful for testing during development\ntry:\n from local_settings import *\nexcept ImportError:\n pass\n\n\n# This is the name of the root user of the site\nROOT_NICK = 'root@%s' % NS_DOMAIN\n\n# This is the name of the site that will be used whenever it refers to itself\nSITE_NAME = \"CollabQ\"\nTAGLINE = \"Open Souce | Enterprise | Social Software\"\nSITE_DESCRIPTION = \"CollabQ community management system\"\nDEFAULT_CHANNEL = 'support'\nPOST_NAME = 'Post'\n# This is the colloquial name for an entry, mostly used for branding purposes\n\nCHANNEL_TYPES = ['Professional', 'Academic', 'Social']\nENABLE_CHANNELS = False\nENABLE_CHANNEL_TYPES = False\nENABLE_ACCOUNT_TYPE = False\n\n# Twitter\nTWITTER_CONSUMER_KEY = ''\nTWITTER_CONSUMER_SECRET = ''\n\n# Things to measure to taste\nMAX_POST_LENGTH = 200\nMAX_COMMENT_LENGTH = MAX_POST_LENGTH\nMAX_TWITTER_LENGTH = 140", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "POST_NAME ", "start_line": 151, "start_column": 0, "end_line": 151, "end_column": 9 } ]
[ { "span": "POST_NAME ", "start_line": 426, "start_column": 0, "end_line": 426, "end_column": 9 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "http", "://", "www", ".", "colla", "bq", ".", "com_", "\\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_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "python", " ", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version_", "._", "startswith_", "(_", "'", "2.6", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "log", "Multi", "processing_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ROO", "T", "\\u", "PATH_", "=_", "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_", "#", " ", "Dj", "ang", "o", " ", "relate", "d", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DEBUG_", "=_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ADMINS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Jos", "e", " ", "Mari", "a", " ", "Za", "mbr", "ana", " ", "Ar", "ze", "'_", ",_", "'", "zero", ".", "fu", "xor", "@", "gma", "il", ".", "com", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MANAGER", "S_", "=_", "ADMINS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "PO", "Box", "Press", " ", "owner", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "zero", "):", " ", "review", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "ADM", "INS", "\\u", "PO", "BOX_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CREATE", "\\u", "CHANNELS", "\\u", "FROM", "\\u", "POST", "S_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "stu", "ff", " ", "is", " ", "alw", "ay", "s", " ", "goi", "ng", " ", "to", " ", "be", " ", "the", " ", "same", " ", "for", " ", "an", " ", "App", " ", "Engine", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "DATA", "BASE", "\\u", "ENGINE_", "=_", "'", "appengine", "'_", "#", " ", "'", "appengine", "'", " ", "is", " ", "the", " ", "only", " ", "support", "ed", " ", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "BASE", "\\u", "NAME_", "=_", "''_", "#", " ", "Not", " ", "used", " ", "with", " ", "appengine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "BASE", "\\u", "USER_", "=_", "''_", "#", " ", "Not", " ", "used", " ", "with", " ", "appengine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "BASE", "\\u", "PASSWORD_", "=_", "''_", "#", " ", "Not", " ", "used", " ", "with", " ", "appengine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "BASE", "\\u", "HOST_", "=_", "''_", "#", " ", "Not", " ", "used", " ", "with", " ", "appengine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "BASE", "\\u", "PORT_", "=_", "''_", "#", " ", "Not", " ", "used", " ", "with", " ", "appengine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "appengine", "\\u", "django", " ", "code", " ", "doe", "sn", "'", "t", " ", "care", " ", "abo", "ut", " ", "the", " ", "address", " ", "of", " ", "memcached", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "a", " ", "bui", "lt", " ", "in", " ", "API", " ", "for", " ", "App", " ", "Engine_", "\\u\\u\\uNL\\u\\u\\u_", "CACHE", "\\u", "BACKEND_", "=_", "'", "memcached", "://'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "time", " ", "zone", " ", "for", " ", "this", " ", "installation", ".", " ", "Choi", "ces", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "List", "\\u", "of", "\\u", "tz", "\\u", "zone", "s", "\\u", "by", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alth", "ou", "gh", " ", "not", " ", "all", " ", "choice", "s", " ", "may", " ", "be", " ", "avail", "able", " ", "on", " ", "all", " ", "operati", "ng", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "runn", "ing", " ", "in", " ", "a", " ", "Window", "s", " ", "environ", "ment", " ", "this", " ", "must", " ", "be", " ", "set", " ", "to", " ", "the", " ", "same", " ", "as", " ", "your", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", " ", "time", " ", "zone", "._", "\\u\\u\\uNL\\u\\u\\u_", "TIME", "\\u", "ZONE_", "=_", "'", "UT", "C", "-", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "code", " ", "for", " ", "this", " ", "installation", ".", " ", "All", " ", "choice", "s", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "i18n", "guy", ".", "com", "/", "unicode", "/", "language", "-", "identifi", "ers", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "LANGUAGE", "\\u", "CODE_", "=_", "'", "en", "-", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "make", " ", "some", " ", "optimization", "s", " ", "so", " ", "as", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "load", " ", "the", " ", "international", "izatio", "n", " ", "machine", "ry", "._", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "I1", "8", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "unique", ",", " ", "and", " ", "don", "'", "t", " ", "share", " ", "it", " ", "with", " ", "any", "body", "._", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "'", "806", "6e", "387", "0f", "b8", "eac", "f1", "927", "89", "c4", "15", "a0", "a3", "e8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "calla", "bles", " ", "tha", "t", " ", "know", " ", "how", " ", "to", " ", "import", " ", "template", "s", " ", "from", " ", "vari", "ous", " ", "source", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "LOADER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "filesystem", ".", "load", "\\u", "template", "\\u", "source", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "app", "\\u", "director", "ies", ".", "load", "\\u", "template", "\\u", "source", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "django", ".", "template", ".", "load", "ers", ".", "egg", "s", ".", "load", "\\u", "template", "\\u", "source", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "domain", ".", "Doma", "in", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "auth", ".", "Auth", "entica", "tion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "exception", ".", "Except", "ion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "verify", ".", "Verify", "Install", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "cache", ".", "Cache", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "strip", "\\u", "whitespace", ".", "Whitespace", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "middle", "ware", ".", "profile", ".", "Profil", "e", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "them", "e", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "THEME", "_", "=_", "'", "inno", "gem", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "THEME", "\\u", "TEMPLATES_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "join_", "(_", "ROO", "T", "\\u", "PATH_", ",_", "'", "template", "s", "'_", ")_", ",_", "DEF", "AUL", "T", "\\u", "THEME", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "the", " ", "template", "s", " ", "live", ",", " ", "you", " ", "probab", "ly", " ", "don", "'", "t", " ", "want", " ", "to", " ", "change", " ", "this", " ", "unl", "ess", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "know", " ", "what", " ", "you", "'", "re", " ", "doi", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "THEME", "\\u", "TEMPLATES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "CONTE", "XT", "\\u", "PROCESSOR", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "debug", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "request", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "common", ".", "context", "\\u", "process", "ors", ".", "settings", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "common", ".", "context", "\\u", "process", "ors", ".", "flash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "common", ".", "context", "\\u", "process", "ors", ".", "component", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ly", " ", "apps", " ", "under", " ", "INSTALLE", "D", "\\u", "APP", "S", " ", "will", " ", "be", " ", "automati", "call", "y", " ", "tested", " ", "via", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "`", "python", " ", "manage", ".", "py", " ", "test", "`", " ", "and", " ", "the", " ", "profiling", " ", "code", " ", "take", "s", " ", "this", " ", "list", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "account", " ", "whi", "le", " ", "filtering", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "APPS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "appengine", "\\u", "django", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "common", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "actor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "channel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "explore", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "join", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "flat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "login", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "front", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invite", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "component", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "override", " ", "the", " ", "default", " ", "test", " ", "runn", "er", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "be", " ", "Total", "ly", " ", "Aw", "eso", "me_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "RUNN", "ER_", "=_", "'", "common", ".", "test", ".", "runn", "er", ".", "run", "\\u", "tests", "'_", "\\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_", "#", " ", "Below", " ", "this", " ", "is", " ", "custom", " ", "for", " ", "Colla", "b", "Q", " ", "(", "not", " ", "relate", "d", " ", "to", " ", "Dj", "ang", "o", ")_", "\\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_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "dynami", "c", " ", "setti", "ng", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "check", " ", "whe", "ther", " ", "we", " ", "have", " ", "bee", "n", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "local", "ly", ",", " ", "it", " ", "is", " ", "used", " ", "mainl", "y", " ", "for", " ", "mak", "ing", " ", "special", " ", "testi", "ng", "-", "only", " ", "tweak", "s", ".", " ", "Ideal", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "wou", "ld", "n", "'", "t", " ", "need", " ", "this", ",", " ", "but", " ", "the", " ", "alternatives", " ", "so", " ", "far", " ", "have", " ", "bee", "n", " ", "trick", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "MANAGE", "\\u", "PY", "_", "=_", "os_", "._", "path_", "._", "exists_", "(_", "'", "manage", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "coll", "oq", "ui", "al", " ", "name", " ", "for", " ", "an", " ", "entry", ",", " ", "most", "ly", " ", "used", " ", "for", " ", "brandi", "ng", " ", "purpose", "s_", "\\u\\u\\uNL\\u\\u\\u_", "POST", "\\u", "NAME_", "=_", "'", "xpr", "ess", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "domain", " ", "where", " ", "this", " ", "is", " ", "install", "ed", " ", "on", " ", "App", " ", "Engine", ".", " ", "It", " ", "will", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "necessar", "y", " ", "to", " ", "know", " ", "this", " ", "if", " ", "you", " ", "plan", " ", "on", " ", "ena", "blin", "g", " ", "SS", "L", " ", "for", " ", "login", " ", "and", " ", "join", "._", "\\u\\u\\uNL\\u\\u\\u_", "APP", "\\u", "ID_", "=_", "'", "colla", "bq", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GA", "E", "\\u", "DOMAIN_", "=_", "'%", "s", ".", "apps", "pot", ".", "com", "'_", "%_", "APP", "\\u", "ID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NS", "\\u", "DOMAIN_", "=_", "GA", "E", "\\u", "DOMAIN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "En", "abl", "ing", " ", "this", " ", "means", " ", "we", " ", "expect", " ", "to", " ", "be", " ", "spend", "ing", " ", "most", " ", "of", " ", "our", " ", "time", " ", "on", " ", "a", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hoste", "d", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "HOST", "ED", "\\u", "DOM", "AIN", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "domain", " ", "you", " ", "inten", "d", " ", "to", " ", "serve", " ", "your", " ", "site", " ", "from", ",", " ", "whe", "n", " ", "usi", "ng", " ", "hoste", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "domains", ".", " ", "If", " ", "SS", "L", " ", "is", " ", "enable", "d", " ", "for", " ", "login", " ", "and", " ", "join", " ", "tho", "se", " ", "request", "s", " ", "will", " ", "still", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "go", " ", "to", " ", "the", " ", "GA", "E", "\\u", "DOM", "AIN", " ", "above", "._", "\\u\\u\\uNL\\u\\u\\u_", "HOST", "ED", "\\u", "DOMAIN_", "=_", "'", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "App", " ", "Engine", " ", "require", "s", " ", "you", " ", "to", " ", "serve", " ", "with", " ", "a", " ", "subdomain_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "HOST", "ED", "\\u", "SUB", "DOMAIN_", "=_", "'", "www", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DOM", "AIN", " ", "will", " ", "be", " ", "used", " ", "where", "ver", " ", "a", " ", "url", " ", "to", " ", "this", " ", "site", " ", "need", "s", " ", "to", " ", "be", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NS", "\\u", "DOM", "AIN", " ", "will", " ", "be", " ", "used", " ", "as", " ", "the", " ", "domain", " ", "part", " ", "of", " ", "actor", " ", "identifi", "ers", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "chang", "ing", " ", "this", " ", "onc", "e", " ", "you", " ", "have", " ", "deploye", "d", " ", "the", " ", "site", " ", "will", " ", "like", "ly", " ", "result", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "cata", "stro", "phi", "c", " ", "fail", "ure", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "HOST", "ED", "\\u", "DOM", "AIN", "\\u", "ENABLED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "DOM", "AIN", " ", "=", " ", "'%", "s", ".", "%", "s", "'", " ", "%", " ", "(", "DEF", "AUL", "T", "\\u", "HOST", "ED", "\\u", "SUB", "DOM", "AIN", ",", " ", "HOST", "ED", "\\u", "DOM", "AIN", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DOMAIN_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "DEF", "AUL", "T", "\\u", "HOST", "ED", "\\u", "SUB", "DOMAIN_", ",_", "HOST", "ED", "\\u", "DOMAIN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DOMAIN_", "=_", "GA", "E", "\\u", "DOMAIN_", "\\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_", "#", " ", "Subd", "omain", "s", " ", "are", "n", "'", "t", " ", "support", "ed", " ", "all", " ", "tha", "t", " ", "nice", "ly", " ", "by", " ", "App", " ", "Engine", " ", "ye", "t", ",", " ", "so", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "probab", "ly", " ", "won", "'", "t", " ", "be", " ", "able", " ", "to", " ", "enable", " ", "WIL", "DC", "ARD", "\\u", "SUB", "DOM", "AINS", " ", "belo", "w", ",", " ", "but", " ", "you", " ", "can", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "set", " ", "up", " ", "your", " ", "app", " ", "to", " ", "use", " ", "some", " ", "of", " ", "the", " ", "static", " ", "subdomain", "s", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Subd", "omain", "s", " ", "are", " ", "ignore", "d", " ", "unl", "ess", " ", "HOST", "ED", "\\u", "DOM", "AIN", "\\u", "ENABLE", "D", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SUB", "DOM", "AINS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WIL", "DC", "ARD", "\\u", "USER", "\\u", "SUB", "DOM", "AINS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "defin", "ed", " ", "as", " ", "{", " ", "subdomain", " ", ":", " ", "url", "\\u", "conf", ",", " ", "...", "}_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "SUB", "DOM", "AINS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "'_", ":_", "'", "api", ".", "urls", "'_", ",_", "#", " ", "api", "-", "only", " ", "url", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "'", "m", "'_", ":_", "'", "urls", "'_", ",_", "#", " ", "default", " ", "url", "conf", ",", " ", "but", " ", "allow", " ", "the", " ", "subdomain_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "SS", "L", " ", "support", " ", "for", " ", "login", " ", "and", " ", "join", ",", " ", "if", " ", "usi", "ng", " ", "HOST", "ED", "\\u", "DOM", "AIN", "\\u", "ENABLED_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "means", " ", "you", " ", "will", " ", "be", " ", "redirec", "ting", " ", "through", " ", "https", "://", "GA", "E", "\\u", "DOM", "AIN", "/", "login_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "https", "://", "GA", "E", "\\u", "DOM", "AIN", "/", "join", " ", "for", " ", "tho", "se", " ", "respec", "tiv", "e", " ", "action", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "SS", "L", "\\u", "LOGIN", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Appearance", " ", "/", " ", "Theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cookie_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cooki", "e", " ", "settings", ",", " ", "pretty", " ", "self", " ", "expl", "anat", "ory", ",", " ", "you", " ", "shou", "ld", "n", "'", "t", " ", "need", " ", "to", " ", "touch", " ", "these", "._", "\\u\\u\\uNL\\u\\u\\u_", "USER", "\\u", "COOKIE", "_", "=_", "'", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PASS", "WORD", "\\u", "COOKIE", "_", "=_", "'", "password", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COOKIE", "\\u", "DOMAIN_", "=_", "'.", "%", "s", "'_", "%_", "DOMAIN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COOKIE", "\\u", "PATH_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Blog", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "you", " ", "want", " ", "/", "blog", " ", "to", " ", "redirec", "t", " ", "to", " ", "your", " ", "blog", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "is", " ", "your", " ", "blog", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "URL_", "=_", "'", "http", "://", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLO", "G", "\\u", "FEED", "\\u", "URL_", "=_", "'", "http", "://", "example", ".", "com", "/", "feed", "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_", "#", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "this", " ", "to", " ", "Tru", "e", " ", "will", " ", "make", " ", "the", " ", "public", " ", "API", " ", "accept", " ", "all", " ", "request", "s", " ", "as", " ", "bei", "ng", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "ROO", "T", " ", "with", " ", "no", " ", "rega", "rd", " ", "to", " ", "actual", " ", "authenticat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Never", " ", "this", " ", "set", " ", "to", " ", "Tru", "e", " ", "on", " ", "a", " ", "producti", "on", " ", "site", "._", "\\u\\u\\uNL\\u\\u\\u_", "API", "\\u", "DISABLE", "\\u", "VERI", "FICATION", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "next", " ", "three", " ", "dete", "rmin", "e", " ", "whi", "ch", " ", "OA", "uth", " ", "Sign", "ature", " ", "Meth", "ods", " ", "to", " ", "allow", "._", "\\u\\u\\uNL\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "RSA", "\\u", "SHA", "1_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "HMAC", "\\u", "SHA", "1_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "PLAIN", "TEXT_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "three", " ", "dete", "rmin", "e", " ", "whe", "ther", " ", "the", " ", "ROO", "T", " ", "use", " ", "shou", "ld", " ", "be", " ", "allow", "ed", " ", "to", " ", "use", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", "s", ",", " ", "if", " ", "any", " ", "at", " ", "all", ".", " ", "Sett", "ing", " ", "all", " ", "of", " ", "these", " ", "to", " ", "Fal", "se", " ", "will", " ", "disable", " ", "the", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ROO", "T", " ", "user", " ", "from", " ", "accessi", "ng", " ", "the", " ", "public", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "ROO", "T", "\\u", "RSA", "\\u", "SHA", "1_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "ROO", "T", "\\u", "HMAC", "\\u", "SHA", "1_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "ROO", "T", "\\u", "PLAIN", "TEXT_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OA", "uth", " ", "consume", "r", " ", "key", " ", "and", " ", "secret", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "TOKEN", "\\u", "KEY_", "=_", "'", "ROO", "T", "\\u", "TOKEN", "\\u", "KEY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROO", "T", "\\u", "TOKEN", "\\u", "SECRET_", "=_", "'", "ROO", "T", "\\u", "TOKEN", "\\u", "SEC", "RET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROO", "T", "\\u", "CONSU", "MER", "\\u", "KEY_", "=_", "'", "ROO", "T", "\\u", "CONSU", "MER", "\\u", "KEY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROO", "T", "\\u", "CONSU", "MER", "\\u", "SECRET_", "=_", "'", "ROO", "T", "\\u", "CONSU", "MER", "\\u", "SEC", "RET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "support", " ", "for", " ", "lega", "cy", " ", "API", " ", "authentication_", "\\u\\u\\uNL\\u\\u\\u_", "API", "\\u", "ALLOW", "\\u", "LEGA", "CY", "\\u", "AUTH_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LEGA", "CY", "\\u", "SEC", "RET", "\\u", "KEY_", "=_", "'", "I", " ", "AM", " ", "ALS", "O", " ", "SEC", "RET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "En", "abl", "ing", " ", "SMS", " ", "will", " ", "require", " ", "a", " ", "bit", " ", "more", " ", "than", " ", "just", " ", "mak", "ing", " ", "this", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mos", "t", " ", "SMS", " ", "vendor", "s", " ", "will", " ", "provide", " ", "a", " ", "service", " ", "tha", "t", " ", "will", " ", "post", " ", "message", "s", " ", "to", " ", "a", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "your", " ", "site", " ", "whe", "n", " ", "an", " ", "SMS", " ", "has", " ", "bee", "n", " ", "receive", "d", " ", "on", " ", "thei", "r", " ", "end", ",", " ", "this", " ", "setti", "ng", " ", "allow", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "to", " ", "add", " ", "a", " ", "secret", " ", "value", " ", "to", " ", "tha", "t", " ", "must", " ", "exist", " ", "in", " ", "tha", "t", " ", "url", " ", "to", " ", "prevent", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mali", "cio", "us", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "VENDOR", "\\u", "SECRET_", "=_", "'", "SMS", "\\u", "VENDOR", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "numbers", " ", "on", " ", "whi", "ch", " ", "you", " ", "expect", " ", "to", " ", "receive", " ", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "TARGET_", "=_", "'", "00000", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "White", "list", " ", "regular", " ", "express", "ion", " ", "for", " ", "allow", "able", " ", "mobile", "-", "terminate", "d", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "MT", "\\u", "WHITE", "LIST_", "=_", "re_", "._", "compile_", "(_", "'\\\\", "+\\\\", "d", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Black", "list", " ", "regular", " ", "express", "ion", " ", "for", " ", "block", "ed", " ", "mobile", "-", "terminate", "d", " ", "targets_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "MT", "\\u", "BLACK", "LIST_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Turn", " ", "on", " ", "test", " ", "mode", " ", "for", " ", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "TEST", "\\u", "ONLY_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", "s", " ", "to", " ", "use", " ", "whe", "n", " ", "testi", "ng", " ", "live", " ", "SMS", " ", "so", " ", "you", " ", "don", "'", "t", " ", "spam", " ", "all", " ", "your", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "TEST", "\\u", "NUMB", "ERS_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XMPP", " ", "/", " ", "IM", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "En", "abl", "ing", " ", "IM", " ", "will", " ", "require", " ", "a", " ", "bit", " ", "more", " ", "than", " ", "just", " ", "mak", "ing", " ", "this", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "id", " ", "(", "JID", ")", " ", "of", " ", "the", " ", "IM", " ", "bot", " ", "tha", "t", " ", "you", " ", "will", " ", "use", " ", "to", " ", "communi", "cate", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "users", " ", "of", " ", "the", " ", "IM", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "BOT", "_", "=_", "'", "root", "@", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Turn", " ", "on", " ", "test", " ", "mode", " ", "for", " ", "IM", "_", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "TEST", "\\u", "ONLY_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "JID", "s", " ", "to", " ", "allow", " ", "whe", "n", " ", "testi", "ng", " ", "live", " ", "XMPP", " ", "so", " ", "you", " ", "don", "'", "t", " ", "spam", " ", "all", " ", "your", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "TEST", "\\u", "JID", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "to", " ", "send", " ", "plain", " ", "text", " ", "message", "s", " ", "only", ".", " ", "Default", " ", "is", " ", "to", " ", "send", " ", "bot", "h", " ", "plain_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "text", " ", "and", " ", "html", "._", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "PLAIN", "\\u", "TEXT", "\\u", "ONLY_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Truncate", " ", "entry", " ", "title", " ", "in", " ", "comment", "s", ".", " ", "Non", "e", " ", "or", " ", "140", "+", " ", "means", " ", "no", " ", "truncat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "IM", "\\u", "MAX", "\\u", "LENGTH", "\\u", "OF", "\\u", "ENTR", "Y", "\\u", "TIT", "LES", "\\u", "FOR", "\\u", "COMMENT", "S_", "=_", "40_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Task", " ", "Queue_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "En", "abl", "ing", " ", "the", " ", "queue", " ", "will", " ", "allow", " ", "you", " ", "to", " ", "process", " ", "posts", " ", "with", " ", "large", "r", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "followers", " ", "but", " ", "will", " ", "require", " ", "you", " ", "to", " ", "set", " ", "up", " ", "a", " ", "cron", " ", "job", " ", "tha", "t", " ", "will", " ", "continuous", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ping", " ", "a", " ", "special", " ", "url", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "queue", " ", "gets", " ", "processed_", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "secret", " ", "to", " ", "use", " ", "for", " ", "your", " ", "cron", " ", "job", " ", "tha", "t", " ", "process", "es", " ", "your", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "QUEUE", "\\u", "VENDOR", "\\u", "SECRET_", "=_", "'", "SEC", "RET", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thr", "ott", "ling", " ", "Config_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "control", " ", "the", " ", "max", " ", "number", " ", "of", " ", "SMS", " ", "to", " ", "send", " ", "over", " ", "a", " ", "30", "-", "day", " ", "period_", "\\u\\u\\uNL\\u\\u\\u_", "THRO", "TTL", "E", "\\u", "SMS", "\\u", "GLOB", "AL", "\\u", "MONTH", "_", "=_", "10000_", "\\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_", "#", " ", "Sett", "ings", " ", "for", " ", "remote", " ", "services_", "\\u\\u\\uNL\\u\\u\\u_", "IMA", "GE", "\\u", "UPLOAD", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMA", "GE", "\\u", "UPLOAD", "\\u", "URL_", "=_", "'", "upload", ".", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "AVA", "TAR", "\\u", "UPLOAD", "\\u", "KB", "_", "=_", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sett", "ings", " ", "for", " ", "Goo", "gle", " ", "Conta", "ct", "s", " ", "import_", "\\u\\u\\uNL\\u\\u\\u_", "GO", "OG", "LE", "\\u", "CONTACT", "S", "\\u", "IMPORT", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FEED", "S", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MARK", "\\u", "AS", "\\u", "SPA", "M", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PRESS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BAD", "GE", "S", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HID", "E", "\\u", "COMMENT", "S", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MULTI", "ADM", "IN", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PRIVATE", "\\u", "CHANNELS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MARK", "DOWN", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "List", "s", " ", "nicks", " ", "of", " ", "users", " ", "participati", "ng", " ", "in", " ", "conversations", " ", "under", "nea", "th", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "area", "s", " ", "for", " ", "posts", ".", " ", "Click", "ing", " ", "list", " ", "items", " ", "inserts", " ", "@", "nicks", " ", "int", "o", " ", "comment", " ", "box", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "list", " ", "show", "s", " ", "a", " ", "maxim", "um", " ", "of", " ", "25", " ", "nicks", "._", "\\u\\u\\uNL\\u\\u\\u_", "COMMENT", "\\u", "QUI", "CK", "LINKS", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "enable", "d", ",", " ", "adds", " ", "support", " ", "for", " ", "usi", "ng", " ", "access", " ", "keys", " ", "1", "-", "9", " ", "to", " ", "insert", " ", "@", "nicks", " ", "into_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comment", " ", "box", ".", " ", "Requ", "ires", " ", "COMMENT", "\\u", "QUI", "CK", "LINKS", "\\u", "ENABLE", "D", "._", "\\u\\u\\uNL\\u\\u\\u_", "COMMENT", "\\u", "QUI", "CK", "LINKS", "\\u", "ACCESS", "KEYS", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROFILE", "\\u", "DB_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Limit", " ", "of", " ", "avat", "ar", " ", "photo", " ", "size", " ", "in", " ", "kilo", "bytes_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "AVA", "TAR", "\\u", "PHOTO", "\\u", "KB", "_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "ACTIVAT", "IONS", "_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ema", "il", " ", "Test", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "EMA", "IL", "\\u", "TEST", "\\u", "ONLY_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "owe", "d", " ", "email", " ", "addresse", "s", " ", "for", " ", "testing_", "\\u\\u\\uNL\\u\\u\\u_", "EMA", "IL", "\\u", "TEST", "\\u", "ADDR", "ESS", "ES_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ema", "il", " ", "limit", "ing", ",", " ", "if", " ", "this", " ", "is", " ", "set", " ", "it", " ", "will", " ", "restrict", " ", "users", " ", "to", " ", "tho", "se", " ", "with", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "email", " ", "addresse", "s", " ", "in", " ", "this", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "EMA", "IL", "\\u", "LIMIT", "\\u", "DOMAIN_", "=_", "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_", "#", " ", "Gd", "ata", " ", "Stuff", "_", "\\u\\u\\uNL\\u\\u\\u_", "GDA", "TA", "\\u", "CONSU", "MER", "\\u", "KEY_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GDA", "TA", "\\u", "CONSU", "MER", "\\u", "SECRET_", "=_", "''_", "\\u\\u\\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_", "DEF", "AUL", "T", "\\u", "FROM", "\\u", "EMAIL_", "=_", "'", "zero", ".", "fu", "xor", "@", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "UNIT", "TEST", "\\u", "TO", "\\u", "EMAIL_", "=_", "'", "unittest", "s", "@", "example", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROF", "ILI", "NG", "\\u", "DATA", "\\u", "PATH_", "=_", "'", "profiling", "/", "prof", "\\u", "db", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "MEMBER", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TA", "XO", "NOM", "Y_", "=_", "'", "tag", "\\u", "geo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TAG_", "=_", "\"/%", "s", "\"_", "%_", "DEF", "AUL", "T", "\\u", "TA", "XO", "NOM", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROO", "T", "\\u", "TAG_", "=_", "\"/%", "s", "\"_", "%_", "DEF", "AUL", "T", "\\u", "TA", "XO", "NOM", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "the", " ", "settings", " ", "for", " ", "the", " ", "dev", " ", "server", " ", "if", " ", "we", " ", "are", " ", "runn", "ing", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "MANAGE", "\\u", "PY", "_", ":_", "\\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_", "dev", "\\u", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "local", " ", "override", "s", ",", " ", "usef", "ul", " ", "for", " ", "testi", "ng", " ", "dur", "ing", " ", "develop", "ment_", "\\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_", "local", "\\u", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "root", " ", "user", " ", "of", " ", "the", " ", "site_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ROO", "T", "\\u", "NIC", "K_", "=_", "'", "root", "@", "%", "s", "'_", "%_", "NS", "\\u", "DOMAIN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", " ", "site", " ", "tha", "t", " ", "will", " ", "be", " ", "used", " ", "whe", "neve", "r", " ", "it", " ", "refer", "s", " ", "to", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "SITE", "\\u", "NAME_", "=_", "\"", "Colla", "b", "Q", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "LINE_", "=_", "\"", "Open", " ", "Sou", "ce", " ", "|", " ", "Enter", "pris", "e", " ", "|", " ", "Soci", "al", " ", "Sof", "twa", "re", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SITE", "\\u", "DESCRIPTION_", "=_", "\"", "Colla", "b", "Q", " ", "communi", "ty", " ", "manage", "ment", " ", "system", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CHANNEL_", "=_", "'", "support", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "POST", "\\u", "NAME_", "=_", "'", "Post", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "coll", "oq", "ui", "al", " ", "name", " ", "for", " ", "an", " ", "entry", ",", " ", "most", "ly", " ", "used", " ", "for", " ", "brandi", "ng", " ", "purpose", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CHAN", "NEL", "\\u", "TYPES_", "=_", "[_", "'", "Profess", "ional", "'_", ",_", "'", "Aca", "demi", "c", "'_", ",_", "'", "Soci", "al", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENABLE", "\\u", "CHANNELS", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENABLE", "\\u", "CHAN", "NEL", "\\u", "TYPES_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ENABLE", "\\u", "ACCOUNT", "\\u", "TYPE_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Twit", "ter_", "\\u\\u\\uNL\\u\\u\\u_", "TWITTER", "\\u", "CONSU", "MER", "\\u", "KEY_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TWITTER", "\\u", "CONSU", "MER", "\\u", "SECRET_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thin", "gs", " ", "to", " ", "measure", " ", "to", " ", "tast", "e_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "POST", "\\u", "LENGTH_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "COMMENT", "\\u", "LENGTH_", "=_", "MAX", "\\u", "POST", "\\u", "LENGTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "\\u", "TWITTER", "\\u", "LENGTH_", "=_", "140_" ]
[ 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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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, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
neurodata/ndstore/test/test_ramon.py
[ { "content": " def test_annotation_field (self):\n \"\"\"Upload an annotation and test it's fields\"\"\"\n\n # Make an annotation \n makeAnno (p, 1)\n \n # Test Status\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test confidence\n confidence = random.random ()\n f = setField(p, 'confidence', confidence)\n f = getField(p, 'confidence')\n assert confidence - float(f.read()) < 0.001\n \n # Test author\n #f = self.getField(p, 'author')\n #assert 'Unit Test' == f.read()", "metadata": "root.Test_Ramon.test_annotation_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 227 }, { "content": " def test_synapse_field (self):\n \"\"\"Upload a synapse and test it's fields\"\"\"\n\n # Make a synapse\n makeAnno (p, 2)\n\n # Test synapse type\n synapse_type = random.randint (0,100)\n f = setField(p, 'synapse_type', synapse_type)\n f = getField(p, 'synapse_type')\n assert synapse_type == int(f.read()) \n\n # Test the weight\n weight = random.random ()\n f = setField(p, 'weight', weight)\n f = getField(p, 'weight')\n assert weight - float(f.read()) < 0.001\n\n # Test the inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test the seeds\n seeds = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'seeds', ','.join([str(i) for i in seeds]))\n f = getField(p, 'seeds')\n assert ','.join([str(i) for i in seeds]) == f.read()", "metadata": "root.Test_Ramon.test_synapse_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 250 }, { "content": " def test_seed_field (self):\n \"\"\"Upload a seed and test it's fields\"\"\"\n\n # Make a seed\n makeAnno (p, 3)\n\n # Test the parent\n parent = random.randint (0,100)\n f = setField(p, 'parent', parent)\n f = getField(p, 'parent')\n assert parent == int(f.read()) \n\n # Test the source\n source = random.randint (0,100)\n f = setField(p, 'source', source)\n f = getField(p, 'source')\n assert source == int(f.read()) \n\n # Test the cubelocation\n cubelocation = random.randint (0,100)\n f = setField(p, 'cubelocation', cubelocation)\n f = getField(p, 'cubelocation')\n assert cubelocation == int(f.read()) \n \n # Test the position\n position = [random.randint (0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'position', ','.join([str(i) for i in position]))\n f = getField(p, 'position')\n assert ','.join([str(i) for i in position]) == f.read()", "metadata": "root.Test_Ramon.test_seed_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 280 }, { "content": " def test_segment_field (self):\n \"\"\"Upload a segment and test it's fields\"\"\"\n\n # Make a segment\n makeAnno (p, 4)\n\n # Test the parentseed\n parentseed = random.randint (0,100)\n f = setField(p, 'parentseed', parentseed)\n f = getField(p, 'parentseed')\n assert parentseed == int(f.read()) \n\n # Test the segmentclass\n segmentclass = random.randint (0,100)\n f = setField(p, 'segmentclass', segmentclass)\n f = getField(p, 'segmentclass')\n assert segmentclass == int(f.read()) \n\n # Test the neuron\n neuron = random.randint (0,100)\n f = setField(p, 'neuron', neuron)\n f = getField(p, 'neuron')\n assert neuron == int(f.read()) \n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n \n # Test the synapses\n synapses = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'synapses', ','.join([str(i) for i in synapses]))\n f = getField(p, 'synapses')\n assert ','.join([str(i) for i in synapses]) == f.read()", "metadata": "root.Test_Ramon.test_segment_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 311 }, { "content": " def test_neuron_field (self):\n \"\"\"Upload a neuron and test it's fields\"\"\"\n\n # Make a neuron\n makeAnno (p, 5)\n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test segments\n status = [random.randint (0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'segments', \",\".join([str(i) for i in status]))\n f = getField(p, 'segments')\n assert \",\".join([str(i) for i in status]) == f.read()", "metadata": "root.Test_Ramon.test_neuron_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 348 }, { "content": " def test_organelle_field (self):\n \"\"\"Upload an organelle and test it's fields\"\"\"\n\n # Make an organelle \n makeAnno ( p, 6 )\n\n # Test the parentseed\n parentseed = random.randint (0,100)\n f = setField(p, 'parentseed', parentseed)\n f = getField(p, 'parentseed')\n assert parentseed == int(f.read()) \n\n # Test the organelleclass\n organelleclass = random.randint (0,100)\n f = setField(p, 'organelleclass', organelleclass)\n f = getField(p, 'organelleclass')\n assert organelleclass == int(f.read()) \n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read()) \n\n # Test the seeds\n seeds = [random.randint(0,100), random.randint(0,100), random.randint(0,100)]\n f = setField(p, 'seeds', ','.join([str(i) for i in seeds]))\n f = getField(p, 'seeds')\n assert ','.join([str(i) for i in seeds]) == f.read()", "metadata": "root.Test_Ramon.test_organelle_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 366 }, { "content": " def test_wrong_field ( self ):\n \n # Make an annotation \n makeAnno (p, 2)\n\n # Test the synapse type\n synapse_type = random.randint (0,100)\n f = setField(p, 'synapse_type', synapse_type)\n f = getField(p, 'synapse_type')\n assert synapse_type == int(f.read()) \n\n # Test the weight\n weight = random.random ()\n f = setField(p, 'weight', weight)\n f = getField(p, 'weight')\n assert weight - float(f.read()) < 0.001\n\n # Test inheritance\n status = random.randint (0,100)\n f = setField(p, 'status', status)\n f = getField(p, 'status')\n assert status == int(f.read())\n \n # bad format to a number\n url = \"http://{}/ca/{}/{}/{}/setField/status/aa/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )\n \n # request a missing field\n url = \"http://{}/ca/{}/{}/{}/getField/othernonesuch/\".format(SITE_HOST, 'unittest', 'unit_anno', p.annoid)\n with pytest.raises(urllib2.HTTPError): \n req = urllib2.Request ( url )\n f = urllib2.urlopen ( url )", "metadata": "root.Test_Ramon.test_wrong_field", "header": "['class', 'Test_Ramon', ':', '___EOS___']", "index": 396 } ]
[ { "span": "f ", "start_line": 235, "start_column": 4, "end_line": 235, "end_column": 5 }, { "span": "f ", "start_line": 241, "start_column": 4, "end_line": 241, "end_column": 5 }, { "span": "f ", "start_line": 258, "start_column": 4, "end_line": 258, "end_column": 5 }, { "span": "f ", "start_line": 264, "start_column": 4, "end_line": 264, "end_column": 5 }, { "span": "f ", "start_line": 270, "start_column": 4, "end_line": 270, "end_column": 5 }, { "span": "f ", "start_line": 276, "start_column": 4, "end_line": 276, "end_column": 5 }, { "span": "f ", "start_line": 288, "start_column": 4, "end_line": 288, "end_column": 5 }, { "span": "f ", "start_line": 294, "start_column": 4, "end_line": 294, "end_column": 5 }, { "span": "f ", "start_line": 300, "start_column": 4, "end_line": 300, "end_column": 5 }, { "span": "f ", "start_line": 306, "start_column": 4, "end_line": 306, "end_column": 5 }, { "span": "f ", "start_line": 319, "start_column": 4, "end_line": 319, "end_column": 5 }, { "span": "f ", "start_line": 325, "start_column": 4, "end_line": 325, "end_column": 5 }, { "span": "f ", "start_line": 331, "start_column": 4, "end_line": 331, "end_column": 5 }, { "span": "f ", "start_line": 337, "start_column": 4, "end_line": 337, "end_column": 5 }, { "span": "f ", "start_line": 343, "start_column": 4, "end_line": 343, "end_column": 5 }, { "span": "f ", "start_line": 356, "start_column": 4, "end_line": 356, "end_column": 5 }, { "span": "f ", "start_line": 362, "start_column": 4, "end_line": 362, "end_column": 5 }, { "span": "f ", "start_line": 374, "start_column": 4, "end_line": 374, "end_column": 5 }, { "span": "f ", "start_line": 380, "start_column": 4, "end_line": 380, "end_column": 5 }, { "span": "f ", "start_line": 386, "start_column": 4, "end_line": 386, "end_column": 5 }, { "span": "f ", "start_line": 392, "start_column": 4, "end_line": 392, "end_column": 5 }, { "span": "f ", "start_line": 403, "start_column": 4, "end_line": 403, "end_column": 5 }, { "span": "f ", "start_line": 409, "start_column": 4, "end_line": 409, "end_column": 5 }, { "span": "f ", "start_line": 415, "start_column": 4, "end_line": 415, "end_column": 5 }, { "span": "req ", "start_line": 422, "start_column": 6, "end_line": 422, "end_column": 9 }, { "span": "f ", "start_line": 423, "start_column": 6, "end_line": 423, "end_column": 7 } ]
[ { "span": "req ", "start_line": 428, "start_column": 6, "end_line": 428, "end_column": 9 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\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", "annot", "ation", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "an", " ", "annot", "ation", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "annot", "ation", " _", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "Status_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "confidence_", "\\u\\u\\uNL\\u\\u\\u_", "confidence_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "confidence", "'_", ",_", "confidence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "confidence", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "confidence_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "author_", "\\u\\u\\uNL\\u\\u\\u_", "#", "f", " ", "=", " ", "self", ".", "get", "Field", "(", "p", ",", " ", "'", "author", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "'", "Unit", " ", "Test", "'", " ", "==", " ", "f", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "synapse", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "synapse", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "synapse_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "synapse", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "\\u", "type_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ",_", "synapse", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "synapse", "\\u", "type_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "weight_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "weight_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "seeds_", "\\u\\u\\uNL\\u\\u\\u_", "seeds_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "seed", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "seed", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "seed_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parent", "'_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parent_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "source", "'_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "source", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "source_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "cube", "location_", "\\u\\u\\uNL\\u\\u\\u_", "cube", "location_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "cube", "location", "'_", ",_", "cube", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "cube", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cube", "location_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "position", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "position_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "position", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "position_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "segment", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "segment", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "segment_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parents", "eed_", "\\u\\u\\uNL\\u\\u\\u_", "parents", "eed_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ",_", "parents", "eed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parents", "eed_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "segment", "class_", "\\u\\u\\uNL\\u\\u\\u_", "segment", "class_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "segment", "class", "'_", ",_", "segment", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "segment", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "segment", "class_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "neuron_", "\\u\\u\\uNL\\u\\u\\u_", "neuron_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "neuro", "n", "'_", ",_", "neuron_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "neuro", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "neuron_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "synapse", "s_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "s_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "s", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "synapse", "s_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "synapse", "s_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "neuro", "n", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "a", " ", "neuro", "n", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "neuron_", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "segments_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "segments", "'_", ",_", "\",\"_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "status_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "segments", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\",\"_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "status_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "orga", "nell", "e\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "an", " ", "orga", "nell", "e", " ", "and", " ", "test", " ", "it", "'", "s", " ", "fields", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "orga", "nell", "e", " _", "\\u\\u\\uNL\\u\\u\\u_", "make", "Ann", "o_", "(_", "p_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "parents", "eed_", "\\u\\u\\uNL\\u\\u\\u_", "parents", "eed_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ",_", "parents", "eed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "parents", "eed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parents", "eed_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "orga", "nell", "ecl", "ass_", "\\u\\u\\uNL\\u\\u\\u_", "orga", "nell", "ecl", "ass_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "orga", "nell", "ecl", "ass", "'_", ",_", "orga", "nell", "ecl", "ass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "orga", "nell", "ecl", "ass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "orga", "nell", "ecl", "ass_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "seeds_", "\\u\\u\\uNL\\u\\u\\u_", "seeds_", "=_", "[_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", ",_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ",_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "seeds", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "','_", "._", "join_", "(_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "seeds_", "]_", ")_", "==_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "\\u", "Ram", "on_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrong", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "an", " ", "annot", "ation", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "make", "Ann", "o_", "(_", "p_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "synapse", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "synapse", "\\u", "type_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ",_", "synapse", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "synapse", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "synapse", "\\u", "type_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "weight_", "\\u\\u\\uNL\\u\\u\\u_", "weight_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ",_", "weight_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "weight", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "weight_", "-_", "float_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "<_", "0.001_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "inherita", "nce_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "random_", "._", "randint_", "(_", "0_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "set", "Field_", "(_", "p_", ",_", "'", "status", "'_", ",_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Field_", "(_", "p_", ",_", "'", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "status_", "==_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "bad", " ", "format", " ", "to", " ", "a", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "set", "Field", "/", "status", "/", "aa", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "request", " ", "a", " ", "missi", "ng", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "\"", "http", "://{}", "/", "ca", "/{}/", "{}/{}", "/", "get", "Field", "/", "other", "none", "suc", "h", "/\"_", "._", "format_", "(_", "SITE", "\\u", "HOST_", ",_", "'", "unittest", "'_", ",_", "'", "unit", "\\u", "anno", "'_", ",_", "p_", "._", "anno", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "urllib2_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ")_", "\\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, 0, 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, 0, 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, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sunlightlabs/read_FEC/fecreader/formdata/management/commands/mark_superceded_body_rows.py
[ { "content": "from dateutil.parser import parse as dateparse\n\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Sum, Max, Min\n\n\nfrom formdata.models import SkedA, SkedE\nfrom fec_alerts.models import new_filing\nfrom formdata.utils.fec_import_logging import fec_logger\n\n\n# for debugging\nfrom django.db import connection\n\n# superceded operations are slow bc of query structure -- need to hit indexes here\n \n \n \n \n \n \n \n \n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def mark_superceded_F24s(new_f3x_new_filing):\n \n # we only mark the child rows as superceded--the filing itself isn't, because it's possible, in theory, that it's *half* superceded. \n coverage_from_date = new_f3x_new_filing.coverage_from_date\n coverage_through_date = new_f3x_new_filing.coverage_to_date\n raw_filer_id = new_f3x_new_filing.fec_id\n \n filing_numbers = new_filing.objects.filter(fec_id=raw_filer_id, form_type__startswith='F24').values('filing_number')\n filing_array = []\n for i in filing_numbers:\n filing_array.append(i['filing_number'])\n \n updated = SkedE.objects.filter(filing_number__in=filing_array, superceded_by_amendment=False, expenditure_date_formatted__gte=coverage_from_date, expenditure_date_formatted__lte=coverage_through_date).update(superceded_by_amendment=True)\n if updated:\n print \"marked %s superceded F24s\" % updated", "metadata": "root.mark_superceded_F24s", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def mark_superceded_F65s(new_f3x_new_filing):\n \n coverage_from_date = new_f3x_new_filing.coverage_from_date\n coverage_through_date = new_f3x_new_filing.coverage_to_date\n raw_filer_id = new_f3x_new_filing.fec_id\n \n filing_numbers = new_filing.objects.filter(fec_id=raw_filer_id, form_type__startswith='F6').values('filing_number')\n filing_array = []\n for i in filing_numbers:\n filing_array.append(i['filing_number'])\n updated = SkedA.objects.filter(filing_number__in=filing_array, superceded_by_amendment=False, contribution_date__gte=coverage_from_date, contribution_date__lte=coverage_through_date).update(superceded_by_amendment=True)\n if updated:\n print \"marked %s superceded F65s\" % updated", "metadata": "root.mark_superceded_F65s", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def mark_superceded_F57s(new_monthly_f5):\n print \"marking superceded F57s\"\n \n coverage_from_date = new_monthly_f5.coverage_from_date\n coverage_through_date = new_monthly_f5.coverage_to_date\n raw_filer_id = new_monthly_f5.fec_id\n \n filing_numbers = new_filing.objects.filter(fec_id=raw_filer_id, is_f5_quarterly=False).values('filing_number')\n filing_array = []\n for i in filing_numbers:\n filing_array.append(i['filing_number'])\n updated = SkedE.objects.filter(form_type__istartswith='F57', filing_number__in=filing_array, superceded_by_amendment=False, expenditure_date_formatted__gte=coverage_from_date, expenditure_date_formatted__lte=coverage_through_date).update(superceded_by_amendment=True)\n if updated:\n print \"marked %s superceded F57s\" % updated", "metadata": "root.mark_superceded_F57s", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def summarize_f24(new_filing):\n filing_ies = SkedE.objects.filter(filing_number=new_filing.filing_number)\n \n results = filing_ies.aggregate(tot_spent=Sum('expenditure_amount'), start_date=Min('expenditure_date_formatted'), end_date=Max('expenditure_date_formatted'))\n if results:\n new_filing.tot_spent = results['tot_spent']\n new_filing.tot_ies = results['tot_spent']\n new_filing.coverage_from_date = results['start_date']\n new_filing.coverage_to_date = results['end_date']\n new_filing.save()", "metadata": "root.summarize_f24", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def summarize_f6(new_filing):\n filing_skeda = SkedA.objects.filter(filing_number=new_filing.filing_number)\n\n results = filing_skeda.aggregate(tot_raised=Sum('contribution_amount'), start_date=Min('contribution_date_formatted'), end_date=Max('contribution_date_formatted'))\n if results:\n new_filing.tot_raised = results['tot_raised']\n new_filing.coverage_from_date = results['start_date']\n new_filing.coverage_to_date = results['end_date']\n new_filing.save()", "metadata": "root.summarize_f6", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def summarize_nonquarterly_f5(new_filing):\n filing_ies = SkedE.objects.filter(filing_number=new_filing.filing_number)\n \n results = filing_ies.aggregate(start_date=Min('expenditure_date_formatted'), end_date=Max('expenditure_date_formatted'))\n new_filing.coverage_from_date = results['start_date']\n new_filing.coverage_to_date = results['end_date']\n new_filing.save()", "metadata": "root.summarize_nonquarterly_f5", "header": "['module', '___EOS___']", "index": 85 }, { "content": "class Command(BaseCommand):\n help = \"Mark the body rows as being superceded as appropriate; also set the new_filing data for stuff that can only be calculated after body rows have run.\"\n requires_model_validation = False\n \n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 94 }, { "content": " def handle(self, *args, **options):\n logger=fec_logger()\n \n filings_to_process = new_filing.objects.filter(previous_amendments_processed=True,header_is_processed=True, data_is_processed=True, body_rows_superceded=False).order_by('filing_number')\n \n for this_filing in filings_to_process:\n print \"processing %s \" % (this_filing.filing_number)\n \n \n # Create summary data for some forms that don't have it in the header. This script only runs after all the body rows of these filings have been entered; most other summary data is entered earlier in the process. \n if this_filing.form_type.upper() in ['F24', 'F24A', 'F24N']:\n summarize_f24(this_filing)\n elif this_filing.form_type.upper() in ['F6', 'F6A', 'F6N']:\n summarize_f6(this_filing)\n \n\n elif this_filing.form_type.startswith('F5') and not this_filing.is_f5_quarterly:\n summarize_nonquarterly_f5(this_filing)\n \n elif this_filing.form_type.startswith('F5') and this_filing.is_f5_quarterly:\n mark_superceded_F57s(this_filing)\n \n # if it's got sked E's and it's an F3X, overwrite 24 hr report\n elif this_filing.form_type.startswith('F3'): \n try:\n this_filing.lines_present['E']\n mark_superceded_F24s(this_filing)\n except KeyError:\n pass\n\n\n try:\n this_filing.lines_present['A']\n mark_superceded_F65s(this_filing)\n except KeyError:\n pass\n \n # By now we should have dates for all filings, including the ones that don't start with a coverage from date\n # that we added by finding the first transaction date, so we can safely set the cycle. \n if not this_filing.cycle:\n # we're about to save it, so don't hit the db twice.\n this_filing.set_cycle(save_now=False)\n \n this_filing.body_rows_superceded = True\n this_filing.save()", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 99 } ]
[ { "span": "from dateutil.parser import parse as dateparse", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 46 }, { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 65 }, { "span": "from django.db import connection", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "dateutil_", "._", "parser_", "import_", "parse_", "as_", "date", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Sum_", ",_", "Max_", ",_", "Min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "form", "data_", "._", "models_", "import_", "Ske", "d", "A_", ",_", "Ske", "d", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fec", "\\u", "alerts_", "._", "models_", "import_", "new", "\\u", "filing", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "form", "data_", "._", "utils_", "._", "fec", "\\u", "import", "\\u", "logging_", "import_", "fec", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "superc", "eded", " ", "operati", "ons", " ", "are", " ", "slow", " ", "bc", " ", "of", " ", "query", " ", "structure", " ", "--", " ", "need", " ", "to", " ", "hit", " ", "indexe", "s", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "mark", "\\u", "superc", "eded", "\\u", "F2", "4", "s_", "(_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "only", " ", "mark", " ", "the", " ", "child", " ", "rows", " ", "as", " ", "superc", "eded", "--", "the", " ", "filing", " ", "its", "elf", " ", "isn", "'", "t", ",", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "possib", "le", ",", " ", "in", " ", "theory", ",", " ", "tha", "t", " ", "it", "'", "s", " ", "*", "half", "*", " ", "superc", "eded", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covera", "ge", "\\u", "through", "\\u", "date_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "filer", "\\u", "id_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "fec", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filing", "\\u", "numbers_", "=_", "new", "\\u", "filing", "_", "._", "objects_", "._", "filter_", "(_", "fec", "\\u", "id_", "=_", "raw", "\\u", "filer", "\\u", "id_", ",_", "form", "\\u", "type\\u\\u", "startswith_", "=_", "'", "F2", "4", "'_", ")_", "._", "values_", "(_", "'", "filing", "\\u", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filing", "\\u", "array_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "filing", "\\u", "numbers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "array_", "._", "append_", "(_", "i_", "[_", "'", "filing", "\\u", "number", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "updated_", "=_", "Ske", "d", "E_", "._", "objects_", "._", "filter_", "(_", "filing", "\\u", "number", "\\u\\u", "in_", "=_", "filing", "\\u", "array_", ",_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "False_", ",_", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "\\u\\u", "gte_", "=_", "covera", "ge", "\\u", "from", "\\u", "date_", ",_", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "\\u\\u", "lte_", "=_", "covera", "ge", "\\u", "through", "\\u", "date_", ")_", "._", "update_", "(_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "marked", " ", "%", "s", " ", "superc", "eded", " ", "F2", "4", "s", "\"_", "%_", "updated_", "\\u\\u\\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_", "mark", "\\u", "superc", "eded", "\\u", "F6", "5", "s_", "(_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covera", "ge", "\\u", "through", "\\u", "date_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "filer", "\\u", "id_", "=_", "new", "\\u", "f3", "x", "\\u", "new", "\\u", "filing", "_", "._", "fec", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filing", "\\u", "numbers_", "=_", "new", "\\u", "filing", "_", "._", "objects_", "._", "filter_", "(_", "fec", "\\u", "id_", "=_", "raw", "\\u", "filer", "\\u", "id_", ",_", "form", "\\u", "type\\u\\u", "startswith_", "=_", "'", "F6", "'_", ")_", "._", "values_", "(_", "'", "filing", "\\u", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filing", "\\u", "array_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "filing", "\\u", "numbers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "array_", "._", "append_", "(_", "i_", "[_", "'", "filing", "\\u", "number", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "updated_", "=_", "Ske", "d", "A_", "._", "objects_", "._", "filter_", "(_", "filing", "\\u", "number", "\\u\\u", "in_", "=_", "filing", "\\u", "array_", ",_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "False_", ",_", "contribution", "\\u", "date", "\\u\\u", "gte_", "=_", "covera", "ge", "\\u", "from", "\\u", "date_", ",_", "contribution", "\\u", "date", "\\u\\u", "lte_", "=_", "covera", "ge", "\\u", "through", "\\u", "date_", ")_", "._", "update_", "(_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "marked", " ", "%", "s", " ", "superc", "eded", " ", "F6", "5", "s", "\"_", "%_", "updated_", "\\u\\u\\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_", "mark", "\\u", "superc", "eded", "\\u", "F5", "7", "s_", "(_", "new", "\\u", "month", "ly", "\\u", "f5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "marking", " ", "superc", "eded", " ", "F5", "7", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "new", "\\u", "month", "ly", "\\u", "f5_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "covera", "ge", "\\u", "through", "\\u", "date_", "=_", "new", "\\u", "month", "ly", "\\u", "f5_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "filer", "\\u", "id_", "=_", "new", "\\u", "month", "ly", "\\u", "f5_", "._", "fec", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filing", "\\u", "numbers_", "=_", "new", "\\u", "filing", "_", "._", "objects_", "._", "filter_", "(_", "fec", "\\u", "id_", "=_", "raw", "\\u", "filer", "\\u", "id_", ",_", "is", "\\u", "f5", "\\u", "quarter", "ly_", "=_", "False_", ")_", "._", "values_", "(_", "'", "filing", "\\u", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filing", "\\u", "array_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "filing", "\\u", "numbers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "array_", "._", "append_", "(_", "i_", "[_", "'", "filing", "\\u", "number", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "updated_", "=_", "Ske", "d", "E_", "._", "objects_", "._", "filter_", "(_", "form", "\\u", "type\\u\\u", "ista", "rts", "with_", "=_", "'", "F5", "7", "'_", ",_", "filing", "\\u", "number", "\\u\\u", "in_", "=_", "filing", "\\u", "array_", ",_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "False_", ",_", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "\\u\\u", "gte_", "=_", "covera", "ge", "\\u", "from", "\\u", "date_", ",_", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "\\u\\u", "lte_", "=_", "covera", "ge", "\\u", "through", "\\u", "date_", ")_", "._", "update_", "(_", "superc", "eded", "\\u", "by", "\\u", "amend", "ment_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "updated_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "marked", " ", "%", "s", " ", "superc", "eded", " ", "F5", "7", "s", "\"_", "%_", "updated_", "\\u\\u\\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_", "summarize", "\\u", "f2", "4_", "(_", "new", "\\u", "filing", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "ies_", "=_", "Ske", "d", "E_", "._", "objects_", "._", "filter_", "(_", "filing", "\\u", "number_", "=_", "new", "\\u", "filing", "_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "filing", "\\u", "ies_", "._", "aggregate_", "(_", "tot", "\\u", "spe", "nt_", "=_", "Sum_", "(_", "'", "expen", "dit", "ure", "\\u", "amo", "unt", "'_", ")_", ",_", "start", "\\u", "date_", "=_", "Min_", "(_", "'", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ",_", "end", "\\u", "date_", "=_", "Max_", "(_", "'", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "filing", "_", "._", "tot", "\\u", "spe", "nt_", "=_", "results_", "[_", "'", "tot", "\\u", "spe", "nt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "tot", "\\u", "ies_", "=_", "results_", "[_", "'", "tot", "\\u", "spe", "nt", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "results_", "[_", "'", "start", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "=_", "results_", "[_", "'", "end", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "save_", "(_", ")_", "\\u\\u\\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_", "summarize", "\\u", "f6", "_", "(_", "new", "\\u", "filing", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "ske", "da_", "=_", "Ske", "d", "A_", "._", "objects_", "._", "filter_", "(_", "filing", "\\u", "number_", "=_", "new", "\\u", "filing", "_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "filing", "\\u", "ske", "da_", "._", "aggregate_", "(_", "tot", "\\u", "raised_", "=_", "Sum_", "(_", "'", "contribution", "\\u", "amo", "unt", "'_", ")_", ",_", "start", "\\u", "date_", "=_", "Min_", "(_", "'", "contribution", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ",_", "end", "\\u", "date_", "=_", "Max_", "(_", "'", "contribution", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "filing", "_", "._", "tot", "\\u", "raised_", "=_", "results_", "[_", "'", "tot", "\\u", "raise", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "results_", "[_", "'", "start", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "=_", "results_", "[_", "'", "end", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "save_", "(_", ")_", "\\u\\u\\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_", "summarize", "\\u", "non", "quarter", "ly", "\\u", "f5_", "(_", "new", "\\u", "filing", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filing", "\\u", "ies_", "=_", "Ske", "d", "E_", "._", "objects_", "._", "filter_", "(_", "filing", "\\u", "number_", "=_", "new", "\\u", "filing", "_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "filing", "\\u", "ies_", "._", "aggregate_", "(_", "start", "\\u", "date_", "=_", "Min_", "(_", "'", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ",_", "end", "\\u", "date_", "=_", "Max_", "(_", "'", "expen", "dit", "ure", "\\u", "date", "\\u", "format", "ted", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "from", "\\u", "date_", "=_", "results_", "[_", "'", "start", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "covera", "ge", "\\u", "to", "\\u", "date_", "=_", "results_", "[_", "'", "end", "\\u", "date", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "filing", "_", "._", "save_", "(_", ")_", "\\u\\u\\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_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "\"", "Mark", " ", "the", " ", "body", " ", "rows", " ", "as", " ", "bei", "ng", " ", "superc", "eded", " ", "as", " ", "appropr", "iate", ";", " ", "als", "o", " ", "set", " ", "the", " ", "new", "\\u", "filing", " ", "data", " ", "for", " ", "stu", "ff", " ", "tha", "t", " ", "can", " ", "only", " ", "be", " ", "calculated", " ", "after", " ", "body", " ", "rows", " ", "have", " ", "run", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "s", "\\u", "model", "\\u", "validation_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "=_", "fec", "\\u", "logger_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filing", "s", "\\u", "to", "\\u", "process_", "=_", "new", "\\u", "filing", "_", "._", "objects_", "._", "filter_", "(_", "previ", "ous", "\\u", "amend", "ment", "s", "\\u", "processed_", "=_", "True_", ",_", "header", "\\u", "is", "\\u", "processed_", "=_", "True_", ",_", "data\\u", "is", "\\u", "processed_", "=_", "True_", ",_", "body", "\\u", "rows", "\\u", "superc", "eded", "_", "=_", "False_", ")_", "._", "order", "\\u", "by_", "(_", "'", "filing", "\\u", "number", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "this", "\\u", "filing", "_", "in_", "filing", "s", "\\u", "to", "\\u", "process_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "process", "ing", " ", "%", "s", " ", "\"_", "%_", "(_", "this", "\\u", "filing", "_", "._", "filing", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "summar", "y", " ", "data", " ", "for", " ", "some", " ", "forms", " ", "tha", "t", " ", "don", "'", "t", " ", "have", " ", "it", " ", "in", " ", "the", " ", "header", ".", " ", "Thi", "s", " ", "script", " ", "only", " ", "runs", " ", "after", " ", "all", " ", "the", " ", "body", " ", "rows", " ", "of", " ", "these", " ", "filing", "s", " ", "have", " ", "bee", "n", " ", "enter", "ed", ";", " ", "most", " ", "other", " ", "summar", "y", " ", "data", " ", "is", " ", "enter", "ed", " ", "ear", "lie", "r", " ", "in", " ", "the", " ", "process", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "upper_", "(_", ")_", "in_", "[_", "'", "F2", "4", "'_", ",_", "'", "F2", "4", "A", "'_", ",_", "'", "F2", "4", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "f2", "4_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "upper_", "(_", ")_", "in_", "[_", "'", "F6", "'_", ",_", "'", "F6", "A", "'_", ",_", "'", "F6", "N", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "f6", "_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F5", "'_", ")_", "and_", "not_", "this", "\\u", "filing", "_", "._", "is", "\\u", "f5", "\\u", "quarter", "ly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "summarize", "\\u", "non", "quarter", "ly", "\\u", "f5_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F5", "'_", ")_", "and_", "this", "\\u", "filing", "_", "._", "is", "\\u", "f5", "\\u", "quarter", "ly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mark", "\\u", "superc", "eded", "\\u", "F5", "7", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "it", "'", "s", " ", "got", " ", "ske", "d", " ", "E", "'", "s", " ", "and", " ", "it", "'", "s", " ", "an", " ", "F3", "X", ",", " ", "overwrit", "e", " ", "24", " ", "hr", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "this", "\\u", "filing", "_", "._", "form", "\\u", "type_", "._", "startswith_", "(_", "'", "F3", "'_", ")_", ":_", "\\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 ", " ", "_", "this", "\\u", "filing", "_", "._", "lines", "\\u", "present_", "[_", "'", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "superc", "eded", "\\u", "F2", "4", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\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\\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 ", " ", "_", "this", "\\u", "filing", "_", "._", "lines", "\\u", "present_", "[_", "'", "A", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mark", "\\u", "superc", "eded", "\\u", "F6", "5", "s_", "(_", "this", "\\u", "filing", "_", ")_", "\\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\\uNL\\u\\u\\u_", "#", " ", "By", " ", "now", " ", "we", " ", "shou", "ld", " ", "have", " ", "dates", " ", "for", " ", "all", " ", "filing", "s", ",", " ", "inclu", "ding", " ", "the", " ", "ones", " ", "tha", "t", " ", "don", "'", "t", " ", "start", " ", "with", " ", "a", " ", "covera", "ge", " ", "from", " ", "date_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "we", " ", "adde", "d", " ", "by", " ", "finding", " ", "the", " ", "first", " ", "transaction", " ", "date", ",", " ", "so", " ", "we", " ", "can", " ", "safe", "ly", " ", "set", " ", "the", " ", "cycle", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "this", "\\u", "filing", "_", "._", "cycle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "abo", "ut", " ", "to", " ", "save", " ", "it", ",", " ", "so", " ", "don", "'", "t", " ", "hit", " ", "the", " ", "db", " ", "twi", "ce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "this", "\\u", "filing", "_", "._", "set\\u", "cycle_", "(_", "save", "\\u", "now_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "this", "\\u", "filing", "_", "._", "body", "\\u", "rows", "\\u", "superc", "eded", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "filing", "_", "._", "save_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
NikolayRag/typeTodo/PyMySQL/pymysql/tests/test_connection.py
[ { "content": "import datetime\nimport decimal\nimport time\nimport sys\nimport unittest2\nimport pymysql\nfrom pymysql.tests import base\n\n\n\n\n# A custom type and function to escape it\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestConnection(base.PyMySQLTestCase):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestConnection", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test_utf8mb4(self):\n \"\"\"This test requires MySQL >= 5.5\"\"\"\n arg = self.databases[0].copy()\n arg['charset'] = 'utf8mb4'\n conn = pymysql.connect(**arg)", "metadata": "root.TestConnection.test_utf8mb4", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 10 }, { "content": " def test_largedata(self):\n \"\"\"Large query and response (>=16MB)\"\"\"\n cur = self.connections[0].cursor()\n cur.execute(\"SELECT @@max_allowed_packet\")\n if cur.fetchone()[0] < 16*1024*1024 + 10:\n print(\"Set max_allowed_packet to bigger than 17MB\")\n return\n t = 'a' * (16*1024*1024)\n cur.execute(\"SELECT '\" + t + \"'\")\n assert cur.fetchone()[0] == t", "metadata": "root.TestConnection.test_largedata", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_autocommit(self):\n con = self.connections[0]\n self.assertFalse(con.get_autocommit())\n\n cur = con.cursor()\n cur.execute(\"SET AUTOCOMMIT=1\")\n self.assertTrue(con.get_autocommit())\n\n con.autocommit(False)\n self.assertFalse(con.get_autocommit())\n cur.execute(\"SELECT @@AUTOCOMMIT\")\n self.assertEqual(cur.fetchone()[0], 0)", "metadata": "root.TestConnection.test_autocommit", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_select_db(self):\n con = self.connections[0]\n current_db = self.databases[0]['db']\n other_db = self.databases[1]['db']\n\n cur = con.cursor()\n cur.execute('SELECT database()')\n self.assertEqual(cur.fetchone()[0], current_db)\n\n con.select_db(other_db)\n cur.execute('SELECT database()')\n self.assertEqual(cur.fetchone()[0], other_db)", "metadata": "root.TestConnection.test_select_db", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_connection_gone_away(self):\n \"\"\"\n http://dev.mysql.com/doc/refman/5.0/en/gone-away.html\n http://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_gone_error\n \"\"\"\n con = self.connections[0]\n cur = con.cursor()\n cur.execute(\"SET wait_timeout=1\")\n time.sleep(2)\n with self.assertRaises(pymysql.OperationalError) as cm:\n cur.execute(\"SELECT 1+1\")\n # error occures while reading, not writing because of socket buffer.\n #self.assertEquals(cm.exception.args[0], 2006)\n self.assertIn(cm.exception.args[0], (2006, 2013))", "metadata": "root.TestConnection.test_connection_gone_away", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_init_command(self):\n conn = pymysql.connect(\n init_command='SELECT \"bar\"; SELECT \"baz\"',\n **self.databases[0]\n )\n c = conn.cursor()\n c.execute('select \"foobar\";')\n self.assertEqual(('foobar',), c.fetchone())\n conn.close()\n with self.assertRaises(pymysql.err.Error):\n conn.ping(reconnect=False)", "metadata": "root.TestConnection.test_init_command", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_read_default_group(self):\n conn = pymysql.connect(\n read_default_group='client',\n **self.databases[0]\n )\n self.assertTrue(conn.open)", "metadata": "root.TestConnection.test_read_default_group", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 80 }, { "content": " def test_context(self):\n with self.assertRaises(ValueError):\n c = pymysql.connect(**self.databases[0])\n with c as cur:\n cur.execute('create table test ( a int )')\n c.begin()\n cur.execute('insert into test values ((1))')\n raise ValueError('pseudo abort')\n c.commit()\n c = pymysql.connect(**self.databases[0])\n with c as cur:\n cur.execute('select count(*) from test')\n self.assertEqual(0, cur.fetchone()[0])\n cur.execute('insert into test values ((1))')\n with c as cur:\n cur.execute('select count(*) from test')\n self.assertEqual(1,cur.fetchone()[0])\n cur.execute('drop table test')", "metadata": "root.TestConnection.test_context", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 87 }, { "content": " def test_set_charset(self):\n c = pymysql.connect(**self.databases[0])\n c.set_charset('utf8')\n # TODO validate setting here", "metadata": "root.TestConnection.test_set_charset", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def test_defer_connect(self):\n import socket\n for db in self.databases:\n d = db.copy()\n try:\n sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n sock.connect(d['unix_socket'])\n except KeyError:\n sock = socket.create_connection(\n (d.get('host', 'localhost'), d.get('port', 3306)))\n for k in ['unix_socket', 'host', 'port']:\n try:\n del d[k]\n except KeyError:\n pass\n\n c = pymysql.connect(defer_connect=True, **d)\n self.assertFalse(c.open)\n c.connect(sock)\n c.close()", "metadata": "root.TestConnection.test_defer_connect", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " @unittest2.skipUnless(sys.version_info[0:2] >= (3,2), \"required py-3.2\")\n def test_no_delay_warning(self):\n current_db = self.databases[0].copy()\n current_db['no_delay'] = True\n with self.assertWarns(DeprecationWarning) as cm:\n conn = pymysql.connect(**current_db)", "metadata": "root.TestConnection.test_no_delay_warning", "header": "['class', 'TestConnection', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 132 }, { "content": "class Foo(object):\n value = \"bar\"", "metadata": "root.Foo", "header": "['module', '___EOS___']", "index": 141 }, { "content": "def escape_foo(x, d):\n return x.value", "metadata": "root.escape_foo", "header": "['module', '___EOS___']", "index": 145 }, { "content": "class TestEscape(base.PyMySQLTestCase):\n\n\n\n\n\n", "metadata": "root.TestEscape", "header": "['module', '___EOS___']", "index": 149 }, { "content": " def test_escape_string(self):\n con = self.connections[0]\n cur = con.cursor()\n\n self.assertEqual(con.escape(\"foo'bar\"), \"'foo\\\\'bar'\")\n # added NO_AUTO_CREATE_USER as not including it in 5.7 generates warnings\n cur.execute(\"SET sql_mode='NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER'\")\n self.assertEqual(con.escape(\"foo'bar\"), \"'foo''bar'\")", "metadata": "root.TestEscape.test_escape_string", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 150 }, { "content": " def test_escape_builtin_encoders(self):\n con = self.connections[0]\n cur = con.cursor()\n\n val = datetime.datetime(2012, 3, 4, 5, 6)\n self.assertEqual(con.escape(val, con.encoders), \"'2012-03-04 05:06:00'\")", "metadata": "root.TestEscape.test_escape_builtin_encoders", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 159 }, { "content": " def test_escape_custom_object(self):\n con = self.connections[0]\n cur = con.cursor()\n\n mapping = {Foo: escape_foo}\n self.assertEqual(con.escape(Foo(), mapping), \"bar\")", "metadata": "root.TestEscape.test_escape_custom_object", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def test_escape_fallback_encoder(self):\n con = self.connections[0]\n cur = con.cursor()\n\n class Custom(str):\n pass\n\n mapping = {pymysql.text_type: pymysql.escape_string}\n self.assertEqual(con.escape(Custom('foobar'), mapping), \"'foobar'\")", "metadata": "root.TestEscape.test_escape_fallback_encoder", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_escape_no_default(self):\n con = self.connections[0]\n cur = con.cursor()\n\n self.assertRaises(TypeError, con.escape, 42, {})", "metadata": "root.TestEscape.test_escape_no_default", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 183 }, { "content": " def test_escape_dict_value(self):\n con = self.connections[0]\n cur = con.cursor()\n\n mapping = con.encoders.copy()\n mapping[Foo] = escape_foo\n self.assertEqual(con.escape({'foo': Foo()}, mapping), {'foo': \"bar\"})", "metadata": "root.TestEscape.test_escape_dict_value", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 189 }, { "content": " def test_escape_list_item(self):\n con = self.connections[0]\n cur = con.cursor()\n\n mapping = con.encoders.copy()\n mapping[Foo] = escape_foo\n self.assertEqual(con.escape([Foo()], mapping), \"(bar)\")", "metadata": "root.TestEscape.test_escape_list_item", "header": "['class', 'TestEscape', '(', 'base', '.', 'PyMySQLTestCase', ')', ':', '___EOS___']", "index": 197 } ]
[ { "span": "import decimal", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pymysql", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pymysql", "_", "._", "tests_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "custom", " ", "type", " ", "and", " ", "function", " ", "to", " ", "escape", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "utf", "8", "mb", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "test", " ", "require", "s", " ", "My", "SQL", " ", ">=", " ", "5.5", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg_", "=_", "self_", "._", "databases_", "[_", "0_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg_", "[_", "'", "charset", "'_", "]_", "=_", "'", "utf", "8", "mb", "4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "pymysql", "_", "._", "connect_", "(_", "**_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "large", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Large", " ", "query", " ", "and", " ", "response", " ", "(>", "=", "16", "MB", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SELECT", " ", "@@", "max", "\\u", "allow", "ed", "\\u", "packet", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "<_", "16_", "*_", "1024_", "*_", "1024_", "+_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Set", " ", "max", "\\u", "allow", "ed", "\\u", "packet", " ", "to", " ", "bigger", " ", "than", " ", "1", "7", "MB", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t_", "=_", "'", "a", "'_", "*_", "(_", "16_", "*_", "1024_", "*_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SELECT", " ", "'\"_", "+_", "t_", "+_", "\"'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", "==_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "autocommit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "con_", "._", "get", "\\u", "autocommit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SET", " ", "AUTO", "COMMIT", "=", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "con_", "._", "get", "\\u", "autocommit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "con_", "._", "autocommit_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "con_", "._", "get", "\\u", "autocommit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SELECT", " ", "@@", "AUTO", "COMMIT", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "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", "db_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "db_", "=_", "self_", "._", "databases_", "[_", "0_", "]_", "[_", "'", "db", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "db_", "=_", "self_", "._", "databases_", "[_", "1_", "]_", "[_", "'", "db", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "SELECT", " ", "databa", "se", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", ",_", "current", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "con_", "._", "select", "\\u", "db_", "(_", "other", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "SELECT", " ", "databa", "se", "()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", ",_", "other", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "connecti", "on", "\\u", "gone", "\\u", "away_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "dev", ".", "mysql", ".", "com", "/", "doc", "/", "ref", "man", "/", "5.0", "/", "en", "/", "gone", "-", "awa", "y", ".", "html", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "dev", ".", "mysql", ".", "com", "/", "doc", "/", "ref", "man", "/", "5.0", "/", "en", "/", "error", "-", "message", "s", "-", "client", ".", "html", "#", "error", "\\u", "cr", "\\u", "server", "\\u", "gone", "\\u", "error", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SET", " ", "wait", "\\u", "timeo", "ut", "=", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "pymysql", "_", "._", "Opera", "tion", "al", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "\"", "SELECT", " ", "1", "+", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "error", " ", "occure", "s", " ", "whi", "le", " ", "readi", "ng", ",", " ", "not", " ", "writ", "ing", " ", "bec", "aus", "e", " ", "of", " ", "socket", " ", "buffer", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "s", "(", "cm", ".", "exception", ".", "args", "[", "0", "],", " ", "2006", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "cm_", "._", "exception_", "._", "args_", "[_", "0_", "]_", ",_", "(_", "2006", "_", ",_", "2013_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init", "\\u", "command_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "pymysql", "_", "._", "connect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "command_", "=_", "'", "SELECT", " ", "\"", "bar", "\";", " ", "SELECT", " ", "\"", "ba", "z", "\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "databases_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "execute_", "(_", "'", "select", " ", "\"", "fooba", "r", "\";", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "'", "fooba", "r", "'_", ",_", ")_", ",_", "c_", "._", "fetchone_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "pymysql", "_", "._", "err_", "._", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "ping_", "(_", "reconnect_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "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", "read", "\\u", "default", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "pymysql", "_", "._", "connect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "default", "\\u", "group_", "=_", "'", "client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "databases_", "[_", "0_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "conn_", "._", "open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "pymysql", "_", "._", "connect_", "(_", "**_", "self_", "._", "databases_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "c_", "as_", "cur_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "'", "create", " ", "table", " ", "test", " ", "(", " ", "a", " ", "int", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "insert", " ", "int", "o", " ", "test", " ", "values", " ", "((", "1", "))'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'", "pseudo", " ", "abort", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "pymysql", "_", "._", "connect_", "(_", "**_", "self_", "._", "databases_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "c_", "as_", "cur_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "'", "select", " ", "count", "(*", ")", " ", "from", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "insert", " ", "int", "o", " ", "test", " ", "values", " ", "((", "1", "))'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "c_", "as_", "cur_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "'", "select", " ", "count", "(*", ")", " ", "from", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "cur_", "._", "fetchone_", "(_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "drop", " ", "table", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "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", "set\\u", "charset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "pymysql", "_", "._", "connect_", "(_", "**_", "self_", "._", "databases_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "set\\u", "charset_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "validat", "e", " ", "setti", "ng", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "defer", "\\u", "connect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "db_", "in_", "self_", "._", "databases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "db_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "=_", "socket_", "._", "socket_", "(_", "socket_", "._", "AF", "\\u", "UNIX", "_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "connect_", "(_", "d_", "[_", "'", "unix", "\\u", "socket", "'_", "]_", ")_", "\\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 ", " _", "sock_", "=_", "socket_", "._", "create", "\\u", "connection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "d_", "._", "get_", "(_", "'", "host", "'_", ",_", "'", "local", "host", "'_", ")_", ",_", "d_", "._", "get_", "(_", "'", "port", "'_", ",_", "3306", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", "in_", "[_", "'", "unix", "\\u", "socket", "'_", ",_", "'", "host", "'_", ",_", "'", "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 ", " ", "_", "del_", "d_", "[_", "k_", "]_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "pymysql", "_", "._", "connect_", "(_", "defer", "\\u", "connect_", "=_", "True_", ",_", "**_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "c_", "._", "open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "connect_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Connection_", "(_", "base_", "._", "Py", "My", "SQL", "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_", "@_", "unittest2_", "._", "skip", "Unless_", "(_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", ":_", "2_", "]_", ">=_", "(_", "3_", ",_", "2_", ")_", ",_", "\"", "require", "d", " ", "py", "-", "3.2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "dela", "y", "\\u", "warning_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "db_", "=_", "self_", "._", "databases_", "[_", "0_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "db_", "[_", "'", "no", "\\u", "dela", "y", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Warn", "s_", "(_", "Dep", "reca", "tion", "Warning_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "pymysql", "_", "._", "connect_", "(_", "**_", "current", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Foo_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\"", "bar", "\"_", "\\u\\u\\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_", "escape", "\\u", "foo_", "(_", "x_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "escape", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "\"", "foo", "'", "bar", "\"_", ")_", ",_", "\"'", "foo", "\\\\\\\\", "'", "bar", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "adde", "d", " ", "NO", "\\u", "AUTO", "\\u", "CREATE", "\\u", "USER", " ", "as", " ", "not", " ", "inclu", "ding", " ", "it", " ", "in", " ", "5.7", " ", "generat", "es", " ", "warnings_", "\\u\\u\\uNL\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "SET", " ", "sql", "\\u", "mode", "='", "NO", "\\u", "BACK", "SLA", "SH", "\\u", "ESCAPE", "S", ",", "NO", "\\u", "AUTO", "\\u", "CREATE", "\\u", "USER", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "\"", "foo", "'", "bar", "\"_", ")_", ",_", "\"'", "foo", "''", "bar", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "bui", "lti", "n", "\\u", "encoders", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "datetime_", "._", "datetime_", "(_", "2012_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "val_", ",_", "con_", "._", "encoders", "_", ")_", ",_", "\"'", "2012", "-0", "3", "-0", "4", " ", "05", ":", "0", "6", ":", "00", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "custom", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "{_", "Foo_", ":_", "escape", "\\u", "foo_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "Foo_", "(_", ")_", ",_", "mapping_", ")_", ",_", "\"", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "fall", "back", "\\u", "encoder_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Custom", "_", "(_", "str_", ")_", ":_", "\\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_", "mapping_", "=_", "{_", "pymysql", "_", "._", "text", "\\u", "type_", ":_", "pymysql", "_", "._", "escape", "\\u", "string_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "Custom", "_", "(_", "'", "fooba", "r", "'_", ")_", ",_", "mapping_", ")_", ",_", "\"'", "fooba", "r", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "no", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "con_", "._", "escape_", ",_", "42_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "dict", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "con_", "._", "encoders", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "[_", "Foo_", "]_", "=_", "escape", "\\u", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "{_", "'", "foo", "'_", ":_", "Foo_", "(_", ")_", "}_", ",_", "mapping_", ")_", ",_", "{_", "'", "foo", "'_", ":_", "\"", "bar", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Escape_", "(_", "base_", "._", "Py", "My", "SQL", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "escape", "\\u", "list", "\\u", "item_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "con_", "=_", "self_", "._", "connections_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "con_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "con_", "._", "encoders", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapping_", "[_", "Foo_", "]_", "=_", "escape", "\\u", "foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "con_", "._", "escape_", "(_", "[_", "Foo_", "(_", ")_", "]_", ",_", "mapping_", ")_", ",_", "\"(", "bar", ")\"_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
rizar/attention-lvcsr/libs/Theano/theano/tensor/tests/test_subtensor.py
[ { "content": " def test1_ok_range_finite(self):\n n = self.shared(numpy.arange(3, dtype=self.dtype))\n t = n[0:2]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue((tval == [0, 1]).all())", "metadata": "root.T_subtensor.test1_ok_range_finite", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 157 }, { "content": " def test2_ok_range_finite(self):\n n = self.shared(numpy.arange(12, dtype=self.dtype).reshape((3, 4)))\n # Also check negative index\n for idx in [(slice(0, 2), 3), ((slice(0, 2), -1)), (slice(0, 2), -4)]:\n t = n[idx] # l]#0:2,3]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue(numpy.allclose(tval, n.get_value()[idx]))", "metadata": "root.T_subtensor.test2_ok_range_finite", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 165 }, { "content": " def test1_ok_elem(self):\n n = self.shared(numpy.ones(1, dtype=self.dtype) * 5)\n t = n[0]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == ())\n self.assertTrue(tval == 5.0)", "metadata": "root.T_subtensor.test1_ok_elem", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test1_ok_range_infinite(self):\n n = self.shared(numpy.arange(3, dtype=self.dtype))\n t = n[1:]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue((tval == [1.0, 2.0]).all())", "metadata": "root.T_subtensor.test1_ok_range_infinite", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 199 }, { "content": " def test1_ok_strided(self):\n n = self.shared(numpy.arange(5, dtype=self.dtype))\n t = n[1::2]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue((tval == [1.0, 3.0]).all())\n\n t = n[0:-1:2] # 0 to 1 from the end stepping by 2\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue((tval == [0.0, 2.0]).all())", "metadata": "root.T_subtensor.test1_ok_strided", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 207 }, { "content": " def test2_ok_elem(self):\n n = self.shared(numpy.arange(6, dtype=self.dtype).reshape((2, 3)))\n t = n[0, 2]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == ())\n self.assertTrue(numpy.all(tval == 2))", "metadata": "root.T_subtensor.test2_ok_elem", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test2_ok_row(self):\n n = self.shared(numpy.arange(6, dtype=self.dtype).reshape((2, 3)))\n t = n[1]\n self.assertFalse(any(n.type.broadcastable))\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (3,))\n self.assertTrue(numpy.all(tval == [3, 4, 5]))", "metadata": "root.T_subtensor.test2_ok_row", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test2_ok_col(self):\n n = self.shared(numpy.arange(6, dtype=self.dtype).reshape((2, 3)))\n t = n[:, 0]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n self.assertFalse(any(n.type.broadcastable))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue(numpy.all(tval == [0, 3]))", "metadata": "root.T_subtensor.test2_ok_col", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test2_ok_rows_finite(self):\n n = self.shared(numpy.arange(12, dtype=self.dtype).reshape((4, 3)))\n t = n[1:3, 0]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue(numpy.all(tval == [3, 6]))", "metadata": "root.T_subtensor.test2_ok_rows_finite", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 278 }, { "content": " def test2_ok_cols_infinite(self):\n n = self.shared(numpy.arange(12, dtype=self.dtype).reshape((4, 3)))\n t = n[1, 2:]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (1,))\n self.assertTrue(numpy.all(tval == 5))", "metadata": "root.T_subtensor.test2_ok_cols_infinite", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 286 }, { "content": " def test2_ok_strided(self):\n n = self.shared(numpy.arange(20, dtype=self.dtype).reshape((4, 5)))\n t = n[1:4:2, 1:5:2]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2, 2))\n self.assertTrue(numpy.all(tval == [[6, 8], [16, 18]]))", "metadata": "root.T_subtensor.test2_ok_strided", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 294 }, { "content": " def test3_ok_mat(self):\n n = self.shared(numpy.arange(24, dtype=self.dtype).reshape((2, 3, 4)))\n t = n[0, 0, 0]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == ())\n self.assertTrue(numpy.all(tval == 0))", "metadata": "root.T_subtensor.test3_ok_mat", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 302 }, { "content": " def test_long(self):\n n = self.shared(numpy.arange(12, dtype=self.dtype).reshape((4, 3)))\n t = n[L(1):L(4):L(2), L(1)]\n self.assertTrue(isinstance(t.owner.op, Subtensor))\n tval = self.eval_output_and_check(t)\n self.assertTrue(tval.shape == (2,))\n self.assertTrue(numpy.all(tval == [4, 10]))", "metadata": "root.T_subtensor.test_long", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 310 }, { "content": " def test_ok_list(self):\n for data, idx in [(rand(4), [1, 0]),\n (rand(4, 5), [2, 3, -1]),\n (rand(4, 2, 3), [0, 3]),\n (rand(4, 2, 3), [3, 3, 1, 1, 2, 2, 0, 0]),\n (rand(4, 2, 3), [3, 3, 1, 1, 2, 2, 0, 0,\n -1, -2, -3, -4]),\n # Test 4 dims as gpu code use another algo\n # in that case This new algo is not as much\n # optimized for that case.\n (rand(4, 4, 2, 3), [3,\n 3, 1, 1, 2, 2, 0, 0, -1, -2, -3, -4]),\n # Test with TensorConstant index.\n (rand(4, 2, 3),\n theano.tensor.constant([3, 3, 1, 1, 2, 2, 0, 0])),\n ]:\n data = numpy.asarray(data, dtype=self.dtype)\n n = self.shared(data)\n t = n[idx]\n\n # We test again AdvancedSubtensor1 as we transfer data to the cpu.\n self.assertTrue(isinstance(t.owner.op, tensor.AdvancedSubtensor1))\n\n val = self.eval_output_and_check(t, list=True)\n if isinstance(idx, list):\n good = data[idx]\n else:\n good = data[idx.data]\n self.assertTrue(val.ndim == data.ndim)\n self.assertTrue(numpy.allclose(val, good), (val, good))\n\n # Test reuse of output memory\n if type(self.adv_sub1) == tensor.AdvancedSubtensor1:\n op = self.adv_sub1()\n # When idx is a TensorConstant.\n if hasattr(idx, \"data\"):\n idx = idx.data\n test_out = [[None]]\n op.perform(None, [data, idx], test_out)\n out1 = test_out[0][0]\n op.perform(None, [data, idx], test_out)\n out2 = test_out[0][0]\n assert out1 is out2\n\n # test the grad\n gn = theano.grad(t.sum(), n)\n g = self.function([], gn, op=self.adv_incsub1)\n utt.verify_grad(lambda m: m[[1, 3]],\n [numpy.random.rand(5, 5).astype(self.dtype)])\n g_0 = g()\n utt.verify_grad(lambda m: m[idx],\n [data])", "metadata": "root.T_subtensor.test_ok_list", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 437 }, { "content": " def test_adv_sub1_broadcast(self):\n v = numpy.arange(3, dtype=self.dtype).reshape((1, 3))\n n = self.shared(v*5, broadcastable=(True, False))\n idx = tensor.lvector()\n t = n[idx]\n self.assertTrue(isinstance(t.owner.op, tensor.AdvancedSubtensor1))\n\n f = self.function([idx], t, op=self.adv_sub1)\n topo = f.maker.fgraph.toposort()\n topo_ = [node for node in topo if not isinstance(node.op,\n self.ignore_topo)]\n assert len(topo_) == 1\n self.assertTrue(isinstance(topo_[0].op, self.adv_sub1))\n f_0 = f([0])\n self.assertTrue(f_0.shape == (1, 3))\n self.assertTrue(numpy.allclose(f_0, v*5))\n f_00 = f([0, 0])\n self.assertTrue(f_00.shape == (2, 3))\n self.assertTrue(numpy.allclose(f_00, v*5))\n self.assertRaises(IndexError, f, [0, 1])\n\n # Test the gradient\n c = t.sum()\n gn = theano.grad(c, n)\n g = self.function([idx], gn, op=self.adv_incsub1)\n g_0 = g([0])\n self.assertTrue(g_0.shape == (1, 3))\n self.assertTrue(numpy.allclose(g_0, 1))\n g_00 = g([0, 0])\n self.assertTrue(g_00.shape == (1, 3))\n self.assertTrue(numpy.allclose(g_00, 2))\n\n utt.verify_grad(lambda m: m[[1, 3]],\n [numpy.random.rand(5, 5).astype(self.dtype)])\n\n def fun(x, y):\n return advanced_inc_subtensor1(x, y, [1, 3])\n utt.verify_grad(fun, [numpy.random.rand(5, 5).astype(self.dtype),\n numpy.random.rand(2, 5).astype(self.dtype)])\n\n def fun(x, y):\n return advanced_set_subtensor1(x, y, [1, 3])\n utt.verify_grad(fun, [numpy.random.rand(5, 5).astype(self.dtype),\n numpy.random.rand(2, 5).astype(self.dtype)])", "metadata": "root.T_subtensor.test_adv_sub1_broadcast", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 516 }, { "content": " def test_adv_sub1_idx_broadcast(self):\n # The idx can be a broadcastable vector.\n ones = numpy.ones((4, 3), dtype=self.dtype)\n n = self.shared(ones * 5)\n idx = tensor.TensorType(dtype='int64', broadcastable=(True,))()\n assert idx.type.broadcastable == (True,)\n t = n[idx]\n self.assertTrue(isinstance(t.owner.op, tensor.AdvancedSubtensor1))\n\n f = self.function([idx], t, op=self.adv_sub1)\n topo = f.maker.fgraph.toposort()\n topo_ = [node for node in topo if not isinstance(node.op,\n self.ignore_topo)]\n assert len(topo_) == 1\n self.assertTrue(isinstance(topo_[0].op, self.adv_sub1))\n f_0 = f([0])\n self.assertTrue(f_0.shape == (1, 3))\n self.assertTrue(numpy.allclose(f_0, 5))\n\n # Test the gradient\n c = t.sum()\n gn = theano.grad(c, n)\n g = self.function([idx], gn, op=self.adv_incsub1)\n g_0 = g([0])\n self.assertTrue(g_0.shape == (4, 3))\n self.assertTrue(numpy.allclose(g_0[0], 1))\n self.assertTrue(numpy.allclose(g_0[1:], 0))", "metadata": "root.T_subtensor.test_adv_sub1_idx_broadcast", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 561 }, { "content": " def grad_list_(self, idxs, data):\n n = self.shared(data)\n\n for idx in idxs:\n # Should stay on the cpu.\n idx_ = _shared(numpy.asarray(idx))\n t = n[idx_]\n gn = theano.tensor.grad(theano.tensor.sum(theano.tensor.exp(t)), n)\n f = self.function([], [gn, gn.shape], op=self.adv_incsub1)\n topo = f.maker.fgraph.toposort()\n if not self.fast_compile:\n assert any([isinstance(node.op, self.\n adv_incsub1) and node.op.inplace for node in topo])\n else:\n assert any([isinstance(node.op, self.\n adv_incsub1) for node in topo])\n assert any([isinstance(node.op, self.adv_sub1) for node in topo])\n gval, gshape = f()\n good = numpy.zeros_like(data)\n # don't work when the same index is used many time\n # good[idx] += numpy.exp(data[idx])\n for i in idx:\n good[i] += numpy.exp(data[i])\n self.assertTrue(gval.ndim == data.ndim)\n self.assertTrue(numpy.allclose(gval, good), (gval, good))\n self.assertTrue(numpy.allclose(gshape, data.shape))\n\n def fct(t):\n return theano.tensor.sum(t[idx_])\n utt.verify_grad(fct, [data])\n\n # Test the grad of the grad (e.i. AdvancedIncSubtensor1.grad)\n def fct2(t):\n return theano.tensor.grad(theano.tensor.sum(t[idx_]), t)\n utt.verify_grad(fct2, [data])\n\n # Test shape of AdvancedIncSubtensor1 and AdvancedSubtensor1\n if not self.fast_compile:\n ops = (self.adv_incsub1, self.adv_sub1)\n else:\n ops = self.ops\n if idx is idxs[0]:\n f = self.function([], [gn.shape, n[idx_].shape],\n op=ops,\n N=0, N_fast=2)\n f()", "metadata": "root.T_subtensor.grad_list_", "header": "['class', 'T_subtensor', '(', 'unittest', '.', 'TestCase', ',', 'utt', '.', 'TestOptimizationMixin', ')', ':', '___EOS___']", "index": 777 }, { "content": " def test_index_w_int_and_vec(self):\n # like test_ok_list, but with a single index on the first one\n # data has to have at least 2 dimensions\n for data, idx in [(rand(4, 5), [2, 3]),\n (rand(2, 4, 3), [0, 3]),\n (rand(2, 4, 3), [3, 3, 1, 1, 2, 2, 0, 0]),\n (rand(2, 4, 3), [3, 3, 1, 1, 2, 2, 0, 0,\n -1, -2, -3, -4]),\n # Test 4 dims as gpu code use another algo\n # in that case This new algo is not as much\n # optimized for that case.\n (rand(4, 4, 2, 3), [3,\n 3, 1, 1, 2, 2, 0, 0, -1, -2, -3, -4]),\n # Test with TensorConstant index.\n (rand(2, 4, 3),\n theano.tensor.constant([3, 3, 1, 1, 2, 2, 0, 0])),\n ]:\n data = numpy.asarray(data, dtype=self.dtype)\n n = self.shared(data)\n t = n[0, idx]\n\n self.assertTrue(isinstance(t.owner.op, tensor.AdvancedSubtensor))\n\n val = self.eval_output_and_check(t)\n if isinstance(idx, list):\n good = data[0, idx]\n else:\n good = data[0, idx.data]\n self.assertTrue(val.ndim == data.ndim - 1)\n self.assertTrue(numpy.allclose(val, good), (val, good))", "metadata": "root.TestAdvancedSubtensor.test_index_w_int_and_vec", "header": "['class', 'TestAdvancedSubtensor', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '# test inc_subtensor', '___NL___', '# also tests set_subtensor', '___NL___', '___EOS___']", "index": 1307 } ]
[ { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 172, "start_column": 12, "end_line": 172, "end_column": 47 }, { "span": "self.assertTrue(tval.shape == ())", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 41 }, { "span": "self.assertTrue(tval == 5.0)", "start_line": 197, "start_column": 8, "end_line": 197, "end_column": 36 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 212, "start_column": 8, "end_line": 212, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 217, "start_column": 8, "end_line": 217, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == ())", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 41 }, { "span": "self.assertTrue(tval.shape == (3,))", "start_line": 266, "start_column": 8, "end_line": 266, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 275, "start_column": 8, "end_line": 275, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 283, "start_column": 8, "end_line": 283, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (1,))", "start_line": 291, "start_column": 8, "end_line": 291, "end_column": 43 }, { "span": "self.assertTrue(tval.shape == (2, 2))", "start_line": 299, "start_column": 8, "end_line": 299, "end_column": 45 }, { "span": "self.assertTrue(tval.shape == ())", "start_line": 307, "start_column": 8, "end_line": 307, "end_column": 41 }, { "span": "self.assertTrue(tval.shape == (2,))", "start_line": 315, "start_column": 8, "end_line": 315, "end_column": 43 }, { "span": "self.assertTrue(val.ndim == data.ndim)", "start_line": 465, "start_column": 12, "end_line": 465, "end_column": 50 }, { "span": "self.assertTrue(f_0.shape == (1, 3))", "start_line": 530, "start_column": 8, "end_line": 530, "end_column": 44 }, { "span": "self.assertTrue(f_00.shape == (2, 3))", "start_line": 533, "start_column": 8, "end_line": 533, "end_column": 45 }, { "span": "self.assertTrue(g_0.shape == (1, 3))", "start_line": 542, "start_column": 8, "end_line": 542, "end_column": 44 }, { "span": "self.assertTrue(g_00.shape == (1, 3))", "start_line": 545, "start_column": 8, "end_line": 545, "end_column": 45 }, { "span": "self.assertTrue(f_0.shape == (1, 3))", "start_line": 577, "start_column": 8, "end_line": 577, "end_column": 44 }, { "span": "self.assertTrue(g_0.shape == (4, 3))", "start_line": 585, "start_column": 8, "end_line": 585, "end_column": 44 }, { "span": "self.assertTrue(gval.ndim == data.ndim)", "start_line": 800, "start_column": 12, "end_line": 800, "end_column": 51 }, { "span": "self.assertTrue(val.ndim == data.ndim - 1)", "start_line": 1335, "start_column": 12, "end_line": 1335, "end_column": 54 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "\\u", "ok", "\\u", "range", "\\u", "finite", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "3_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "tval", "_", "==_", "[_", "0_", ",_", "1_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "range", "\\u", "finite", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "12_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "3_", ",_", "4_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", " ", "check", " ", "negati", "ve", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", "in_", "[_", "(_", "slice_", "(_", "0_", ",_", "2_", ")_", ",_", "3_", ")_", ",_", "(_", "(_", "slice_", "(_", "0_", ",_", "2_", ")_", ",_", "-_", "1_", ")_", ")_", ",_", "(_", "slice_", "(_", "0_", ",_", "2_", ")_", ",_", "-_", "4_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "n_", "[_", "idx_", "]_", "#", " ", "l", "]", "#", "0", ":", "2", ",", "3", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "tval", "_", ",_", "n_", "._", "get", "\\u", "value_", "(_", ")_", "[_", "idx_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "\\u", "ok", "\\u", "elem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "ones_", "(_", "1_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "==_", "5.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "\\u", "ok", "\\u", "range", "\\u", "infini", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "3_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "tval", "_", "==_", "[_", "1.0_", ",_", "2.0_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "1", "\\u", "ok", "\\u", "stride", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "5_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "tval", "_", "==_", "[_", "1.0_", ",_", "3.0_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", ":_", "-_", "1_", ":_", "2_", "]_", "#", " ", "0", " ", "to", " ", "1", " ", "from", " ", "the", " ", "end", " ", "step", "ping", " ", "by", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "tval", "_", "==_", "[_", "0.0_", ",_", "2.0_", "]_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "elem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "6_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "row_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "6_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "any_", "(_", "n_", "._", "type_", "._", "broadcast", "able_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "3_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "[_", "3_", ",_", "4_", ",_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "col_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "6_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", ":_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "any_", "(_", "n_", "._", "type_", "._", "broadcast", "able_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "[_", "0_", ",_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "rows", "\\u", "finite", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "12_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", ":_", "3_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "[_", "3_", ",_", "6_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "cols", "\\u", "infini", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "12_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", ",_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "2", "\\u", "ok", "\\u", "stride", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "20_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "4_", ",_", "5_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "1_", ":_", "4_", ":_", "2_", ",_", "1_", ":_", "5_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "[_", "[_", "6_", ",_", "8_", "]_", ",_", "[_", "16_", ",_", "18_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "3", "\\u", "ok", "\\u", "mat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "24_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "2_", ",_", "3_", ",_", "4_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "long_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "numpy_", "._", "arange_", "(_", "12_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "L_", "(_", "1_", ")_", ":_", "L_", "(_", "4_", ")_", ":_", "L_", "(_", "2_", ")_", ",_", "L_", "(_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tval", "_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "tval", "_", "._", "shape_", "==_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "all_", "(_", "tval", "_", "==_", "[_", "4_", ",_", "10_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ok", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", ",_", "idx_", "in_", "[_", "(_", "rand_", "(_", "4_", ")_", ",_", "[_", "1_", ",_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "5_", ")_", ",_", "[_", "2_", ",_", "3_", ",_", "-_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "[_", "0_", ",_", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ",_", "-_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "4", " ", "dims", " ", "as", " ", "gpu", " ", "code", " ", "use", " ", "anot", "her", " ", "algo_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "tha", "t", " ", "case", " ", "Thi", "s", " ", "new", " ", "algo", " ", "is", " ", "not", " ", "as", " ", "muc", "h_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "optimize", "d", " ", "for", " ", "tha", "t", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", ",_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ",_", "-_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "Tensor", "Const", "ant", " ", "index", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "theano_", "._", "tensor_", "._", "constant_", "(_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "numpy_", "._", "asarray_", "(_", "data_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "self_", "._", "shared_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "test", " ", "again", " ", "Advance", "d", "Subt", "ens", "or", "1", " ", "as", " ", "we", " ", "transfer", " ", "data", " ", "to", " ", "the", " ", "cpu", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "tensor_", "._", "Advance", "d", "Subt", "ens", "or", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ",_", "list_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "idx_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good_", "=_", "data_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good_", "=_", "data_", "[_", "idx_", "._", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "val_", "._", "ndim_", "==_", "data_", "._", "ndim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "val_", ",_", "good_", ")_", ",_", "(_", "val_", ",_", "good_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "reus", "e", " ", "of", " ", "output", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", "==_", "tensor_", "._", "Advance", "d", "Subt", "ens", "or", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "op_", "=_", "self_", "._", "adv", "\\u", "sub", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "idx", " ", "is", " ", "a", " ", "Tensor", "Const", "ant", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "idx_", ",_", "\"", "data", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "idx_", "=_", "idx_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "out_", "=_", "[_", "[_", "None_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "._", "perform_", "(_", "None_", ",_", "[_", "data_", ",_", "idx_", "]_", ",_", "test\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out1_", "=_", "test\\u", "out_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "op_", "._", "perform_", "(_", "None_", ",_", "[_", "data_", ",_", "idx_", "]_", ",_", "test\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out2_", "=_", "test\\u", "out_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "out1_", "is_", "out2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "the", " ", "grad_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gn_", "=_", "theano_", "._", "grad_", "(_", "t_", "._", "sum_", "(_", ")_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "self_", "._", "function_", "(_", "[_", "]_", ",_", "gn_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "lambda_", "m_", ":_", "m_", "[_", "[_", "1_", ",_", "3_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "numpy_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "0_", "=_", "g_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "lambda_", "m_", ":_", "m_", "[_", "idx_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "data_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "adv", "\\u", "sub", "1", "\\u", "broadcast_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "numpy_", "._", "arange_", "(_", "3_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "._", "reshape_", "(_", "(_", "1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "self_", "._", "shared_", "(_", "v_", "*_", "5_", ",_", "broadcast", "able_", "=_", "(_", "True_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "tensor_", "._", "lve", "ctor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "tensor_", "._", "Advance", "d", "Subt", "ens", "or", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "self_", "._", "function_", "(_", "[_", "idx_", "]_", ",_", "t_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo_", "=_", "f_", "._", "maker_", "._", "fg", "raph_", "._", "topo", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo", "\\u_", "=_", "[_", "node_", "for_", "node_", "in_", "topo_", "if_", "not_", "isinstance_", "(_", "node_", "._", "op_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ignore", "\\u", "topo_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "topo", "\\u_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "topo", "\\u_", "[_", "0_", "]_", "._", "op_", ",_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "0_", "=_", "f_", "(_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f", "\\u", "0_", "._", "shape_", "==_", "(_", "1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "f", "\\u", "0_", ",_", "v_", "*_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "00_", "=_", "f_", "(_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f", "\\u", "00_", "._", "shape_", "==_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "f", "\\u", "00_", ",_", "v_", "*_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Index", "Error_", ",_", "f_", ",_", "[_", "0_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "gradient_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "t_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gn_", "=_", "theano_", "._", "grad_", "(_", "c_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "self_", "._", "function_", "(_", "[_", "idx_", "]_", ",_", "gn_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "0_", "=_", "g_", "(_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g", "\\u", "0_", "._", "shape_", "==_", "(_", "1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "g", "\\u", "0_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "00_", "=_", "g_", "(_", "[_", "0_", ",_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g", "\\u", "00_", "._", "shape_", "==_", "(_", "1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "g", "\\u", "00_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "lambda_", "m_", ":_", "m_", "[_", "[_", "1_", ",_", "3_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "numpy_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fun_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "advanced", "\\u", "inc", "\\u", "subt", "ens", "or", "1_", "(_", "x_", ",_", "y_", ",_", "[_", "1_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "fun_", ",_", "[_", "numpy_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "random_", "._", "rand_", "(_", "2_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fun_", "(_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "advanced", "\\u", "set\\u", "subt", "ens", "or", "1_", "(_", "x_", ",_", "y_", ",_", "[_", "1_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "fun_", ",_", "[_", "numpy_", "._", "random_", "._", "rand_", "(_", "5_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "random_", "._", "rand_", "(_", "2_", ",_", "5_", ")_", "._", "astype_", "(_", "self_", "._", "dtype_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "adv", "\\u", "sub", "1", "\\u", "idx", "\\u", "broadcast_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "idx", " ", "can", " ", "be", " ", "a", " ", "broadcast", "able", " ", "vector", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ones_", "=_", "numpy_", "._", "ones_", "(_", "(_", "4_", ",_", "3_", ")_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "self_", "._", "shared_", "(_", "ones_", "*_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "tensor_", "._", "Tensor", "Type_", "(_", "dtype_", "=_", "'", "int", "64", "'_", ",_", "broadcast", "able_", "=_", "(_", "True_", ",_", ")_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "idx_", "._", "type_", "._", "broadcast", "able_", "==_", "(_", "True_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "tensor_", "._", "Advance", "d", "Subt", "ens", "or", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "self_", "._", "function_", "(_", "[_", "idx_", "]_", ",_", "t_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo_", "=_", "f_", "._", "maker_", "._", "fg", "raph_", "._", "topo", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo", "\\u_", "=_", "[_", "node_", "for_", "node_", "in_", "topo_", "if_", "not_", "isinstance_", "(_", "node_", "._", "op_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ignore", "\\u", "topo_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "topo", "\\u_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "topo", "\\u_", "[_", "0_", "]_", "._", "op_", ",_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f", "\\u", "0_", "=_", "f_", "(_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f", "\\u", "0_", "._", "shape_", "==_", "(_", "1_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "f", "\\u", "0_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "gradient_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "t_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gn_", "=_", "theano_", "._", "grad_", "(_", "c_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "self_", "._", "function_", "(_", "[_", "idx_", "]_", ",_", "gn_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g", "\\u", "0_", "=_", "g_", "(_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g", "\\u", "0_", "._", "shape_", "==_", "(_", "4_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "g", "\\u", "0_", "[_", "0_", "]_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "g", "\\u", "0_", "[_", "1_", ":_", "]_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "T", "\\u", "subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ",_", "utt", "_", "._", "Test", "Optim", "izatio", "n", "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_", "grad", "\\u", "list\\u_", "(_", "self_", ",_", "idxs_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "shared_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", "in_", "idxs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "stay", " ", "on", " ", "the", " ", "cpu", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx", "\\u_", "=_", "\\u", "shared_", "(_", "numpy_", "._", "asarray_", "(_", "idx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "idx", "\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gn_", "=_", "theano_", "._", "tensor_", "._", "grad_", "(_", "theano_", "._", "tensor_", "._", "sum_", "(_", "theano_", "._", "tensor_", "._", "exp_", "(_", "t_", ")_", ")_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "self_", "._", "function_", "(_", "[_", "]_", ",_", "[_", "gn_", ",_", "gn_", "._", "shape_", "]_", ",_", "op_", "=_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo_", "=_", "f_", "._", "maker_", "._", "fg", "raph_", "._", "topo", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "fast", "\\u", "compile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "any_", "(_", "[_", "isinstance_", "(_", "node_", "._", "op_", ",_", "self_", "._", "\\u\\u\\uNL\\u\\u\\u_", "adv", "\\u", "inc", "sub", "1_", ")_", "and_", "node_", "._", "op_", "._", "inplace_", "for_", "node_", "in_", "topo_", "]_", ")_", "\\u\\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_", "any_", "(_", "[_", "isinstance_", "(_", "node_", "._", "op_", ",_", "self_", "._", "\\u\\u\\uNL\\u\\u\\u_", "adv", "\\u", "inc", "sub", "1_", ")_", "for_", "node_", "in_", "topo_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "any_", "(_", "[_", "isinstance_", "(_", "node_", "._", "op_", ",_", "self_", "._", "adv", "\\u", "sub", "1_", ")_", "for_", "node_", "in_", "topo_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gva", "l_", ",_", "gs", "hape_", "=_", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "work", " ", "whe", "n", " ", "the", " ", "same", " ", "index", " ", "is", " ", "used", " ", "many", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "good", "[", "idx", "]", " ", "+=", " ", "nump", "y", ".", "exp", "(", "data", "[", "idx", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "idx_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good_", "[_", "i_", "]_", "+=_", "numpy_", "._", "exp_", "(_", "data_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "gva", "l_", "._", "ndim_", "==_", "data_", "._", "ndim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "gva", "l_", ",_", "good_", ")_", ",_", "(_", "gva", "l_", ",_", "good_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "gs", "hape_", ",_", "data_", "._", "shape_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fct", "_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "theano_", "._", "tensor_", "._", "sum_", "(_", "t_", "[_", "idx", "\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "fct", "_", ",_", "[_", "data_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "the", " ", "grad", " ", "of", " ", "the", " ", "grad", " ", "(", "e", ".", "i", ".", " ", "Advance", "d", "Inc", "Subt", "ens", "or", "1", ".", "grad", ")_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fct", "2_", "(_", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "theano_", "._", "tensor_", "._", "grad_", "(_", "theano_", "._", "tensor_", "._", "sum_", "(_", "t_", "[_", "idx", "\\u_", "]_", ")_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utt", "_", "._", "verify", "\\u", "grad_", "(_", "fct", "2_", ",_", "[_", "data_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "shape", " ", "of", " ", "Advance", "d", "Inc", "Subt", "ens", "or", "1", " ", "and", " ", "Advance", "d", "Subt", "ens", "or", "1_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "fast", "\\u", "compile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ops_", "=_", "(_", "self_", "._", "adv", "\\u", "inc", "sub", "1_", ",_", "self_", "._", "adv", "\\u", "sub", "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 ", " _", "ops_", "=_", "self_", "._", "ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "idx_", "is_", "idxs_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "self_", "._", "function_", "(_", "[_", "]_", ",_", "[_", "gn_", "._", "shape_", ",_", "n_", "[_", "idx", "\\u_", "]_", "._", "shape_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "op_", "=_", "ops_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "N_", "=_", "0_", ",_", "N", "\\u", "fast_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Advance", "d", "Subt", "ens", "or_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "inc", "\\u", "subt", "ens", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "tests", " ", "set\\u", "subt", "ens", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "w", "\\u", "int\\u", "and", "\\u", "vec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "like", " ", "test\\u", "ok", "\\u", "list", ",", " ", "but", " ", "with", " ", "a", " ", "single", " ", "index", " ", "on", " ", "the", " ", "first", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "data", " ", "has", " ", "to", " ", "have", " ", "at", " ", "leas", "t", " ", "2", " ", "dimensions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", ",_", "idx_", "in_", "[_", "(_", "rand_", "(_", "4_", ",_", "5_", ")_", ",_", "[_", "2_", ",_", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "2_", ",_", "4_", ",_", "3_", ")_", ",_", "[_", "0_", ",_", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "2_", ",_", "4_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "2_", ",_", "4_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ",_", "-_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "4", " ", "dims", " ", "as", " ", "gpu", " ", "code", " ", "use", " ", "anot", "her", " ", "algo_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "tha", "t", " ", "case", " ", "Thi", "s", " ", "new", " ", "algo", " ", "is", " ", "not", " ", "as", " ", "muc", "h_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "optimize", "d", " ", "for", " ", "tha", "t", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "4_", ",_", "4_", ",_", "2_", ",_", "3_", ")_", ",_", "[_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", ",_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ",_", "-_", "4_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "Tensor", "Const", "ant", " ", "index", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "rand_", "(_", "2_", ",_", "4_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "theano_", "._", "tensor_", "._", "constant_", "(_", "[_", "3_", ",_", "3_", ",_", "1_", ",_", "1_", ",_", "2_", ",_", "2_", ",_", "0_", ",_", "0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "numpy_", "._", "asarray_", "(_", "data_", ",_", "dtype_", "=_", "self_", "._", "dtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "self_", "._", "shared_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "n_", "[_", "0_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "t_", "._", "owner_", "._", "op_", ",_", "tensor_", "._", "Advance", "d", "Subt", "ens", "or_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "self_", "._", "eval", "\\u", "output", "\\u", "and", "\\u", "check_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "idx_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good_", "=_", "data_", "[_", "0_", ",_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "good_", "=_", "data_", "[_", "0_", ",_", "idx_", "._", "data_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "val_", "._", "ndim_", "==_", "data_", "._", "ndim_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "allclose_", "(_", "val_", ",_", "good_", ")_", ",_", "(_", "val_", ",_", "good_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
fusionbox/django-widgy/widgy/__init__.py
[ { "content": "import traceback\nimport sys\n\nfrom django.core.exceptions import ImproperlyConfigured\n\n\n\n\n\n\nregistry = Registry()\nregister = registry.register\nunregister = registry.unregister\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseRegistry(set):\n \"\"\"\n Container class for unique Django models.\n\n A model must be registered with a registry to be visible to Widgy.\n \"\"\"\n", "metadata": "root.BaseRegistry", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def register(self, model):\n from django.db import models\n if model in self:\n raise ImproperlyConfigured(\n \"You cannot register the same model ('{0}') twice.\"\n .format(model)\n )\n if not issubclass(model, models.Model):\n raise ImproperlyConfigured((\"{0} is not a subclass of django.db.models.Model, \"\n \"so it cannot be registered\").format(model))\n if model._meta.abstract:\n raise ImproperlyConfigured(\"You cannot register the abstract class {0}\".format(model))\n self.add(model)\n\n # allow use as a decorator\n return model", "metadata": "root.BaseRegistry.register", "header": "['class', 'BaseRegistry', '(', 'set', ')', ':', '___EOS___']", "index": 12 }, { "content": " def unregister(self, model):\n self.remove(model)", "metadata": "root.BaseRegistry.unregister", "header": "['class', 'BaseRegistry', '(', 'set', ')', ':', '___EOS___']", "index": 29 }, { "content": "class Registry(BaseRegistry):\n \"\"\"\n Container class for all widgets available for use in widgy.\n\n A widget must be registered with the registry in order to appear in the\n available widgets box.\n \"\"\"\n", "metadata": "root.Registry", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def register(self, content):\n from widgy.models import Content\n if not issubclass(content, Content):\n raise ImproperlyConfigured(\n \"{0} is not a subclass of Content, so it cannot be registered\".format(content)\n )\n return super(Registry, self).register(content)", "metadata": "root.Registry.register", "header": "['class', 'Registry', '(', 'BaseRegistry', ')', ':', '___EOS___']", "index": 41 } ]
[ { "span": "import traceback", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 16 }, { "span": "import sys", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "registry_", "=_", "Registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "=_", "registry_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unregister_", "=_", "registry_", "._", "unregister_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Registry_", "(_", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Containe", "r", " ", "class", " ", "for", " ", "unique", " ", "Dj", "ang", "o", " ", "model", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "model", " ", "must", " ", "be", " ", "register", "ed", " ", "with", " ", "a", " ", "registr", "y", " ", "to", " ", "be", " ", "visi", "ble", " ", "to", " ", "Wid", "gy", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Registry_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "self_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "You", " ", "cann", "ot", " ", "register", " ", "the", " ", "same", " ", "model", " ", "('{", "0", "}')", " ", "twi", "ce", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "model_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "model_", ",_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "(_", "\"{", "0", "}", " ", "is", " ", "not", " ", "a", " ", "subclass", " ", "of", " ", "django", ".", "db", ".", "model", "s", ".", "Model", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "so", " ", "it", " ", "cann", "ot", " ", "be", " ", "register", "ed", "\"_", ")_", "._", "format_", "(_", "model_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model_", "._", "\\u", "meta_", "._", "abstract_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "You", " ", "cann", "ot", " ", "register", " ", "the", " ", "abstract", " ", "class", " ", "{", "0", "}\"_", "._", "format_", "(_", "model_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allow", " ", "use", " ", "as", " ", "a", " ", "decorator_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Registry_", "(_", "set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unregister_", "(_", "self_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "remove_", "(_", "model_", ")_", "\\u\\u\\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_", "Registry_", "(_", "Base", "Registry_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Containe", "r", " ", "class", " ", "for", " ", "all", " ", "widget", "s", " ", "avail", "able", " ", "for", " ", "use", " ", "in", " ", "wid", "gy", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "widget", " ", "must", " ", "be", " ", "register", "ed", " ", "with", " ", "the", " ", "registr", "y", " ", "in", " ", "order", " ", "to", " ", "appear", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "avail", "able", " ", "widget", "s", " ", "box", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Registry_", "(_", "Base", "Registry_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "register_", "(_", "self_", ",_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "wid", "gy_", "._", "models_", "import_", "Content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "content_", ",_", "Content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "is", " ", "not", " ", "a", " ", "subclass", " ", "of", " ", "Conten", "t", ",", " ", "so", " ", "it", " ", "cann", "ot", " ", "be", " ", "register", "ed", "\"_", "._", "format_", "(_", "content_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Registry_", ",_", "self_", ")_", "._", "register_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
scieloorg/scielo-manager/scielomanager/validator/tests/tests_pages.py
[ { "content": "# coding:utf-8\nfrom os import path\nimport unittest\nimport mocker\nfrom PIL import Image\nimport StringIO\n\nfrom django.core.urlresolvers import reverse\nfrom django_webtest import WebTest\nfrom django.conf import settings\nfrom django_factory_boy import auth\nfrom django.core.files.uploadedfile import InMemoryUploadedFile\n\nfrom . import doubles\nimport pkg_resources\n\nPACKTOOLS_VERSION = pkg_resources.get_distribution('packtools').version\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _get_test_xml_abspath(filename):\n folder_path = settings.PROJECT_PATH\n folder_path = settings.PROJECT_PATH.split('/')\n folder_path.extend(['validator', 'tests', 'xml_tests_files', filename])\n return '/'.join(folder_path)", "metadata": "root._get_test_xml_abspath", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def get_temporary_text_file():\n io = StringIO.StringIO()\n io.write('foo')\n text_file = InMemoryUploadedFile(io, field_name='file', name='foo.txt', content_type='text', size=io.len, charset='utf8')\n text_file.seek(0)\n return text_file", "metadata": "root.get_temporary_text_file", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def get_temporary_image_file():\n io = StringIO.StringIO()\n size = (200, 200)\n color = (255, 0, 0, 0)\n image = Image.new(\"RGBA\", size, color)\n image.save(io, format='PNG')\n image_file = InMemoryUploadedFile(io, field_name='file', name='foo.png', content_type='png', size=io.len, charset=None)\n image_file.seek(0)\n return image_file", "metadata": "root.get_temporary_image_file", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def get_temporary_xml_file(xml_abs_path):\n fp = open(xml_abs_path)\n io = StringIO.StringIO(fp.read())\n fp.close()\n xml_file = InMemoryUploadedFile(io, field_name='file', name='foo.xml', content_type='text/xml', size=io.len, charset='utf8')\n xml_file.seek(0)\n return xml_file", "metadata": "root.get_temporary_xml_file", "header": "['module', '___EOS___']", "index": 45 }, { "content": "class ValidatorTests(WebTest, mocker.MockerTestCase):\n\n\n\n\n\n\n", "metadata": "root.ValidatorTests", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def test_access_unauthenticated_user(self):\n response = self.app.get(\n reverse('validator.packtools.stylechecker',),\n )\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'validator/stylechecker.html')", "metadata": "root.ValidatorTests.test_access_unauthenticated_user", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_access_authenticated_user(self):\n self.user = auth.UserF(is_active=True)\n response = self.app.get(\n reverse('validator.packtools.stylechecker',),\n user=self.user\n )\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'validator/stylechecker.html')", "metadata": "root.ValidatorTests.test_access_authenticated_user", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_link_is_present_at_homepage(self):\n response = self.app.get(\n reverse('index',),\n )\n # response redirecto to login\n self.assertEqual(response.status_code, 302)\n response = response.follow()\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'registration/login.html')\n expected_url = reverse('validator.packtools.stylechecker',)\n response.mustcontain('href=\"%s\"' % expected_url)", "metadata": "root.ValidatorTests.test_link_is_present_at_homepage", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def test_submit_empty_form_is_not_valid(self):\n # with\n page = self.app.get(\n reverse('validator.packtools.stylechecker',),\n )\n form = page.forms['xml_upload_form']\n # when\n response = form.submit()\n # then\n self.assertTemplateUsed(response, 'validator/stylechecker.html')\n self.assertFalse(response.context['form'].is_valid())\n form_errors = response.context['form'].errors\n expected_errors = {'file': [u'This field is required.']}\n self.assertEqual(form_errors, expected_errors)\n self.assertFalse(hasattr(response.context, 'results'))", "metadata": "root.ValidatorTests.test_submit_empty_form_is_not_valid", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_submit_text_file_then_form_not_valid(self):\n \"\"\"\n Submitting a text file will raise a from validation error\n \"\"\"\n # with\n test_file = get_temporary_text_file()\n # when\n response = self.client.post(\n reverse('validator.packtools.stylechecker',),\n {\n 'file': test_file\n }\n )\n # then\n form = response.context['form']\n self.assertFalse(response.context['form'].is_valid())\n expected_errors = {\n 'file': [u'This type of file is not allowed! Please select another file.']\n }\n self.assertEqual(form.errors, expected_errors)", "metadata": "root.ValidatorTests.test_submit_text_file_then_form_not_valid", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 100 }, { "content": " def test_submit_image_file_then_form_not_valid(self):\n \"\"\"\n Submitting a image file will raise a from validation error\n \"\"\"\n # with\n test_file = get_temporary_image_file()\n # when\n response = self.client.post(\n reverse('validator.packtools.stylechecker',),\n {\n 'file': test_file\n }\n )\n # then\n form = response.context['form']\n self.assertFalse(response.context['form'].is_valid())\n expected_errors = {'file': [u'This type of file is not allowed! Please select another file.']}\n self.assertEqual(form.errors, expected_errors)", "metadata": "root.ValidatorTests.test_submit_image_file_then_form_not_valid", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 121 }, { "content": " def test_submit_valid_xml_file_then_get_annotations_form_valid(self):\n \"\"\"\n Submitting a xml file that generate annotations will let the form as valid,\n and xml validation will return annotations\n \"\"\"\n # with\n\n stub_analyze_xml = doubles.make_stub_analyze_xml('valid')\n mock_utils = self.mocker.replace('validator.utils')\n mock_utils.analyze_xml\n self.mocker.result(stub_analyze_xml)\n\n self.mocker.replay()\n\n test_file_path = _get_test_xml_abspath('with_style_errors.xml')\n test_file = get_temporary_xml_file(test_file_path)\n\n # when\n response = self.client.post(\n reverse('validator.packtools.stylechecker',),\n {\n 'file': test_file\n }\n )\n\n # then\n form = response.context['form']\n xml_exception = response.context['xml_exception']\n results = response.context['results']\n\n self.assertTrue(form.is_valid())\n self.assertTemplateUsed('validator/stylechecker.html')\n\n # the template cares about this keys\n self.assertEqual(results.keys(), ['validation_errors', 'meta', 'annotations'])", "metadata": "root.ValidatorTests.test_submit_valid_xml_file_then_get_annotations_form_valid", "header": "['class', 'ValidatorTests', '(', 'WebTest', ',', 'mocker', '.', 'MockerTestCase', ')', ':', '___EOS___']", "index": 140 } ]
[ { "span": "from os import path", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 19 }, { "span": "import unittest", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mocker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "web", "test_", "import_", "Web", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "factor", "y", "\\u", "boy", "_", "import_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "uploade", "dfile", "_", "import_", "In", "Memo", "ry", "Upload", "ed", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "double", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "\\u", "resources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PACK", "TOOLS", "\\u", "VERSION_", "=_", "pkg", "\\u", "resources_", "._", "get", "\\u", "distribution_", "(_", "'", "pack", "tool", "s", "'_", ")_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "test\\u", "xml", "\\u", "abspath_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "folder", "\\u", "path_", "=_", "settings_", "._", "PROJECT", "\\u", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "\\u", "path_", "=_", "settings_", "._", "PROJECT", "\\u", "PATH_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "folder", "\\u", "path_", "._", "extend_", "(_", "[_", "'", "validator", "'_", ",_", "'", "tests", "'_", ",_", "'", "xml", "\\u", "tests", "\\u", "files", "'_", ",_", "filename_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'/'_", "._", "join_", "(_", "folder", "\\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_", "get", "\\u", "temporar", "y", "\\u", "text", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "._", "write_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "file_", "=_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "io_", ",_", "field", "\\u", "name_", "=_", "'", "file", "'_", ",_", "name_", "=_", "'", "foo", ".", "txt", "'_", ",_", "content", "\\u", "type_", "=_", "'", "text", "'_", ",_", "size_", "=_", "io_", "._", "len_", ",_", "charset_", "=_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "temporar", "y", "\\u", "image", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "(_", "200_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "(_", "255_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "Image_", "._", "new_", "(_", "\"", "RGB", "A", "\"_", ",_", "size_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "save_", "(_", "io_", ",_", "format_", "=_", "'", "PNG", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "file_", "=_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "io_", ",_", "field", "\\u", "name_", "=_", "'", "file", "'_", ",_", "name_", "=_", "'", "foo", ".", "png", "'_", ",_", "content", "\\u", "type_", "=_", "'", "png", "'_", ",_", "size_", "=_", "io_", "._", "len_", ",_", "charset_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "image", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "temporar", "y", "\\u", "xml", "\\u", "file_", "(_", "xml", "\\u", "abs", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "open_", "(_", "xml", "\\u", "abs", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "io_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "fp_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "file_", "=_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "io_", ",_", "field", "\\u", "name_", "=_", "'", "file", "'_", ",_", "name_", "=_", "'", "foo", ".", "xml", "'_", ",_", "content", "\\u", "type_", "=_", "'", "text", "/", "xml", "'_", ",_", "size_", "=_", "io_", "._", "len_", ",_", "charset_", "=_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "xml", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "access", "\\u", "unau", "then", "tica", "ted", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "'", "validator", "/", "style", "checke", "r", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "access", "\\u", "authenticat", "ed", "\\u", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "auth_", "._", "User", "F_", "(_", "is", "\\u", "active_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "self_", "._", "user_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "'", "validator", "/", "style", "checke", "r", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "link", "\\u", "is", "\\u", "presen", "t", "\\u", "at", "\\u", "homepage_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "index", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "response", " ", "redirec", "to", " ", "to", " ", "login_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "response_", "._", "follow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "'", "registration", "/", "login", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "url_", "=_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "must", "contain", "_", "(_", "'", "href", "=\"", "%", "s", "\"'_", "%_", "expected", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "empty", "\\u", "form", "\\u", "is", "\\u", "not", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "page_", "=_", "self_", "._", "app_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "page_", "._", "forms_", "[_", "'", "xml", "\\u", "upload", "\\u", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "form_", "._", "submit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "response_", ",_", "'", "validator", "/", "style", "checke", "r", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "errors_", "=_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "errors_", "=_", "{_", "'", "file", "'_", ":_", "[_", "u", "'", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "form", "\\u", "errors_", ",_", "expected", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "hasattr_", "(_", "response_", "._", "context_", ",_", "'", "results", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "text", "\\u", "file", "\\u", "then", "\\u", "form", "\\u", "not", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Submit", "ting", " ", "a", " ", "text", " ", "file", " ", "will", " ", "raise", " ", "a", " ", "from", " ", "validation", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "file_", "=_", "get", "\\u", "temporar", "y", "\\u", "text", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "test\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "[_", "u", "'", "Thi", "s", " ", "type", " ", "of", " ", "file", " ", "is", " ", "not", " ", "allow", "ed", "!", " ", "Ple", "ase", " ", "select", " ", "anot", "her", " ", "file", ".'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "form_", "._", "errors_", ",_", "expected", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "image", "\\u", "file", "\\u", "then", "\\u", "form", "\\u", "not", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Submit", "ting", " ", "a", " ", "image", " ", "file", " ", "will", " ", "raise", " ", "a", " ", "from", " ", "validation", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "file_", "=_", "get", "\\u", "temporar", "y", "\\u", "image", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "test\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "._", "is", "\\u", "valid_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "errors_", "=_", "{_", "'", "file", "'_", ":_", "[_", "u", "'", "Thi", "s", " ", "type", " ", "of", " ", "file", " ", "is", " ", "not", " ", "allow", "ed", "!", " ", "Ple", "ase", " ", "select", " ", "anot", "her", " ", "file", ".'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "form_", "._", "errors_", ",_", "expected", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Validat", "or", "Tests_", "(_", "Web", "Test_", ",_", "mocker_", "._", "Mocke", "r", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "submit", "\\u", "valid", "\\u", "xml", "\\u", "file", "\\u", "then", "\\u", "get", "\\u", "annotations\\u", "form", "\\u", "valid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Submit", "ting", " ", "a", " ", "xml", " ", "file", " ", "tha", "t", " ", "generat", "e", " ", "annot", "ation", "s", " ", "will", " ", "let", " ", "the", " ", "form", " ", "as", " ", "valid", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "xml", " ", "validation", " ", "will", " ", "return", " ", "annot", "ation", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stub", "\\u", "analyze", "\\u", "xml_", "=_", "double", "s_", "._", "make", "\\u", "stub", "\\u", "analyze", "\\u", "xml_", "(_", "'", "valid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "utils_", "=_", "self_", "._", "mocker_", "._", "replace_", "(_", "'", "validator", ".", "util", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "utils_", "._", "analyze", "\\u", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mocker_", "._", "result_", "(_", "stub", "\\u", "analyze", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mocker_", "._", "replay_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "file", "\\u", "path_", "=_", "\\u", "get", "\\u", "test\\u", "xml", "\\u", "abspath_", "(_", "'", "with", "\\u", "style", "\\u", "error", "s", ".", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "file_", "=_", "get", "\\u", "temporar", "y", "\\u", "xml", "\\u", "file_", "(_", "test\\u", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "validator", ".", "pack", "tool", "s", ".", "style", "checke", "r", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "test\\u", "file_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "response_", "._", "context_", "[_", "'", "form", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml", "\\u", "exception_", "=_", "response_", "._", "context_", "[_", "'", "xml", "\\u", "exception", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "response_", "._", "context_", "[_", "'", "results", "'_", "]_", "\\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_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "'", "validator", "/", "style", "checke", "r", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "template", " ", "care", "s", " ", "abo", "ut", " ", "this", " ", "keys_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "results_", "._", "keys_", "(_", ")_", ",_", "[_", "'", "validation", "\\u", "error", "s", "'_", ",_", "'", "meta", "'_", ",_", "'", "annot", "ation", "s", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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 ]
Unused local variable
tornadoweb/tornado/tornado/gen.py
[ { "content": "def _make_coroutine_wrapper(func, replace_callback):\n \"\"\"The inner workings of ``@gen.coroutine`` and ``@gen.engine``.\n\n The two decorators differ in their treatment of the ``callback``\n argument, so we cannot simply implement ``@engine`` in terms of\n ``@coroutine``.\n \"\"\"\n # On Python 3.5, set the coroutine flag on our generator, to allow it\n # to be used with 'await'.\n if hasattr(types, 'coroutine'):\n func = types.coroutine(func)\n\n @functools.wraps(func)\n def wrapper(*args, **kwargs):\n future = TracebackFuture()\n\n if replace_callback and 'callback' in kwargs:\n callback = kwargs.pop('callback')\n IOLoop.current().add_future(\n future, lambda future: callback(future.result()))\n\n try:\n result = func(*args, **kwargs)\n except (Return, StopIteration) as e:\n result = _value_from_stopiteration(e)\n except Exception:\n future.set_exc_info(sys.exc_info())\n return future\n else:\n if isinstance(result, GeneratorType):\n # Inline the first iteration of Runner.run. This lets us\n # avoid the cost of creating a Runner when the coroutine\n # never actually yields, which in turn allows us to\n # use \"optional\" coroutines in critical path code without\n # performance penalty for the synchronous case.\n try:\n orig_stack_contexts = stack_context._state.contexts\n yielded = next(result)\n if stack_context._state.contexts is not orig_stack_contexts:\n yielded = TracebackFuture()\n yielded.set_exception(\n stack_context.StackContextInconsistentError(\n 'stack_context inconsistency (probably caused '\n 'by yield within a \"with StackContext\" block)'))\n except (StopIteration, Return) as e:\n future.set_result(_value_from_stopiteration(e))\n except Exception:\n future.set_exc_info(sys.exc_info())\n else:\n Runner(result, future, yielded)\n try:\n return future\n finally:\n # Subtle memory optimization: if next() raised an exception,\n # the future's exc_info contains a traceback which\n # includes this stack frame. This creates a cycle,\n # which will be collected at the next full GC but has\n # been shown to greatly increase memory usage of\n # benchmarks (relative to the refcount-based scheme\n # used in the absence of cycles). We can avoid the\n # cycle by clearing the local variable after we return it.\n future = None\n future.set_result(result)\n return future\n return wrapper", "metadata": "root._make_coroutine_wrapper", "header": "['module', '___EOS___']", "index": 247 } ]
[ { "span": "future ", "start_line": 308, "start_column": 20, "end_line": 308, "end_column": 26 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "coroutine", "\\u", "wrapper_", "(_", "func_", ",_", "replace", "\\u", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "inner", " ", "working", "s", " ", "of", " ", "``", "@", "gen", ".", "coroutine", "``", " ", "and", " ", "``", "@", "gen", ".", "eng", "ine", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "two", " ", "decorat", "ors", " ", "differ", " ", "in", " ", "thei", "r", " ", "treatment", " ", "of", " ", "the", " ", "``", "callback", "``", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", ",", " ", "so", " ", "we", " ", "cann", "ot", " ", "simp", "ly", " ", "implement", " ", "``", "@", "eng", "ine", "``", " ", "in", " ", "term", "s", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "``", "@", "coroutine", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "Pyth", "on", " ", "3.5", ",", " ", "set", " ", "the", " ", "coroutine", " ", "flag", " ", "on", " ", "our", " ", "generat", "or", ",", " ", "to", " ", "allow", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "be", " ", "used", " ", "with", " ", "'", "await", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "types_", ",_", "'", "coroutine", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "func_", "=_", "types_", "._", "coroutine_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "functools_", "._", "wraps_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "wrapper_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "future_", "=_", "Trace", "back", "Future_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "replace", "\\u", "callback_", "and_", "'", "callback", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "=_", "kwargs_", "._", "pop_", "(_", "'", "callback", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IO", "Loop_", "._", "current_", "(_", ")_", "._", "add", "\\u", "future_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "future_", ",_", "lambda_", "future_", ":_", "callback_", "(_", "future_", "._", "result_", "(_", ")_", ")_", ")_", "\\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 ", " _", "result_", "=_", "func_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Return_", ",_", "Sto", "p", "Iteration_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "\\u", "value", "\\u", "from", "\\u", "stop", "iteration_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "future_", "._", "set\\u", "exc", "\\u", "info_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "future_", "\\u\\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_", "isinstance_", "(_", "result_", ",_", "Generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", "line", " ", "the", " ", "first", " ", "iterati", "on", " ", "of", " ", "Run", "ner", ".", "run", ".", " ", " ", "Thi", "s", " ", "lets", " ", "us_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avoid", " ", "the", " ", "cost", " ", "of", " ", "creati", "ng", " ", "a", " ", "Run", "ner", " ", "whe", "n", " ", "the", " ", "coroutine_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "neve", "r", " ", "actual", "ly", " ", "yield", "s", ",", " ", "whi", "ch", " ", "in", " ", "turn", " ", "allow", "s", " ", "us", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "\"", "option", "al", "\"", " ", "coroutine", "s", " ", "in", " ", "critic", "al", " ", "path", " ", "code", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "anc", "e", " ", "penalt", "y", " ", "for", " ", "the", " ", "synchron", "ous", " ", "case", "._", "\\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 ", " ", "_", "orig", "\\u", "stack", "\\u", "contexts_", "=_", "stack", "\\u", "context_", "._", "\\u", "state_", "._", "contexts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield", "ed_", "=_", "next_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stack", "\\u", "context_", "._", "\\u", "state_", "._", "contexts_", "is_", "not_", "orig", "\\u", "stack", "\\u", "contexts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield", "ed_", "=_", "Trace", "back", "Future_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield", "ed_", "._", "set\\u", "exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stack", "\\u", "context_", "._", "Stack", "Context", "Inco", "nsis", "tent", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stack", "\\u", "context", " ", "incon", "siste", "nc", "y", " ", "(", "probab", "ly", " ", "caus", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "by", " ", "yield", " ", "within", " ", "a", " ", "\"", "with", " ", "Stack", "Context", "\"", " ", "block", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Sto", "p", "Iteration_", ",_", "Return_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "future_", "._", "set\\u", "result_", "(_", "\\u", "value", "\\u", "from", "\\u", "stop", "iteration_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "future_", "._", "set\\u", "exc", "\\u", "info_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "Runner_", "(_", "result_", ",_", "future_", ",_", "yield", "ed_", ")_", "\\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_", "future_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Subt", "le", " ", "memory", " ", "optimization", ":", " ", "if", " ", "next", "()", " ", "raise", "d", " ", "an", " ", "exception", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "future", "'", "s", " ", "exc", "\\u", "info", " ", "contain", "s", " ", "a", " ", "traceback", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", "s", " ", "this", " ", "stack", " ", "frame", ".", " ", " ", "Thi", "s", " ", "create", "s", " ", "a", " ", "cycle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "will", " ", "be", " ", "collected", " ", "at", " ", "the", " ", "next", " ", "full", " ", "GC", " ", "but", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "shown", " ", "to", " ", "great", "ly", " ", "increase", " ", "memory", " ", "usage", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "benchmarks", " ", "(", "relative", " ", "to", " ", "the", " ", "refco", "unt", "-", "based", " ", "scheme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "in", " ", "the", " ", "absen", "ce", " ", "of", " ", "cycle", "s", ").", " ", " ", "We", " ", "can", " ", "avoid", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cycle", " ", "by", " ", "clear", "ing", " ", "the", " ", "local", " ", "variab", "le", " ", "after", " ", "we", " ", "return", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "future_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "future_", "._", "set\\u", "result_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "future_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\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, 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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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
amrdraz/kodr/app/brython/www/src/Lib/test/test_asyncore.py
[ { "content": " def test_compact_traceback(self):\n try:\n raise Exception(\"I don't like spam!\")\n except:\n real_t, real_v, real_tb = sys.exc_info()\n r = asyncore.compact_traceback()\n else:\n self.fail(\"Expected exception\")\n\n (f, function, line), t, v, info = r\n self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py')\n self.assertEqual(function, 'test_compact_traceback')\n self.assertEqual(t, real_t)\n self.assertEqual(v, real_v)\n self.assertEqual(info, '[%s|%s|%s]' % (f, function, line))", "metadata": "root.HelperFunctionTests.test_compact_traceback", "header": "['class', 'HelperFunctionTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 221 }, { "content": " def test_handle_error(self):\n\n class TestClient(BaseClient):\n def handle_write(self):\n 1.0 / 0\n def handle_error(self):\n self.flag = True\n try:\n raise\n except ZeroDivisionError:\n pass\n else:\n raise Exception(\"exception not raised\")\n\n server = BaseServer(self.family, self.addr)\n client = TestClient(self.family, server.address)\n self.loop_waiting_for_flag(client)", "metadata": "root.BaseTestAPI.test_handle_error", "header": "['class', 'BaseTestAPI', ':', '___EOS___']", "index": 689 } ]
[ { "span": "self.fail(\"Expected exception\")", "start_line": 228, "start_column": 12, "end_line": 228, "end_column": 43 }, { "span": "raise Exception(\"exception not raised\")", "start_line": 701, "start_column": 20, "end_line": 701, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Help", "er", "Function", "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", "compact", "\\u", "traceback_", "(_", "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 ", " _", "raise_", "Exception_", "(_", "\"", "I", " ", "don", "'", "t", " ", "like", " ", "spam", "!\"_", ")_", "\\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 ", " _", "real", "\\u", "t_", ",_", "real", "\\u", "v_", ",_", "real", "\\u", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "async", "ore_", "._", "compact", "\\u", "traceback_", "(_", ")_", "\\u\\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_", "(_", "\"", "Expect", "ed", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "(_", "f_", ",_", "function_", ",_", "line_", ")_", ",_", "t_", ",_", "v_", ",_", "info_", "=_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os_", "._", "path_", "._", "split_", "(_", "f_", ")_", "[_", "-_", "1_", "]_", ",_", "'", "test\\u", "async", "ore", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "function_", ",_", "'", "test\\u", "compact", "\\u", "traceback", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "t_", ",_", "real", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", ",_", "real", "\\u", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "info_", ",_", "'[", "%", "s", "|", "%", "s", "|", "%", "s", "]'_", "%_", "(_", "f_", ",_", "function_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Test", "API_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "handle", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Client_", "(_", "Base", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "handle", "\\u", "write_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "1.0_", "/_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "flag_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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_", "Zero", "Divis", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "\"", "exception", " ", "not", " ", "raise", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "=_", "Base", "Server_", "(_", "self_", "._", "family_", ",_", "self_", "._", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "Test", "Client_", "(_", "self_", "._", "family_", ",_", "server_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "loop", "\\u", "wait", "ing", "\\u", "for", "\\u", "flag_", "(_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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 ]
Variable defined multiple times
networkx/networkx/networkx/algorithms/tests/test_cycles.py
[ { "content": " def test_cycle_basis(self):\n G=self.G\n cy=networkx.cycle_basis(G,0)\n sort_cy= sorted( sorted(c) for c in cy )\n assert_equal(sort_cy, [[0,1,2,3],[0,1,6,7,8],[0,3,4,5]])\n cy=networkx.cycle_basis(G,1)\n sort_cy= sorted( sorted(c) for c in cy )\n assert_equal(sort_cy, [[0,1,2,3],[0,1,6,7,8],[0,3,4,5]])\n cy=networkx.cycle_basis(G,9)\n sort_cy= sorted( sorted(c) for c in cy )\n assert_equal(sort_cy, [[0,1,2,3],[0,1,6,7,8],[0,3,4,5]])\n # test disconnected graphs\n nx.add_cycle(G, \"ABC\")\n cy=networkx.cycle_basis(G,9)\n sort_cy= sorted(sorted(c) for c in cy[:-1]) + [sorted(cy[-1])]\n assert_equal(sort_cy, [[0,1,2,3],[0,1,6,7,8],[0,3,4,5],['A','B','C']])", "metadata": "root.TestCycles.test_cycle_basis", "header": "['class', 'TestCycles', ':', '___EOS___']", "index": 25 }, { "content": " @raises(nx.NetworkXNotImplemented)\n def test_cycle_basis(self):\n G=nx.DiGraph()\n cy=networkx.cycle_basis(G,0)", "metadata": "root.TestCycles.test_cycle_basis", "header": "['class', 'TestCycles', ':', '___EOS___']", "index": 42 }, { "content": " def test_multidigraph_ignore2(self):\n # Loop traversed an edge while ignoring its orientation.\n G = nx.MultiDiGraph([(0,1), (1,2), (1,2)])\n x = list(find_cycle(G, [0,1,2], orientation='ignore'))\n x_ = [(1,2,0,FORWARD), (1,2,1,REVERSE)]\n assert_equal(x, x_)", "metadata": "root.TestFindCycle.test_multidigraph_ignore2", "header": "['class', 'TestFindCycle', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": " def test_multidigraph_ignore2(self):\n # Node 2 doesn't need to be searched again from visited from 4.\n # The goal here is to cover the case when 2 to be researched from 4,\n # when 4 is visited from the first time (so we must make sure that 4\n # is not visited from 2, and hence, we respect the edge orientation).\n G = nx.MultiDiGraph([(0,1), (1,2), (2,3), (4,2)])\n assert_raises(nx.exception.NetworkXNoCycle,\n find_cycle, G, [0,1,2,3,4], orientation='original')", "metadata": "root.TestFindCycle.test_multidigraph_ignore2", "header": "['class', 'TestFindCycle', '(', 'object', ')', ':', '___EOS___']", "index": 199 } ]
[ { "span": "test_cycle_basis(", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 24 }, { "span": "test_multidigraph_ignore2(", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 33 } ]
[ { "span": "test_cycle_basis(", "start_line": 43, "start_column": 8, "end_line": 43, "end_column": 24 }, { "span": "test_multidigraph_ignore2(", "start_line": 199, "start_column": 8, "end_line": 199, "end_column": 33 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Cycle", "s_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cycle", "\\u", "basis_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "self_", "._", "G_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cy_", "=_", "networkx_", "._", "cycle", "\\u", "basis_", "(_", "G_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "cy_", "=_", "sorted_", "(_", "sorted_", "(_", "c_", ")_", "for_", "c_", "in_", "cy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "sort", "\\u", "cy_", ",_", "[_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "6_", ",_", "7_", ",_", "8_", "]_", ",_", "[_", "0_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cy_", "=_", "networkx_", "._", "cycle", "\\u", "basis_", "(_", "G_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "cy_", "=_", "sorted_", "(_", "sorted_", "(_", "c_", ")_", "for_", "c_", "in_", "cy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "sort", "\\u", "cy_", ",_", "[_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "6_", ",_", "7_", ",_", "8_", "]_", ",_", "[_", "0_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cy_", "=_", "networkx_", "._", "cycle", "\\u", "basis_", "(_", "G_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "cy_", "=_", "sorted_", "(_", "sorted_", "(_", "c_", ")_", "for_", "c_", "in_", "cy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "sort", "\\u", "cy_", ",_", "[_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "6_", ",_", "7_", ",_", "8_", "]_", ",_", "[_", "0_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "disconnected", " ", "graphs_", "\\u\\u\\uNL\\u\\u\\u_", "nx_", "._", "add", "\\u", "cycle_", "(_", "G_", ",_", "\"", "ABC", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cy_", "=_", "networkx_", "._", "cycle", "\\u", "basis_", "(_", "G_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "cy_", "=_", "sorted_", "(_", "sorted_", "(_", "c_", ")_", "for_", "c_", "in_", "cy_", "[_", ":_", "-_", "1_", "]_", ")_", "+_", "[_", "sorted_", "(_", "cy_", "[_", "-_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "sort", "\\u", "cy_", ",_", "[_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "[_", "0_", ",_", "1_", ",_", "6_", ",_", "7_", ",_", "8_", "]_", ",_", "[_", "0_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ",_", "[_", "'", "A", "'_", ",_", "'", "B", "'_", ",_", "'", "C", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cycle", "s_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "nx_", "._", "Network", "XN", "ot", "Implemented_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "cycle", "\\u", "basis_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Di", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cy_", "=_", "networkx_", "._", "cycle", "\\u", "basis_", "(_", "G_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "Cycle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multid", "igra", "ph", "\\u", "ignore", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Loop", " ", "traverse", "d", " ", "an", " ", "edge", " ", "whi", "le", " ", "ign", "orin", "g", " ", "its", " ", "orientation", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Multi", "Di", "Graph_", "(_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "1_", ",_", "2_", ")_", ",_", "(_", "1_", ",_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "list_", "(_", "find", "\\u", "cycle_", "(_", "G_", ",_", "[_", "0_", ",_", "1_", ",_", "2_", "]_", ",_", "orientation_", "=_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x\\u_", "=_", "[_", "(_", "1_", ",_", "2_", ",_", "0_", ",_", "FORWARD", "_", ")_", ",_", "(_", "1_", ",_", "2_", ",_", "1_", ",_", "REVERSE", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "x_", ",_", "x\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Fin", "d", "Cycle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multid", "igra", "ph", "\\u", "ignore", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Node", " ", "2", " ", "doe", "sn", "'", "t", " ", "need", " ", "to", " ", "be", " ", "searche", "d", " ", "again", " ", "from", " ", "visit", "ed", " ", "from", " ", "4._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "goal", " ", "here", " ", "is", " ", "to", " ", "cover", " ", "the", " ", "case", " ", "whe", "n", " ", "2", " ", "to", " ", "be", " ", "research", "ed", " ", "from", " ", "4", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "4", " ", "is", " ", "visit", "ed", " ", "from", " ", "the", " ", "first", " ", "time", " ", "(", "so", " ", "we", " ", "must", " ", "make", " ", "sure", " ", "tha", "t", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "not", " ", "visit", "ed", " ", "from", " ", "2", ",", " ", "and", " ", "hen", "ce", ",", " ", "we", " ", "respec", "t", " ", "the", " ", "edge", " ", "orientation", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "nx_", "._", "Multi", "Di", "Graph_", "(_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "1_", ",_", "2_", ")_", ",_", "(_", "2_", ",_", "3_", ")_", ",_", "(_", "4_", ",_", "2_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "nx_", "._", "exception_", "._", "Network", "XN", "o", "Cycle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "find", "\\u", "cycle_", ",_", "G_", ",_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ",_", "orientation_", "=_", "'", "original", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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,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, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
django-import-export/django-import-export/tests/core/tests/resources_tests.py
[ { "content": " def test_link_to_nonexistent_field(self):\n with self.assertRaises(FieldDoesNotExist) as cm:\n class BrokenBook1(resources.ModelResource):\n class Meta:\n model = Book\n fields = ('nonexistent__invalid',)\n self.assertEqual(\"Book.nonexistent: Book has no field named 'nonexistent'\",\n cm.exception.args[0])\n\n with self.assertRaises(FieldDoesNotExist) as cm:\n class BrokenBook2(resources.ModelResource):\n class Meta:\n model = Book\n fields = ('author__nonexistent',)\n self.assertEqual(\"Book.author.nonexistent: Author has no field named \"\n \"'nonexistent'\", cm.exception.args[0])", "metadata": "root.ModelResourceTest.test_link_to_nonexistent_field", "header": "['class', 'ModelResourceTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 502 }, { "content": " def test_link_to_nonrelation_field(self):\n with self.assertRaises(KeyError) as cm:\n class BrokenBook1(resources.ModelResource):\n class Meta:\n model = Book\n fields = ('published__invalid',)\n self.assertEqual(\"Book.published is not a relation\",\n cm.exception.args[0])\n\n with self.assertRaises(KeyError) as cm:\n class BrokenBook2(resources.ModelResource):\n class Meta:\n model = Book\n fields = ('author__name__invalid',)\n self.assertEqual(\"Book.author.name is not a relation\",\n cm.exception.args[0])", "metadata": "root.ModelResourceTest.test_link_to_nonrelation_field", "header": "['class', 'ModelResourceTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 519 } ]
[ { "span": "BrokenBook1(", "start_line": 504, "start_column": 18, "end_line": 504, "end_column": 29 }, { "span": "BrokenBook2(", "start_line": 512, "start_column": 18, "end_line": 512, "end_column": 29 }, { "span": "BrokenBook1(", "start_line": 521, "start_column": 18, "end_line": 521, "end_column": 29 }, { "span": "BrokenBook2(", "start_line": 529, "start_column": 18, "end_line": 529, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "link", "\\u", "to", "\\u", "nonexist", "ent", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Field", "Do", "es", "Not", "Exist_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Bro", "ken", "Boo", "k1_", "(_", "resources_", "._", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model_", "=_", "Book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "nonexist", "ent", "\\u\\u", "invalid", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Boo", "k", ".", "nonexist", "ent", ":", " ", "Boo", "k", " ", "has", " ", "no", " ", "field", " ", "named", " ", "'", "nonexist", "ent", "'\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cm_", "._", "exception_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Field", "Do", "es", "Not", "Exist_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Bro", "ken", "Boo", "k2_", "(_", "resources_", "._", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model_", "=_", "Book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "author", "\\u\\u", "nonexist", "ent", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Boo", "k", ".", "author", ".", "nonexist", "ent", ":", " ", "Author", " ", "has", " ", "no", " ", "field", " ", "named", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "nonexist", "ent", "'\"_", ",_", "cm_", "._", "exception_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Reso", "urc", "e", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "link", "\\u", "to", "\\u", "non", "relation", "\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Bro", "ken", "Boo", "k1_", "(_", "resources_", "._", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model_", "=_", "Book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "publi", "shed", "\\u\\u", "invalid", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Boo", "k", ".", "publi", "shed", " ", "is", " ", "not", " ", "a", " ", "relation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cm_", "._", "exception_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", "as_", "cm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Bro", "ken", "Boo", "k2_", "(_", "resources_", "._", "Model", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "model_", "=_", "Book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "author", "\\u\\u", "name", "\\u\\u", "invalid", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Boo", "k", ".", "author", ".", "name", " ", "is", " ", "not", " ", "a", " ", "relation", "\"_", ",_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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, 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 ]
Except block handles 'BaseException'
GeoscienceAustralia/agdc/src/stacker.py
[ { "content": " def __init__(self, source_datacube=None, default_tile_type_id=1):\n \"\"\"Constructor\n Arguments:\n source_datacube: Optional DataCube object whose connection and data will be shared\n tile_type_id: Optional tile_type_id value (defaults to 1)\n \"\"\"\n \n if source_datacube:\n # Copy values from source_datacube and then override command line args\n self.__dict__ = copy(source_datacube.__dict__)\n \n args = self.parse_args()\n # Set instance attributes for every value in command line arguments file\n for attribute_name in args.__dict__.keys():\n attribute_value = args.__dict__[attribute_name]\n self.__setattr__(attribute_name, attribute_value)\n\n else:\n DataCube.__init__(self) # Call inherited constructor\n \n if self.debug:\n console_handler.setLevel(logging.DEBUG)\n \n # Attempt to parse dates from command line arguments or config file\n try:\n self.default_tile_type_id = int(self.default_tile_type_id) \n except:\n self.default_tile_type_id = default_tile_type_id # Use function argument value if not in command-line args\n try:\n self.start_date = datetime.strptime(self.start_date, '%Y%m%d').date()\n except:\n try:\n self.start_date = datetime.strptime(self.start_date, '%d/%m/%Y').date()\n except:\n self.start_date = None \n try:\n self.end_date = datetime.strptime(self.end_date, '%Y%m%d').date()\n except:\n try:\n self.end_date = datetime.strptime(self.end_date, '%d/%m/%Y').date()\n except:\n self.end_date= None \n try:\n self.x_index = int(self.x_index) \n except:\n self.x_index = None\n try:\n self.y_index = int(self.y_index) \n except:\n self.y_index = None\n\n # Path/Row values to permit single-scene stacking\n try:\n self.path = int(self.path) \n except:\n self.path = None\n try:\n self.row = int(self.row) \n except:\n self.row = None\n \n # Other variables set from config file only - not used\n try:\n self.min_path = int(self.min_path) \n except:\n self.min_path = None\n try:\n self.max_path = int(self.max_path) \n except:\n self.max_path = None\n try:\n self.min_row = int(self.min_row) \n except:\n self.min_row = None\n try:\n self.max_row = int(self.max_row) \n except:\n self.max_row = None\n\n # Create nested dict for given lookup_scheme_name with levels keyed by:\n # tile_type_id, satellite_tag, sensor_name, level_name, band_tag\n band_lookup = BandLookup(self) # Don't bother initialising it - we only want the lookup dict\n self.band_lookup_dict = band_lookup.band_lookup_dict[self.band_lookup_scheme]", "metadata": "root.Stacker.__init__", "header": "['class', 'Stacker', '(', 'DataCube', ')', ':', '___EOS___']", "index": 138 } ]
[ { "span": "except:", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 15 }, { "span": "except:", "start_line": 168, "start_column": 8, "end_line": 168, "end_column": 15 }, { "span": "except:", "start_line": 171, "start_column": 12, "end_line": 171, "end_column": 19 }, { "span": "except:", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 15 }, { "span": "except:", "start_line": 178, "start_column": 12, "end_line": 178, "end_column": 19 }, { "span": "except:", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 15 }, { "span": "except:", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 15 }, { "span": "except:", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 15 }, { "span": "except:", "start_line": 196, "start_column": 8, "end_line": 196, "end_column": 15 }, { "span": "except:", "start_line": 202, "start_column": 8, "end_line": 202, "end_column": 15 }, { "span": "except:", "start_line": 206, "start_column": 8, "end_line": 206, "end_column": 15 }, { "span": "except:", "start_line": 210, "start_column": 8, "end_line": 210, "end_column": 15 }, { "span": "except:", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Stack", "er_", "(_", "Data", "Cube_", ")_", ":_", "\\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_", ",_", "source", "\\u", "datac", "ube", "_", "=_", "None_", ",_", "default", "\\u", "tile", "\\u", "type", "\\u", "id_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "source", "\\u", "datac", "ube", ":", " ", "Optio", "nal", " ", "Data", "Cub", "e", " ", "object", " ", "who", "se", " ", "connecti", "on", " ", "and", " ", "data", " ", "will", " ", "be", " ", "shared", "\\", "10", ";", " ", " ", " ", " ", "tile", "\\u", "type", "\\u", "id", ":", " ", "Optio", "nal", " ", "tile", "\\u", "type", "\\u", "id", " ", "value", " ", "(", "default", "s", " ", "to", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "source", "\\u", "datac", "ube", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "values", " ", "from", " ", "source", "\\u", "datac", "ube", " ", "and", " ", "then", " ", "override", " ", "command", " ", "line", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "=_", "copy_", "(_", "source", "\\u", "datac", "ube", "_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "self_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "instance", " ", "attribute", "s", " ", "for", " ", "every", " ", "value", " ", "in", " ", "command", " ", "line", " ", "argu", "ment", "s", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "attribute", "\\u", "name_", "in_", "args_", "._", "\\u\\u", "dict\\u\\u_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attribute", "\\u", "value_", "=_", "args_", "._", "\\u\\u", "dict\\u\\u_", "[_", "attribute", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "attribute", "\\u", "name_", ",_", "attribute", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Data", "Cube_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "#", " ", "Call", " ", "inherited", " ", "constructor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "console", "\\u", "handler_", "._", "set", "Level_", "(_", "logging_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "parse", " ", "dates", " ", "from", " ", "command", " ", "line", " ", "argu", "ment", "s", " ", "or", " ", "config", " ", "file_", "\\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_", "._", "default", "\\u", "tile", "\\u", "type", "\\u", "id_", "=_", "int_", "(_", "self_", "._", "default", "\\u", "tile", "\\u", "type", "\\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 ", " _", "self_", "._", "default", "\\u", "tile", "\\u", "type", "\\u", "id_", "=_", "default", "\\u", "tile", "\\u", "type", "\\u", "id_", "#", " ", "Us", "e", " ", "function", " ", "argu", "ment", " ", "value", " ", "if", " ", "not", " ", "in", " ", "command", "-", "line", " ", "args_", "\\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_", "._", "start", "\\u", "date_", "=_", "datetime_", "._", "strptime_", "(_", "self_", "._", "start", "\\u", "date_", ",_", "'%", "Y", "%", "m", "%", "d", "'_", ")_", "._", "date_", "(_", ")_", "\\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 ", " _", "self_", "._", "start", "\\u", "date_", "=_", "datetime_", "._", "strptime_", "(_", "self_", "._", "start", "\\u", "date_", ",_", "'%", "d", "/", "%", "m", "/", "%", "Y", "'_", ")_", "._", "date_", "(_", ")_", "\\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_", "._", "start", "\\u", "date_", "=_", "None_", "\\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_", "._", "end", "\\u", "date_", "=_", "datetime_", "._", "strptime_", "(_", "self_", "._", "end", "\\u", "date_", ",_", "'%", "Y", "%", "m", "%", "d", "'_", ")_", "._", "date_", "(_", ")_", "\\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 ", " _", "self_", "._", "end", "\\u", "date_", "=_", "datetime_", "._", "strptime_", "(_", "self_", "._", "end", "\\u", "date_", ",_", "'%", "d", "/", "%", "m", "/", "%", "Y", "'_", ")_", "._", "date_", "(_", ")_", "\\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_", "._", "end", "\\u", "date_", "=_", "None_", "\\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_", "._", "x", "\\u", "index_", "=_", "int_", "(_", "self_", "._", "x", "\\u", "index_", ")_", "\\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_", "._", "x", "\\u", "index_", "=_", "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 ", " _", "self_", "._", "y", "\\u", "index_", "=_", "int_", "(_", "self_", "._", "y", "\\u", "index_", ")_", "\\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_", "._", "y", "\\u", "index_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Path", "/", "Row", " ", "values", " ", "to", " ", "permit", " ", "single", "-", "scen", "e", " ", "stack", "ing_", "\\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_", "._", "path_", "=_", "int_", "(_", "self_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "path_", "=_", "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 ", " _", "self_", "._", "row_", "=_", "int_", "(_", "self_", "._", "row_", ")_", "\\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_", "._", "row_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", " ", "variab", "les", " ", "set", " ", "from", " ", "config", " ", "file", " ", "only", " ", "-", " ", "not", " ", "used_", "\\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_", "._", "min", "\\u", "path_", "=_", "int_", "(_", "self_", "._", "min", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "min", "\\u", "path_", "=_", "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 ", " _", "self_", "._", "max", "\\u", "path_", "=_", "int_", "(_", "self_", "._", "max", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "\\u", "path_", "=_", "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 ", " _", "self_", "._", "min", "\\u", "row_", "=_", "int_", "(_", "self_", "._", "min", "\\u", "row_", ")_", "\\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_", "._", "min", "\\u", "row_", "=_", "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 ", " _", "self_", "._", "max", "\\u", "row_", "=_", "int_", "(_", "self_", "._", "max", "\\u", "row_", ")_", "\\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_", "._", "max", "\\u", "row_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "nest", "ed", " ", "dict", " ", "for", " ", "give", "n", " ", "look", "up", "\\u", "sche", "me", "\\u", "name", " ", "with", " ", "level", "s", " ", "keyed", " ", "by", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tile", "\\u", "type", "\\u", "id", ",", " ", "satellite", "\\u", "tag", ",", " ", "sensor", "\\u", "name", ",", " ", "level", "\\u", "name", ",", " ", "band", "\\u", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "band", "\\u", "lookup_", "=_", "Band", "Lookup_", "(_", "self_", ")_", "#", " ", "Don", "'", "t", " ", "bot", "her", " ", "initiali", "sing", " ", "it", " ", "-", " ", "we", " ", "only", " ", "want", " ", "the", " ", "look", "up", " ", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "band", "\\u", "look", "up", "\\u", "dict_", "=_", "band", "\\u", "lookup_", "._", "band", "\\u", "look", "up", "\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
DexterInd/GrovePi/Projects/OLED_Weather Station/weather_station.py
[ { "content": "# Adapted from home_temp_hum_display.py\n'''\n\nThe MIT License (MIT)\n\nGrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.\nCopyright (C) 2015 Dexter Industries\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n'''\n\nfrom grovepi import *\nfrom grove_oled import *\n\nimport threading\n\ndht_sensor_port = 7 # Connect the DHt sensor to port 7\n\n#Start and initialize the OLED\noled_init()\noled_clearDisplay()\noled_setNormalDisplay()\noled_setVerticalMode()\ntime.sleep(.1)\n\n\n\n\n\nwhile True:\n try:\n # Get the temperature and Humidity from the DHT sensor\n [temp, hum] = dht(dht_sensor_port, 1)\n print((\"Temp =\", temp, \"C\\tHumidity =\", hum, \"%\"))\n t = str(temp)\n h = str(hum)\n\n #outside_thread = threading.Thread(target=update_outside_weather)\n #outside_thread.start()\n\n oled_setTextXY(0, 1) # Print \"INSIDE\" at line 1\n oled_putString(\"INSIDE\")\n\n oled_setTextXY(2, 0) # Print \"TEMP\" and the temperature in line 3\n oled_putString(\"Temp:\")\n oled_putString(t + \"C\")\n\n oled_setTextXY(3, 0) # Print \"HUM :\" and the humidity in line 4\n oled_putString(\"Hum :\")\n oled_putString(h + \"%\")\n\n #outside_thread.join()\n update_outside_weather()\n\n except (IOError, TypeError, Exception) as e:\n print((\"Error:\" + str(e)))\n finally:\n #outside_thread.join()\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_outside_weather(location='Bucharest,ro'):\n import pyowm # Do a 'sudo pip install pyowm' to get this module\n\n owm = pyowm.OWM()\n\n #forecast = owm.daily_forecast(location)\n\n observation = owm.weather_at_place(location)\n weather = observation.get_weather()\n\n return weather", "metadata": "root.get_outside_weather", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def update_outside_weather():\n # This uses OpenWeatherMap via the PyOWM module;\n # pywom module needs to be installed via pip,\n # see https://github.com/csparpa/pyowm\n weather = get_outside_weather()\n # by default location is Bucharest,ro; change it to your own\n\n oled_setTextXY(5, 1)\n oled_putString(\"OUTSIDE\")\n\n oled_setTextXY(7, 0)\n oled_putString(\"Temp:\")\n oled_putString(str(weather.get_temperature(\"celsius\")['temp']) + \"C\")\n\n oled_setTextXY(8, 0)\n oled_putString(\"Hum :\")\n oled_putString(str(weather.get_humidity()) + \"%\")\n\n oled_setTextXY(9, 0)\n oled_putString(\"Rain:\")\n\n rain = weather.get_rain()\n if len(rain) > 0:\n pass\n else:\n oled_putString(\"0%\")\n\n print((\"Weather: \", weather.get_temperature(\"celsius\")))\n print((\"Humidity: \", weather.get_humidity()))", "metadata": "root.update_outside_weather", "header": "['module', '___EOS___']", "index": 56 } ]
[ { "span": "import threading", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Adapt", "ed", " ", "from", " ", "home", "\\u", "temp", "\\u", "hum", "\\u", "display", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "\\", "10", ";", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")", "\\", "10", ";", "\\", "10", ";", "Gro", "ve", "Pi", " ", "for", " ", "the", " ", "Ras", "pbe", "rr", "y", " ", "Pi", ":", " ", "an", " ", "open", " ", "source", " ", "platform", " ", "for", " ", "connecti", "ng", " ", "Gro", "ve", " ", "Sensors", " ", "to", " ", "the", " ", "Ras", "pbe", "rr", "y", " ", "Pi", ".", "\\", "10", ";", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", " ", "De", "xter", " ", "Industr", "ies", "\\", "10", ";", "\\", "10", ";", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy", "\\", "10", ";", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "\\", "10", ";", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", "\\", "10", ";", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "\\", "10", ";", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", "\\", "10", ";", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", "\\", "10", ";", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", "\\", "10", ";", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", "\\", "10", ";", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "\\", "10", ";", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "\\", "10", ";", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", "\\", "10", ";", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", "\\", "10", ";", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gro", "ve", "pi_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gro", "ve", "\\u", "ole", "d_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dht", "\\u", "sensor", "\\u", "port_", "=_", "7_", "#", " ", "Connect", " ", "the", " ", "DH", "t", " ", "sensor", " ", "to", " ", "port", " ", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Start", " ", "and", " ", "initialize", " ", "the", " ", "OLE", "D_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "clear", "Display_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "set", "Normal", "Display_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "set", "Vertica", "l", "Mode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", ".1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tempe", "ratur", "e", " ", "and", " ", "Hum", "idi", "ty", " ", "from", " ", "the", " ", "DH", "T", " ", "sensor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "[_", "temp_", ",_", "hum", "_", "]_", "=_", "dht", "_", "(_", "dht", "\\u", "sensor", "\\u", "port_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "(_", "\"", "Temp", " ", "=\"_", ",_", "temp_", ",_", "\"", "C", "\\\\", "t", "Hum", "idi", "ty", " ", "=\"_", ",_", "hum", "_", ",_", "\"%\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "str_", "(_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "str_", "(_", "hum", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "outsi", "de", "\\u", "thread", " ", "=", " ", "thread", "ing", ".", "Thread", "(", "target", "=", "update", "\\u", "outsi", "de", "\\u", "wea", "ther", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "outsi", "de", "\\u", "thread", ".", "start", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "0_", ",_", "1_", ")_", "#", " ", "Print", " ", "\"", "INS", "IDE", "\"", " ", "at", " ", "line", " ", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "INS", "IDE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "2_", ",_", "0_", ")_", "#", " ", "Print", " ", "\"", "TEMP", "\"", " ", "and", " ", "the", " ", "tempe", "ratur", "e", " ", "in", " ", "line", " ", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "Temp", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "t_", "+_", "\"", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "3_", ",_", "0_", ")_", "#", " ", "Print", " ", "\"", "HUM", " ", ":\"", " ", "and", " ", "the", " ", "humid", "it", "y", " ", "in", " ", "line", " ", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "Hum", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "h_", "+_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "outsi", "de", "\\u", "thread", ".", "join", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "outsi", "de", "\\u", "weather_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "Type", "Error_", ",_", "Exception_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "(_", "\"", "Error", ":\"_", "+_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "outsi", "de", "\\u", "thread", ".", "join", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "outsi", "de", "\\u", "weather_", "(_", "location_", "=_", "'", "Bu", "char", "est", ",", "ro", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyo", "wm_", "#", " ", "Do", " ", "a", " ", "'", "sudo", " ", "pip", " ", "install", " ", "pyo", "wm", "'", " ", "to", " ", "get", " ", "this", " ", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ow", "m_", "=_", "pyo", "wm_", "._", "OW", "M_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "forecast", " ", "=", " ", "ow", "m", ".", "daily", "\\u", "forecast", "(", "location", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observation_", "=_", "ow", "m_", "._", "wea", "ther", "\\u", "at", "\\u", "place_", "(_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weather_", "=_", "observation_", "._", "get", "\\u", "weather_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "weather_", "\\u\\u\\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_", "update", "\\u", "outsi", "de", "\\u", "weather_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "use", "s", " ", "Open", "Wea", "ther", "Map", " ", "via", " ", "the", " ", "Py", "OW", "M", " ", "module", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyw", "om", " ", "module", " ", "need", "s", " ", "to", " ", "be", " ", "install", "ed", " ", "via", " ", "pip", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "https", "://", "git", "hub", ".", "com", "/", "csp", "arp", "a", "/", "pyo", "wm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "weather_", "=_", "get", "\\u", "outsi", "de", "\\u", "weather_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "by", " ", "default", " ", "location", " ", "is", " ", "Bu", "char", "est", ",", "ro", ";", " ", "change", " ", "it", " ", "to", " ", "your", " ", "own_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "5_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "OUT", "SIDE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "7_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "Temp", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "str_", "(_", "weather_", "._", "get", "\\u", "temperature_", "(_", "\"", "cel", "sius", "\"_", ")_", "[_", "'", "temp", "'_", "]_", ")_", "+_", "\"", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "8_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "Hum", " ", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "str_", "(_", "weather_", "._", "get", "\\u", "humidity_", "(_", ")_", ")_", "+_", "\"%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "d\\u", "set", "Text", "XY_", "(_", "9_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ole", "d\\u", "put", "String_", "(_", "\"", "Rain", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rain_", "=_", "weather_", "._", "get", "\\u", "rain_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "rain_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ole", "d\\u", "put", "String_", "(_", "\"", "0", "%\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "(_", "\"", "Wea", "ther", ":", " ", "\"_", ",_", "weather_", "._", "get", "\\u", "temperature_", "(_", "\"", "cel", "sius", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "(_", "\"", "Hum",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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 ]
Unused import
rlpy/rlpy/rlpy/__init__.py
[ { "content": "import rlpy.Agents\nimport rlpy.Tools\nimport rlpy.Domains\nimport rlpy.MDPSolvers\nimport rlpy.Experiments\nimport rlpy.Policies\nimport rlpy.Representations\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import rlpy.Agents", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 18 }, { "span": "import rlpy.Tools", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 17 }, { "span": "import rlpy.Domains", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 19 }, { "span": "import rlpy.MDPSolvers", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 22 }, { "span": "import rlpy.Experiments", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 23 }, { "span": "import rlpy.Policies", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 20 }, { "span": "import rlpy.Representations", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "rlp", "y_", "._", "Agent", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "Tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "Doma", "ins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "MD", "PS", "olve", "rs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "Experiment", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "Polic", "ies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rlp", "y_", "._", "Representation", "s_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 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, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1 ]
Unused import
sccn/SNAP/src/modules/Sample3.py
[ { "content": "from framework.latentmodule import LatentModule\nimport random\nimport time\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Main(LatentModule):\n", "metadata": "root.Main", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def __init__(self):\n LatentModule.__init__(self)\n \n # set defaults for some configurable parameters:\n self.speed = 2", "metadata": "root.Main.__init__", "header": "['class', 'Main', '(', 'LatentModule', ')', ':', '___EOS___']", "index": 5 }, { "content": " def run(self):\n self.write('In the next part, please hit the A key whenever the ball hits the ground!\\nSpace when ready.','space')\n watcher = self.watchfor_multiple_begin(['a'])\n \n vel = [self.speed,0] # velocity\n pos = [-0.7,0.7] # position\n \n ball = self.picture('ball.png',duration=10000,scale=0.03,pos=pos,block=False)\n now = time.time()\n t_end = now + 20\n while True:\n # calc amount of time passed\n dt = time.time() - now \n now = time.time()\n if now > t_end:\n break\n \n # move the ball\n pos[0] += vel[0] * dt\n pos[1] += vel[1] * dt\n ball.setPos(pos[0],0,pos[1])\n # decelerate the ball and apply gravity\n vel[0] = vel[0]*0.98**dt\n vel[1] = vel[1]*0.98**dt - 2*dt\n # bounce\n if abs(pos[0]) > base.getAspectRatio():\n vel[0] = abs(vel[0]) * (-1 if pos[0]>0 else +1)\n if abs(pos[1]) > 1:\n vel[1] = abs(vel[1]) * (-1 if pos[1]>0 else +1)\n \n self.sleep(0.01)\n ball.destroy()\n \n results = self.watchfor_multiple_end(watcher)\n self.write('You pressed the A key at the following times:\\n%s\\n. Press space to end the experiment.' % str(results['a']),'space')\n self.write('You have successfully completed the experiment!')", "metadata": "root.Main.run", "header": "['class', 'Main', '(', 'LatentModule', ')', ':', '___EOS___']", "index": 11 } ]
[ { "span": "import random", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "framework_", "._", "latent", "module_", "import_", "Late", "nt", "Module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\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_", "Main_", "(_", "Late", "nt", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Main_", "(_", "Late", "nt", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Late", "nt", "Module_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "default", "s", " ", "for", " ", "some", " ", "configurable", " ", "parameter", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "speed_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main_", "(_", "Late", "nt", "Module_", ")_", ":_", "\\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_", "._", "write_", "(_", "'", "In", " ", "the", " ", "next", " ", "part", ",", " ", "plea", "se", " ", "hit", " ", "the", " ", "A", " ", "key", " ", "whe", "neve", "r", " ", "the", " ", "bal", "l", " ", "hits", " ", "the", " ", "ground", "!\\\\", "n", "Spac", "e", " ", "whe", "n", " ", "read", "y", ".'_", ",_", "'", "space", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "watcher_", "=_", "self_", "._", "watch", "for", "\\u", "multiple", "\\u", "begin_", "(_", "[_", "'", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vel_", "=_", "[_", "self_", "._", "speed_", ",_", "0_", "]_", "#", " ", "velocity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "[_", "-_", "0.7_", ",_", "0.7_", "]_", "#", " ", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ball_", "=_", "self_", "._", "picture_", "(_", "'", "bal", "l", ".", "png", "'_", ",_", "duration_", "=_", "10000_", ",_", "scale_", "=_", "0.03_", ",_", "pos_", "=_", "pos_", ",_", "block_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "end_", "=_", "now_", "+_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "calc", " ", "amo", "unt", " ", "of", " ", "time", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "now_", ">_", "t", "\\u", "end_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "move", " ", "the", " ", "ball_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "[_", "0_", "]_", "+=_", "vel_", "[_", "0_", "]_", "*_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "[_", "1_", "]_", "+=_", "vel_", "[_", "1_", "]_", "*_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ball_", "._", "set", "Pos_", "(_", "pos_", "[_", "0_", "]_", ",_", "0_", ",_", "pos_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dece", "ler", "ate", " ", "the", " ", "bal", "l", " ", "and", " ", "appl", "y", " ", "gravity", "_", "\\u\\u\\uNL\\u\\u\\u_", "vel_", "[_", "0_", "]_", "=_", "vel_", "[_", "0_", "]_", "*_", "0.98", "_", "**_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vel_", "[_", "1_", "]_", "=_", "vel_", "[_", "1_", "]_", "*_", "0.98", "_", "**_", "dt_", "-_", "2_", "*_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bounce", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "abs_", "(_", "pos_", "[_", "0_", "]_", ")_", ">_", "base_", "._", "get", "Asp", "ect", "Ratio_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vel_", "[_", "0_", "]_", "=_", "abs_", "(_", "vel_", "[_", "0_", "]_", ")_", "*_", "(_", "-_", "1_", "if_", "pos_", "[_", "0_", "]_", ">_", "0_", "else_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "abs_", "(_", "pos_", "[_", "1_", "]_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vel_", "[_", "1_", "]_", "=_", "abs_", "(_", "vel_", "[_", "1_", "]_", ")_", "*_", "(_", "-_", "1_", "if_", "pos_", "[_", "1_", "]_", ">_", "0_", "else_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sleep_", "(_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ball_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "self_", "._", "watch", "for", "\\u", "multiple", "\\u", "end_", "(_", "watcher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "'", "You", " ", "presse", "d", " ", "the", " ", "A", " ", "key", " ", "at", " ", "the", " ", "follow", "ing", " ", "times", ":\\\\", "n", "%", "s", "\\\\", "n", ".", " ", "Press", " ", "space", " ", "to", " ", "end", " ", "the", " ", "experiment", ".'_", "%_", "str_", "(_", "results_", "[_", "'", "a", "'_", "]_", ")_", ",_", "'", "space", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "'", "You", " ", "have", " ", "success", "full", "y", " ", "complete", "d", " ", "the", " ", "experiment", "!'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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