query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
sequence
label_sequence
sequence
Except block handles 'BaseException'
enthought/pyface/pyface/ui/wx/grid/tests/simple_grid_model_test_case.py
[ { "content": "import unittest\n\ntry:\n from pyface.ui.wx.grid.api \\\n import GridRow, GridColumn, SimpleGridModel\nexcept ImportError:\n wx_available = False\nelse:\n wx_available = True\n\n\n\n\n#### EOF ######################################################################\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pyf", "ace_", "._", "ui_", "._", "wx_", "._", "grid_", "._", "api_", "import_", "Grid", "Row_", ",_", "Grid", "Column_", ",_", "Simple", "Grid", "Model_", "\\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 ", " _", "wx", "\\u", "available_", "=_", "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 ", " _", "wx", "\\u", "available_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "EO", "F", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
scikit-learn/scikit-learn/sklearn/isotonic.py
[ { "content": " def __setstate__(self, state):\n \"\"\"Pickle-protocol - set state of the estimator.\n\n We need to rebuild the interpolation function.\n \"\"\"\n self.__dict__.update(state)\n if hasattr(self, '_necessary_X_') and hasattr(self, '_necessary_y_'):\n self._build_f(self._necessary_X_, self._necessary_y_)", "metadata": "root.IsotonicRegression.__setstate__", "header": "['class', 'IsotonicRegression', '(', 'BaseEstimator', ',', 'TransformerMixin', ',', 'RegressorMixin', ')', ':', '___EOS___']", "index": 425 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Iso", "toni", "c", "Regression_", "(_", "Base", "Estimator_", ",_", "Transform", "er", "Mixin_", ",_", "Regr", "esso", "r", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pickl", "e-", "protoc", "ol", " ", "-", " ", "set", " ", "state", " ", "of", " ", "the", " ", "esti", "mat", "or", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "need", " ", "to", " ", "rebu", "ild", " ", "the", " ", "interpolati", "on", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'\\u", "necessar", "y", "\\u", "X", "\\u'_", ")_", "and_", "hasattr_", "(_", "self_", ",_", "'\\u", "necessar", "y", "\\u", "y", "\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "build", "\\u", "f_", "(_", "self_", "._", "\\u", "necessar", "y", "\\u", "X", "\\u_", ",_", "self_", "._", "\\u", "necessar", "y", "\\u", "y\\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 ]
Unused import
francelabs/datafari/windows/python/Lib/ctypes/test/test_checkretval.py
[ { "content": "import unittest\n\nfrom ctypes import *\nfrom ctypes.test import need_symbol\n\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CHECKED(c_int):\n _check_retval_ = staticmethod(_check_retval_)", "metadata": "root.CHECKED", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def _check_retval_(value):\n # Receives a CHECKED instance.\n return str(value.value)", "metadata": "root.CHECKED._check_retval_", "header": "['class', 'CHECKED', '(', 'c_int', ')', ':', '___EOS___']", "index": 6 }, { "content": "class Test(unittest.TestCase):\n\n", "metadata": "root.Test", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def test_checkretval(self):\n\n import _ctypes_test\n dll = CDLL(_ctypes_test.__file__)\n self.assertEqual(42, dll._testfunc_p_p(42))\n\n dll._testfunc_p_p.restype = CHECKED\n self.assertEqual(\"42\", dll._testfunc_p_p(42))\n\n dll._testfunc_p_p.restype = None\n self.assertEqual(None, dll._testfunc_p_p(42))\n\n del dll._testfunc_p_p.restype\n self.assertEqual(42, dll._testfunc_p_p(42))", "metadata": "root.Test.test_checkretval", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " @need_symbol('oledll')\n def test_oledll(self):\n self.assertRaises(WindowsError,\n oledll.oleaut32.CreateTypeLib2,\n 0, None, None)", "metadata": "root.Test.test_oledll", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 28 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "._", "test_", "import_", "need", "\\u", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "CHECK", "ED_", "(_", "c\\u", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "check", "\\u", "ret", "val", "\\u_", "=_", "staticmethod_", "(_", "\\u", "check", "\\u", "ret", "val", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CHECK", "ED_", "(_", "c\\u", "int_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "check", "\\u", "ret", "val", "\\u_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Receive", "s", " ", "a", " ", "CHECK", "ED", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "value_", "._", "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_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "check", "retval_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u", "ctype", "s", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dll_", "=_", "CD", "LL_", "(_", "\\u", "ctype", "s", "\\u", "test_", "._", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "42_", ",_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "(_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "._", "restype_", "=_", "CHECK", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "4", "2", "\"_", ",_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "(_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "(_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "._", "restype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "42_", ",_", "dll_", "._", "\\u", "testf", "unc", "\\u", "p", "\\u", "p_", "(_", "42_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "need", "\\u", "symbol_", "(_", "'", "ole", "dll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ole", "dll_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Window", "s", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ole", "dll_", "._", "ole", "aut", "32_", "._", "Creat", "e", "Type", "Lib", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "None_", ",_", "None_", ")_", "\\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, 4, 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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args):\n \"\"\"\n :param f: Function to check gradient for\n :param df: Gradient of function to check\n :param x0:\n Initial guess for inputs x (if it has a shape (a,b) this will be reflected in the parameter names).\n Can be a list of arrays, if takes a list of arrays. This list will be passed\n to f and df in the same order as given here.\n If only one argument, make sure not to pass a list!!!\n\n :type x0: [array-like] | array-like | float | int\n :param names:\n Names to print, when performing gradcheck. If a list was passed to x0\n a list of names with the same length is expected.\n :param args: Arguments passed as f(x, *args, **kwargs) and df(x, *args, **kwargs)\n\n Examples:\n ---------\n from GPy.models import GradientChecker\n N, M, Q = 10, 5, 3\n\n Sinusoid:\n\n X = numpy.random.rand(N, Q)\n grad = GradientChecker(numpy.sin,numpy.cos,X,'x')\n grad.checkgrad(verbose=1)\n\n Using GPy:\n\n X, Z = numpy.random.randn(N,Q), numpy.random.randn(M,Q)\n kern = GPy.kern.linear(Q, ARD=True) + GPy.kern.rbf(Q, ARD=True)\n grad = GradientChecker(kern.K,\n lambda x: 2*kern.dK_dX(numpy.ones((1,1)), x),\n x0 = X.copy(),\n names='X')\n grad.checkgrad(verbose=1)\n grad.randomize()\n grad.checkgrad(verbose=1)\n \"\"\"\n super(GradientChecker, self).__init__(name='GradientChecker')\n if isinstance(x0, (list, tuple)) and names is None:\n self.shapes = [get_shape(xi) for xi in x0]\n self.names = ['X{i}'.format(i=i) for i in range(len(x0))]\n elif isinstance(x0, (list, tuple)) and names is not None:\n self.shapes = [get_shape(xi) for xi in x0]\n self.names = names\n elif names is None:\n self.names = ['X']\n self.shapes = [get_shape(x0)]\n else:\n self.names = names\n self.shapes = [get_shape(x0)]\n\n for name, xi in zip(self.names, at_least_one_element(x0)):\n self.__setattr__(name, Param(name, xi))\n self.link_parameter(self.__getattribute__(name))\n# self._param_names = []\n# for name, shape in zip(self.names, self.shapes):\n# self._param_names.extend(map(lambda nameshape: ('_'.join(nameshape)).strip('_'), itertools.izip(itertools.repeat(name), itertools.imap(lambda t: '_'.join(map(str, t)), itertools.product(*map(lambda xi: range(xi), shape))))))\n self.args = args\n self.kwargs = kwargs\n self.f = f\n self.df = df", "metadata": "root.GradientChecker.__init__", "header": "['class', 'GradientChecker', '(', 'Model', ')', ':', '___EOS___']", "index": 25 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Grad", "ient", "Checker_", "(_", "Model_", ")_", ":_", "\\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_", ",_", "f_", ",_", "df_", ",_", "x0_", ",_", "names_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "f", ":", " ", "Function", " ", "to", " ", "check", " ", "gradi", "ent", " ", "for", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "df", ":", " ", "Grad", "ient", " ", "of", " ", "function", " ", "to", " ", "check", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "x0", ":", "\\", "10", ";", " ", " ", " ", " ", "Initial", " ", "guess", " ", "for", " ", "inputs", " ", "x", " ", "(", "if", " ", "it", " ", "has", " ", "a", " ", "shape", " ", "(", "a", ",", "b", ")", " ", "this", " ", "will", " ", "be", " ", "reflect", "ed", " ", "in", " ", "the", " ", "parameter", " ", "names", ").", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "be", " ", "a", " ", "list", " ", "of", " ", "arrays", ",", " ", "if", " ", "take", "s", " ", "a", " ", "list", " ", "of", " ", "arrays", ".", " ", "Thi", "s", " ", "list", " ", "will", " ", "be", " ", "pass", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "f", " ", "and", " ", "df", " ", "in", " ", "the", " ", "same", " ", "order", " ", "as", " ", "give", "n", " ", "here", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "only", " ", "one", " ", "argu", "ment", ",", " ", "make", " ", "sure", " ", "not", " ", "to", " ", "pass", " ", "a", " ", "list", "!!!", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "x0", ":", " ", "[", "array", "-", "like", "]", " ", "|", " ", "array", "-", "like", " ", "|", " ", "float", " ", "|", " ", "int", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "names", ":", "\\", "10", ";", " ", " ", " ", " ", "Names", " ", "to", " ", "print", ",", " ", "whe", "n", " ", "perform", "ing", " ", "grad", "check", ".", " ", "If", " ", "a", " ", "list", " ", "was", " ", "pass", "ed", " ", "to", " ", "x0", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "list", " ", "of", " ", "names", " ", "with", " ", "the", " ", "same", " ", "length", " ", "is", " ", "expected", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "Arg", "ument", "s", " ", "pass", "ed", " ", "as", " ", "f", "(", "x", ",", " ", "*", "args", ",", " ", "**", "kwarg", "s", ")", " ", "and", " ", "df", "(", "x", ",", " ", "*", "args", ",", " ", "**", "kwarg", "s", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", ":", "\\", "10", ";", " ", " ", " ", " ", "---------", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "GP", "y", ".", "model", "s", " ", "import", " ", "Grad", "ient", "Check", "er", "\\", "10", ";", " ", " ", " ", " ", "N", ",", " ", "M", ",", " ", "Q", " ", "=", " ", "10", ",", " ", "5", ",", " ", "3", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sin", "uso", "id", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "X", " ", "=", " ", "nump", "y", ".", "random", ".", "rand", "(", "N", ",", " ", "Q", ")", "\\", "10", ";", " ", " ", " ", " ", "grad", " ", "=", " ", "Grad", "ient", "Check", "er", "(", "nump", "y", ".", "sin", ",", "nump", "y", ".", "cos", ",", "X", ",'", "x", "')", "\\", "10", ";", " ", " ", " ", " ", "grad", ".", "check", "grad", "(", "verbo", "se", "=", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "ing", " ", "GP", "y", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "X", ",", " ", "Z", " ", "=", " ", "nump", "y", ".", "random", ".", "rand", "n", "(", "N", ",", "Q", "),", " ", "nump", "y", ".", "random", ".", "rand", "n", "(", "M", ",", "Q", ")", "\\", "10", ";", " ", " ", " ", " ", "kern", " ", "=", " ", "GP", "y", ".", "kern", ".", "linear", "(", "Q", ",", " ", "ARD", "=", "Tru", "e", ")", " ", "+", " ", "GP", "y", ".", "kern", ".", "rbf", "(", "Q", ",", " ", "ARD", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "grad", " ", "=", " ", "Grad", "ient", "Check", "er", "(", "kern", ".", "K", ",", "\\", "10", ";", " ", " ", " ", "lambda", " ", "x", ":", " ", "2", "*", "kern", ".", "d", "K", "\\u", "d", "X", "(", "nump", "y", ".", "ones", "((", "1", ",", "1", "))", ",", " ", "x", "),", "\\", "10", ";", " ", " ", " ", "x0", " ", "=", " ", "X", ".", "copy", "()", ",", "\\", "10", ";", " ", " ", " ", "names", "='", "X", "')", "\\", "10", ";", " ", " ", " ", " ", "grad", ".", "check", "grad", "(", "verbo", "se", "=", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "grad", ".", "randomize", "()", "\\", "10", ";", " ", " ", " ", " ", "grad", ".", "check", "grad", "(", "verbo", "se", "=", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Grad", "ient", "Checker_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", "=_", "'", "Grad", "ient", "Check", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "x0_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "names_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shapes_", "=_", "[_", "get", "\\u", "shape_", "(_", "xi_", ")_", "for_", "xi_", "in_", "x0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "names_", "=_", "[_", "'", "X", "{", "i", "}'_", "._", "format_", "(_", "i_", "=_", "i_", ")_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "x0_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "x0_", ",_", "(_", "list_", ",_", "tuple_", ")_", ")_", "and_", "names_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shapes_", "=_", "[_", "get", "\\u", "shape_", "(_", "xi_", ")_", "for_", "xi_", "in_", "x0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "names_", "=_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "names_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "names_", "=_", "[_", "'", "X", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shapes_", "=_", "[_", "get", "\\u", "shape_", "(_", "x0_", ")_", "]_", "\\u\\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_", "._", "names_", "=_", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shapes_", "=_", "[_", "get", "\\u", "shape_", "(_", "x0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", ",_", "xi_", "in_", "zip_", "(_", "self_", "._", "names_", ",_", "at", "\\u", "leas", "t", "\\u", "one", "\\u", "element_", "(_", "x0_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "name_", ",_", "Param_", "(_", "name_", ",_", "xi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "link", "\\u", "parameter_", "(_", "self_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".\\u", "param", "\\u", "names", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "for", " ", "name", ",", " ", "shape", " ", "in", " ", "zip", "(", "self", ".", "names", ",", " ", "self", ".", "shape", "s", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".\\u", "param", "\\u", "names", ".", "extend", "(", "map", "(", "lambda", " ", "names", "hap", "e", ":", " ", "('\\", "u", "'.", "join", "(", "names", "hap", "e", "))", ".", "strip", "('\\", "u", "')", ",", " ", "iter", "tool", "s", ".", "izi", "p", "(", "iter", "tool", "s", ".", "repeat", "(", "name", "),", " ", "iter", "tool", "s", ".", "imap", "(", "lambda", " ", "t", ":", " ", "'\\u", "'.", "join", "(", "map", "(", "str", ",", " ", "t", "))", ",", " ", "iter", "tool", "s", ".", "product", "(*", "map", "(", "lambda", " ", "xi", ":", " ", "range", "(", "xi", "),", " ", "shape", ")))))", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nlloyd/SubliminalCollaborator/libs/twisted/plugins/twisted_news.py
[ { "content": "# Copyright (c) Twisted Matrix Laboratories.\n# See LICENSE for details.\n\nfrom twisted.application.service import ServiceMaker\n\nTwistedNews = ServiceMaker(\n \"Twisted News\",\n \"twisted.news.tap\",\n \"A news server.\",\n \"news\")\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "application_", "._", "service_", "import_", "Service", "Maker_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Twi", "sted", "News", "_", "=_", "Service", "Maker_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Twi", "sted", " ", "News", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twist", "ed", ".", "news", ".", "tap", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "A", " ", "news", " ", "server", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "news", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cpfair/tapiriik/tapiriik/testing/sync.py
[ { "content": "from tapiriik.testing.testtools import TestTools, TapiriikTestCase\n\nfrom tapiriik.sync import SynchronizationTask\nfrom tapiriik.sync.activity_record import ActivityRecord\nfrom tapiriik.services import UserException, UserExceptionType\nfrom tapiriik.services.api import APIExcludeActivity\nfrom tapiriik.services.interchange import Activity, ActivityType\nfrom tapiriik.auth import User\n\nfrom datetime import datetime, timedelta, tzinfo\nimport pytz\nimport copy\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UTC(tzinfo):\n \"\"\"UTC\"\"\"\n\n\n", "metadata": "root.UTC", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def utcoffset(self, dt):\n return timedelta(0)", "metadata": "root.UTC.utcoffset", "header": "['class', 'UTC', '(', 'tzinfo', ')', ':', '___EOS___']", "index": 17 }, { "content": " def tzname(self, dt):\n return \"UTC\"", "metadata": "root.UTC.tzname", "header": "['class', 'UTC', '(', 'tzinfo', ')', ':', '___EOS___']", "index": 20 }, { "content": " def dst(self, dt):\n return timedelta(0)", "metadata": "root.UTC.dst", "header": "['class', 'UTC', '(', 'tzinfo', ')', ':', '___EOS___']", "index": 23 }, { "content": "class SyncTests(TapiriikTestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SyncTests", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def test_svc_level_dupe(self):\n ''' check that service-level duplicate activities are caught (no DB involvement) '''\n\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n\n actA = Activity()\n actA.StartTime = datetime(1, 2, 3, 4, 5, 6, 7)\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actB = Activity()\n actB.StartTime = actA.StartTime\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n self.assertEqual(len(s._activities), 1)", "metadata": "root.SyncTests.test_svc_level_dupe", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_svc_level_dupe_tz_uniform(self):\n ''' check that service-level duplicate activities with the same TZs are caught '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = Activity()\n actA.StartTime = pytz.timezone(\"America/Denver\").localize(datetime(1, 2, 3, 4, 5, 6, 7))\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actB = Activity()\n actB.StartTime = actA.StartTime\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n self.assertEqual(len(s._activities), 1)", "metadata": "root.SyncTests.test_svc_level_dupe_tz_uniform", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_svc_level_dupe_tz_nonuniform(self):\n ''' check that service-level duplicate activities with non-uniform TZs are caught '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = Activity()\n actA.StartTime = datetime(1, 2, 3, 4, 5, 6, 7)\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actB = Activity()\n actB.StartTime = pytz.timezone(\"America/Denver\").localize(actA.StartTime)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n self.assertEqual(len(s._activities), 1)", "metadata": "root.SyncTests.test_svc_level_dupe_tz_nonuniform", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_svc_level_dupe_tz_irregular(self):\n ''' check that service-level duplicate activities with irregular TZs are caught '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = Activity()\n actA.StartTime = pytz.timezone(\"America/Edmonton\").localize(datetime(1, 2, 3, 4, 5, 6, 7))\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actB = Activity()\n actB.StartTime = actA.StartTime.astimezone(pytz.timezone(\"America/Iqaluit\"))\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n self.assertEqual(len(s._activities), 1)", "metadata": "root.SyncTests.test_svc_level_dupe_tz_irregular", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_svc_level_dupe_time_leeway(self):\n ''' check that service-level duplicate activities within the defined time leeway are caught '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = Activity()\n actA.StartTime = datetime(1, 2, 3, 4, 5, 6, 7)\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actA.Type = set(svcA.SupportedActivities).intersection(set(svcB.SupportedActivities)).pop()\n actB = Activity()\n actB.StartTime = datetime(1, 2, 3, 4, 6, 6, 7)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n actB.Type = actA.Type\n\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n self.assertIn(actA.UID, actA.UIDs)\n self.assertIn(actB.UID, actA.UIDs)\n self.assertIn(actA.UID, actB.UIDs)\n self.assertIn(actB.UID, actB.UIDs)\n\n # we need to fake up the service records to avoid having to call the actual sync method where these values are normally preset\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n recA.SynchronizedActivities = [actA.UID]\n recB.SynchronizedActivities = [actB.UID]\n\n s._serviceConnections = [recA, recB]\n recipientServicesA = s._determineRecipientServices(actA)\n recipientServicesB = s._determineRecipientServices(actB)\n\n self.assertEqual(len(recipientServicesA), 0)\n self.assertEqual(len(recipientServicesB), 0)\n self.assertEqual(len(s._activities), 1)", "metadata": "root.SyncTests.test_svc_level_dupe_time_leeway", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 120 }, { "content": " def test_svc_supported_activity_types(self):\n ''' check that only activities are only sent to services which support them '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n svcA.SupportedActivities = [ActivityType.CrossCountrySkiing]\n svcB.SupportedActivities = [ActivityType.Cycling]\n\n actA = Activity()\n actA.StartTime = datetime(1, 2, 3, 4, 5, 6, 7)\n actA.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n actA.Type = svcA.SupportedActivities[0]\n actA.CalculateUID()\n actA.UIDs = set([actA.UID])\n actA.Record = ActivityRecord.FromActivity(actA)\n\n actB = Activity()\n actB.StartTime = datetime(5, 6, 7, 8, 9, 10, 11)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n actB.Type = [x for x in svcB.SupportedActivities if x != actA.Type][0]\n actB.CalculateUID()\n actB.UIDs = set([actB.UID])\n actB.Record = ActivityRecord.FromActivity(actB)\n\n s = SynchronizationTask(None)\n s._serviceConnections = [recA, recB]\n s._activities = []\n s._accumulateActivities(recA, [actA])\n s._accumulateActivities(recB, [actB])\n\n syncToA = s._determineRecipientServices(actA)\n syncToB = s._determineRecipientServices(actB)\n\n self.assertEqual(len(syncToA), 0)\n self.assertEqual(len(syncToB), 0)\n\n svcB.SupportedActivities = svcA.SupportedActivities\n\n syncToA = s._determineRecipientServices(actA)\n syncToB = s._determineRecipientServices(actB)\n\n self.assertEqual(len(syncToA), 1)\n self.assertEqual(len(syncToB), 0)\n\n svcB.SupportedActivities = svcA.SupportedActivities = [ActivityType.CrossCountrySkiing, ActivityType.Cycling]\n\n syncToA = s._determineRecipientServices(actA)\n syncToB = s._determineRecipientServices(actB)\n\n self.assertEqual(len(syncToA), 1)\n self.assertEqual(len(syncToB), 1)", "metadata": "root.SyncTests.test_svc_supported_activity_types", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 161 }, { "content": " def test_accumulate_exclusions(self):\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n\n # regular\n s = SynchronizationTask(None)\n s._syncExclusions = {recA._id: {}}\n exc = APIExcludeActivity(\"Messag!e\", activity_id=3.14)\n s._accumulateExclusions(recA, exc)\n exclusionstore = s._syncExclusions\n self.assertTrue(\"3_14\" in exclusionstore[recA._id])\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"Message\"], \"Messag!e\")\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"Activity\"], None)\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"ExternalActivityID\"], 3.14)\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"Permanent\"], True)\n\n # updating\n act = TestTools.create_blank_activity(svcA)\n act.UID = \"3_14\" # meh\n exc = APIExcludeActivity(\"Messag!e2\", activity_id=42, permanent=False, activity=act)\n s = SynchronizationTask(None)\n s._syncExclusions = {recA._id: {}}\n s._accumulateExclusions(recA, exc)\n exclusionstore = s._syncExclusions\n self.assertTrue(\"3_14\" in exclusionstore[recA._id])\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"Message\"], \"Messag!e2\")\n self.assertNotEqual(exclusionstore[recA._id][\"3_14\"][\"Activity\"], None) # Who knows what the string format will be down the road?\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"ExternalActivityID\"], 42)\n self.assertEqual(exclusionstore[recA._id][\"3_14\"][\"Permanent\"], False)\n\n # multiple, retaining existing\n exc2 = APIExcludeActivity(\"INM\", activity_id=13)\n exc3 = APIExcludeActivity(\"FNIM\", activity_id=37)\n s._accumulateExclusions(recA, [exc2, exc3])\n exclusionstore = s._syncExclusions\n self.assertTrue(\"3_14\" in exclusionstore[recA._id])\n self.assertTrue(\"37\" in exclusionstore[recA._id])\n self.assertTrue(\"13\" in exclusionstore[recA._id])\n\n # don't allow with no identifiers\n exc4 = APIExcludeActivity(\"nooooo\")\n s = SynchronizationTask(None)\n s._syncExclusions = {}\n self.assertRaises(ValueError, s._accumulateExclusions, recA, [exc4])", "metadata": "root.SyncTests.test_accumulate_exclusions", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " def test_activity_deduplicate_normaltz(self):\n ''' ensure that we can't deduplicate activities with non-pytz timezones '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = TestTools.create_random_activity(svcA, tz=UTC())\n\n actB = Activity()\n actB.StartTime = actA.StartTime.replace(tzinfo=None) + timedelta(seconds=10)\n actB.EndTime = actA.EndTime.replace(tzinfo=None)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB, record=recB)\n actA.Name = \"Not this\"\n actB.Name = \"Heya\"\n actB.Type = ActivityType.Walking\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n self.assertRaises(ValueError, s._accumulateActivities, recA, [copy.deepcopy(actA)])", "metadata": "root.SyncTests.test_activity_deduplicate_normaltz", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def test_activity_deduplicate_tzerror(self):\n ''' Test that probably-duplicate activities with starttimes like 09:12:22 and 15:12:22 (on the same day) are recognized as one '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = TestTools.create_random_activity(svcA, tz=pytz.timezone(\"America/Iqaluit\"))\n actB = Activity()\n actB.StartTime = actA.StartTime.replace(tzinfo=pytz.timezone(\"America/Denver\")) + timedelta(hours=5)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB)\n actA.Name = \"Not this\"\n actB.Name = \"Heya\"\n actB.Type = ActivityType.Walking\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n\n self.assertEqual(len(s._activities), 1)\n\n # Ensure that it is deduplicated on non-exact match\n actB.StartTime = actA.StartTime.replace(tzinfo=pytz.timezone(\"America/Denver\")) + timedelta(hours=5, seconds=1)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n\n self.assertEqual(len(s._activities), 1)\n\n # Ensure that it is *not* deduplicated when it really doesn't match\n actB.StartTime = actA.StartTime.replace(tzinfo=pytz.timezone(\"America/Denver\")) + timedelta(hours=5, minutes=7)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n\n self.assertEqual(len(s._activities), 2)\n\n # Ensure that overly large differences >38hr - not possible via TZ differences & shamefully bad import/export code on the part of some services - are not deduplicated\n actB.StartTime = actA.StartTime.replace(tzinfo=pytz.timezone(\"America/Denver\")) + timedelta(hours=50)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n\n self.assertEqual(len(s._activities), 2)", "metadata": "root.SyncTests.test_activity_deduplicate_tzerror", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 280 }, { "content": " def test_activity_coalesce(self):\n ''' ensure that activity data is getting coalesced by _accumulateActivities '''\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n actA = TestTools.create_random_activity(svcA, tz=pytz.timezone(\"America/Iqaluit\"))\n actB = Activity()\n actB.StartTime = actA.StartTime.replace(tzinfo=None)\n actB.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcB)\n actA.Name = \"Not this\"\n actA.Private = True\n actB.Name = \"Heya\"\n actB.Type = ActivityType.Walking\n actA.CalculateUID()\n actB.CalculateUID()\n\n s = SynchronizationTask(None)\n s._activities = []\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n\n self.assertEqual(len(s._activities), 1)\n act = s._activities[0]\n\n self.assertEqual(act.StartTime, actA.StartTime)\n self.assertEqual(act.EndTime, actA.EndTime)\n self.assertEqual(act.EndTime.tzinfo, actA.StartTime.tzinfo)\n self.assertEqual(act.StartTime.tzinfo, actA.StartTime.tzinfo)\n self.assertLapsListsEqual(act.Laps, actA.Laps)\n self.assertTrue(act.Private) # Most restrictive setting\n self.assertEqual(act.Name, actB.Name) # The first activity takes priority.\n self.assertEqual(act.Type, actB.Type) # Same here.\n self.assertTrue(list(actB.ServiceDataCollection.keys())[0] in act.ServiceDataCollection)\n self.assertTrue(list(actA.ServiceDataCollection.keys())[0] in act.ServiceDataCollection)\n\n s._activities = []\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n\n self.assertEqual(len(s._activities), 1)\n act = s._activities[0]\n\n self.assertEqual(act.StartTime, actA.StartTime)\n self.assertEqual(act.EndTime, actA.EndTime)\n self.assertEqual(act.EndTime.tzinfo, actA.StartTime.tzinfo)\n self.assertEqual(act.StartTime.tzinfo, actA.StartTime.tzinfo)\n self.assertLapsListsEqual(act.Laps, actA.Laps)\n self.assertEqual(act.Name, actA.Name) # The first activity takes priority.\n self.assertEqual(act.Type, actB.Type) # Exception: ActivityType.Other does not take priority\n self.assertTrue(list(actB.ServiceDataCollection.keys())[0] in act.ServiceDataCollection)\n self.assertTrue(list(actA.ServiceDataCollection.keys())[0] in act.ServiceDataCollection)\n\n # Similar activities should be coalesced (Hiking, Walking..)..\n actA.Type = ActivityType.Hiking\n s._activities = []\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n\n self.assertEqual(len(s._activities), 1)\n act = s._activities[0]\n self.assertEqual(act.Type, actA.Type) # Here, it will take priority.\n\n # Dissimilar should not..\n actA.Type = ActivityType.CrossCountrySkiing\n s._activities = []\n s._accumulateActivities(recA, [copy.deepcopy(actA)])\n s._accumulateActivities(recB, [copy.deepcopy(actB)])\n\n self.assertEqual(len(s._activities), 2)\n self.assertEqual(s._activities[0].Type, actB.Type)\n self.assertEqual(s._activities[1].Type, actA.Type)", "metadata": "root.SyncTests.test_activity_coalesce", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 326 }, { "content": " def test_eligibility_excluded(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n recipientServices = [recA, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {recA._id: UserException(UserExceptionType.Private)}\n s.user = user\n s._serviceConnections = recipientServices\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recB in eligible)\n self.assertTrue(recA not in eligible)", "metadata": "root.SyncTests.test_eligibility_excluded", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 398 }, { "content": " def test_eligibility_config(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n svcA.Configurable = True\n svcA.RequiresConfiguration = lambda x: True\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n recipientServices = [recA, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = recipientServices\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recB in eligible)\n self.assertTrue(recA not in eligible)", "metadata": "root.SyncTests.test_eligibility_config", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 415 }, { "content": " def test_eligibility_flowexception(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recA)\n act.Origin = recA\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n User.SetFlowException(user, recA, recB, flowToTarget=False)\n recipientServices = [recA, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = recipientServices\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA in eligible)\n self.assertFalse(recB in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 434 }, { "content": " def test_eligibility_flowexception_shortcircuit(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n svcC = TestTools.create_mock_service(\"mockC\")\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n recC = TestTools.create_mock_svc_record(svcC)\n act = TestTools.create_blank_activity(svcA, record=recA)\n User.SetFlowException(user, recA, recC, flowToTarget=False)\n\n # Behaviour with known origin and no override set\n act.Origin = recA\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n recipientServices = [recC, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = [recA, recB, recC]\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB in eligible)\n self.assertTrue(recC not in eligible)\n\n # Enable alternate routing\n # FIXME: This setting doesn't seem to be used anywhere any more?? Test disabled at the end..\n recB.SetConfiguration({\"allow_activity_flow_exception_bypass_via_self\": True}, no_save=True)\n self.assertTrue(recB.GetConfiguration()[\"allow_activity_flow_exception_bypass_via_self\"])\n # We should now be able to arrive at recC via recB\n act.Origin = recA\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n recipientServices = [recC, recB]\n s._excludedServices = {}\n s._serviceConnections = [recA, recB, recC]\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB in eligible)\n # self.assertTrue(recC in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception_shortcircuit", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 453 }, { "content": " def test_eligibility_flowexception_reverse(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n act.Origin = recB\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n User.SetFlowException(user, recA, recB, flowToSource=False)\n recipientServices = [recA, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = recipientServices\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertFalse(recA in eligible)\n self.assertTrue(recB in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception_reverse", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 493 }, { "content": " def test_eligibility_flowexception_both(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n act.Origin = recB\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=False)\n recipientServices = [recA, recB]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = recipientServices\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertFalse(recA in eligible)\n self.assertTrue(recB in eligible)\n\n act.Origin = recA\n act.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA in eligible)\n self.assertFalse(recB in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception_both", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 512 }, { "content": " def test_eligibility_flowexception_none(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n act.Origin = recB\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=False)\n recipientServices = [recA]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = [recA, recB]\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB not in eligible)\n\n recipientServices = [recB]\n act.Origin = recA\n act.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB not in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception_none", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 537 }, { "content": " def test_eligibility_flowexception_change(self):\n user = TestTools.create_mock_user()\n svcA, svcB = TestTools.create_mock_services()\n recA = TestTools.create_mock_svc_record(svcA)\n recB = TestTools.create_mock_svc_record(svcB)\n act = TestTools.create_blank_activity(svcA, record=recB)\n act.Origin = recB\n act.UIDs = set([act.UID])\n act.Record = ActivityRecord.FromActivity(act)\n\n recipientServices = [recA]\n s = SynchronizationTask(None)\n s._excludedServices = {}\n s.user = user\n s._serviceConnections = [recA, recB]\n\n User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=True)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB not in eligible)\n\n recipientServices = [recB]\n act.Origin = recA\n act.ServiceDataCollection = TestTools.create_mock_servicedatacollection(svcA, record=recA)\n User.SetFlowException(user, recA, recB, flowToSource=True, flowToTarget=False)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB not in eligible)\n\n User.SetFlowException(user, recA, recB, flowToSource=False, flowToTarget=False)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA not in eligible)\n self.assertTrue(recB not in eligible)\n\n recipientServices = [recA, recB]\n User.SetFlowException(user, recA, recB, flowToSource=True, flowToTarget=True)\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA in eligible)\n self.assertTrue(recB in eligible)\n\n eligible = s._determineEligibleRecipientServices(act, recipientServices)\n self.assertTrue(recA in eligible)\n self.assertTrue(recB in eligible)", "metadata": "root.SyncTests.test_eligibility_flowexception_change", "header": "['class', 'SyncTests', '(', 'TapiriikTestCase', ')', ':', '___EOS___']", "index": 563 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "testing_", "._", "testtools_", "import_", "Test", "Tools_", ",_", "Tap", "iri", "ik", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "sync_", "import_", "Synchronization", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "sync_", "._", "activit", "y", "\\u", "record_", "import_", "Activ", "it", "y", "Record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "services_", "import_", "User", "Exception_", ",_", "User", "Except", "ion", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "services_", "._", "api_", "import_", "API", "Exclude", "Activity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "services_", "._", "interc", "hange", "_", "import_", "Activity_", ",_", "Activ", "it", "y", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tap", "iri", "ik_", "._", "auth_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", ",_", "tzinfo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "UTC_", "(_", "tzinfo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "UT", "C", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "UTC_", "(_", "tzinfo_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "utc", "offset_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "timedelta_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UTC_", "(_", "tzinfo_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tz", "name_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "UT", "C", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UTC_", "(_", "tzinfo_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dst_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "timedelta_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "svc", "\\u", "level", "\\u", "dupe", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "service", "-", "level", " ", "duplicat", "e", " ", "activit", "ies", " ", "are", " ", "cau", "ght", " ", "(", "no", " ", "DB", " ", "involv", "ement", ")", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svc", "\\u", "level", "\\u", "dupe", "\\u", "tz", "\\u", "uniform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "service", "-", "level", " ", "duplicat", "e", " ", "activit", "ies", " ", "with", " ", "the", " ", "same", " ", "TZ", "s", " ", "are", " ", "cau", "ght", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", "._", "localize_", "(_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svc", "\\u", "level", "\\u", "dupe", "\\u", "tz", "\\u", "non", "uniform_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "service", "-", "level", " ", "duplicat", "e", " ", "activit", "ies", " ", "with", " ", "non", "-", "uniform", " ", "TZ", "s", " ", "are", " ", "cau", "ght", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", "._", "localize_", "(_", "act", "A_", "._", "Start", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svc", "\\u", "level", "\\u", "dupe", "\\u", "tz", "\\u", "irre", "gul", "ar_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "service", "-", "level", " ", "duplicat", "e", " ", "activit", "ies", " ", "with", " ", "irre", "gul", "ar", " ", "TZ", "s", " ", "are", " ", "cau", "ght", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Ed", "mont", "on", "\"_", ")_", "._", "localize_", "(_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "asti", "mezone", "_", "(_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "I", "qa", "lui", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svc", "\\u", "level", "\\u", "dupe", "\\u", "time", "\\u", "lee", "way_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "service", "-", "level", " ", "duplicat", "e", " ", "activit", "ies", " ", "within", " ", "the", " ", "defin", "ed", " ", "time", " ", "lee", "way", " ", "are", " ", "cau", "ght", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Type_", "=_", "set_", "(_", "svc", "A_", "._", "Supp", "orte", "d", "Activ", "ities_", ")_", "._", "intersection_", "(_", "set_", "(_", "svc", "B_", "._", "Supp", "orte", "d", "Activ", "ities_", ")_", ")_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "6_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Type_", "=_", "act", "A_", "._", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "act", "A_", "._", "UID_", ",_", "act", "A_", "._", "UI", "Ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "act", "B_", "._", "UID_", ",_", "act", "A_", "._", "UI", "Ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "act", "A_", "._", "UID_", ",_", "act", "B_", "._", "UI", "Ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "act", "B_", "._", "UID_", ",_", "act", "B_", "._", "UI", "Ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "fake", " ", "up", " ", "the", " ", "service", " ", "record", "s", " ", "to", " ", "avoid", " ", "hav", "ing", " ", "to", " ", "call", " ", "the", " ", "actual", " ", "sync", " ", "method", " ", "where", " ", "these", " ", "values", " ", "are", " ", "normal", "ly", " ", "preset_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "._", "Synchronize", "d", "Activ", "ities_", "=_", "[_", "act", "A_", "._", "UID_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "._", "Synchronize", "d", "Activ", "ities_", "=_", "[_", "act", "B_", "._", "UID_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Service", "s", "A_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Service", "s", "B_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "recip", "ient", "Service", "s", "A_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "recip", "ient", "Service", "s", "B_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svc", "\\u", "support", "ed", "\\u", "activit", "y", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "check", " ", "tha", "t", " ", "only", " ", "activit", "ies", " ", "are", " ", "only", " ", "sent", " ", "to", " ", "service", "s", " ", "whi", "ch", " ", "support", " ", "them", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", "._", "Supp", "orte", "d", "Activ", "ities_", "=_", "[_", "Activ", "it", "y", "Type_", "._", "Cross", "Count", "ry", "Ski", "ing_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "B_", "._", "Supp", "orte", "d", "Activ", "ities_", "=_", "[_", "Activ", "it", "y", "Type_", "._", "Cyc", "ling_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Start", "Time_", "=_", "datetime_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", ",_", "6_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Type_", "=_", "svc", "A_", "._", "Supp", "orte", "d", "Activ", "ities_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act", "A_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "datetime_", "(_", "5_", ",_", "6_", ",_", "7_", ",_", "8_", ",_", "9_", ",_", "10_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Type_", "=_", "[_", "x_", "for_", "x_", "in_", "svc", "B_", "._", "Supp", "orte", "d", "Activ", "ities_", "if_", "x_", "!=_", "act", "A_", "._", "Type_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act", "B_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "act", "A_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "act", "B_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sync", "To", "A_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sync", "To", "B_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "A_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "B_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "svc", "B_", "._", "Supp", "orte", "d", "Activ", "ities_", "=_", "svc", "A_", "._", "Supp", "orte", "d", "Activ", "ities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sync", "To", "A_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sync", "To", "B_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "A_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "B_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "svc", "B_", "._", "Supp", "orte", "d", "Activ", "ities_", "=_", "svc", "A_", "._", "Supp", "orte", "d", "Activ", "ities_", "=_", "[_", "Activ", "it", "y", "Type_", "._", "Cross", "Count", "ry", "Ski", "ing_", ",_", "Activ", "it", "y", "Type_", "._", "Cyc", "ling_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sync", "To", "A_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sync", "To", "B_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Recipient", "Services_", "(_", "act", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "A_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "sync", "To", "B_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "accumulate", "\\u", "exclusions", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regular", "_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "=_", "{_", "rec", "A_", "._", "\\u", "id_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", "=_", "API", "Exclude", "Activity_", "(_", "\"", "Messag", "!", "e", "\"_", ",_", "activit", "y", "\\u", "id_", "=_", "3.14", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Exclu", "sions_", "(_", "rec", "A_", ",_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclusions", "tore_", "=_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "3", "\\u", "14", "\"_", "in_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Messag", "e", "\"_", "]_", ",_", "\"", "Messag", "!", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Activ", "it", "y", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Exter", "nal", "Activ", "it", "y", "ID", "\"_", "]_", ",_", "3.14", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Permanent", "\"_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "updat", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UID_", "=_", "\"", "3", "\\u", "14", "\"_", "#", " ", "me", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", "=_", "API", "Exclude", "Activity_", "(_", "\"", "Messag", "!", "e2", "\"_", ",_", "activit", "y", "\\u", "id_", "=_", "42_", ",_", "permanent", "_", "=_", "False_", ",_", "activity_", "=_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "=_", "{_", "rec", "A_", "._", "\\u", "id_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Exclu", "sions_", "(_", "rec", "A_", ",_", "exc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclusions", "tore_", "=_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "3", "\\u", "14", "\"_", "in_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Messag", "e", "\"_", "]_", ",_", "\"", "Messag", "!", "e2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Activ", "it", "y", "\"_", "]_", ",_", "None_", ")_", "#", " ", "Who", " ", "knows", " ", "what", " ", "the", " ", "string", " ", "format", " ", "will", " ", "be", " ", "down", " ", "the", " ", "road", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Exter", "nal", "Activ", "it", "y", "ID", "\"_", "]_", ",_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", "[_", "\"", "3", "\\u", "14", "\"_", "]_", "[_", "\"", "Permanent", "\"_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multiple", ",", " ", "retain", "ing", " ", "existing_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "2_", "=_", "API", "Exclude", "Activity_", "(_", "\"", "IN", "M", "\"_", ",_", "activit", "y", "\\u", "id_", "=_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "3_", "=_", "API", "Exclude", "Activity_", "(_", "\"", "FN", "IM", "\"_", ",_", "activit", "y", "\\u", "id_", "=_", "37_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Exclu", "sions_", "(_", "rec", "A_", ",_", "[_", "exc", "2_", ",_", "exc", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclusions", "tore_", "=_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "3", "\\u", "14", "\"_", "in_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "3", "7", "\"_", "in_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "13", "\"_", "in_", "exclusions", "tore_", "[_", "rec", "A_", "._", "\\u", "id_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "allow", " ", "with", " ", "no", " ", "identifiers_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "4_", "=_", "API", "Exclude", "Activity_", "(_", "\"", "noo", "ooo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "sync", "Exclu", "sions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "s_", "._", "\\u", "accumulate", "Exclu", "sions_", ",_", "rec", "A_", ",_", "[_", "exc", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "activit", "y", "\\u", "dedup", "licat", "e\\u", "normal", "tz_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "ensure", " ", "tha", "t", " ", "we", " ", "can", "'", "t", " ", "dedup", "licat", "e", " ", "activit", "ies", " ", "with", " ", "non", "-", "pyt", "z", " ", "timezones", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "random", "\\u", "activity_", "(_", "svc", "A_", ",_", "tz_", "=_", "UTC_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "+_", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "End", "Time_", "=_", "act", "A_", "._", "End", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Name_", "=_", "\"", "Not", " ", "this", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Name_", "=_", "\"", "He", "ya", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Type_", "=_", "Activ", "it", "y", "Type_", "._", "Walk", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", ",_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "activit", "y", "\\u", "dedup", "licat", "e\\u", "tze", "rror_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Test", " ", "tha", "t", " ", "probab", "ly", "-", "duplicat", "e", " ", "activit", "ies", " ", "with", " ", "startt", "imes", " ", "like", " ", "09", ":", "1", "2", ":", "2", "2", " ", "and", " ", "15", ":", "1", "2", ":", "2", "2", " ", "(", "on", " ", "the", " ", "same", " ", "day", ")", " ", "are", " ", "recognize", "d", " ", "as", " ", "one", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "random", "\\u", "activity_", "(_", "svc", "A_", ",_", "tz_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "I", "qa", "lui", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", ")_", "+_", "timedelta_", "(_", "hours_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Name_", "=_", "\"", "Not", " ", "this", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Name_", "=_", "\"", "He", "ya", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Type_", "=_", "Activ", "it", "y", "Type_", "._", "Walk", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "it", " ", "is", " ", "dedup", "licat", "ed", " ", "on", " ", "non", "-", "exact", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", ")_", "+_", "timedelta_", "(_", "hours_", "=_", "5_", ",_", "seconds_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "it", " ", "is", " ", "*", "not", "*", " ", "dedup", "licat", "ed", " ", "whe", "n", " ", "it", " ", "reall", "y", " ", "doe", "sn", "'", "t", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", ")_", "+_", "timedelta_", "(_", "hours_", "=_", "5_", ",_", "minutes_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "overl", "y", " ", "large", " ", "difference", "s", " ", ">", "3", "8", "hr", " ", "-", " ", "not", " ", "possib", "le", " ", "via", " ", "TZ", " ", "difference", "s", " ", "&", " ", "sha", "me", "full", "y", " ", "bad", " ", "import", "/", "export", " ", "code", " ", "on", " ", "the", " ", "part", " ", "of", " ", "some", " ", "service", "s", " ", "-", " ", "are", " ", "not", " ", "dedup", "licat", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "Den", "ver", "\"_", ")_", ")_", "+_", "timedelta_", "(_", "hours_", "=_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "activit", "y", "\\u", "coalesce", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "ensure", " ", "tha", "t", " ", "activit", "y", " ", "data", " ", "is", " ", "getti", "ng", " ", "coalesce", "d", " ", "by", " ", "\\u", "accumulate", "Activ", "iti", "es", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "random", "\\u", "activity_", "(_", "svc", "A_", ",_", "tz_", "=_", "pytz_", "._", "timezone_", "(_", "\"", "Ame", "rica", "/", "I", "qa", "lui", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "=_", "Activity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Start", "Time_", "=_", "act", "A_", "._", "Start", "Time_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Name_", "=_", "\"", "Not", " ", "this", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Priva", "te_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Name_", "=_", "\"", "He", "ya", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Type_", "=_", "Activ", "it", "y", "Type_", "._", "Walk", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "A_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act", "B_", "._", "Calculat", "e", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "s_", "._", "\\u", "activities_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Start", "Time_", ",_", "act", "A_", "._", "Start", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "End", "Time_", ",_", "act", "A_", "._", "End", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "End", "Time_", "._", "tzinfo_", ",_", "act", "A_", "._", "Start", "Time_", "._", "tzinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Start", "Time_", "._", "tzinfo_", ",_", "act", "A_", "._", "Start", "Time_", "._", "tzinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Lap", "s", "List", "s", "Equal_", "(_", "act_", "._", "Lap", "s_", ",_", "act", "A_", "._", "Lap", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "act_", "._", "Priva", "te_", ")_", "#", " ", "Mos", "t", " ", "restrict", "ive", " ", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Name_", ",_", "act", "B_", "._", "Name_", ")_", "#", " ", "The", " ", "first", " ", "activit", "y", " ", "take", "s", " ", "priorit", "y", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Type_", ",_", "act", "B_", "._", "Type_", ")_", "#", " ", "Sam", "e", " ", "here", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "act", "B_", "._", "Service", "Data", "Collection_", "._", "keys_", "(_", ")_", ")_", "[_", "0_", "]_", "in_", "act_", "._", "Service", "Data", "Collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "act", "A_", "._", "Service", "Data", "Collection_", "._", "keys_", "(_", ")_", ")_", "[_", "0_", "]_", "in_", "act_", "._", "Service", "Data", "Collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "s_", "._", "\\u", "activities_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Start", "Time_", ",_", "act", "A_", "._", "Start", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "End", "Time_", ",_", "act", "A_", "._", "End", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "End", "Time_", "._", "tzinfo_", ",_", "act", "A_", "._", "Start", "Time_", "._", "tzinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Start", "Time_", "._", "tzinfo_", ",_", "act", "A_", "._", "Start", "Time_", "._", "tzinfo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Lap", "s", "List", "s", "Equal_", "(_", "act_", "._", "Lap", "s_", ",_", "act", "A_", "._", "Lap", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Name_", ",_", "act", "A_", "._", "Name_", ")_", "#", " ", "The", " ", "first", " ", "activit", "y", " ", "take", "s", " ", "priorit", "y", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Type_", ",_", "act", "B_", "._", "Type_", ")_", "#", " ", "Except", "ion", ":", " ", "Activ", "it", "y", "Type", ".", "Ot", "her", " ", "doe", "s", " ", "not", " ", "take", " ", "priority_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "act", "B_", "._", "Service", "Data", "Collection_", "._", "keys_", "(_", ")_", ")_", "[_", "0_", "]_", "in_", "act_", "._", "Service", "Data", "Collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "act", "A_", "._", "Service", "Data", "Collection_", "._", "keys_", "(_", ")_", ")_", "[_", "0_", "]_", "in_", "act_", "._", "Service", "Data", "Collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simil", "ar", " ", "activit", "ies", " ", "shou", "ld", " ", "be", " ", "coalesce", "d", " ", "(", "Hi", "king", ",", " ", "Walk", "ing", "..", ").", "._", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Type_", "=_", "Activ", "it", "y", "Type_", "._", "Hi", "king", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "s_", "._", "\\u", "activities_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "act_", "._", "Type_", ",_", "act", "A_", "._", "Type_", ")_", "#", " ", "Her", "e", ",", " ", "it", " ", "will", " ", "take", " ", "priorit", "y", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dis", "similar", " ", "shou", "ld", " ", "not", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "act", "A_", "._", "Type_", "=_", "Activ", "it", "y", "Type_", "._", "Cross", "Count", "ry", "Ski", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "activities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "A_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "A_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "accumulate", "Activ", "ities_", "(_", "rec", "B_", ",_", "[_", "copy_", "._", "deepcopy_", "(_", "act", "B_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "s_", "._", "\\u", "activities_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "\\u", "activities_", "[_", "0_", "]_", "._", "Type_", ",_", "act", "B_", "._", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "\\u", "activities_", "[_", "1_", "]_", "._", "Type_", ",_", "act", "A_", "._", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "excluded_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "rec", "A_", "._", "\\u", "id_", ":_", "User", "Exception_", "(_", "User", "Except", "ion", "Type_", "._", "Priva", "te_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "recip", "ient", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "config_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", "._", "Configura", "ble_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", "._", "Requ", "ires", "Configuration_", "=_", "lambda_", "x_", ":_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "recip", "ient", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "recip", "ient", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception", "\\u", "short", "circuit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "C_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service_", "(_", "\"", "mock", "C", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "C_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "C_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "C_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Behavio", "ur", " ", "with", " ", "know", "n", " ", "orig", "in", " ", "and", " ", "no", " ", "override", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "C_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", ",_", "rec", "C_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "C_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Enable", " ", "alternat", "e", " ", "routing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "Thi", "s", " ", "setti", "ng", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "be", " ", "used", " ", "any", "where", " ", "any", " ", "more", "??", " ", " ", "Test", " ", "disable", "d", " ", "at", " ", "the", " ", "end", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "rec", "B_", "._", "Set", "Configuration_", "(_", "{_", "\"", "allow", "\\u", "activit", "y", "\\u", "flow", "\\u", "exception", "\\u", "bypass", "\\u", "via", "\\u", "self", "\"_", ":_", "True_", "}_", ",_", "no", "\\u", "save_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "._", "Get", "Configuration_", "(_", ")_", "[_", "\"", "allow", "\\u", "activit", "y", "\\u", "flow", "\\u", "exception", "\\u", "bypass", "\\u", "via", "\\u", "self", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "now", " ", "be", " ", "able", " ", "to", " ", "arrive", " ", "at", " ", "rec", "C", " ", "via", " ", "rec", "B_", "\\u\\u\\uNL\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "C_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", ",_", "rec", "C_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "assert", "Tru", "e", "(", "rec", "C", " ", "in", " ", "eligible", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception", "\\u", "reverse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "recip", "ient", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception", "\\u", "both_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "False_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "recip", "ient", "Services_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "False_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Tests_", "(_", "Tap", "iri", "ik", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "eli", "gib", "ilit", "y", "\\u", "flow", "exception", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svc", "A_", ",_", "svc", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "services_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "A_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "B_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "svc", "\\u", "record_", "(_", "svc", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "Test", "Tools_", "._", "create", "\\u", "blank", "\\u", "activity_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "B_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "UI", "Ds_", "=_", "set_", "(_", "[_", "act_", "._", "UID_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Record_", "=_", "Activ", "it", "y", "Record_", "._", "Fro", "m", "Activity_", "(_", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "Synchronization", "Task_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "exclu", "ded", "Services_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "\\u", "service", "Connections_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "False_", ",_", "flow", "To", "Target_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Origin_", "=_", "rec", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "._", "Service", "Data", "Collection_", "=_", "Test", "Tools_", "._", "create", "\\u", "mock", "\\u", "service", "datac", "olle", "ction_", "(_", "svc", "A_", ",_", "record_", "=_", "rec", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "True_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "False_", ",_", "flow", "To", "Target_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "not_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "recip", "ient", "Services_", "=_", "[_", "rec", "A_", ",_", "rec", "B_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "User_", "._", "Set", "Flow", "Exception_", "(_", "user_", ",_", "rec", "A_", ",_", "rec", "B_", ",_", "flow", "To", "Source_", "=_", "True_", ",_", "flow", "To", "Target_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eligible", "_", "=_", "s_", "._", "\\u", "dete", "rmin", "e", "Eli", "gib", "le", "Recipient", "Services_", "(_", "act_", ",_", "recip", "ient", "Services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "A_", "in_", "eligible", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "rec", "B_", "in_", "eligible", "_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
kuri65536/python-for-android/python3-alpha/python-libs/pyxmpp2/resolver.py
[ { "content": " def resolve_srv(self, domain, service, protocol, callback):\n \"\"\"Start looking up an SRV record for `service` at `domain`.\n\n `callback` will be called with a properly sorted list of (hostname,\n port) pairs on success. The list will be empty on error and it will\n contain only (\".\", 0) when the service is explicitely disabled.\n\n :Parameters:\n - `domain`: domain name to look up\n - `service`: service name e.g. 'xmpp-client'\n - `protocol`: protocol name, e.g. 'tcp'\n - `callback`: a function to be called with a list of received\n addresses\n :Types:\n - `domain`: `str`\n - `service`: `str`\n - `protocol`: `str`\n - `callback`: function accepting a single argument\n \"\"\"\n if isinstance(domain, str):\n domain = domain.encode(\"idna\").decode(\"us-ascii\")\n domain = \"_{0}._{1}.{2}\".format(service, protocol, domain)\n try:\n records = dns.resolver.query(domain, 'SRV')\n except dns.exception.DNSException as err:\n logger.warning(\"Could not resolve {0!r}: {1}\"\n .format(domain, err.__class__.__name__))\n callback([])\n return\n if not records:\n callback([])\n return\n\n result = []\n for record in reorder_srv(records):\n hostname = record.target.to_text()\n if hostname in (\".\", \"\"):\n continue\n result.append((hostname, record.port))\n\n if not result:\n callback([(\".\", 0)])\n else:\n callback(result)\n return", "metadata": "root.BlockingResolver.resolve_srv", "header": "['class', 'BlockingResolver', '(', 'Resolver', ')', ':', '___EOS___']", "index": 280 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Block", "ing", "Resolver_", "(_", "Resolver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "srv_", "(_", "self_", ",_", "domain_", ",_", "service_", ",_", "protocol_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "look", "ing", " ", "up", " ", "an", " ", "SRV", " ", "record", " ", "for", " ", "`", "service", "`", " ", "at", " ", "`", "domain", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "callback", "`", " ", "will", " ", "be", " ", "call", "ed", " ", "with", " ", "a", " ", "proper", "ly", " ", "sorte", "d", " ", "list", " ", "of", " ", "(", "host", "name", ",", "\\", "10", ";", " ", " ", " ", " ", "port", ")", " ", "pair", "s", " ", "on", " ", "success", ".", " ", "The", " ", "list", " ", "will", " ", "be", " ", "empty", " ", "on", " ", "error", " ", "and", " ", "it", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "contain", " ", "only", " ", "(\".", "\",", " ", "0", ")", " ", "whe", "n", " ", "the", " ", "service", " ", "is", " ", "explicit", "el", "y", " ", "disable", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "domain", "`", ":", " ", "domain", " ", "name", " ", "to", " ", "look", " ", "up", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "service", "`", ":", " ", "service", " ", "name", " ", "e", ".", "g", ".", " ", "'", "xmpp", "-", "client", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "protoc", "ol", "`", ":", " ", "protoc", "ol", " ", "name", ",", " ", "e", ".", "g", ".", " ", "'", "tcp", "'", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "callback", "`", ":", " ", "a", " ", "function", " ", "to", " ", "be", " ", "call", "ed", " ", "with", " ", "a", " ", "list", " ", "of", " ", "receive", "d", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "addresse", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "Type", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "domain", "`", ":", " ", "`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "service", "`", ":", " ", "`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "protoc", "ol", "`", ":", " ", "`", "str", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "`", "callback", "`", ":", " ", "function", " ", "accept", "ing", " ", "a", " ", "single", " ", "argu", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "domain_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "domain_", "._", "encode_", "(_", "\"", "idn", "a", "\"_", ")_", "._", "decode_", "(_", "\"", "us", "-", "ascii", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domain_", "=_", "\"\\u", "{", "0", "}.", "\\u{", "1", "}.", "{", "2", "}\"_", "._", "format_", "(_", "service_", ",_", "protocol_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "records_", "=_", "dns_", "._", "resolver_", "._", "query_", "(_", "domain_", ",_", "'", "SRV", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "dns_", "._", "exception_", "._", "DNS", "Exception_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "\"", "Cou", "ld", " ", "not", " ", "resolve", " ", "{", "0", "!", "r", "}:", " ", "{", "1", "}\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "domain_", ",_", "err_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "reorder", "\\u", "srv_", "(_", "records_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hostname_", "=_", "record_", "._", "target_", "._", "to", "\\u", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hostname_", "in_", "(_", "\".\"_", ",_", "\"\"_", ")_", ":_", "\\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_", "result_", "._", "append_", "(_", "(_", "hostname_", ",_", "record_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "(_", "[_", "(_", "\".\"_", ",_", "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 ", " _", "callback_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Flask app is run in debug mode
ottogroup/palladium/palladium/server.py
[ { "content": "\"\"\"HTTP API implementation.\n\"\"\"\n\nimport sys\nfrom docopt import docopt\nfrom flask import Flask\nfrom flask import make_response\nfrom flask import request\nimport numpy as np\nimport ujson\nfrom werkzeug.exceptions import BadRequest\n\nfrom . import __version__\nfrom .interfaces import PredictError\nfrom .util import args_from_config\nfrom .util import get_config\nfrom .util import get_metadata\nfrom .util import initialize_config\nfrom .util import logger\nfrom .util import memory_usage_psutil\nfrom .util import PluggableDecorator\nfrom .util import process_store\n\napp = Flask(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def devserver_cmd(argv=sys.argv[1:]): # pragma: no cover\n \"\"\"\\\nServe the web API for development.\n\nUsage:\n pld-devserver [options]\n\nOptions:\n -h --help Show this screen.\n\n --host=<host> The host to use [default: 0.0.0.0].\n\n --port=<port> The port to use [default: 5000].\n\n --debug=<debug> Whether or not to use debug mode [default: 0].\n\"\"\"\n arguments = docopt(devserver_cmd.__doc__, argv=argv)\n initialize_config()\n app.run(\n host=arguments['--host'],\n port=int(arguments['--port']),\n debug=int(arguments['--debug']),\n )", "metadata": "root.devserver_cmd", "header": "['module', '___EOS___']", "index": 239 } ]
[]
[]
0
false
[ "[CLS]_", "Flask_", "app_", "is_", "run_", "in_", "debug_", "mode_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "HTTP", " ", "API", " ", "implementation", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docopt_", "import_", "docopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "make", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ujson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "exceptions_", "import_", "Ba", "d", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "interfaces_", "import_", "Predic", "t", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "args", "\\u", "from", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "get", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "get", "\\u", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "initialize", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "memory", "\\u", "usage", "\\u", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "Plug", "gab", "le", "Decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "process", "\\u", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "devs", "erver", "\\u", "cmd_", "(_", "argv_", "=_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ")_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\\\", "\\", "10", ";", "Serv", "e", " ", "the", " ", "web", " ", "API", " ", "for", " ", "develop", "ment", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", " ", " ", "pl", "d", "-", "devs", "erver", " ", "[", "options", "]", "\\", "10", ";", "\\", "10", ";", "Optio", "ns", ":", "\\", "10", ";", " ", " ", "-", "h", " ", "--", "help", " ", " ", " ", "Show", " ", "this", " ", "screen", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "--", "host", "=", "<", "host", ">", " ", " ", " ", "The", " ", "host", " ", "to", " ", "use", " ", "[", "default", ":", " ", "0.", "0.", "0.", "0", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", "--", "port", "=", "<", "port", ">", " ", " ", " ", "The", " ", "port", " ", "to", " ", "use", " ", "[", "default", ":", " ", "5000", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", "--", "debug", "=", "<", "debug", ">", " ", " ", " ", " ", " ", "Whe", "ther", " ", "or", " ", "not", " ", "to", " ", "use", " ", "debug", " ", "mode", " ", "[", "default", ":", " ", "0", "].", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "docopt_", "(_", "devs", "erver", "\\u", "cmd_", "._", "\\u\\u", "doc\\u\\u_", ",_", "argv_", "=_", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initialize", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "run_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "arguments_", "[_", "'--", "host", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port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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 ]
Implicit string concatenation in a list
evennia/evennia/evennia/help/migrations/0001_initial.py
[ { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('typeclasses', '0001_initial'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='HelpEntry',\n fields=[\n ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),\n ('db_key', models.CharField(help_text=b'key to search for', unique=True, max_length=255, verbose_name=b'help key')),\n ('db_help_category', models.CharField(default=b'General', help_text=b'organizes help entries in lists', max_length=255, verbose_name=b'help category')),\n ('db_entrytext', models.TextField(help_text=b'the main body of help text', verbose_name=b'help entry', blank=True)),\n ('db_lock_storage', models.TextField(help_text=b'normally view:all().', verbose_name=b'locks', blank=True)),\n ('db_staff_only', models.BooleanField(default=False)),\n ('db_tags', models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag', null=True)),\n ],\n options={\n 'verbose_name': 'Help Entry',\n 'verbose_name_plural': 'Help Entries',\n },\n bases=(models.Model,),\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "typec", "lasse", "s", "'_", ",_", "'", "0001", "\\u", "initial", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Creat", "e", "Model_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Help", "Entr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "id", "'_", ",_", "models_", "._", "Auto", "Field_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "ID", "'_", ",_", "serialize_", "=_", "False_", ",_", "auto", "\\u", "created_", "=_", "True_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "key", "'_", ",_", "models_", "._", "Char", "Field_", "(_", "help", "\\u", "text_", "=_", "b", "'", "key", " ", "to", " ", "search", " ", "for", "'_", ",_", "unique_", "=_", "True_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "verbo", "se", "\\u", "name_", "=_", "b", "'", "help", " ", "key", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "help", "\\u", "category", "'_", ",_", "models_", "._", "Char", "Field_", "(_", "default_", "=_", "b", "'", "General", "'_", ",_", "help", "\\u", "text_", "=_", "b", "'", "organize", "s", " ", "help", " ", "entri", "es", " ", "in", " ", "lists", "'_", ",_", "max", "\\u", "length_", "=_", "255_", ",_", "verbo", "se", "\\u", "name_", "=_", "b", "'", "help", " ", "category", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "entry", "text", "'_", ",_", "models_", "._", "Text", "Field_", "(_", "help", "\\u", "text_", "=_", "b", "'", "the", " ", "main", " ", "body", " ", "of", " ", "help", " ", "text", "'_", ",_", "verbo", "se", "\\u", "name_", "=_", "b", "'", "help", " ", "entry", "'_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "lock", "\\u", "storage", "'_", ",_", "models_", "._", "Text", "Field_", "(_", "help", "\\u", "text_", "=_", "b", "'", "normal", "ly", " ", "view", ":", "all", "()", ".'_", ",_", "verbo", "se", "\\u", "name_", "=_", "b", "'", "lock", "s", "'_", ",_", "blank_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "sta", "ff", "\\u", "only", "'_", ",_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "db", "\\u", "tags", "'_", ",_", "models_", "._", "Many", "To", "Many", "Field_", "(_", "help", "\\u", "text_", "=_", "b", "'", "tags", " ", "on", " ", "this", " ", "object", ".", " ", "Ta", "gs", " ", "are", " ", "simple", " ", "string", " ", "marker", "s", " ", "to", " ", "identify", ",", " ", "group", " ", "and", " ", "alias", " ", "object", "s", ".'_", ",_", "to_", "=_", "'", "typec", "lasse", "s", ".", "Ta", "g", "'_", ",_", "null_", "=_", "True_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verbo", "se", "\\u", "name", "'_", ":_", "'", "Help", " ", "Entr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verbo", "se", "\\u", "name", "\\u", "plural", "'_", ":_", "'", "Help", " ", "Entr", "ies", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bases_", "=_", "(_", "models_", "._", "Model_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Esri/ops-server-config/Publish/Portal/portalpy/provision.py
[ { "content": " def deserialize_users(self, path):\n \"\"\" Deserialize users from CSV. \"\"\"\n users = []\n if not os.path.isfile(path):\n raise PortalError('Specific path is not a file: ' + path)\n user_reader = csv.DictReader(open(path, \"rb\"))\n for user in user_reader:\n users.append(user)\n return users", "metadata": "root.CSVDeserializer.deserialize_users", "header": "['class', 'CSVDeserializer', '(', 'object', ')', ':', '___EOS___']", "index": 518 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "CSV", "Deserializ", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deserialize", "\\u", "users_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Deserializ", "e", " ", "users", " ", "from", " ", "CSV", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Porta", "l", "Error_", "(_", "'", "Specifi", "c", " ", "path", " ", "is", " ", "not", " ", "a", " ", "file", ":", " ", "'_", "+_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "reader_", "=_", "csv_", "._", "Dict", "Reader_", "(_", "open_", "(_", "path_", ",_", "\"", "rb", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "user_", "in_", "user", "\\u", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "._", "append_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "users_", "\\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 ]
Unused import
hyperion-rt/hyperion/hyperion/model/tests/test_get_quantities.py
[ { "content": "import numpy as np\n\nfrom .. import Model\nfrom ...util.functions import random_id\nfrom .test_helpers import get_test_dust\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_no_initial(tmpdir):\n m = Model()\n m.set_cartesian_grid([-1., 1.], [-1., 1.], [-1., 1.])\n m.add_density_grid(np.array([[[1.]]]), get_test_dust())\n m.set_n_initial_iterations(0)\n m.set_n_photons(imaging=1)\n m.write(tmpdir.join(random_id()).strpath)\n mo = m.run(tmpdir.join(random_id()).strpath)\n g = mo.get_quantities()\n assert 'density' in g", "metadata": "root.test_no_initial", "header": "['module', '___EOS___']", "index": 7 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "import_", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "util_", "._", "functions_", "import_", "random", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "test\\u", "helpers_", "import_", "get", "\\u", "test\\u", "dust", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "initial_", "(_", "tmpdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "Model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "set\\u", "cartesian", "\\u", "grid_", "(_", "[_", "-_", "1._", ",_", "1._", "]_", ",_", "[_", "-_", "1._", ",_", "1._", "]_", ",_", "[_", "-_", "1._", ",_", "1._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "add", "\\u", "densit", "y", "\\u", "grid_", "(_", "np_", "._", "array_", "(_", "[_", "[_", "[_", "1._", "]_", "]_", "]_", ")_", ",_", "get", "\\u", "test\\u", "dust", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "set\\u", "n", "\\u", "initial", "\\u", "iterations_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "set\\u", "n", "\\u", "photon", "s_", "(_", "imagin", "g_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "write_", "(_", "tmpdir_", "._", "join_", "(_", "random", "\\u", "id_", "(_", ")_", ")_", "._", "strp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mo_", "=_", "m_", "._", "run_", "(_", "tmpdir_", "._", "join_", "(_", "random", "\\u", "id_", "(_", ")_", ")_", "._", "strp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "mo_", "._", "get", "\\u", "quantities", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "densit", "y", "'_", "in_", "g_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
maraoz/proofofexistence/babel/localtime/_win32.py
[ { "content": "def get_localzone_name():\n # Windows is special. It has unique time zone names (in several\n # meanings of the word) available, but unfortunately, they can be\n # translated to the language of the operating system, so we need to\n # do a backwards lookup, by going through all time zones and see which\n # one matches.\n handle = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)\n\n TZLOCALKEYNAME = r'SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation'\n localtz = winreg.OpenKey(handle, TZLOCALKEYNAME)\n keyvalues = valuestodict(localtz)\n localtz.Close()\n if 'TimeZoneKeyName' in keyvalues:\n # Windows 7 (and Vista?)\n\n # For some reason this returns a string with loads of NUL bytes at\n # least on some systems. I don't know if this is a bug somewhere, I\n # just work around it.\n tzkeyname = keyvalues['TimeZoneKeyName'].split('\\x00', 1)[0]\n else:\n # Windows 2000 or XP\n\n # This is the localized name:\n tzwin = keyvalues['StandardName']\n\n # Open the list of timezones to look up the real name:\n TZKEYNAME = r'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones'\n tzkey = winreg.OpenKey(handle, TZKEYNAME)\n\n # Now, match this value to Time Zone information\n tzkeyname = None\n for i in range(winreg.QueryInfoKey(tzkey)[0]):\n subkey = winreg.EnumKey(tzkey, i)\n sub = winreg.OpenKey(tzkey, subkey)\n data = valuestodict(sub)\n sub.Close()\n if data['Std'] == tzwin:\n tzkeyname = subkey\n break\n\n tzkey.Close()\n handle.Close()\n\n if tzkeyname is None:\n raise LookupError('Can not find Windows timezone configuration')\n\n timezone = tz_names.get(tzkeyname)\n if timezone is None:\n # Nope, that didn't work. Try adding 'Standard Time',\n # it seems to work a lot of times:\n timezone = tz_names.get(tzkeyname + ' Standard Time')\n\n # Return what we have.\n if timezone is None:\n raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)\n\n return timezone", "metadata": "root.get_localzone_name", "header": "['module', '___EOS___']", "index": 32 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "local", "zone", "\\u", "name_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Window", "s", " ", "is", " ", "special", ".", " ", "It", " ", "has", " ", "unique", " ", "time", " ", "zone", " ", "names", " ", "(", "in", " ", "sever", "al_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "meaning", "s", " ", "of", " ", "the", " ", "word", ")", " ", "avail", "able", ",", " ", "but", " ", "unfo", "rtu", "nat", "el", "y", ",", " ", "the", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "translat", "ed", " ", "to", " ", "the", " ", "language", " ", "of", " ", "the", " ", "operati", "ng", " ", "system", ",", " ", "so", " ", "we", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "a", " ", "back", "ward", "s", " ", "look", "up", ",", " ", "by", " ", "goi", "ng", " ", "through", " ", "all", " ", "time", " ", "zone", "s", " ", "and", " ", "see", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "matche", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handle_", "=_", "winreg_", "._", "Connect", "Registry_", "(_", "None_", ",_", "winreg_", "._", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TZ", "LOCAL", "KEY", "NAME_", "=_", "r", "'", "SYSTEM", "\\\\", "Curr", "ent", "Control", "Set", "\\\\", "Control", "\\\\", "Time", "Zon", "e", "Information", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localt", "z_", "=_", "winreg_", "._", "Open", "Key_", "(_", "handle_", ",_", "TZ", "LOCAL", "KEY", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyval", "ues_", "=_", "values", "tod", "ict_", "(_", "localt", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localt", "z_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "Time", "Zon", "e", "Key", "Name", "'_", "in_", "keyval", "ues_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Window", "s", " ", "7", " ", "(", "and", " ", "Vis", "ta", "?)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "some", " ", "reason", " ", "this", " ", "return", "s", " ", "a", " ", "string", " ", "with", " ", "load", "s", " ", "of", " ", "NU", "L", " ", "bytes", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "leas", "t", " ", "on", " ", "some", " ", "system", "s", ".", " ", "I", " ", "don", "'", "t", " ", "know", " ", "if", " ", "this", " ", "is", " ", "a", " ", "bug", " ", "some", "where", ",", " ", "I_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "work", " ", "aro", "und", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tz", "keyname_", "=_", "keyval", "ues_", "[_", "'", "Time", "Zon", "e", "Key", "Name", "'_", "]_", "._", "split_", "(_", "'\\\\", "x0", "0", "'_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Window", "s", " ", "2000", " ", "or", " ", "XP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "localized", " ", "name", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tz", "win_", "=_", "keyval", "ues_", "[_", "'", "Standard", "Name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "the", " ", "list", " ", "of", " ", "timezones", " ", "to", " ", "look", " ", "up", " ", "the", " ", "real", " ", "name", ":_", "\\u\\u\\uNL\\u\\u\\u_", "TZ", "KEY", "NAME_", "=_", "r", "'", "SOFT", "WARE", "\\\\", "Micro", "soft", "\\\\", "Window", "s", " ", "NT", "\\\\", "Curr", "ent", "Version", "\\\\", "Time", " ", "Zon", "es", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tz", "key_", "=_", "winreg_", "._", "Open", "Key_", "(_", "handle_", ",_", "TZ", "KEY", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "match", " ", "this", " ", "value", " ", "to", " ", "Time", " ", "Zon", "e", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "tz", "keyname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "winreg_", "._", "Query", "Info", "Key_", "(_", "tz", "key_", ")_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subkey", "_", "=_", "winreg_", "._", "Enum", "Key_", "(_", "tz", "key_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "winreg_", "._", "Open", "Key_", "(_", "tz", "key_", ",_", "subkey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "values", "tod", "ict_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "'", "Std", "'_", "]_", "==_", "tz", "win_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tz", "keyname_", "=_", "subkey", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tz", "key_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handle_", "._", "Close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tz", "keyname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Look", "up", "Error_", "(_", "'", "Can", " ", "not", " ", "find", " ", "Window", "s", " ", "timezon", "e", " ", "configura", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timezone_", "=_", "tz", "\\u", "names_", "._", "get_", "(_", "tz", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timezone_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "pe", ",", " ", "tha", "t", " ", "did", "n", "'", "t", " ", "work", ".", " ", "Tr", "y", " ", "addin", "g", " ", "'", "Standard", " ", "Time", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "see", "ms", " ", "to", " ", "work", " ", "a", " ", "lot", " ", "of", " ", "times", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timezone_", "=_", "tz", "\\u", "names_", "._", "get_", "(_", "tz", "keyname_", "+_", "'", " ", "Standard", " ", "Time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "what", " ", "we", " ", "have", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "timezone_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "pytz_", "._", "Un", "know", "n", "Time", "Zon", "e", "Error_", "(_", "'", "Can", " ", "not", " ", "find", " ", "timezon", "e", " ", "'_", "+_", "tz", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "timezone_", "\\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 ]
Use of the return value of a procedure
pycontribs/jira/setup.py
[ { "content": "#!/usr/bin/env python\nimport logging\nimport os\nimport sys\nimport subprocess\nimport warnings\nimport codecs\n\nfrom setuptools import setup, find_packages, Command\nfrom setuptools.command.test import test as TestCommand\n\nNAME = \"jira\"\n\nhere = os.path.dirname(__file__)\nif here not in sys.path:\n sys.path.insert(0, here)\n\nfrom jira.version import __version__ # noqa\n\n# this should help getting annoying warnings from inside distutils\nwarnings.simplefilter('ignore', UserWarning)\n\n\n\n\n\n\n\n\n\n\nsetup(\n name=NAME,\n version=__version__,\n cmdclass={'test': PyTest, 'release': Release, 'prerelease': PreRelease},\n packages=find_packages(exclude=['tests', 'tools']),\n include_package_data=True,\n\n install_requires=['requests>=2.6.0',\n 'requests_oauthlib>=0.3.3',\n 'tlslite>=0.4.4',\n 'six>=1.9.0',\n 'requests_toolbelt'] + (['ordereddict'] if _is_ordereddict_needed() else []),\n tests_require=['pytest', 'tlslite>=0.4.4', 'requests>=2.6.0',\n 'setuptools', 'pep8', 'autopep8', 'sphinx', 'sphinx_rtd_theme', 'six>=1.9.0',\n 'pytest-cov', 'pytest-pep8', 'pytest-instafail',\n 'pytest-xdist',\n ],\n extras_require={\n 'magic': ['filemagic>=1.6'],\n 'shell': ['ipython>=0.13']},\n entry_points={\n 'console_scripts':\n ['jirashell = jira.jirashell:main']},\n\n license='BSD',\n description='Python library for interacting with JIRA via REST APIs.',\n long_description=open(\"README.rst\").read(),\n maintainer='Sorin Sbarnea',\n maintainer_email='[email protected]',\n author='Ben Speakmon',\n author_email='[email protected]',\n provides=[NAME],\n url='https://github.com/pycontribs/jira',\n bugtrack_url='https://github.com/pycontribs/jira/issues',\n home_page='https://github.com/pycontribs/jira',\n download_url='https://github.com/pycontribs/jira/archive/%s.tar.gz' % __version__,\n keywords='jira atlassian rest api',\n\n classifiers=[\n 'Development Status :: 5 - Production/Stable',\n 'Environment :: Other Environment',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'Programming Language :: Python',\n 'Topic :: Internet :: WWW/HTTP',\n 'Topic :: Software Development :: Libraries :: Python Modules'])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _is_ordereddict_needed():\n \"\"\" Check if `ordereddict` package really needed \"\"\"\n try:\n return False\n except ImportError:\n pass\n return True", "metadata": "root._is_ordereddict_needed", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", ",_", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "._", "command_", "._", "test_", "import_", "test_", "as_", "Test", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "NAME_", "=_", "\"", "jira", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "here_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "here_", "not_", "in_", "sys_", "._", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "here_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "jira", "_", "._", "version_", "import_", "\\u\\u", "version\\u\\u_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "help", " ", "getti", "ng", " ", "anno", "ying", " ", "warn", "ings", " ", "from", " ", "insi", "de", " ", "distutils_", "\\u\\u\\uNL\\u\\u\\u_", "warnings_", "._", "simplefilter_", "(_", "'", "ignore", "'_", ",_", "User", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "{_", "'", "test", "'_", ":_", "Py", "Test_", ",_", "'", "release", "'_", ":_", "Release_", ",_", "'", "prere", "lease", "'_", ":_", "Pre", "Release_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", "exclude_", "=_", "[_", "'", "tests", "'_", ",_", "'", "tool", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "'", "request", "s", ">=", "2.6", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "s", "\\u", "oauth", "lib", ">=", "0.", "3.3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tls", "lite", ">=", "0.", "4.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "si", "x", ">=", "1.9", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "s", "\\u", "toolb", "elt", "'_", "]_", "+_", "(_", "[_", "'", "order", "eddi", "ct", "'_", "]_", "if_", "\\u", "is", "\\u", "order", "eddi", "ct", "\\u", "needed_", "(_", ")_", "else_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests", "\\u", "require_", "=_", "[_", "'", "pytest", "'_", ",_", "'", "tls", "lite", ">=", "0.", "4.4", "'_", ",_", "'", "request", "s", ">=", "2.6", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "setup", "tool", "s", "'_", ",_", "'", "pep", "8", "'_", ",_", "'", "autop", "ep", "8", "'_", ",_", "'", "sphinx", "'_", ",_", "'", "sphinx", "\\u", "rtd", "\\u", "them", "e", "'_", ",_", "'", "si", "x", ">=", "1.9", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pytest", "-", "cov", "'_", ",_", "'", "pytest", "-", "pep", "8", "'_", ",_", "'", "pytest", "-", "insta", "fail", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pytest", "-", "xdi", "st", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "s", "\\u", "require_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "magic", "'_", ":_", "[_", "'", "filem", "agi", "c", ">=", "1.6", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shell", "'_", ":_", "[_", "'", "ipython", ">=", "0.13", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "points_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "console", "\\u", "scripts", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "jira", "shell", " ", "=", " ", "jira", ".", "jira", "shell", ":", "main", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Pyth", "on", " ", "librar", "y", " ", "for", " ", "interacti", "ng", " ", "with", " ", "JI", "RA", " ", "via", " ", "REST", " ", "API", "s", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ")_", "._", "read_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer_", "=_", "'", "So", "rin", " ", "Sb", "arn", "ea", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer", "\\u", "email_", "=_", "'", "sor", "in", ".", "sba", "rne", "a", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Ben", " ", "Speak", "mon", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "ben", ".", "speak", "mon", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provides_", "=_", "[_", "NAME_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "pyco", "ntri", "bs", "/", "jira", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bug", "track", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "pyco", "ntri", "bs", "/", "jira", "/", "issue", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "home", "\\u", "page_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "pyco", "ntri", "bs", "/", "jira", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "pyco", "ntri", "bs", "/", "jira", "/", "archive", "/", "%", "s", ".", "tar", ".", "gz", "'_", "%_", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "jira", " ", "atlas", "sia", "n", " ", "rest", " ", "api", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Ot", "her", " ", "Environ", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\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", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "'_", "]_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "is", "\\u", "order", "eddi", "ct", "\\u", "needed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "if", " ", "`", "order", "eddi", "ct", "`", " ", "package", " ", "reall", "y", " ", "need", "ed", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Should use a 'with' statement
noirbizarre/flask-restplus/tests/test_api.py
[ { "content": " def test_multiple_default_endpoint_lazy_for_namespace(self):\n api = restplus.Api()\n ns = api.namespace('ns', 'Test namespace')\n\n @ns.route('/test2/')\n @ns.route('/test/')\n class TestResource(restplus.Resource):\n pass\n\n api.init_app(self.app)\n\n with self.context():\n self.assertEqual(url_for('ns_test_resource'), '/ns/test/')\n self.assertEqual(url_for('ns_test_resource_2'), '/ns/test2/')", "metadata": "root.APITestCase.test_multiple_default_endpoint_lazy_for_namespace", "header": "['class', 'APITestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 221 } ]
[]
[]
0
true
[ "[CLS]_", "Sho", "ul", "d_", "use_", "a_", "'", "with", "'_", "statement_", "[SEP]_", "class_", "API", "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", "multiple", "\\u", "default", "\\u", "endpoint", "\\u", "lazy", "\\u", "for", "\\u", "namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api_", "=_", "rest", "plus_", "._", "Api_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "=_", "api_", "._", "namespace_", "(_", "'", "ns", "'_", ",_", "'", "Test", " ", "namespace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "ns_", "._", "route_", "(_", "'/", "test", "2", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "ns_", "._", "route_", "(_", "'/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "Resource_", "(_", "rest", "plus_", "._", "Resource_", ")_", ":_", "\\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_", "api_", "._", "init", "\\u", "app_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "url", "\\u", "for_", "(_", "'", "ns", "\\u", "test\\u", "resource", "'_", ")_", ",_", "'/", "ns", "/", "test", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "url", "\\u", "for_", "(_", "'", "ns", "\\u", "test\\u", "resource", "\\u", "2", "'_", ")_", ",_", "'/", "ns", "/", "test", "2", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
SublimeText/PackageDev/fileconv/plist_parser.py
[ { "content": " def _push_value(self, value):\n if not self.__stack:\n self._assert(self.__plist is None, \"Multiple objects at top level\")\n self.__plist = value\n else:\n top = self.__stack[-1]\n #assert isinstance(top, (dict, list))\n if self.__in_dict:\n k = self.__key\n if k is None:\n raise PropertyListParseError(\"Missing key for dictionary.\")\n top[k] = value\n self.__key = None\n else:\n top.append(value)", "metadata": "root.XmlPropertyListParser._push_value", "header": "['class', 'XmlPropertyListParser', '(', 'object', ')', ':', '___EOS___']", "index": 112 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Xm", "l", "Proper", "ty", "List", "Parser_", "(_", "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", "push", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u\\u", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "assert_", "(_", "self_", "._", "\\u\\u", "plist_", "is_", "None_", ",_", "\"", "Multipl", "e", " ", "object", "s", " ", "at", " ", "top", " ", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "plist_", "=_", "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 ", " _", "top_", "=_", "self_", "._", "\\u\\u", "stack_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "assert", " ", "isin", "stance", "(", "top", ",", " ", "(", "dict", ",", " ", "list", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "in", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "k_", "=_", "self_", "._", "\\u\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Proper", "ty", "List", "Pars", "e", "Error_", "(_", "\"", "Missing", " ", "key", " ", "for", " ", "dictionar", "y", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "top_", "[_", "k_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "key_", "=_", "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 ", " _", "top_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
intuition-io/insights/insights/managers/_review/olmar.py
[ { "content": "import numpy as np\n\nfrom intuition.api.portfolio import PortfolioFactory\nimport insights.managers.utils as utils\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OLMAR(PortfolioFactory):\n '''\n On-Line Portfolio Moving Average Reversion\n\n More info can be found in the corresponding paper:\n http://icml.cc/2012/papers/168.pdf\n '''\n\n initialized = False\n\n\n\n", "metadata": "root.OLMAR", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def initialize(self, configuration):\n self.log.debug(configuration)\n self.eps = configuration.get('eps', 1)", "metadata": "root.OLMAR.initialize", "header": "['class', 'OLMAR', '(', 'PortfolioFactory', ')', ':', '___EOS___']", "index": 16 }, { "content": " def warm(self, data):\n self.m = len(data.keys())\n self.b_t = np.ones(self.m) / self.m", "metadata": "root.OLMAR.warm", "header": "['class', 'OLMAR', '(', 'PortfolioFactory', ')', ':', '___EOS___']", "index": 20 }, { "content": " def _rebalance_portfolio(self, data, desired_port):\n # rebalance portfolio\n allocations = {}\n desired_amount = np.zeros_like(desired_port)\n current_amount = np.zeros_like(desired_port)\n prices = np.zeros_like(desired_port)\n\n if not self.initialized:\n positions_value = self.portfolio.starting_cash\n self.initialized = True\n else:\n positions_value = self.portfolio.positions_value + \\\n self.portfolio.cash\n\n for i, stock in enumerate(data):\n current_amount[i] = self.portfolio.positions[stock].amount\n prices[i] = data[stock].price\n\n desired_amount = np.round(desired_port * positions_value / prices)\n\n diff_amount = desired_amount - current_amount\n\n for i, stock in enumerate(data):\n # Remove nan values\n if not np.isnan(diff_amount[i]):\n allocations[stock] = int(diff_amount[i])\n return allocations", "metadata": "root.OLMAR._rebalance_portfolio", "header": "['class', 'OLMAR', '(', 'PortfolioFactory', ')', ':', '___EOS___']", "index": 24 }, { "content": " def optimize(self, date, to_buy, to_sell, parameters):\n # This implementation only process buy signals\n allocations = {}\n for sid in to_sell:\n allocations[sid] = to_sell[sid].amount\n\n data = to_buy\n\n #if not self.initialized:\n #self._warm(data)\n\n x_tilde = np.zeros(self.m)\n b = np.zeros(self.m)\n\n # find relative moving average price for each security\n for i, stock in enumerate(data):\n price = data[stock].price\n # Relative mean deviation\n if 'mavg' in data[stock]:\n x_tilde[i] = data[stock]['mavg']['price'] / price\n\n ###########################\n # Inside of OLMAR (algo 2)\n x_bar = x_tilde.mean()\n\n # market relative deviation\n mark_rel_dev = x_tilde - x_bar\n\n # Expected return with current portfolio\n exp_return = np.dot(self.b_t, x_tilde)\n weight = self.eps - exp_return\n variability = (np.linalg.norm(mark_rel_dev)) ** 2\n\n # test for divide-by-zero case\n if variability == 0.0:\n step_size = 0\n else:\n step_size = max(0, weight / variability)\n\n b = self.b_t + step_size * mark_rel_dev\n b_norm = utils.simplex_projection(b)\n np.testing.assert_almost_equal(b_norm.sum(), 1)\n\n allocations.update(self._rebalance_portfolio(data, b_norm))\n\n # update portfolio\n self.b_t = b_norm\n\n #e_ret = 0\n #e_risk = 1\n e_ret = exp_return\n e_risk = variability\n return allocations, e_ret, e_risk", "metadata": "root.OLMAR.optimize", "header": "['class', 'OLMAR', '(', 'PortfolioFactory', ')', ':', '___EOS___']", "index": 52 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "int", "uit", "ion_", "._", "api_", "._", "portfolio_", "import_", "Port", "folio", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "insights", "_", "._", "managers_", "._", "utils_", "as_", "utils_", "\\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_", "OL", "MAR", "_", "(_", "Port", "folio", "Factory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "On", "-", "Line", " ", "Port", "folio", " ", "Movi", "ng", " ", "Average", " ", "Revers", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Mor", "e", " ", "info", " ", "can", " ", "be", " ", "found", " ", "in", " ", "the", " ", "correspond", "ing", " ", "pape", "r", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "ic", "ml", ".", "cc", "/", "2012", "/", "papers", "/", "168", ".", "pdf", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "initialized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "OL", "MAR", "_", "(_", "Port", "folio", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ",_", "configuration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "configuration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "eps_", "=_", "configuration_", "._", "get_", "(_", "'", "eps", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OL", "MAR", "_", "(_", "Port", "folio", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "warm", "_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "m_", "=_", "len_", "(_", "data_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b", "\\u", "t_", "=_", "np_", "._", "ones_", "(_", "self_", "._", "m_", ")_", "/_", "self_", "._", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OL", "MAR", "_", "(_", "Port", "folio", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rebalance", "\\u", "portfolio_", "(_", "self_", ",_", "data_", ",_", "desi", "red", "\\u", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rebalance", " ", "portfolio_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allocations", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "desi", "red", "\\u", "amount_", "=_", "np_", "._", "zero", "s", "\\u", "like_", "(_", "desi", "red", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "amount_", "=_", "np_", "._", "zero", "s", "\\u", "like_", "(_", "desi", "red", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prices_", "=_", "np_", "._", "zero", "s", "\\u", "like_", "(_", "desi", "red", "\\u", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "initialized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "position", "s", "\\u", "value_", "=_", "self_", "._", "portfolio_", "._", "startin", "g", "\\u", "cash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initialized_", "=_", "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 ", " _", "position", "s", "\\u", "value_", "=_", "self_", "._", "portfolio_", "._", "position", "s", "\\u", "value_", "+_", "self_", "._", "portfolio_", "._", "cash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "stock_", "in_", "enumerate_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "amount_", "[_", "i_", "]_", "=_", "self_", "._", "portfolio_", "._", "positions_", "[_", "stock_", "]_", "._", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prices_", "[_", "i_", "]_", "=_", "data_", "[_", "stock_", "]_", "._", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "desi", "red", "\\u", "amount_", "=_", "np_", "._", "round_", "(_", "desi", "red", "\\u", "port_", "*_", "position", "s", "\\u", "value_", "/_", "prices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "amount_", "=_", "desi", "red", "\\u", "amount_", "-_", "current", "\\u", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "stock_", "in_", "enumerate_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "nan", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "np_", "._", "isnan_", "(_", "diff", "\\u", "amount_", "[_", "i_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allocations", "_", "[_", "stock_", "]_", "=_", "int_", "(_", "diff", "\\u", "amount_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "allocations", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OL", "MAR", "_", "(_", "Port", "folio", "Factory_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "optimize_", "(_", "self_", ",_", "date_", ",_", "to", "\\u", "buy", "_", ",_", "to", "\\u", "sell", "_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "implementation", " ", "only", " ", "process", " ", "buy", " ", "signals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allocations", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sid_", "in_", "to", "\\u", "sell", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allocations", "_", "[_", "sid_", "]_", "=_", "to", "\\u", "sell", "_", "[_", "sid_", "]_", "._", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "to", "\\u", "buy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "self", ".", "initialize", "d", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".\\u", "warm", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "tilde", "_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "relative", " ", "movin", "g", " ", "averag", "e", " ", "price", " ", "for", " ", "each", " ", "security_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "stock_", "in_", "enumerate_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "price_", "=_", "data_", "[_", "stock_", "]_", "._", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Relative", " ", "mean", " ", "deviation", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "mav", "g", "'_", "in_", "data_", "[_", "stock_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "tilde", "_", "[_", "i_", "]_", "=_", "data_", "[_", "stock_", "]_", "[_", "'", "mav", "g", "'_", "]_", "[_", "'", "price", "'_", "]_", "/_", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inside", " ", "of", " ", "OL", "MAR", " ", "(", "algo", " ", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x", "\\u", "bar_", "=_", "x", "\\u", "tilde", "_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "market", " ", "relative", " ", "deviation", "_", "\\u\\u\\uNL\\u\\u\\u_", "mark", "\\u", "rel", "\\u", "dev_", "=_", "x", "\\u", "tilde", "_", "-_", "x", "\\u", "bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Expect", "ed", " ", "return", " ", "with", " ", "current", " ", "portfolio_", "\\u\\u\\uNL\\u\\u\\u_", "exp", "\\u", "return_", "=_", "np_", "._", "dot_", "(_", "self_", "._", "b", "\\u", "t_", ",_", "x", "\\u", "tilde", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight_", "=_", "self_", "._", "eps_", "-_", "exp", "\\u", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "ility_", "=_", "(_", "np_", "._", "linalg_", "._", "norm_", "(_", "mark", "\\u", "rel", "\\u", "dev_", ")_", ")_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "for", " ", "divide", "-", "by", "-", "zero", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "variab", "ility_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "size_", "=_", "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 ", " _", "step", "\\u", "size_", "=_", "max_", "(_", "0_", ",_", "weight_", "/_", "variab", "ility_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "=_", "self_", "._", "b", "\\u", "t_", "+_", "step", "\\u", "size_", "*_", "mark", "\\u", "rel", "\\u", "dev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u", "norm_", "=_", "utils_", "._", "simplex", "\\u", "projection_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "b", "\\u", "norm_", "._", "sum_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "allocations", "_", "._", "update_", "(_", "self_", "._", "\\u", "rebalance", "\\u", "portfolio_", "(_", "data_", ",_", "b", "\\u", "norm_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "portfolio_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "b", "\\u", "t_", "=_", "b", "\\u", "norm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "e\\u", "ret", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "e\\u", "risk", " ", "=", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "e\\u", "ret_", "=_", "exp", "\\u", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e\\u", "risk", "_", "=_", "variab", "ility_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "allocations", "_", ",_", "e\\u", "ret_", ",_", "e\\u", "risk", "_" ]
[ 4, 4, 4, 4, 4, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
devttys0/binwalk/src/binwalk/modules/hashmatch.py
[ { "content": " def _get_file_list(self, directory):\n '''\n Generates a directory tree.\n\n @directory - The root directory to start from.\n\n Returns a set of file paths, excluding the root directory.\n '''\n file_list = []\n\n # Normalize directory path so that we can exclude it from each individual file path\n directory = os.path.abspath(directory) + os.path.sep\n\n for (root, dirs, files) in os.walk(directory):\n # Don't include the root directory in the file paths\n root = ''.join(root.split(directory, 1)[1:])\n\n # Get a list of files, with or without symlinks as specified during __init__\n files = [os.path.join(root, f) for f in files if self.symlinks or not os.path.islink(f)]\n\n file_list += files\n \n return set(file_list)", "metadata": "root.HashMatch._get_file_list", "header": "['class', 'HashMatch', '(', 'Module', ')', ':', '___EOS___']", "index": 208 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Hash", "Match_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "file", "\\u", "list_", "(_", "self_", ",_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "a", " ", "director", "y", " ", "tree", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "director", "y", " ", "-", " ", "The", " ", "root", " ", "director", "y", " ", "to", " ", "start", " ", "from", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "set", " ", "of", " ", "file", " ", "path", "s", ",", " ", "excluding", " ", "the", " ", "root", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normalize", " ", "director", "y", " ", "path", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "exclu", "de", " ", "it", " ", "from", " ", "each", " ", "individual", " ", "file", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "directory_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "directory_", ")_", "+_", "os_", "._", "path_", "._", "sep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "root_", ",_", "dirs_", ",_", "files_", ")_", "in_", "os_", "._", "walk_", "(_", "directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "include", " ", "the", " ", "root", " ", "director", "y", " ", "in", " ", "the", " ", "file", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "''_", "._", "join_", "(_", "root_", "._", "split_", "(_", "directory_", ",_", "1_", ")_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "a", " ", "list", " ", "of", " ", "files", ",", " ", "with", " ", "or", " ", "with", "out", " ", "symlinks", " ", "as", " ", "specified", " ", "dur", "ing", " ", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "f_", ")_", "for_", "f_", "in_", "files_", "if_", "self_", "._", "symlin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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
scanny/python-pptx/pptx/dml/color.py
[ { "content": "# encoding: utf-8\n\n\"\"\"\nDrawingML objects related to color, ColorFormat being the most prominent.\n\"\"\"\n\nfrom __future__ import absolute_import, print_function, unicode_literals\n\nfrom ..enum.dml import MSO_COLOR_TYPE, MSO_THEME_COLOR\nfrom ..oxml.dml.color import (\n CT_HslColor, CT_PresetColor, CT_SchemeColor, CT_ScRgbColor, CT_SRgbColor,\n CT_SystemColor\n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ColorFormat(object):\n \"\"\"\n Provides access to color settings such as RGB color, theme color, and\n luminance adjustments.\n \"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.ColorFormat", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self, eg_colorChoice_parent, color):\n super(ColorFormat, self).__init__()\n self._xFill = eg_colorChoice_parent\n self._color = color", "metadata": "root.ColorFormat.__init__", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " @property\n def brightness(self):\n \"\"\"\n Read/write float value between -1.0 and 1.0 indicating the brightness\n adjustment for this color, e.g. -0.25 is 25% darker and 0.4 is 40%\n lighter. 0 means no brightness adjustment.\n \"\"\"\n return self._color.brightness", "metadata": "root.ColorFormat.brightness", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 25 }, { "content": " @brightness.setter\n def brightness(self, value):\n self._validate_brightness_value(value)\n self._color.brightness = value", "metadata": "root.ColorFormat.brightness", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " @classmethod\n def from_colorchoice_parent(cls, eg_colorChoice_parent):\n xClr = eg_colorChoice_parent.eg_colorChoice\n color = _Color(xClr)\n color_format = cls(eg_colorChoice_parent, color)\n return color_format", "metadata": "root.ColorFormat.from_colorchoice_parent", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " @property\n def rgb(self):\n \"\"\"\n |RGBColor| value of this color, or None if no RGB color is explicitly\n defined for this font. Setting this value to an |RGBColor| instance\n causes its type to change to MSO_COLOR_TYPE.RGB. If the color was a\n theme color with a brightness adjustment, the brightness adjustment\n is removed when changing it to an RGB color.\n \"\"\"\n return self._color.rgb", "metadata": "root.ColorFormat.rgb", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": " @rgb.setter\n def rgb(self, rgb):\n if not isinstance(rgb, RGBColor):\n raise ValueError('assigned value must be type RGBColor')\n # change to rgb color format if not already\n if not isinstance(self._color, _SRgbColor):\n srgbClr = self._xFill.get_or_change_to_srgbClr()\n self._color = _SRgbColor(srgbClr)\n # call _SRgbColor instance to do the setting\n self._color.rgb = rgb", "metadata": "root.ColorFormat.rgb", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 57 }, { "content": " @property\n def theme_color(self):\n \"\"\"\n Theme color value of this color, one of those defined in the\n MSO_THEME_COLOR enumeration, e.g. MSO_THEME_COLOR.ACCENT_1. Raises\n AttributeError on access if the color is not type\n ``MSO_COLOR_TYPE.SCHEME``. Assigning a value in ``MSO_THEME_COLOR``\n causes the color's type to change to ``MSO_COLOR_TYPE.SCHEME``.\n \"\"\"\n return self._color.theme_color", "metadata": "root.ColorFormat.theme_color", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " @theme_color.setter\n def theme_color(self, mso_theme_color_idx):\n # change to theme color format if not already\n if not isinstance(self._color, _SchemeColor):\n schemeClr = self._xFill.get_or_change_to_schemeClr()\n self._color = _SchemeColor(schemeClr)\n self._color.theme_color = mso_theme_color_idx", "metadata": "root.ColorFormat.theme_color", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " @property\n def type(self):\n \"\"\"\n Read-only. A value from :ref:`MsoColorType`, either RGB or SCHEME,\n corresponding to the way this color is defined, or None if no color\n is defined at the level of this font.\n \"\"\"\n return self._color.color_type", "metadata": "root.ColorFormat.type", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": " def _validate_brightness_value(self, value):\n if value < -1.0 or value > 1.0:\n raise ValueError('brightness must be number in range -1.0 to 1.0')\n if isinstance(self._color, _NoneColor):\n msg = (\n \"can't set brightness when color.type is None. Set color.rgb\"\n \" or .theme_color first.\"\n )\n raise ValueError(msg)", "metadata": "root.ColorFormat._validate_brightness_value", "header": "['class', 'ColorFormat', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": "class _Color(object):\n \"\"\"\n Object factory for color object of the appropriate type, also the base\n class for all color type classes such as SRgbColor.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root._Color", "header": "['module', '___EOS___']", "index": 107 }, { "content": " def __new__(cls, xClr):\n color_cls = {\n type(None): _NoneColor,\n CT_HslColor: _HslColor,\n CT_PresetColor: _PrstColor,\n CT_SchemeColor: _SchemeColor,\n CT_ScRgbColor: _ScRgbColor,\n CT_SRgbColor: _SRgbColor,\n CT_SystemColor: _SysColor,\n }[type(xClr)]\n return super(_Color, cls).__new__(color_cls)", "metadata": "root._Color.__new__", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def __init__(self, xClr):\n super(_Color, self).__init__()\n self._xClr = xClr", "metadata": "root._Color.__init__", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 124 }, { "content": " @property\n def brightness(self):\n lumMod, lumOff = self._xClr.lumMod, self._xClr.lumOff\n # a tint is lighter, a shade is darker\n # only tints have lumOff child\n if lumOff is not None:\n brightness = lumOff.val\n return brightness\n # which leaves shades, if lumMod is present\n if lumMod is not None:\n brightness = lumMod.val - 1.0\n return brightness\n # there's no brightness adjustment if no lum{Mod|Off} elements\n return 0", "metadata": "root._Color.brightness", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 128 }, { "content": " @brightness.setter\n def brightness(self, value):\n if value > 0:\n self._tint(value)\n elif value < 0:\n self._shade(value)\n else:\n self._xClr.clear_lum()", "metadata": "root._Color.brightness", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 143 }, { "content": " @property\n def color_type(self): # pragma: no cover\n tmpl = \".color_type property must be implemented on %s\"\n raise NotImplementedError(tmpl % self.__class__.__name__)", "metadata": "root._Color.color_type", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 152 }, { "content": " @property\n def rgb(self):\n \"\"\"\n Raises TypeError on access unless overridden by subclass.\n \"\"\"\n tmpl = \"no .rgb property on color type '%s'\"\n raise AttributeError(tmpl % self.__class__.__name__)", "metadata": "root._Color.rgb", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 157 }, { "content": " @property\n def theme_color(self):\n \"\"\"\n Raises TypeError on access unless overridden by subclass.\n \"\"\"\n return MSO_THEME_COLOR.NOT_THEME_COLOR", "metadata": "root._Color.theme_color", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 165 }, { "content": " def _shade(self, value):\n lumMod_val = 1.0 - abs(value)\n color_elm = self._xClr.clear_lum()\n color_elm.add_lumMod(lumMod_val)", "metadata": "root._Color._shade", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 172 }, { "content": " def _tint(self, value):\n lumOff_val = value\n lumMod_val = 1.0 - lumOff_val\n color_elm = self._xClr.clear_lum()\n color_elm.add_lumMod(lumMod_val)\n color_elm.add_lumOff(lumOff_val)", "metadata": "root._Color._tint", "header": "['class', '_Color', '(', 'object', ')', ':', '___EOS___']", "index": 177 }, { "content": "class _HslColor(_Color):\n", "metadata": "root._HslColor", "header": "['module', '___EOS___']", "index": 185 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.HSL", "metadata": "root._HslColor.color_type", "header": "['class', '_HslColor', '(', '_Color', ')', ':', '___EOS___']", "index": 187 }, { "content": "class _NoneColor(_Color):\n\n", "metadata": "root._NoneColor", "header": "['module', '___EOS___']", "index": 192 }, { "content": " @property\n def color_type(self):\n return None", "metadata": "root._NoneColor.color_type", "header": "['class', '_NoneColor', '(', '_Color', ')', ':', '___EOS___']", "index": 194 }, { "content": " @property\n def theme_color(self):\n \"\"\"\n Raise TypeError on attempt to access .theme_color when no color\n choice is present.\n \"\"\"\n tmpl = \"no .theme_color property on color type '%s'\"\n raise AttributeError(tmpl % self.__class__.__name__)", "metadata": "root._NoneColor.theme_color", "header": "['class', '_NoneColor', '(', '_Color', ')', ':', '___EOS___']", "index": 198 }, { "content": "class _PrstColor(_Color):\n", "metadata": "root._PrstColor", "header": "['module', '___EOS___']", "index": 208 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.PRESET", "metadata": "root._PrstColor.color_type", "header": "['class', '_PrstColor', '(', '_Color', ')', ':', '___EOS___']", "index": 210 }, { "content": "class _SchemeColor(_Color):\n\n\n\n", "metadata": "root._SchemeColor", "header": "['module', '___EOS___']", "index": 215 }, { "content": " def __init__(self, schemeClr):\n super(_SchemeColor, self).__init__(schemeClr)\n self._schemeClr = schemeClr", "metadata": "root._SchemeColor.__init__", "header": "['class', '_SchemeColor', '(', '_Color', ')', ':', '___EOS___']", "index": 217 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.SCHEME", "metadata": "root._SchemeColor.color_type", "header": "['class', '_SchemeColor', '(', '_Color', ')', ':', '___EOS___']", "index": 221 }, { "content": " @property\n def theme_color(self):\n \"\"\"\n Theme color value of this color, one of those defined in the\n MSO_THEME_COLOR enumeration, e.g. MSO_THEME_COLOR.ACCENT_1. None if\n no theme color is explicitly defined for this font. Setting this to a\n value in MSO_THEME_COLOR causes the color's type to change to\n ``MSO_COLOR_TYPE.SCHEME``.\n \"\"\"\n return self._schemeClr.val", "metadata": "root._SchemeColor.theme_color", "header": "['class', '_SchemeColor', '(', '_Color', ')', ':', '___EOS___']", "index": 225 }, { "content": " @theme_color.setter\n def theme_color(self, mso_theme_color_idx):\n self._schemeClr.val = mso_theme_color_idx", "metadata": "root._SchemeColor.theme_color", "header": "['class', '_SchemeColor', '(', '_Color', ')', ':', '___EOS___']", "index": 236 }, { "content": "class _ScRgbColor(_Color):\n", "metadata": "root._ScRgbColor", "header": "['module', '___EOS___']", "index": 241 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.SCRGB", "metadata": "root._ScRgbColor.color_type", "header": "['class', '_ScRgbColor', '(', '_Color', ')', ':', '___EOS___']", "index": 243 }, { "content": "class _SRgbColor(_Color):\n\n\n\n", "metadata": "root._SRgbColor", "header": "['module', '___EOS___']", "index": 248 }, { "content": " def __init__(self, srgbClr):\n super(_SRgbColor, self).__init__(srgbClr)\n self._srgbClr = srgbClr", "metadata": "root._SRgbColor.__init__", "header": "['class', '_SRgbColor', '(', '_Color', ')', ':', '___EOS___']", "index": 250 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.RGB", "metadata": "root._SRgbColor.color_type", "header": "['class', '_SRgbColor', '(', '_Color', ')', ':', '___EOS___']", "index": 254 }, { "content": " @property\n def rgb(self):\n \"\"\"\n |RGBColor| value of this color, corresponding to the value in the\n required ``val`` attribute of the ``<a:srgbColr>`` element.\n \"\"\"\n return RGBColor.from_string(self._srgbClr.val)", "metadata": "root._SRgbColor.rgb", "header": "['class', '_SRgbColor', '(', '_Color', ')', ':', '___EOS___']", "index": 258 }, { "content": " @rgb.setter\n def rgb(self, rgb):\n self._srgbClr.val = str(rgb)", "metadata": "root._SRgbColor.rgb", "header": "['class', '_SRgbColor', '(', '_Color', ')', ':', '___EOS___']", "index": 266 }, { "content": "class _SysColor(_Color):\n", "metadata": "root._SysColor", "header": "['module', '___EOS___']", "index": 271 }, { "content": " @property\n def color_type(self):\n return MSO_COLOR_TYPE.SYSTEM", "metadata": "root._SysColor.color_type", "header": "['class', '_SysColor', '(', '_Color', ')', ':', '___EOS___']", "index": 273 }, { "content": "class RGBColor(tuple):\n \"\"\"\n Immutable value object defining a particular RGB color.\n \"\"\"\n\n", "metadata": "root.RGBColor", "header": "['module', '___EOS___']", "index": 278 }, { "content": " def __new__(cls, r, g, b):\n msg = 'RGBColor() takes three integer values 0-255'\n for val in (r, g, b):\n if not isinstance(val, int) or val < 0 or val > 255:\n raise ValueError(msg)\n return super(RGBColor, cls).__new__(cls, (r, g, b))", "metadata": "root.RGBColor.__new__", "header": "['class', 'RGBColor', '(', 'tuple', ')', ':', '___EOS___']", "index": 282 }, { "content": " def __str__(self):\n \"\"\"\n Return a hex string rgb value, like '3C2F80'\n \"\"\"\n return '%02X%02X%02X' % self", "metadata": "root.RGBColor.__str__", "header": "['class', 'RGBColor', '(', 'tuple', ')', ':', '___EOS___']", "index": 289 }, { "content": " @classmethod\n def from_string(cls, rgb_hex_str):\n \"\"\"\n Return a new instance from an RGB color hex string like ``'3C2F80'``.\n \"\"\"\n r = int(rgb_hex_str[:2], 16)\n g = int(rgb_hex_str[2:4], 16)\n b = int(rgb_hex_str[4:], 16)\n return cls(r, g, b)", "metadata": "root.RGBColor.from_string", "header": "['class', 'RGBColor', '(', 'tuple', ')', ':', '___EOS___']", "index": 295 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Draw", "ing", "ML", " ", "object", "s", " ", "relate", "d", " ", "to", " ", "color", ",", " ", "Color", "Format", " ", "bei", "ng", " ", "the", " ", "most", " ", "prom", "inen", "t", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "enum_", "._", "dm", "l_", "import_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", ",_", "MS", "O", "\\u", "THEME", "\\u", "COLOR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "ox", "ml_", "._", "dm", "l_", "._", "color_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "Hs", "l", "Color_", ",_", "CT", "\\u", "Preset", "Color_", ",_", "CT", "\\u", "Sche", "me", "Color_", ",_", "CT", "\\u", "Sc", "Rg", "b", "Color_", ",_", "CT", "\\u", "SR", "gb", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "System", "Color_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Prov", "ides", " ", "access", " ", "to", " ", "color", " ", "settings", " ", "suc", "h", " ", "as", " ", "RGB", " ", "color", ",", " ", "them", "e", " ", "color", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "lumin", "anc", "e", " ", "adjustment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "eg", "\\u", "color", "Choi", "ce", "\\u", "parent_", ",_", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Color", "Format_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x", "Fill_", "=_", "eg", "\\u", "color", "Choi", "ce", "\\u", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "color_", "=_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "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_", "brightness_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", "/", "write", " ", "float", " ", "value", " ", "bet", "ween", " ", "-1", ".0", " ", "and", " ", "1.0", " ", "indicati", "ng", " ", "the", " ", "bright", "ness", "\\", "10", ";", " ", " ", " ", " ", "adjustment", " ", "for", " ", "this", " ", "color", ",", " ", "e", ".", "g", ".", " ", "-0", ".2", "5", " ", "is", " ", "25", "%", " ", "dark", "er", " ", "and", " ", "0.", "4", " ", "is", " ", "40", "%\\", "10", ";", " ", " ", " ", " ", "light", "er", ".", " ", "0", " ", "means", " ", "no", " ", "bright", "ness", " ", "adjustment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "color_", "._", "brightness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "brightness_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "brightness_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "validat", "e\\u", "bright", "ness", "\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "color_", "._", "brightness_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "color", "choice", "\\u", "parent_", "(_", "cls_", ",_", "eg", "\\u", "color", "Choi", "ce", "\\u", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "Cl", "r_", "=_", "eg", "\\u", "color", "Choi", "ce", "\\u", "parent_", "._", "eg", "\\u", "color", "Choice_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "\\u", "Color_", "(_", "x", "Cl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "format_", "=_", "cls_", "(_", "eg", "\\u", "color", "Choi", "ce", "\\u", "parent_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "color", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "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_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "|", "RGB", "Color", "|", " ", "value", " ", "of", " ", "this", " ", "color", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "RGB", " ", "color", " ", "is", " ", "explicit", "ly", "\\", "10", ";", " ", " ", " ", " ", "defin", "ed", " ", "for", " ", "this", " ", "font", ".", " ", "Sett", "ing", " ", "this", " ", "value", " ", "to", " ", "an", " ", "|", "RGB", "Color", "|", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "caus", "es", " ", "its", " ", "type", " ", "to", " ", "change", " ", "to", " ", "MS", "O", "\\u", "COLOR", "\\u", "TYPE", ".", "RGB", ".", " ", "If", " ", "the", " ", "color", " ", "was", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "them", "e", " ", "color", " ", "with", " ", "a", " ", "bright", "ness", " ", "adjustment", ",", " ", "the", " ", "bright", "ness", " ", "adjustment", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "remove", "d", " ", "whe", "n", " ", "chang", "ing", " ", "it", " ", "to", " ", "an", " ", "RGB", " ", "color", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "color_", "._", "rgb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rgb_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ",_", "rgb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "rgb_", ",_", "RGB", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "assign", "ed", " ", "value", " ", "must", " ", "be", " ", "type", " ", "RGB", "Color", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "change", " ", "to", " ", "rgb", " ", "color", " ", "format", " ", "if", " ", "not", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "self_", "._", "\\u", "color_", ",_", "\\u", "SR", "gb", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sr", "gb", "Cl", "r_", "=_", "self_", "._", "\\u", "x", "Fill_", "._", "get", "\\u", "or", "\\u", "change", "\\u", "to", "\\u", "sr", "gb", "Cl", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "color_", "=_", "\\u", "SR", "gb", "Color_", "(_", "sr", "gb", "Cl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "\\u", "SR", "gb", "Color", " ", "instance", " ", "to", " ", "do", " ", "the", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "color_", "._", "rgb_", "=_", "rgb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "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_", "them", "e\\u", "color_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Them", "e", " ", "color", " ", "value", " ", "of", " ", "this", " ", "color", ",", " ", "one", " ", "of", " ", "tho", "se", " ", "defin", "ed", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "MS", "O", "\\u", "THEME", "\\u", "COLOR", " ", "enumerati", "on", ",", " ", "e", ".", "g", ".", " ", "MS", "O", "\\u", "THEME", "\\u", "COLOR", ".", "ACCE", "NT", "\\u", "1", ".", " ", "Rai", "ses", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "Error", " ", "on", " ", "access", " ", "if", " ", "the", " ", "color", " ", "is", " ", "not", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "``", "MS", "O", "\\u", "COLOR", "\\u", "TYPE", ".", "SCHEME", "``.", " ", "Assign", "ing", " ", "a", " ", "value", " ", "in", " ", "``", "MS", "O", "\\u", "THEME", "\\u", "COLOR", "``", "\\", "10", ";", " ", " ", " ", " ", "caus", "es", " ", "the", " ", "color", "'", "s", " ", "type", " ", "to", " ", "change", " ", "to", " ", "``", "MS", "O", "\\u", "COLOR", "\\u", "TYPE", ".", "SCHEME", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "color_", "._", "them", "e\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "them", "e\\u", "color_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "them", "e\\u", "color_", "(_", "self_", ",_", "mso", "\\u", "them", "e\\u", "color", "\\u", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "change", " ", "to", " ", "them", "e", " ", "color", " ", "format", " ", "if", " ", "not", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "self_", "._", "\\u", "color_", ",_", "\\u", "Sche", "me", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sche", "me", "Cl", "r_", "=_", "self_", "._", "\\u", "x", "Fill_", "._", "get", "\\u", "or", "\\u", "change", "\\u", "to", "\\u", "sche", "me", "Cl", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "color_", "=_", "\\u", "Sche", "me", "Color_", "(_", "sche", "me", "Cl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "color_", "._", "them", "e\\u", "color_", "=_", "mso", "\\u", "them", "e\\u", "color", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "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_", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", "-", "only", ".", " ", "A", " ", "value", " ", "from", " ", ":", "ref", ":`", "Ms", "o", "Color", "Type", "`", ",", " ", "eit", "her", " ", "RGB", " ", "or", " ", "SCHEME", ",", "\\", "10", ";", " ", " ", " ", " ", "correspond", "ing", " ", "to", " ", "the", " ", "way", " ", "this", " ", "color", " ", "is", " ", "defin", "ed", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "no", " ", "color", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "defin", "ed", " ", "at", " ", "the", " ", "level", " ", "of", " ", "this", " ", "font", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "color_", "._", "color", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Color", "Format_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "validat", "e\\u", "bright", "ness", "\\u", "value_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "<_", "-_", "1.0_", "or_", "value_", ">_", "1.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "bright", "ness", " ", "must", " ", "be", " ", "number", " ", "in", " ", "range", " ", "-1", ".0", " ", "to", " ", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "self_", "._", "\\u", "color_", ",_", "\\u", "Non", "e", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", "'", "t", " ", "set", " ", "bright", "ness", " ", "whe", "n", " ", "color", ".", "type", " ", "is", " ", "Non", "e", ".", " ", "Set", " ", "color", ".", "rgb", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "or", " ", ".", "them", "e\\u", "color", " ", "first", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Object", " ", "factor", "y", " ", "for", " ", "color", " ", "object", " ", "of", " ", "the", " ", "appropr", "iate", " ", "type", ",", " ", "als", "o", " ", "the", " ", "base", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "for", " ", "all", " ", "color", " ", "type", " ", "classe", "s", " ", "suc", "h", " ", "as", " ", "SR", "gb", "Color", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "x", "Cl", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color", "\\u", "cls_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "None_", ")_", ":_", "\\u", "Non", "e", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "Hs", "l", "Color_", ":_", "\\u", "Hs", "l", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "Preset", "Color_", ":_", "\\u", "Pr", "st", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "Sche", "me", "Color_", ":_", "\\u", "Sche", "me", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "Sc", "Rg", "b", "Color_", ":_", "\\u", "Sc", "Rg", "b", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "SR", "gb", "Color_", ":_", "\\u", "SR", "gb", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CT", "\\u", "System", "Color_", ":_", "\\u", "Sys", "Color_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[_", "type_", "(_", "x", "Cl", "r_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "\\u", "Color_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "color", "\\u", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x", "Cl", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "\\u", "Color_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x", "Cl", "r_", "=_", "x", "Cl", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "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_", "brightness_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lum", "Mod_", ",_", "lum", "Off_", "=_", "self_", "._", "\\u", "x", "Cl", "r_", "._", "lum", "Mod_", ",_", "self_", "._", "\\u", "x", "Cl", "r_", "._", "lum", "Off_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "tint", " ", "is", " ", "light", "er", ",", " ", "a", " ", "shade", " ", "is", " ", "dark", "er_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "tint", "s", " ", "have", " ", "lum", "Off", " ", "child_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lum", "Off_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "brightness_", "=_", "lum", "Off_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "brightness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "whi", "ch", " ", "lea", "ves", " ", "shade", "s", ",", " ", "if", " ", "lum", "Mod", " ", "is", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lum", "Mod_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "brightness_", "=_", "lum", "Mod_", "._", "val_", "-_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "brightness_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", "'", "s", " ", "no", " ", "bright", "ness", " ", "adjustment", " ", "if", " ", "no", " ", "lum", "{", "Mod", "|", "Off", "}", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "brightness_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "brightness_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "tint", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "shade", "_", "(_", "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 ", " _", "self_", "._", "\\u", "x", "Cl", "r_", "._", "clear", "\\u", "lum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpl_", "=_", "\".", "color", "\\u", "type", " ", "property", " ", "must", " ", "be", " ", "implemented", " ", "on", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "tmpl_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "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_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Type", "Error", " ", "on", " ", "access", " ", "unl", "ess", " ", "overrid", "den", " ", "by", " ", "subclass", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpl_", "=_", "\"", "no", " ", ".", "rgb", " ", "property", " ", "on", " ", "color", " ", "type", " ", "'%", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "tmpl_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "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_", "them", "e\\u", "color_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Type", "Error", " ", "on", " ", "access", " ", "unl", "ess", " ", "overrid", "den", " ", "by", " ", "subclass", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "MS", "O", "\\u", "THEME", "\\u", "COLOR_", "._", "NOT", "\\u", "THEME", "\\u", "COLOR_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "shade", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lum", "Mod", "\\u", "val_", "=_", "1.0_", "-_", "abs_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "elm_", "=_", "self_", "._", "\\u", "x", "Cl", "r_", "._", "clear", "\\u", "lum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "elm_", "._", "add", "\\u", "lum", "Mod_", "(_", "lum", "Mod", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Color_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "tint", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lum", "Off", "\\u", "val_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lum", "Mod", "\\u", "val_", "=_", "1.0_", "-_", "lum", "Off", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "elm_", "=_", "self_", "._", "\\u", "x", "Cl", "r_", "._", "clear", "\\u", "lum", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "elm_", "._", "add", "\\u", "lum", "Mod_", "(_", "lum", "Mod", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "elm_", "._", "add", "\\u", "lum", "Off_", "(_", "lum", "Off", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Hs", "l", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Hs", "l", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "HS", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Non", "e", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Non", "e", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Non", "e", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", "them", "e\\u", "color_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "se", " ", "Type", "Error", " ", "on", " ", "atte", "mpt", " ", "to", " ", "access", " ", ".", "them", "e\\u", "color", " ", "whe", "n", " ", "no", " ", "color", "\\", "10", ";", " ", " ", " ", " ", "choice", " ", "is", " ", "presen", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpl_", "=_", "\"", "no", " ", ".", "them", "e\\u", "color", " ", "property", " ", "on", " ", "color", " ", "type", " ", "'%", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "tmpl_", "%_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\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_", "class_", "\\u", "Pr", "st", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Pr", "st", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "PRESE", "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_", "class_", "\\u", "Sche", "me", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sche", "me", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", ",_", "sche", "me", "Cl", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "\\u", "Sche", "me", "Color_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "sche", "me", "Cl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sche", "me", "Cl", "r_", "=_", "sche", "me", "Cl", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sche", "me", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "SCHEME", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sche", "me", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", "them", "e\\u", "color_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Them", "e", " ", "color", " ", "value", " ", "of", " ", "this", " ", "color", ",", " ", "one", " ", "of", " ", "tho", "se", " ", "defin", "ed", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "MS", "O", "\\u", "THEME", "\\u", "COLOR", " ", "enumerati", "on", ",", " ", "e", ".", "g", ".", " ", "MS", "O", "\\u", "THEME", "\\u", "COLOR", ".", "ACCE", "NT", "\\u", "1", ".", " ", "Non", "e", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "no", " ", "them", "e", " ", "color", " ", "is", " ", "explicit", "ly", " ", "defin", "ed", " ", "for", " ", "this", " ", "font", ".", " ", "Sett", "ing", " ", "this", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "in", " ", "MS", "O", "\\u", "THEME", "\\u", "COLOR", " ", "caus", "es", " ", "the", " ", "color", "'", "s", " ", "type", " ", "to", " ", "change", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "``", "MS", "O", "\\u", "COLOR", "\\u", "TYPE", ".", "SCHEME", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "sche", "me", "Cl", "r_", "._", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sche", "me", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "them", "e\\u", "color_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "them", "e\\u", "color_", "(_", "self_", ",_", "mso", "\\u", "them", "e\\u", "color", "\\u", "idx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sche", "me", "Cl", "r_", "._", "val_", "=_", "mso", "\\u", "them", "e\\u", "color", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Sc", "Rg", "b", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sc", "Rg", "b", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "SCR", "GB", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "SR", "gb", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "SR", "gb", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", ",_", "sr", "gb", "Cl", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "\\u", "SR", "gb", "Color_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "sr", "gb", "Cl", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sr", "gb", "Cl", "r_", "=_", "sr", "gb", "Cl", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "SR", "gb", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "RGB_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "SR", "gb", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\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_", "rgb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "|", "RGB", "Color", "|", " ", "value", " ", "of", " ", "this", " ", "color", ",", " ", "correspond", "ing", " ", "to", " ", "the", " ", "value", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "require", "d", " ", "``", "val", "``", " ", "attribute", " ", "of", " ", "the", " ", "``", "<", "a", ":", "sr", "gb", "Col", "r", ">`", "`", " ", "element", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "RGB", "Color_", "._", "from", "\\u", "string_", "(_", "self_", "._", "\\u", "sr", "gb", "Cl", "r_", "._", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "SR", "gb", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "rgb_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rgb_", "(_", "self_", ",_", "rgb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sr", "gb", "Cl", "r_", "._", "val_", "=_", "str_", "(_", "rgb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Sys", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Sys", "Color_", "(_", "\\u", "Color_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "color", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "MS", "O", "\\u", "COLOR", "\\u", "TYPE_", "._", "SYSTEM", "_", "\\u\\u\\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_", "RGB", "Color_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Immu", "table", " ", "value", " ", "object", " ", "defini", "ng", " ", "a", " ", "partic", "ular", " ", "RGB", " ", "color", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "r_", ",_", "g_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "RGB", "Color", "()", " ", "take", "s", " ", "three", " ", "integ", "er", " ", "values", " ", "0", "-", "255", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "(_", "r_", ",_", "g_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "val_", ",_", "int_", ")_", "or_", "val_", "<_", "0_", "or_", "val_", ">_", "255_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "RGB", "Color_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "(_", "r_", ",_", "g_", ",_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "hex", " ", "string", " ", "rgb", " ", "value", ",", " ", "like", " ", "'", "3", "C2", "F8", "0", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'%", "02", "X", "%", "02", "X", "%", "02", "X", "'_", "%_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RGB", "Color_", "(_", "tuple_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "string_", "(_", "cls_", ",_", "rgb", "\\u", "hex", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "new", " ", "instance", " ", "from", " ", "an", " ", "RGB", " ", "color", " ", "hex", " ", "string", " ", "like", " ", "``", "'", "3", "C2", "F8", "0", "'``", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "int_", "(_", "rgb", "\\u", "hex", "\\u", "str_", "[_", ":_", "2_", "]_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "int_", "(_", "rgb", "\\u", "hex", "\\u", "str_", "[_", "2_", ":_", "4_", "]_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "int_", "(_", "rgb", "\\u", "hex", "\\u", "str_", "[_", "4_", ":_", "]_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "r_", ",_", "g_", ",_", "b_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
amolenaar/roles/example.py
[ { "content": " def withdraw(self, amount):\n print \"Withdraw \" + str(amount) + \" from \" + str(self)\n self.balance -= amount", "metadata": "root.Account.withdraw", "header": "['class', 'Account', '(', 'object', ')', ':', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Account_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "withdraw", "_", "(_", "self_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "With", "draw", " ", "\"_", "+_", "str_", "(_", "amount_", ")_", "+_", "\"", " ", "from", " ", "\"_", "+_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "balance_", "-=_", "amount_", "\\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 ]
Variable defined multiple times
OpenMDAO/OpenMDAO/mpitest/test_sqlite.py
[ { "content": " def test_basic(self):\n size = 3\n\n prob = Problem(Group(), impl=impl)\n\n G1 = prob.root.add('G1', ParallelGroup())\n G1.add('P1', IndepVarComp('x', np.ones(size, float) * 1.0))\n G1.add('P2', IndepVarComp('x', np.ones(size, float) * 2.0))\n\n prob.root.add('C1', ABCDArrayComp(size))\n\n prob.root.connect('G1.P1.x', 'C1.a')\n prob.root.connect('G1.P2.x', 'C1.b')\n\n prob.driver.add_recorder(self.recorder)\n\n self.recorder.options['record_params'] = True\n self.recorder.options['record_resids'] = True\n\n prob.setup(check=False)\n\n t0, t1 = run(prob)\n prob.cleanup()\n\n expected_params = [\n (\"C1.a\", [1.0, 1.0, 1.0]),\n (\"C1.b\", [2.0, 2.0, 2.0]),\n ]\n\n expected_unknowns = [\n (\"G1.P1.x\", np.array([1.0, 1.0, 1.0])),\n (\"G1.P2.x\", np.array([2.0, 2.0, 2.0])),\n (\"C1.c\", np.array([3.0, 3.0, 3.0])),\n (\"C1.d\", np.array([-1.0, -1.0, -1.0])),\n (\"C1.out_string\", \"_C1\"),\n (\"C1.out_list\", [1.5]),\n ]\n expected_resids = [\n (\"G1.P1.x\", np.array([0.0, 0.0, 0.0])),\n (\"G1.P2.x\", np.array([0.0, 0.0, 0.0])),\n (\"C1.c\", np.array([0.0, 0.0, 0.0])),\n (\"C1.d\", np.array([0.0, 0.0, 0.0])),\n (\"C1.out_string\", \"\"),\n (\"C1.out_list\", []),\n ]\n\n self.assertIterationDataRecorded(((coordinate, (t0, t1),\n expected_params, expected_unknowns,\n expected_resids),),\n self.eps, prob.root)", "metadata": "root.TestSqliteRecorder.test_basic", "header": "['class', 'TestSqliteRecorder', '(', 'MPITestCase', ')', ':', '___EOS___']", "index": 100 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Sqlite", "Recorder", "_", "(_", "MPI", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "=_", "Problem_", "(_", "Group_", "(_", ")_", ",_", "impl_", "=_", "impl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "G1_", "=_", "prob_", "._", "root_", "._", "add_", "(_", "'", "G1", "'_", ",_", "Parallel", "Group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "._", "add_", "(_", "'", "P1", "'_", ",_", "Inde", "p", "Var", "Comp_", "(_", "'", "x", "'_", ",_", "np_", "._", "ones_", "(_", "size_", ",_", "float_", ")_", "*_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G1_", "._", "add_", "(_", "'", "P2", "'_", ",_", "Inde", "p", "Var", "Comp_", "(_", "'", "x", "'_", ",_", "np_", "._", "ones_", "(_", "size_", ",_", "float_", ")_", "*_", "2.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "root_", "._", "add_", "(_", "'", "C1", "'_", ",_", "ABC", "DA", "rray", "Comp_", "(_", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "root_", "._", "connect_", "(_", "'", "G1", ".", "P1", ".", "x", "'_", ",_", "'", "C1", ".", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "root_", "._", "connect_", "(_", "'", "G1", ".", "P2", ".", "x", "'_", ",_", "'", "C1", ".", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "driver_", "._", "add", "\\u", "recorder_", "(_", "self_", "._", "recorder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "recorder_", "._", "options_", "[_", "'", "record", "\\u", "params", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "recorder_", "._", "options_", "[_", "'", "record", "\\u", "resid", "s", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prob_", "._", "setup_", "(_", "check_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", ",_", "t1_", "=_", "run_", "(_", "prob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prob_", "._", "cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "params_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "a", "\"_", ",_", "[_", "1.0_", ",_", "1.0_", ",_", "1.0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "b", "\"_", ",_", "[_", "2.0_", ",_", "2.0_", ",_", "2.0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "unknown", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "G1", ".", "P1", ".", "x", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "1.0_", ",_", "1.0_", ",_", "1.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "G1", ".", "P2", ".", "x", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "2.0_", ",_", "2.0_", ",_", "2.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "c", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "3.0_", ",_", "3.0_", ",_", "3.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "d", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "-_", "1.0_", ",_", "-_", "1.0_", ",_", "-_", "1.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "out", "\\u", "string", "\"_", ",_", "\"\\u", "C1", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "out", "\\u", "list", "\"_", ",_", "[_", "1.5_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "resid", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "G1", ".", "P1", ".", "x", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "G1", ".", "P2", ".", "x", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "c", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "d", "\"_", ",_", "np_", "._", "array_", "(_", "[_", "0.0_", ",_", "0.0_", ",_", "0.0_", "]_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "out", "\\u", "string", "\"_", ",_", "\"\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "C1", ".", "out", "\\u", "list", "\"_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Iterat", "ion", "Data", "Record", "ed_", "(_", "(_", "(_", "coordinate_", ",_", "(_", "t0_", ",_", "t1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "params_", ",_", "expected", "\\u", "unknown", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "resid", "s_", ")_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "eps_", ",_", "prob_", "._", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Testing equality to None
vikingco/django-datatrans/datatrans/views.py
[ { "content": "def editor(request, model, language, objects):\n registry = utils.get_registry()\n fields = registry[model]\n\n default_lang = utils.get_default_language()\n model_name = u'%s' % model._meta.verbose_name\n\n first_unedited_translation = None\n object_list = []\n for object in objects:\n context_object = get_context_object(\n model, fields, language, default_lang, object)\n object_list.append(context_object)\n\n if first_unedited_translation is None:\n for field in context_object['fields']:\n tr = field['translation']\n if not tr.edited:\n first_unedited_translation = tr\n break\n\n context = {'model': model_name,\n 'objects': object_list,\n 'original_language': default_lang,\n 'other_language': language,\n 'progress': _get_model_stats(\n model, lambda x: x.filter(language=language)),\n 'first_unedited': first_unedited_translation}\n\n return render_to_response(\n 'datatrans/model_detail.html', context,\n context_instance=RequestContext(request))", "metadata": "root.editor", "header": "['module', '___EOS___']", "index": 146 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "editor_", "(_", "request_", ",_", "model_", ",_", "language_", ",_", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "registry_", "=_", "utils_", "._", "get", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "registry_", "[_", "model_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "lang_", "=_", "utils_", "._", "get", "\\u", "default", "\\u", "language_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "name_", "=_", "u", "'%", "s", "'_", "%_", "model_", "._", "\\u", "meta_", "._", "verbo", "se", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "first", "\\u", "une", "dit", "ed", "\\u", "translation_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "object_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context", "\\u", "object_", "=_", "get", "\\u", "context", "\\u", "object_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "fields_", ",_", "language_", ",_", "default", "\\u", "lang_", ",_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "._", "append_", "(_", "context", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "first", "\\u", "une", "dit", "ed", "\\u", "translation_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "context", "\\u", "object_", "[_", "'", "fields", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tr_", "=_", "field_", "[_", "'", "translatio", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "tr_", "._", "edited", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "first", "\\u", "une", "dit", "ed", "\\u", "translation_", "=_", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "'", "model", "'_", ":_", "model", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "s", "'_", ":_", "object\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "original", "\\u", "language", "'_", ":_", "default", "\\u", "lang_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "other", "\\u", "language", "'_", ":_", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "progress", "'_", ":_", "\\u", "get", "\\u", "model", "\\u", "stats_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "lambda_", "x_", ":_", "x_", "._", "filter_", "(_", "language_", "=_", "language_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "une", "dit", "ed", "'_", ":_", "first", "\\u", "une", "dit", "ed", "\\u", "translation_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datat", "rans", "/", "model", "\\u", "deta", "il", ".", "html", "'_", ",_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bslatkin/dpxdt/dpxdt/server/auth.py
[ { "content": "@app.route('/login')\ndef login_view():\n next_url = request.args.get('next', default='/', type=str)\n\n if app.config.get('IGNORE_AUTH'):\n fake_id = 'anonymous_superuser'\n anonymous_superuser = models.User.query.get(fake_id)\n if not anonymous_superuser:\n anonymous_superuser = models.User(\n id=fake_id,\n email_address='[email protected]',\n superuser=1)\n db.session.add(anonymous_superuser)\n db.session.commit()\n login_user(anonymous_superuser)\n confirm_login()\n return redirect(next_url)\n\n # Inspired by:\n # http://stackoverflow.com/questions/9499286\n # /using-google-oauth2-with-flask\n params = dict(\n response_type='code',\n client_id=app.config['GOOGLE_OAUTH2_CLIENT_ID'],\n redirect_uri=app.config['GOOGLE_OAUTH2_REDIRECT_URI'],\n scope=GOOGLE_OAUTH2_SCOPES,\n state=urllib.quote(next_url),\n )\n target_url = '%s?%s' % (\n GOOGLE_OAUTH2_AUTH_URL, urllib.urlencode(params))\n logging.debug('Redirecting user to login at url=%r', target_url)\n return redirect(target_url)", "metadata": "root.login_view", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "login", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login", "\\u", "view_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "url_", "=_", "request_", "._", "args_", "._", "get_", "(_", "'", "next", "'_", ",_", "default_", "=_", "'/'_", ",_", "type_", "=_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "app_", "._", "config_", "._", "get_", "(_", "'", "IGNORE", "\\u", "AUTH", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fake", "\\u", "id_", "=_", "'", "anonym", "ous", "\\u", "super", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "anonym", "ous", "\\u", "superuser_", "=_", "models_", "._", "User_", "._", "query_", "._", "get_", "(_", "fake", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "anonym", "ous", "\\u", "superuser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anonym", "ous", "\\u", "superuser_", "=_", "models_", "._", "User_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "fake", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "email", "\\u", "address_", "=_", "'", "super", "user", "@", "example", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "superuser_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "add_", "(_", "anonym", "ous", "\\u", "superuser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "login", "\\u", "user_", "(_", "anonym", "ous", "\\u", "superuser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confirm", "\\u", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "next", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ins", "pir", "ed", " ", "by", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "949", "928", "6_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "/", "usi", "ng", "-", "google", "-", "oauth2", "-", "with", "-", "flask_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "type_", "=_", "'", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "id_", "=_", "app_", "._", "config_", "[_", "'", "GO", "OG", "LE", "\\u", "OAUTH", "2", "\\u", "CLIENT", "\\u", "ID", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "uri_", "=_", "app_", "._", "config_", "[_", "'", "GO", "OG", "LE", "\\u", "OAUTH", "2", "\\u", "REDIRECT", "\\u", "URI", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scope_", "=_", "GO", "OG", "LE", "\\u", "OAUTH", "2", "\\u", "SCOPE", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "urllib_", "._", "quote_", "(_", "next", "\\u", "url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "url_", "=_", "'%", "s", "?", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "GO", "OG", "LE", "\\u", "OAUTH", "2", "\\u", "AUTH", "\\u", "URL_", ",_", "urllib_", "._", "urlencode_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "Redirect", "ing", " ", "user", " ", "to", " ", "login", " ", "at", " ", "url", "=", "%", "r", "'_", ",_", "target", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "target", "\\u", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
apache/libcloud/libcloud/test/compute/test_gce.py
[ { "content": " def test_format_metadata(self):\n in_md = [{'key': 'k0', 'value': 'v0'}, {'key': 'k1', 'value': 'v1'}]\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = [{'k0': 'v0'}, {'k1': 'v1'}]\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = {'key': 'k0', 'value': 'v0'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 1, out_md)\n self.assertEqual(out_md['items'][0]['key'], 'k0')\n self.assertEqual(out_md['items'][0]['value'], 'v0')\n\n in_md = {'k0': 'v0'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 1)\n self.assertEqual(out_md['items'][0]['key'], 'k0')\n self.assertEqual(out_md['items'][0]['value'], 'v0')\n\n in_md = {'k0': 'v0', 'k1': 'v1', 'k2': 'v2'}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 3)\n keys = [x['key'] for x in out_md['items']]\n vals = [x['value'] for x in out_md['items']]\n keys.sort()\n vals.sort()\n self.assertEqual(keys, ['k0', 'k1', 'k2'])\n self.assertEqual(vals, ['v0', 'v1', 'v2'])\n\n in_md = {'items': [{'key': 'k0', 'value': 'v0'},\n {'key': 'k1', 'value': 'v1'}]}\n out_md = self.driver._format_metadata('fp', in_md)\n self.assertTrue('fingerprint' in out_md)\n self.assertEqual(out_md['fingerprint'], 'fp')\n self.assertTrue('items' in out_md)\n self.assertEqual(len(out_md['items']), 2)\n self.assertTrue(out_md['items'][0]['key'] in ['k0', 'k1'])\n self.assertTrue(out_md['items'][0]['value'] in ['v0', 'v1'])\n\n in_md = {'items': 'foo'}\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)\n in_md = {'items': {'key': 'k1', 'value': 'v0'}}\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)\n in_md = ['k0', 'v1']\n self.assertRaises(ValueError, self.driver._format_metadata, 'fp', in_md)", "metadata": "root.GCENodeDriverTest.test_format_metadata", "header": "['class', 'GCENodeDriverTest', '(', 'GoogleTestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 667 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "class_", "GC", "EN", "ode", "Drive", "r", "Test_", "(_", "Goo", "gle", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "format\\u", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "md_", "=_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v1", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "[_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "{_", "'", "k", "1", "'_", ":_", "'", "v1", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ",_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", ",_", "'", "k", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "v", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", ",_", "'", "k", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "'", "v", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "k", "0", "'_", ":_", "'", "v", "0", "'_", ",_", "'", "k", "1", "'_", ":_", "'", "v1", "'_", ",_", "'", "k2", "'_", ":_", "'", "v2", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "x_", "[_", "'", "key", "'_", "]_", "for_", "x_", "in_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "=_", "[_", "x_", "[_", "'", "value", "'_", "]_", "for_", "x_", "in_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vals_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "keys_", ",_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", ",_", "'", "k2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vals_", ",_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", ",_", "'", "v2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "[_", "{_", "'", "key", "'_", ":_", "'", "k", "0", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v1", "'_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "md_", "=_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", "(_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fingerprint", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "out", "\\u", "md_", "[_", "'", "fingerprint", "'_", "]_", ",_", "'", "fp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "items", "'_", "in_", "out", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "key", "'_", "]_", "in_", "[_", "'", "k", "0", "'_", ",_", "'", "k", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "out", "\\u", "md_", "[_", "'", "items", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "in_", "[_", "'", "v", "0", "'_", ",_", "'", "v1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "'", "foo", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "md_", "=_", "{_", "'", "items", "'_", ":_", "{_", "'", "key", "'_", ":_", "'", "k", "1", "'_", ",_", "'", "value", "'_", ":_", "'", "v", "0", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "md_", "=_", "[_", "'", "k", "0", "'_", ",_", "'", "v1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "self_", "._", "driver_", "._", "\\u", "format\\u", "metadata_", ",_", "'", "fp", "'_", ",_", "in", "\\u", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused local variable
bmander/graphserver/pygs/test/unit_test/test_path.py
[ { "content": " def test_ten(self):\n \"\"\"getSize returns ten after ten entries\"\"\"\n \n for i in range(10):\n aa = Vertex(\"AA\")\n bb = Vertex(\"BB\")\n payload = Link()\n self.path.addSegment( bb, Edge(aa, bb, payload) )\n \n self.assertEquals( self.path.num_elements, 10 )", "metadata": "root.TestPathSize.test_ten", "header": "['class', 'TestPathSize', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Path", "Size_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ten_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", "Size", " ", "return", "s", " ", "ten", " ", "after", " ", "ten", " ", "entri", "es", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aa_", "=_", "Vertex_", "(_", "\"", "AA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bb_", "=_", "Vertex_", "(_", "\"", "BB", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "Link_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "path_", "._", "add", "Segment_", "(_", "bb_", ",_", "Edge_", "(_", "aa_", ",_", "bb_", ",_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "path_", "._", "num", "\\u", "elements_", ",_", "10_", ")_", "\\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 ]
Unused import
google/grr/grr/parsers/linux_pam_parser.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Parsers for Linux PAM configuration files.\"\"\"\nimport os\nimport re\n\n\nfrom grr.lib import parsers\nfrom grr.lib.rdfvalues import config_file as rdf_config_file\nfrom grr.parsers import config_file\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PAMParser(parsers.FileParser, config_file.FieldParser):\n \"\"\"Parser for PAM configurations.\"\"\"\n\n output_types = [\"PamConfig\"]\n supported_artifacts = [\"LinuxPamConfigs\"]\n process_together = True\n\n # The syntax is based on:\n # http://linux.die.net/man/5/pam.d\n\n PAMDIR = \"/etc/pam.d\"\n OLD_PAMCONF_FILENAME = \"/etc/pam.conf\"\n PAMCONF_RE = re.compile(r\"\"\"\n (\\S+) # The \"type\".\n \\s+ # separator\n ( # Now match the \"control\" argument.\n \\[[^\\]]*\\] # Complex form. e.g. [success=ok default=die] etc.\n | \\w+ # Or a single word form.\n ) # End of the \"control\" argument.\n \\s+ # separator\n (\\S+) # The \"module-path\".\n (?:\\s+(.*))? # And the optional \"module-arguments\" is anything else.\n \"\"\", re.VERBOSE)\n\n\n\n", "metadata": "root.PAMParser", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def _FixPath(self, path):\n # Anchor any relative paths in the PAMDIR\n if not os.path.isabs(path):\n return os.path.join(self.PAMDIR, path)\n else:\n return path", "metadata": "root.PAMParser._FixPath", "header": "['class', 'PAMParser', '(', 'parsers', '.', 'FileParser', ',', 'config_file', '.', 'FieldParser', ')', ':', '___EOS___']", "index": 35 }, { "content": " def EnumerateAllConfigs(self, stats, file_objects):\n \"\"\"Generate RDFs for the fully expanded configs.\n\n Args:\n stats: A list of RDF StatEntries corresponding to the file_objects.\n file_objects: A list of file handles.\n\n Returns:\n A tuple of a list of RDFValue PamConfigEntries found & a list of strings\n which are the external config references found.\n \"\"\"\n # Convert the stats & file_objects into a cache of a\n # simple path keyed dict of file contents.\n cache = {}\n for stat_obj, file_obj in zip(stats, file_objects):\n cache[stat_obj.pathspec.path] = file_obj.read()\n\n result = []\n external = []\n # Check to see if we have the old pam config file laying around.\n if self.OLD_PAMCONF_FILENAME in cache:\n # The PAM documentation says if it contains config data, then\n # it takes precedence over the rest of the config.\n # If it doesn't, the rest of the PAMDIR config counts.\n result, external = self.EnumerateConfig(None, self.OLD_PAMCONF_FILENAME,\n cache)\n if result:\n return result, external\n\n # If we made it here, there isn't a old-style pam.conf file worth\n # speaking of, so process everything!\n for path in cache:\n # PAM uses the basename as the 'service' id.\n service = os.path.basename(path)\n r, e = self.EnumerateConfig(service, path, cache)\n result.extend(r)\n external.extend(e)\n return result, external", "metadata": "root.PAMParser.EnumerateAllConfigs", "header": "['class', 'PAMParser', '(', 'parsers', '.', 'FileParser', ',', 'config_file', '.', 'FieldParser', ')', ':', '___EOS___']", "index": 42 }, { "content": " def EnumerateConfig(self, service, path, cache, filter_type=None):\n \"\"\"Return PamConfigEntries it finds as it recursively follows PAM configs.\n\n Args:\n service: A string containing the service name we are processing.\n path: A string containing the file path name we want.\n cache: A dictionary keyed on path, with the file contents (list of str).\n filter_type: A string containing type name of the results we want.\n\n Returns:\n A tuple of a list of RDFValue PamConfigEntries found & a list of strings\n which are the external config references found.\n \"\"\"\n\n result = []\n external = []\n path = self._FixPath(path)\n\n # Make sure we only look at files under PAMDIR.\n # Check we have the file in our artifact/cache. If not, our artifact\n # didn't give it to us, and that's a problem.\n # Note: This should only ever happen if it was referenced\n # from /etc/pam.conf so we can assume that was the file.\n if path not in cache:\n external.append(\"%s -> %s\", self.OLD_PAMCONF_FILENAME, path)\n return result, external\n\n for tokens in self.ParseEntries(cache[path]):\n if path == self.OLD_PAMCONF_FILENAME:\n # We are processing the old style PAM conf file. It's a special case.\n # It's format is \"service type control module-path module-arguments\"\n # i.e. the 'service' is the first arg, the rest is line\n # is like everything else except for that addition.\n try:\n service = tokens[0] # Grab the service from the start line.\n tokens = tokens[1:] # Make the rest of the line look like \"normal\".\n except IndexError:\n continue # It's a blank line, skip it.\n\n # Process any inclusions in the line.\n new_path = None\n filter_request = None\n try:\n # If a line starts with @include, then include the entire referenced\n # file.\n # e.g. \"@include common-auth\"\n if tokens[0] == \"@include\":\n new_path = tokens[1]\n # If a line's second arg is an include/substack, then filter the\n # referenced file only including entries that match the 'type'\n # requested.\n # e.g. \"auth include common-auth-screensaver\"\n elif tokens[1] in [\"include\", \"substack\"]:\n new_path = tokens[2]\n filter_request = tokens[0]\n except IndexError:\n # It's not a valid include line, so keep processing as normal.\n pass\n\n # If we found an include file, enumerate that file now, and\n # included it where we are in this config file.\n if new_path:\n # Preemptively check to see if we have a problem where the config\n # is referencing a file outside of the expected/defined artifact.\n # Doing it here allows us to produce a better context for the\n # problem. Hence the slight duplication of code.\n\n new_path = self._FixPath(new_path)\n if new_path not in cache:\n external.append(\"%s -> %s\" % (path, new_path))\n continue # Skip to the next line of the file.\n r, e = self.EnumerateConfig(service, new_path, cache, filter_request)\n result.extend(r)\n external.extend(e)\n else:\n # If we have been asked to filter on types, skip over any types\n # we are not interested in.\n if filter_type and tokens[0] != filter_type:\n continue # We can skip this line.\n\n # If we got here, then we want to include this line in this service's\n # config.\n\n # Reform the line and break into the correct fields as best we can.\n # Note: ParseEntries doesn't cope with what we need to do.\n match = self.PAMCONF_RE.match(\" \".join(tokens))\n if match:\n p_type, control, module_path, module_args = match.group(1, 2, 3, 4)\n # Trim a leading \"-\" from the type field if present.\n if p_type.startswith(\"-\"):\n p_type = p_type[1:]\n result.append(rdf_config_file.PamConfigEntry(\n service=service,\n type=p_type,\n control=control,\n module_path=module_path,\n module_args=module_args))\n return result, external", "metadata": "root.PAMParser.EnumerateConfig", "header": "['class', 'PAMParser', '(', 'parsers', '.', 'FileParser', ',', 'config_file', '.', 'FieldParser', ')', ':', '___EOS___']", "index": 81 }, { "content": " def ParseMultiple(self, stats, file_objects, knowledge_base):\n _ = knowledge_base\n results, externals = self.EnumerateAllConfigs(stats, file_objects)\n yield rdf_config_file.PamConfig(entries=results, external_config=externals)", "metadata": "root.PAMParser.ParseMultiple", "header": "['class', 'PAMParser', '(', 'parsers', '.', 'FileParser', ',', 'config_file', '.', 'FieldParser', ')', ':', '___EOS___']", "index": 180 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Parser", "s", " ", "for", " ", "Lin", "ux", " ", "PA", "M", " ", "configura", "tion", " ", "files", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "parsers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "rdf", "values_", "import_", "config", "\\u", "file_", "as_", "rdf", "\\u", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "parsers_", "import_", "config", "\\u", "file_", "\\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_", "PA", "MP", "arser", "_", "(_", "parsers_", "._", "File", "Parser_", ",_", "config", "\\u", "file_", "._", "Field", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Parser", " ", "for", " ", "PA", "M", " ", "configura", "tion", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "types_", "=_", "[_", "\"", "Pa", "m", "Config", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support", "ed", "\\u", "artifacts_", "=_", "[_", "\"", "Lin", "ux", "Pa", "m", "Configs", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "together_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "synta", "x", " ", "is", " ", "based", " ", "on", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "linux", ".", "die", ".", "net", "/", "man", "/", "5", "/", "pam", ".", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PA", "MD", "IR_", "=_", "\"/", "etc", "/", "pam", ".", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OLD", "\\u", "PA", "MC", "ONF", "\\u", "FILENAME_", "=_", "\"/", "etc", "/", "pam", ".", "conf", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PA", "MC", "ONF", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "\"\"\"", "\\", "10", ";", " ", " ", "(\\\\", "S", "+)", " ", " ", "#", " ", "The", " ", "\"", "type", "\".\\", "10", ";", " ", " ", "\\\\", "s", "+", " ", " ", " ", " ", "#", " ", "separator", "\\", "10", ";", " ", " ", "(", " ", " ", " ", " ", " ", " ", "#", " ", "No", "w", " ", "match", " ", "the", " ", "\"", "control", "\"", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\\\\[", "[", "^", "\\\\]", "]*\\\\", "]", " ", " ", " ", "#", " ", "Comple", "x", " ", "form", ".", " ", "e", ".", "g", ".", " ", "[", "success", "=", "ok", " ", "default", "=", "die", "]", " ", "etc", ".", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "\\\\", "w", "+", " ", " ", " ", " ", "#", " ", "Or", " ", "a", " ", "single", " ", "word", " ", "form", ".", "\\", "10", ";", " ", " ", ")", " ", " ", " ", " ", " ", " ", "#", " ", "End", " ", "of", " ", "the", " ", "\"", "control", "\"", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", "\\\\", "s", "+", " ", " ", " ", " ", "#", " ", "separator", "\\", "10", ";", " ", " ", "(\\\\", "S", "+)", " ", " ", "#", " ", "The", " ", "\"", "module", "-", "path", "\".\\", "10", ";", " ", " ", "(?:\\\\", "s", "+(", ".*)", ")?", " ", " ", " ", "#", " ", "And", " ", "the", " ", "option", "al", " ", "\"", "module", "-", "argu", "ment", "s", "\"", " ", "is", " ", "anyt", "hing", " ", "else", ".", "\\", "10", ";", " ", " ", "\"\"\"_", ",_", "re_", "._", "VERBOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "PA", "MP", "arser", "_", "(_", "parsers_", "._", "File", "Parser_", ",_", "config", "\\u", "file_", "._", "Field", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Fix", "Path_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Anc", "hor", " ", "any", " ", "relative", " ", "path", "s", " ", "in", " ", "the", " ", "PA", "MD", "IR_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isabs_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "PA", "MD", "IR_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PA", "MP", "arser", "_", "(_", "parsers_", "._", "File", "Parser_", ",_", "config", "\\u", "file_", "._", "Field", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Enumerate", "All", "Configs", "_", "(_", "self_", ",_", "stats_", ",_", "file", "\\u", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "RDF", "s", " ", "for", " ", "the", " ", "full", "y", " ", "expand", "ed", " ", "configs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "stats", ":", " ", "A", " ", "list", " ", "of", " ", "RDF", " ", "Stat", "Entr", "ies", " ", "correspond", "ing", " ", "to", " ", "the", " ", "file", "\\u", "object", "s", ".", "\\", "10", ";", " ", " ", "file", "\\u", "object", "s", ":", " ", "A", " ", "list", " ", "of", " ", "file", " ", "handle", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "tuple", " ", "of", " ", "a", " ", "list", " ", "of", " ", "RDF", "Value", " ", "Pa", "m", "Config", "Entr", "ies", " ", "found", " ", "&", " ", "a", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", "whi", "ch", " ", "are", " ", "the", " ", "external", " ", "config", " ", "reference", "s", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Convert", " ", "the", " ", "stats", " ", "&", " ", "file", "\\u", "object", "s", " ", "int", "o", " ", "a", " ", "cache", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "path", " ", "keyed", " ", "dict", " ", "of", " ", "file", " ", "content", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "stat", "\\u", "obj_", ",_", "file", "\\u", "obj_", "in_", "zip_", "(_", "stats_", ",_", "file", "\\u", "objects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "stat", "\\u", "obj_", "._", "pathspec", "_", "._", "path_", "]_", "=_", "file", "\\u", "obj_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "have", " ", "the", " ", "old", " ", "pam", " ", "config", " ", "file", " ", "lay", "ing", " ", "aro", "und", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "OLD", "\\u", "PA", "MC", "ONF", "\\u", "FILENAME_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "PA", "M", " ", "documentation", " ", "say", "s", " ", "if", " ", "it", " ", "contain", "s", " ", "config", " ", "data", ",", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "take", "s", " ", "preceden", "ce", " ", "over", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "config", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "doe", "sn", "'", "t", ",", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "PA", "MD", "IR", " ", "config", " ", "count", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", ",_", "external_", "=_", "self_", "._", "Enumerate", "Config_", "(_", "None_", ",_", "self_", "._", "OLD", "\\u", "PA", "MC", "ONF", "\\u", "FILENAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", ",_", "external_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "made", " ", "it", " ", "here", ",", " ", "there", " ", "isn", "'", "t", " ", "a", " ", "old", "-", "style", " ", "pam", ".", "conf", " ", "file", " ", "worth", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "speak", "ing", " ", "of", ",", " ", "so", " ", "process", " ", "every", "thing", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "path_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "PA", "M", " ", "use", "s", " ", "the", " ", "basen", "ame", " ", "as", " ", "the", " ", "'", "service", "'", " ", "id", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", ",_", "e_", "=_", "self_", "._", "Enumerate", "Config_", "(_", "service_", ",_", "path_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "extend_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external_", "._", "extend_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", ",_", "external_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PA", "MP", "arser", "_", "(_", "parsers_", "._", "File", "Parser_", ",_", "config", "\\u", "file_", "._", "Field", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Enumerate", "Config_", "(_", "self_", ",_", "service_", ",_", "path_", ",_", "cache_", ",_", "filter", "\\u", "type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Pa", "m", "Config", "Entr", "ies", " ", "it", " ", "find", "s", " ", "as", " ", "it", " ", "recurs", "ively", " ", "follow", "s", " ", "PA", "M", " ", "configs", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "service", ":", " ", "A", " ", "string", " ", "contain", "ing", " ", "the", " ", "service", " ", "name", " ", "we", " ", "are", " ", "process", "ing", ".", "\\", "10", ";", " ", " ", "path", ":", " ", "A", " ", "string", " ", "contain", "ing", " ", "the", " ", "file", " ", "path", " ", "name", " ", "we", " ", "want", ".", "\\", "10", ";", " ", " ", "cache", ":", " ", "A", " ", "dictionar", "y", " ", "keyed", " ", "on", " ", "path", ",", " ", "with", " ", "the", " ", "file", " ", "content", "s", " ", "(", "list", " ", "of", " ", "str", ").", "\\", "10", ";", " ", " ", "filter", "\\u", "type", ":", " ", "A", " ", "string", " ", "contain", "ing", " ", "type", " ", "name", " ", "of", " ", "the", " ", "results", " ", "we", " ", "want", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "tuple", " ", "of", " ", "a", " ", "list", " ", "of", " ", "RDF", "Value", " ", "Pa", "m", "Config", "Entr", "ies", " ", "found", " ", "&", " ", "a", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", "whi", "ch", " ", "are", " ", "the", " ", "external", " ", "config", " ", "reference", "s", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "self_", "._", "\\u", "Fix", "Path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "we", " ", "only", " ", "look", " ", "at", " ", "files", " ", "under", " ", "PA", "MD", "IR", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "we", " ", "have", " ", "the", " ", "file", " ", "in", " ", "our", " ", "artifact", "/", "cache", ".", " ", "If", " ", "not", ",", " ", "our", " ", "artifact_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "did", "n", "'", "t", " ", "give", " ", "it", " ", "to", " ", "us", ",", " ", "and", " ", "tha", "t", "'", "s", " ", "a", " ", "problem", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "ever", " ", "happ", "en", " ", "if", " ", "it", " ", "was", " ", "referenced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "/", "etc", "/", "pam", ".", "conf", " ", "so", " ", "we", " ", "can", " ", "assume", " ", "tha", "t", " ", "was", " ", "the", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", "not_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "external_", "._", "append_", "(_", "\"%", "s", " ", "->", " ", "%", "s", "\"_", ",_", "self_", "._", "OLD", "\\u", "PA", "MC", "ONF", "\\u", "FILENAME_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", ",_", "external_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tokens_", "in_", "self_", "._", "Pars", "e", "Entries_", "(_", "cache_", "[_", "path_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "==_", "self_", "._", "OLD", "\\u", "PA", "MC", "ONF", "\\u", "FILENAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "are", " ", "process", "ing", " ", "the", " ", "old", " ", "style", " ", "PA", "M", " ", "conf", " ", "file", ".", " ", "It", "'", "s", " ", "a", " ", "special", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "format", " ", "is", " ", "\"", "service", " ", "type", " ", "control", " ", "module", "-", "path", " ", "module", "-", "argu", "ment", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "i", ".", "e", ".", " ", "the", " ", "'", "service", "'", " ", "is", " ", "the", " ", "first", " ", "arg", ",", " ", "the", " ", "rest", " ", "is", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "like", " ", "every", "thing", " ", "else", " ", "except", " ", "for", " ", "tha", "t", " ", "addition", "._", "\\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 ", " _", "service_", "=_", "tokens_", "[_", "0_", "]_", "#", " ", "Grab", " ", "the", " ", "service", " ", "from", " ", "the", " ", "start", " ", "line", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "tokens_", "[_", "1_", ":_", "]_", "#", " ", "Make", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "line", " ", "look", " ", "like", " ", "\"", "normal", "\".", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "It", "'", "s", " ", "a", " ", "blank", " ", "line", ",", " ", "skip", " ", "it", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "any", " ", "inclusion", "s", " ", "in", " ", "the", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "request_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "line", " ", "starts", " ", "with", " ", "@", "include", ",", " ", "then", " ", "include", " ", "the", " ", "entire", " ", "referenced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "\"@", "include", " ", "common", "-", "auth", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tokens_", "[_", "0_", "]_", "==_", "\"@", "include", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "path_", "=_", "tokens_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "line", "'", "s", " ", "second", " ", "arg", " ", "is", " ", "an", " ", "include", "/", "substa", "ck", ",", " ", "then", " ", "filter", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "referenced", " ", "file", " ", "only", " ", "inclu", "ding", " ", "entri", "es", " ", "tha", "t", " ", "match", " ", "the", " ", "'", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "request", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "\"", "auth", " ", "include", " ", "common", "-", "auth", "-", "screens", "aver", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tokens_", "[_", "1_", "]_", "in_", "[_", "\"", "include", "\"_", ",_", "\"", "substa", "ck", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "path_", "=_", "tokens_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "request_", "=_", "tokens_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "not", " ", "a", " ", "valid", " ", "include", " ", "line", ",", " ", "so", " ", "keep", " ", "process", "ing", " ", "as", " ", "normal", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "found", " ", "an", " ", "include", " ", "file", ",", " ", "enumerate", " ", "tha", "t", " ", "file", " ", "now", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", "d", " ", "it", " ", "where", " ", "we", " ", "are", " ", "in", " ", "this", " ", "config", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pre", "emp", "tiv", "el", "y", " ", "check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "have", " ", "a", " ", "problem", " ", "where", " ", "the", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "referenci", "ng", " ", "a", " ", "file", " ", "outsi", "de", " ", "of", " ", "the", " ", "expected", "/", "defin", "ed", " ", "artifact", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", "ing", " ", "it", " ", "here", " ", "allow", "s", " ", "us", " ", "to", " ", "produce", " ", "a", " ", "bett", "er", " ", "context", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "problem", ".", " ", "Hen", "ce", " ", "the", " ", "slight", " ", "duplicat", "ion", " ", "of", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "path_", "=_", "self_", "._", "\\u", "Fix", "Path_", "(_", "new", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "path_", "not_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "external_", "._", "append_", "(_", "\"%", "s", " ", "->", " ", "%", "s", "\"_", "%_", "(_", "path_", ",_", "new", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Ski", "p", " ", "to", " ", "the", " ", "next", " ", "line", " ", "of", " ", "the", " ", "file", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "r_", ",_", "e_", "=_", "self_", "._", "Enumerate", "Config_", "(_", "service_", ",_", "new", "\\u", "path_", ",_", "cache_", ",_", "filter", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "extend_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "external_", "._", "extend_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "bee", "n", " ", "ask", "ed", " ", "to", " ", "filter", " ", "on", " ", "types", ",", " ", "skip", " ", "over", " ", "any", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "not", " ", "interest", "ed", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "filter", "\\u", "type_", "and_", "tokens_", "[_", "0_", "]_", "!=_", "filter", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "We", " ", "can", " ", "skip", " ", "this", " ", "line", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "got", " ", "here", ",", " ", "then", " ", "we", " ", "want", " ", "to", " ", "include", " ", "this", " ", "line", " ", "in", " ", "this", " ", "service", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "config", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ref", "orm", " ", "the", " ", "line", " ", "and", " ", "break", " ", "int", "o", " ", "the", " ", "correct", " ", "fields", " ", "as", " ", "best", " ", "we", " ", "can", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Pars", "e", "Entr", "ies", " ", "doe", "sn", "'", "t", " ", "cope", " ", "with", " ", "what", " ", "we", " ", "need", " ", "to", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "self_", "._", "PA", "MC", "ONF", "\\u", "RE_", "._", "match_", "(_", "\"", " ", "\"_", "._", "join_", "(_", "tokens_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "type_", ",_", "control_", ",_", "module", "\\u", "path_", ",_", "module", "\\u", "args_", "=_", "match_", "._", "group_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Trim", " ", "a", " ", "lead", "ing", " ", "\"-", "\"", " ", "from", " ", "the", " ", "type", " ", "field", " ", "if", " ", "presen", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "p", "\\u", "type_", "._", "startswith_", "(_", "\"-\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "type_", "=_", "p", "\\u", "type_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "rdf", "\\u", "config", "\\u", "file_", "._", "Pa", "m", "Config", "Entry_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service_", "=_", "service_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "p", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "=_", "control_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "args_", "=_", "module", "\\u", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", ",_", "external_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PA", "MP", "arser", "_", "(_", "parsers_", "._", "File", "Parser_", ",_", "config", "\\u", "file_", "._", "Field", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Pars", "e", "Multiple_", "(_", "self_", ",_", "stats_", ",_", "file", "\\u", "objects_", ",_", "knowledge", "\\u", "base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "knowledge", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", ",_", "externals", "_", "=_", "self_", "._", "Enumerate", "All", "Configs", "_", "(_", "stats_", ",_", "file", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "rdf", "\\u", "config", "\\u", "file_", "._", "Pa", "m", "Config_", "(_", "entries_", "=_", "results_", ",_", "external", "\\u", "config_", "=_", "externals", "_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant assignment
kayhayen/Nuitka/tests/basics/ExecEval.py
[ { "content": "# Copyright 2016, Kay Hayen, mailto:[email protected]\n#\n# Python tests originally created or extracted from other peoples work. The\n# parts were too small to be protected.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nimport tempfile, sys, os\n\nprint \"eval 3+3=\", eval(\"3+3\")\nprint \"eval 4+4=\", eval(\" 4+4\")\n\n\nprint \"eval in a function with nothing provided\", functionEval1()\n\n\nprint \"eval in a function with globals provided\", functionEval2()\n\n\nprint \"eval in a for loop as iterator giver\", functionEval3()\n\nprint \"exec on a global level\",\nexec( \"d=2+2\" )\nprint \"2+2=\",d # @UndefinedVariable\n\n\n\nprint \"exec in function without and with locals() provided:\", functionExec1(), functionExec2()\n\ntmp_filename = tempfile.gettempdir() + \"/execfile.py\"\n\nf = open(tmp_filename, 'w')\nf.write(\"e=7\\nf=8\\n\")\nf.close()\n\nexecfile(tmp_filename)\n\nprint \"execfile with defaults f,g=\", e, f # @UndefinedVariable\n\nglobal_vars = { 'e' : '0', 'f' : 0 }\nlocal_vars = dict(global_vars)\n\nexecfile(tmp_filename, global_vars)\n\nprint \"execfile with globals dict:\", global_vars.keys()\n\nexecfile(tmp_filename, global_vars, local_vars)\n\nprint \"execfile with globals and locals dict:\", local_vars\n\n\nfunctionExecfile()\n\n\n\nf = 7\n\n\n\nfunctionExecNonesTuple()\nfunctionExecNonesSyntax()\n\nprint \"Global value is untouched\", f\n\n\n\nfunctionEvalNones2()\n\n\n\n\nfunctionExecNonesTuple2()\nfunctionExecNonesSyntax2()\n\nprint \"Exec with a future division definition and one without:\"\n\nexec \"\"\"\nfrom __future__ import division\nfrom __future__ import print_function\nprint( \"3/2 is with future division\", 3/2 )\n\"\"\"\n\nexec \"\"\"\nfrom __future__ import print_function\nprint( \"3/2 is without future division\", 3/2 )\n\"\"\"\n\nx = 1\ny = 1\n\n\nfunctionGlobalsExecShadow()\n\n\nfunctionWithClosureProvidedByExec()\n\nx = 2\n\n\nprint \"Closure in a function with exec to not none\", functionWithExecAffectingClosure()\n\n\nprint \"Exec in a generator function\", tuple(generatorFunctionWithExec())\n\n\nprint \"Eval in a list contraction or generator expression\", evalInContractions()\n\n\nprint \"Exec adds functions declares in explicit locals() given.\", execDefinesFunctionToLocalsExplicity()\n\nos.unlink(tmp_filename)\n\n\n\nprint \"Exec with too short tuple argument:\", execWithShortTuple()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "tests", " ", "original", "ly", " ", "created", " ", "or", " ", "extracted", " ", "from", " ", "other", " ", "people", "s", " ", "work", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "s", " ", "wer", "e", " ", "too", " ", "small", " ", "to", " ", "be", " ", "protect", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tempfile_", ",_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "eval", " ", "3", "+", "3", "=\"_", ",_", "eval_", "(_", "\"", "3", "+", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "eval", " ", " ", "4", "+", "4", "=\"_", ",_", "eval_", "(_", "\"", " ", "4", "+", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "eval", " ", "in", " ", "a", " ", "function", " ", "with", " ", "not", "hing", " ", "provided", "\"_", ",_", "function", "Eval", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "eval", " ", "in", " ", "a", " ", "function", " ", "with", " ", "globals", " ", "provided", "\"_", ",_", "function", "Eval", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "eval", " ", "in", " ", "a", " ", "for", " ", "loop", " ", "as", " ", "iter", "ator", " ", "give", "r", "\"_", ",_", "function", "Eval", "3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "exec", " ", "on", " ", "a", " ", "global", " ", "level", "\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "\"", "d", "=", "2", "+", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "2", "+", "2", "=\"_", ",_", "d_", "#", " ", "@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "exec", " ", "in", " ", "function", " ", "with", "out", " ", "and", " ", "with", " ", "locals", "()", " ", "provided", ":\"_", ",_", "function", "Exe", "c1_", "(_", ")_", ",_", "function", "Exe", "c2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "filename_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "\"/", "execfile", ".", "py", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "tmp", "\\u", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "\"", "e", "=", "7", "\\\\", "nf", "=", "8", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "execfile", "_", "(_", "tmp", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "execfile", " ", "with", " ", "default", "s", " ", "f", ",", "g", "=\"_", ",_", "e_", ",_", "f_", "#", " ", "@", "Unde", "fined", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "vars_", "=_", "{_", "'", "e", "'_", ":_", "'", "0", "'_", ",_", "'", "f", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "vars_", "=_", "dict_", "(_", "global", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "execfile", "_", "(_", "tmp", "\\u", "filename_", ",_", "global", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "execfile", " ", "with", " ", "globals", " ", "dict", ":\"_", ",_", "global", "\\u", "vars_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "execfile", "_", "(_", "tmp", "\\u", "filename_", ",_", "global", "\\u", "vars_", ",_", "local", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "execfile", " ", "with", " ", "globals", " ", "and", " ", "locals", " ", "dict", ":\"_", ",_", "local", "\\u", "vars_", "\\u\\u\\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_", "function", "Exe", "cfile_", "(_", ")_", "\\u\\u\\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_", "f_", "=_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "function", "Exe", "c", "Non", "es", "Tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "Exe", "c", "Non", "es", "Syntax", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Global", " ", "value", " ", "is", " ", "unto", "uche", "d", "\"_", ",_", "f_", "\\u\\u\\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_", "function", "Eval", "Non", "es", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "function", "Exe", "c", "Non", "es", "Tup", "le2", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function", "Exe", "c", "Non", "es", "Syntax", "2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "Exe", "c", " ", "with", " ", "a", " ", "future", " ", "divisi", "on", " ", "definit", "ion", " ", "and", " ", "one", " ", "with", "out", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exec_", "\"\"\"", "\\", "10", ";", "from", " ", "\\u\\u", "future", "\\u\\u", " ", "import", " ", "divisi", "on", "\\", "10", ";", "from", " ", "\\u\\u", "future", "\\u\\u", " ", "import", " ", "print", "\\u", "function", "\\", "10", ";", "print", "(", " ", "\"", "3", "/", "2", " ", "is", " ", "with", " ", "future", " ", "divisi", "on", "\",", " ", "3", "/", "2", " ", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exec_", "\"\"\"", "\\", "10", ";", "from", " ", "\\u\\u", "future", "\\u\\u", " ", "import", " ", "print", "\\u", "function", "\\", "10", ";", "print", "(", " ", "\"", "3", "/", "2", " ", "is", " ", "with", "out", " ", "future", " ", "divisi", "on", "\",", " ", "3", "/", "2", " ", ")", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "1_", "\\u\\u\\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_", "function", "Global", "s", "Exe", "c", "Shadow_", "(_", ")_", "\\u\\u\\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_", "function", "With", "Clos", "ure", "Provided", "By", "Exec_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Clos", "ure", " ", "in", " ", "a", " ", "function", " ", "with", " ", "exec", " ", "to", " ", "not", " ", "none", "\"_", ",_", "function", "With", "Exe", "c", "Affect", "ing", "Clos", "ure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Exe", "c", " ", "in", " ", "a", " ", "generat", "or", " ", "function", "\"_", ",_", "tuple_", "(_", "generat", "or", "Function", "With", "Exec_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Eval", " ", "in", " ", "a", " ", "list", " ", "contract", "ion", " ", "or", " ", "generat", "or", " ", "express", "ion", "\"_", ",_", "eval", "In", "Contract", "ions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Exe", "c", " ", "adds", " ", "function", "s", " ", "declar", "es", " ", "in", " ", "explicit", " ", "locals", "()", " ", "give", "n", ".\"_", ",_", "exec", "Define", "s", "Function", "To", "Local", "s", "Exp", "licit", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "unlink_", "(_", "tmp", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cortesi/pry/test/covtests/test_coverage.py
[ { "content": " def test_getStats(self):\n self.cov.start()\n import testUnit.getStats, testUnit.getRanges\n reload(testUnit.getRanges)\n testUnit.getStats.foo()\n testUnit.getRanges.foo()\n self.cov.stop()\n\n f = self.cov.fileDict[os.path.abspath(\"testUnit/getStats.py\")]\n assert f.numExecutable == 4\n assert f.numExecuted == 3\n assert f.percentage == 75\n assert f.notExecutedRanges == [5]\n\n f = self.cov.fileDict[os.path.abspath(\"testUnit/getRanges.py\")]\n assert f.numExecutable == 12\n assert f.notExecutedRanges == [6, 9, 14]\n assert f.numExecuted == 9\n assert f.percentage == 75", "metadata": "root.uCoverage.test_getStats", "header": "['class', 'uCoverage', '(', 'libpry', '.', 'AutoTree', ')', ':', '___EOS___']", "index": 83 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "u", "Coverage", "_", "(_", "libp", "ry_", "._", "Auto", "Tree_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "Stats_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cov_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "test", "Unit_", "._", "get", "Stats_", ",_", "test", "Unit_", "._", "get", "Ranges_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reload_", "(_", "test", "Unit_", "._", "get", "Ranges_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Unit_", "._", "get", "Stats_", "._", "foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Unit_", "._", "get", "Ranges_", "._", "foo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cov_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "self_", "._", "cov_", "._", "file", "Dict_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "\"", "test", "Unit", "/", "get", "Stat", "s", ".", "py", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "num", "Executable", "_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "num", "Execut", "ed_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "percentage_", "==_", "75_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "not", "Execut", "ed", "Ranges_", "==_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "self_", "._", "cov_", "._", "file", "Dict_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "\"", "test", "Unit", "/", "get", "Range", "s", ".", "py", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "num", "Executable", "_", "==_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "not", "Execut", "ed", "Ranges_", "==_", "[_", "6_", ",_", "9_", ",_", "14_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "num", "Execut", "ed_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "f_", "._", "percentage_", "==_", "75_", "\\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 ]
Unused local variable
jpadilla/pyjwt/jwt/api_jws.py
[ { "content": " def encode(self, payload, key, algorithm='HS256', headers=None,\n json_encoder=None):\n segments = []\n\n if algorithm is None:\n algorithm = 'none'\n\n if algorithm not in self._valid_algs:\n pass\n\n # Header\n header = {'typ': self.header_typ, 'alg': algorithm}\n\n if headers:\n self._validate_headers(headers)\n header.update(headers)\n\n json_header = json.dumps(\n header,\n separators=(',', ':'),\n cls=json_encoder\n ).encode('utf-8')\n\n segments.append(base64url_encode(json_header))\n segments.append(base64url_encode(payload))\n\n # Segments\n signing_input = b'.'.join(segments)\n try:\n alg_obj = self._algorithms[algorithm]\n key = alg_obj.prepare_key(key)\n signature = alg_obj.sign(signing_input, key)\n\n except KeyError:\n raise NotImplementedError('Algorithm not supported')\n\n segments.append(base64url_encode(signature))\n\n return b'.'.join(segments)", "metadata": "root.PyJWS.encode", "header": "['class', 'PyJWS', '(', 'object', ')', ':', '___EOS___']", "index": 67 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Py", "JW", "S_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "payload_", ",_", "key_", ",_", "algorithm_", "=_", "'", "HS", "256", "'_", ",_", "headers_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json", "\\u", "encoder_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "segments_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "algorithm_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algorithm_", "=_", "'", "none", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "algorithm_", "not_", "in_", "self_", "._", "\\u", "valid", "\\u", "alg", "s_", ":_", "\\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_", "#", " ", "Header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "{_", "'", "typ", "'_", ":_", "self_", "._", "header", "\\u", "typ_", ",_", "'", "alg", "'_", ":_", "algorithm_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "validat", "e\\u", "headers_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "._", "update_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json", "\\u", "header_", "=_", "json_", "._", "dumps_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "header_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "separators_", "=_", "(_", "','_", ",_", "':'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "=_", "json", "\\u", "encoder_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "segments_", "._", "append_", "(_", "base64", "url", "\\u", "encode_", "(_", "json", "\\u", "header_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "segments_", "._", "append_", "(_", "base64", "url", "\\u", "encode_", "(_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Segments", "_", "\\u\\u\\uNL\\u\\u\\u_", "signin", "g", "\\u", "input_", "=_", "b", "'.'_", "._", "join_", "(_", "segments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "obj_", "=_", "self_", "._", "\\u", "algorithms_", "[_", "algorithm_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "alg", "\\u", "obj_", "._", "prepar", "e\\u", "key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signature_", "=_", "alg", "\\u", "obj_", "._", "sign_", "(_", "signin", "g", "\\u", "input_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Algorit", "hm", " ", "not", " ", "support", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "segments_", "._", "append_", "(_", "base64", "url", "\\u", "encode_", "(_", "signature_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dropbox/changes/changes/api/author_diffs.py
[ { "content": "from __future__ import absolute_import, division, unicode_literals\n\nfrom changes.api.base import APIView\nfrom changes.api.auth import get_current_user\nfrom changes.config import db\nfrom changes.models import Author, Build, PhabricatorDiff\n\nfrom collections import defaultdict\n\nfrom changes.utils.phabricator_utils import PhabricatorClient\n\nimport requests\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AuthorPhabricatorDiffsAPIView(APIView):\n \"\"\"\n Hits phabricator to get a list of the user's diffs in review. This is the\n first (possibly only) changes api call that hits phabricator: we can't rely\n on local data because there's no way to know whether a diff has been\n abandoned or not.\n \"\"\"\n", "metadata": "root.AuthorPhabricatorDiffsAPIView", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def get(self, author_id):\n authors = Author.find(author_id, get_current_user())\n if not authors and author_id == 'me':\n return '''Either there is no current user or you are not in the\n author table''', 401\n elif not authors:\n return 'author not found', 404\n\n try:\n author_email = authors[0].email\n request = PhabricatorClient()\n request.connect()\n user_info = request.call('user.query', {'emails': [author_email]})\n\n if not user_info:\n return 'phabricator: %s not found' % author_email, 404\n\n author_phid = user_info[0][\"phid\"]\n\n diff_info = request.call('differential.query', {\n 'authors': [author_phid],\n 'status': \"status-open\"\n })\n\n diff_info.sort(key=lambda k: -1 * int(k['dateModified']))\n\n except requests.exceptions.ConnectionError:\n return 'Unable to connect to Phabricator', 503\n\n if not diff_info:\n # No diffs, no point in trying to find builds.\n return self.respond([])\n\n rows = list(db.session.query(\n PhabricatorDiff, Build\n ).join(\n Build, Build.source_id == PhabricatorDiff.source_id\n ).filter(\n PhabricatorDiff.revision_id.in_([d['id'] for d in diff_info])\n ))\n\n serialized_builds = zip(\n self.serialize([row.Build for row in rows]),\n [row.PhabricatorDiff for row in rows]\n )\n\n builds_map = defaultdict(list)\n for build, phabricator_diff in serialized_builds:\n builds_map[str(phabricator_diff.revision_id)].append(build)\n\n for d in diff_info:\n d['builds'] = builds_map[str(d['id'])]\n\n return self.respond(diff_info)", "metadata": "root.AuthorPhabricatorDiffsAPIView.get", "header": "['class', 'AuthorPhabricatorDiffsAPIView', '(', 'APIView', ')', ':', '___EOS___']", "index": 22 } ]
[]
[]
0
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_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "changes_", "._", "api_", "._", "base_", "import_", "API", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "api_", "._", "auth_", "import_", "get", "\\u", "current", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "config_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "models_", "import_", "Author_", ",_", "Build_", ",_", "Pha", "bri", "cator", "Diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "changes_", "._", "utils_", "._", "pha", "bri", "cator", "\\u", "utils_", "import_", "Pha", "bri", "cator", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\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_", "Author", "Pha", "bri", "cator", "Diff", "s", "API", "View_", "(_", "API", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hits", " ", "pha", "bri", "cator", " ", "to", " ", "get", " ", "a", " ", "list", " ", "of", " ", "the", " ", "user", "'", "s", " ", "diffs", " ", "in", " ", "review", ".", " ", "Thi", "s", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "(", "possib", "ly", " ", "only", ")", " ", "change", "s", " ", "api", " ", "call", " ", "tha", "t", " ", "hits", " ", "pha", "bri", "cator", ":", " ", "we", " ", "can", "'", "t", " ", "rely", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "local", " ", "data", " ", "bec", "aus", "e", " ", "there", "'", "s", " ", "no", " ", "way", " ", "to", " ", "know", " ", "whe", "ther", " ", "a", " ", "diff", " ", "has", " ", "bee", "n", "\\", "10", ";", " ", " ", " ", " ", "aband", "oned", " ", "or", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Author", "Pha", "bri", "cator", "Diff", "s", "API", "View_", "(_", "API", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "author", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authors_", "=_", "Author_", "._", "find_", "(_", "author", "\\u", "id_", ",_", "get", "\\u", "current", "\\u", "user_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "authors_", "and_", "author", "\\u", "id_", "==_", "'", "me", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'''", "Ei", "ther", " ", "there", " ", "is", " ", "no", " ", "current", " ", "user", " ", "or", " ", "you", " ", "are", " ", "not", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "author", " ", "table", "'''_", ",_", "401_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "authors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "author", " ", "not", " ", "found", "'_", ",_", "404_", "\\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 ", " _", "author", "\\u", "email_", "=_", "authors_", "[_", "0_", "]_", "._", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "Pha", "bri", "cator", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "info_", "=_", "request_", "._", "call_", "(_", "'", "user", ".", "query", "'_", ",_", "{_", "'", "email", "s", "'_", ":_", "[_", "author", "\\u", "email_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "user", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "pha", "bri", "cator", ":", " ", "%", "s", " ", "not", " ", "found", "'_", "%_", "author", "\\u", "email_", ",_", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "author", "\\u", "phi", "d_", "=_", "user", "\\u", "info_", "[_", "0_", "]_", "[_", "\"", "phi", "d", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "info_", "=_", "request_", "._", "call_", "(_", "'", "differential", ".", "query", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "s", "'_", ":_", "[_", "author", "\\u", "phi", "d_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "\"", "status", "-", "open", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "info_", "._", "sort_", "(_", "key_", "=_", "lambda_", "k_", ":_", "-_", "1_", "*_", "int_", "(_", "k_", "[_", "'", "date", "Modifie", "d", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "requests_", "._", "exceptions_", "._", "Connect", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Una", "ble", " ", "to", " ", "connect", " ", "to", " ", "Pha", "bri", "cator", "'_", ",_", "503_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "diff", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "diffs", ",", " ", "no", " ", "point", " ", "in", " ", "try", "ing", " ", "to", " ", "find", " ", "builds", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "respond_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rows_", "=_", "list_", "(_", "db_", "._", "session_", "._", "query_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Pha", "bri", "cator", "Diff_", ",_", "Build_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Build_", ",_", "Build_", "._", "source", "\\u", "id_", "==_", "Pha", "bri", "cator", "Diff_", "._", "source", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Pha", "bri", "cator", "Diff_", "._", "revis", "ion", "\\u", "id_", "._", "in\\u_", "(_", "[_", "d_", "[_", "'", "id", "'_", "]_", "for_", "d_", "in_", "diff", "\\u", "info_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "serialize", "d\\u", "builds_", "=_", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "serialize_", "(_", "[_", "row_", "._", "Build_", "for_", "row_", "in_", "rows_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "row_", "._", "Pha", "bri", "cator", "Diff_", "for_", "row_", "in_", "rows_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "builds", "\\u", "map_", "=_", "defaultdict_", "(_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "build_", ",_", "pha", "bri", "cator", "\\u", "diff_", "in_", "serialize", "d\\u", "builds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "builds", "\\u", "map_", "[_", "str_", "(_", "pha", "bri", "cator", "\\u", "diff_", "._", "revis", "ion", "\\u", "id_", ")_", "]_", "._", "append_", "(_", "build_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "d_", "in_", "diff", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "'", "builds", "'_", "]_", "=_", "builds", "\\u", "map_", "[_", "str_", "(_", "d_", "[_", "'", "id", "'_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "respond_", "(_", "diff", "\\u", "info_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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,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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 ]
Unnecessary pass
zcutlip/broken_abandoned/part_9/firmware_building/firmware_headers/janky_ambit_header.py
[ { "content": "class AmbitHeaderException(Exception):\n pass", "metadata": "root.AmbitHeaderException", "header": "['module', '___EOS___']", "index": 16 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ambi", "t", "Head", "er", "Exception_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
wiliamsouza/hystrix-py/tests/test_rolling_percentile.py
[ { "content": "def test_percentile_algorithm_media4():\n ''' Unsorted so it is expected to sort it for us. '''\n snapshot = PercentileSnapshot(300, 75, 125, 500, 100, 160,\n 180, 200, 210, 50, 170)\n assert snapshot.percentile(50) == 175", "metadata": "root.test_percentile_algorithm_media4", "header": "['module', '___EOS___']", "index": 173 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "percentile", "\\u", "algo", "rit", "hm", "\\u", "media", "4_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Uns", "orte", "d", " ", "so", " ", "it", " ", "is", " ", "expected", " ", "to", " ", "sort", " ", "it", " ", "for", " ", "us", ".", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snapshot_", "=_", "Perce", "ntil", "e", "Snapshot_", "(_", "300_", ",_", "75_", ",_", "125_", ",_", "500_", ",_", "100_", ",_", "160_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "180_", ",_", "200_", ",_", "210_", ",_", "50_", ",_", "170_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "snapshot_", "._", "percentile_", "(_", "50_", ")_", "==_", "175_", "\\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 ]
Unused local variable
SALib/SALib/SALib/tests/test_regression.py
[ { "content": "def test_regression_dgsm():\n param_file = 'SALib/test_functions/params/Ishigami.txt'\n problem = read_param_file(param_file)\n param_values = finite_diff.sample(problem, 10000, delta=0.001)\n\n Y = Ishigami.evaluate(param_values)\n\n Si = dgsm.analyze(problem, param_values, Y,\n conf_level=0.95, print_to_console=False)\n\n assert_allclose(Si['dgsm'], [2.229, 7.066, 3.180], atol=5e-2, rtol=1e-1)", "metadata": "root.test_regression_dgsm", "header": "['module', '___EOS___']", "index": 160 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "regress", "ion", "\\u", "dg", "sm_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "param", "\\u", "file_", "=_", "'", "SAL", "ib", "/", "test\\u", "function", "s", "/", "params", "/", "Is", "hi", "gam", "i", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "problem_", "=_", "read", "\\u", "param", "\\u", "file_", "(_", "param", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "param", "\\u", "values_", "=_", "finite", "\\u", "diff_", "._", "sample_", "(_", "problem_", ",_", "10000_", ",_", "delta_", "=_", "0.001_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "=_", "Is", "hi", "gam", "i_", "._", "evaluate_", "(_", "param", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Si", "_", "=_", "dg", "sm_", "._", "analyze_", "(_", "problem_", ",_", "param", "\\u", "values_", ",_", "Y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "conf", "\\u", "level_", "=_", "0.95_", ",_", "print", "\\u", "to", "\\u", "console_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "Si", "_", "[_", "'", "dg", "sm", "'_", "]_", ",_", "[_", "2.2", "29_", ",_", "7.0", "66_", ",_", "3.1", "80_", "]_", ",_", "atol_", "=_", "5e-", "2_", ",_", "rtol_", "=_", "1e-1", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Comparison of constants
pantsbuild/pants/src/python/pants/pantsd/watchman.py
[ { "content": " def subscribed(self, build_root, handlers):\n \"\"\"Bulk subscribe generator for StreamableWatchmanClient.\n\n :param str build_root: the build_root for all subscriptions.\n :param iterable handlers: a sequence of Watchman.EventHandler namedtuple objects.\n :yields: a stream of tuples in the form (subscription_name: str, subscription_event: dict).\n \"\"\"\n command_list = [['subscribe',\n build_root,\n handler.name,\n handler.metadata] for handler in handlers]\n\n self._logger.debug('watchman command_list is: {}'.format(command_list))\n\n for event in self.client.stream_query(command_list):\n if event is None:\n yield None, None\n elif 'subscribe' in event:\n self._logger.info('confirmed watchman subscription: {}'.format(event))\n yield None, None\n elif 'subscription' in event:\n yield event.get('subscription'), event\n else:\n self._logger.warning('encountered non-subscription event: {}'.format(event))", "metadata": "root.Watchman.subscribed", "header": "['class', 'Watchman', '(', 'ProcessManager', ')', ':', '___EOS___']", "index": 134 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Watch", "man_", "(_", "Process", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subscribed", "_", "(_", "self_", ",_", "build", "\\u", "root_", ",_", "handlers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Bul", "k", " ", "subscribe", " ", "generat", "or", " ", "for", " ", "Stream", "able", "Watch", "man", "Client", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "build", "\\u", "root", ":", " ", "the", " ", "build", "\\u", "root", " ", "for", " ", "all", " ", "subscript", "ion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "iterable", " ", "handler", "s", ":", " ", "a", " ", "sequence", " ", "of", " ", "Watch", "man", ".", "Event", "Handle", "r", " ", "namedtupl", "e", " ", "object", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "yield", "s", ":", " ", "a", " ", "stream", " ", "of", " ", "tuple", "s", " ", "in", " ", "the", " ", "form", " ", "(", "subscript", "ion", "\\u", "name", ":", " ", "str", ",", " ", "subscript", "ion", "\\u", "event", ":", " ", "dict", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command", "\\u", "list_", "=_", "[_", "[_", "'", "subscribe", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "build", "\\u", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "._", "metadata_", "]_", "for_", "handler_", "in_", "handlers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "logger_", "._", "debug_", "(_", "'", "watch", "man", " ", "command", "\\u", "list", " ", "is", ":", " ", "{}'_", "._", "format_", "(_", "command", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event_", "in_", "self_", "._", "client_", "._", "stream", "\\u", "query_", "(_", "command", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "subscribe", "'_", "in_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "info_", "(_", "'", "confirm", "ed", " ", "watch", "man", " ", "subscript", "ion", ":", " ", "{}'_", "._", "format_", "(_", "event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "subscript", "ion", "'_", "in_", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "event_", "._", "get_", "(_", "'", "subscript", "ion", "'_", ")_", ",_", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "logger_", "._", "warning_", "(_", "'", "encounter", "ed", " ", "non", "-", "subscript", "ion", " ", "event", ":", " ", "{}'_", "._", "format_", "(_", "event_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
lbryio/lbry/lbrynet/core/server/BlobRequestHandler.py
[ { "content": " def send_file(self, consumer):\n\n def _send_file():\n inner_d = start_transfer()\n # TODO: if the transfer fails, check if it's because the connection was cut off.\n # TODO: if so, perhaps bill the client\n inner_d.addCallback(lambda _: set_expected_payment())\n inner_d.addBoth(set_not_uploading)\n return inner_d\n\n def count_bytes(data):\n self.blob_bytes_uploaded += len(data)\n self.peer.update_stats('blob_bytes_uploaded', len(data))\n return data\n\n def start_transfer():\n self.file_sender = FileSender()\n log.info(\"Starting the file upload\")\n assert self.read_handle is not None, \"self.read_handle was None when trying to start the transfer\"\n d = self.file_sender.beginFileTransfer(self.read_handle, consumer, count_bytes)\n return d\n\n def set_expected_payment():\n log.info(\"Setting expected payment\")\n if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None:\n self.wallet.add_expected_payment(self.peer,\n self.currently_uploading.length * 1.0 *\n self.blob_data_payment_rate / 2**20)\n self.blob_bytes_uploaded = 0\n self.peer.update_stats('blobs_uploaded', 1)\n return None\n\n def set_not_uploading(reason=None):\n if self.currently_uploading is not None:\n self.currently_uploading.close_read_handle(self.read_handle)\n self.read_handle = None\n self.currently_uploading = None\n self.file_sender = None\n if reason is not None and isinstance(reason, Failure):\n log.info(\"Upload has failed. Reason: %s\", reason.getErrorMessage())\n\n return _send_file()", "metadata": "root.BlobRequestHandler.send_file", "header": "['class', 'BlobRequestHandler', '(', 'object', ')', ':', '___EOS___']", "index": 117 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Blo", "b", "Request", "Handler_", "(_", "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_", "send", "\\u", "file_", "(_", "self_", ",_", "consumer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "send", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inner", "\\u", "d_", "=_", "start", "\\u", "transfer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "if", " ", "the", " ", "transfer", " ", "fail", "s", ",", " ", "check", " ", "if", " ", "it", "'", "s", " ", "bec", "aus", "e", " ", "the", " ", "connecti", "on", " ", "was", " ", "cut", " ", "off", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "if", " ", "so", ",", " ", "per", "hap", "s", " ", "bill", " ", "the", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "inner", "\\u", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "set\\u", "expected", "\\u", "payment_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "\\u", "d_", "._", "add", "Bot", "h_", "(_", "set\\u", "not", "\\u", "upload", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "inner", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count", "\\u", "bytes_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "blob", "\\u", "bytes", "\\u", "uploade", "d_", "+=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "peer_", "._", "update", "\\u", "stats_", "(_", "'", "blob", "\\u", "bytes", "\\u", "uploade", "d", "'_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "transfer_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file", "\\u", "sender_", "=_", "File", "Sender_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "Start", "ing", " ", "the", " ", "file", " ", "upload", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "read", "\\u", "handle_", "is_", "not_", "None_", ",_", "\"", "self", ".", "read", "\\u", "handle", " ", "was", " ", "Non", "e", " ", "whe", "n", " ", "try", "ing", " ", "to", " ", "start", " ", "the", " ", "transfer", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "file", "\\u", "sender_", "._", "begin", "File", "Transfer", "_", "(_", "self_", "._", "read", "\\u", "handle_", ",_", "consumer_", ",_", "count", "\\u", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "expected", "\\u", "payment_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Sett", "ing", " ", "expected", " ", "pay", "ment", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "blob", "\\u", "bytes", "\\u", "uploade", "d_", "!=_", "0_", "and_", "self_", "._", "blob", "\\u", "data\\u", "pay", "ment", "\\u", "rate_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wallet_", "._", "add", "\\u", "expected", "\\u", "payment_", "(_", "self_", "._", "peer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "currentl", "y", "\\u", "upload", "ing_", "._", "length_", "*_", "1.0_", "*_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "blob", "\\u", "data\\u", "pay", "ment", "\\u", "rate_", "/_", "2_", "**_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "blob", "\\u", "bytes", "\\u", "uploade", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "peer_", "._", "update", "\\u", "stats_", "(_", "'", "blobs", "\\u", "uploade", "d", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "not", "\\u", "upload", "ing_", "(_", "reason_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "currentl", "y", "\\u", "upload", "ing_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "currentl", "y", "\\u", "upload", "ing_", "._", "close", "\\u", "read", "\\u", "handle_", "(_", "self_", "._", "read", "\\u", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "handle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "currentl", "y", "\\u", "upload", "ing_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "file", "\\u", "sender_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reason_", "is_", "not_", "None_", "and_", "isinstance_", "(_", "reason_", ",_", "Failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Upload", " ", "has", " ", "fail", "ed", ".", " ", "Rea", "son", ":", " ", "%", "s", "\"_", ",_", "reason_", "._", "get", "Error", "Message_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "send", "\\u", "file_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Comparison using is when operands support `__eq__`
pycollada/pycollada/collada/camera.py
[ { "content": "####################################################################\n# #\n# THIS FILE IS PART OF THE pycollada LIBRARY SOURCE CODE. #\n# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS #\n# GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE #\n# IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. #\n# #\n# THE pycollada SOURCE CODE IS (C) COPYRIGHT 2011 #\n# by Jeff Terrace and contributors #\n# #\n####################################################################\n\n\"\"\"Contains objects for representing cameras\"\"\"\n\nimport numpy\n\nfrom collada.common import DaeObject, E, tag\nfrom collada.common import DaeIncompleteError, DaeBrokenRefError, \\\n DaeMalformedError\nfrom collada.xmlutil import etree as ElementTree\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " @staticmethod\n def load(collada, localscope, node):\n orthonode = node.find('%s/%s/%s' % (\n tag('optics'),\n tag('technique_common'),\n tag('orthographic')))\n\n if orthonode is None: raise DaeIncompleteError('Missing orthographic for camera definition')\n\n xmag = orthonode.find( tag('xmag') )\n ymag = orthonode.find( tag('ymag') )\n aspect_ratio = orthonode.find( tag('aspect_ratio') )\n znearnode = orthonode.find( tag('znear') )\n zfarnode = orthonode.find( tag('zfar') )\n id = node.get('id', '')\n\n try:\n if xmag is not None:\n xmag = float(xmag.text)\n if ymag is not None:\n ymag = float(ymag.text)\n if aspect_ratio is not None:\n aspect_ratio = float(aspect_ratio.text)\n znear = float(znearnode.text)\n zfar = float(zfarnode.text)\n except (TypeError, ValueError) as ex:\n raise DaeMalformedError('Corrupted float values in camera definition')\n\n #There are some exporters that incorrectly output all three of these.\n # Worse, they actually got the caculation of aspect_ratio wrong!\n # So instead of failing to load, let's just add one more hack because of terrible exporters\n if xmag is not None and ymag is not None and aspect_ratio is not None:\n aspect_ratio = None\n\n return OrthographicCamera(id, znear, zfar, xmag=xmag, ymag=ymag,\n aspect_ratio=aspect_ratio, xmlnode=node)", "metadata": "root.OrthographicCamera.load", "header": "['class', 'OrthographicCamera', '(', 'Camera', ')', ':', '___EOS___']", "index": 284 } ]
[]
[]
0
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "FILE", " ", "IS", " ", "PART", " ", "OF", " ", "THE", " ", "pyco", "lla", "da", " ", "LIBRARY", " ", "SOU", "RC", "E", " ", "CODE", ".", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USE", ",", " ", "DISTRI", "BUT", "ION", " ", "AND", " ", "REP", "RO", "DU", "CTION", " ", "OF", " ", "THIS", " ", "LIBRARY", " ", "SOU", "RC", "E", " ", "IS", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GO", "VER", "NED", " ", "BY", " ", "A", " ", "BS", "D", "-", "STYLE", " ", "SOU", "RC", "E", " ", "LICENSE", " ", "INCLUDE", "D", " ", "WITH", " ", "THIS", " ", "SOU", "RC", "E", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IN", " ", "'", "COPY", "ING", "'.", " ", "PLE", "AS", "E", " ", "READ", " ", "THE", "SE", " ", "TERM", "S", " ", "BEFORE", " ", "DISTRI", "BUT", "ING", ".", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "pyco", "lla", "da", " ", "SOU", "RC", "E", " ", "CODE", " ", "IS", " ", "(", "C", ")", " ", "COPY", "RIG", "HT", " ", "2011", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "Je", "ff", " ", "Terra", "ce", " ", "and", " ", "contributor", "s", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", " ", " ", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Contain", "s", " ", "object", "s", " ", "for", " ", "represent", "ing", " ", "cameras", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colla", "da_", "._", "common_", "import_", "Da", "e", "Object_", ",_", "E_", ",_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colla", "da_", "._", "common_", "import_", "Da", "e", "Incomp", "lete", "Error_", ",_", "Da", "e", "Bro", "ken", "Ref", "Error_", ",_", "Da", "e", "Mal", "formed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colla", "da_", "._", "xml", "util_", "import_", "etree_", "as_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Ortho", "graphic", "Camera_", "(_", "Camera_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load_", "(_", "colla", "da_", ",_", "locals", "cope", "_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ortho", "node_", "=_", "node_", "._", "find_", "(_", "'%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "optic", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "technique", "\\u", "common", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "(_", "'", "ortho", "graphic", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ortho", "node_", "is_", "None_", ":_", "raise_", "Da", "e", "Incomp", "lete", "Error_", "(_", "'", "Missing", " ", "ortho", "graphic", " ", "for", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xma", "g_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "xma", "g", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yma", "g_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "yma", "g", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "aspect", "\\u", "ratio", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zn", "earn", "ode_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zn", "ear", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "arn", "ode_", "=_", "ortho", "node_", "._", "find_", "(_", "tag_", "(_", "'", "zf", "ar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "node_", "._", "get_", "(_", "'", "id", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xma", "g_", "=_", "float_", "(_", "xma", "g_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "yma", "g_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yma", "g_", "=_", "float_", "(_", "yma", "g_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "float_", "(_", "aspect", "\\u", "ratio_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zn", "ear_", "=_", "float_", "(_", "zn", "earn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zf", "ar_", "=_", "float_", "(_", "zf", "arn", "ode_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Da", "e", "Mal", "formed", "Error_", "(_", "'", "Corr", "upt", "ed", " ", "float", " ", "values", " ", "in", " ", "came", "ra", " ", "definit", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "There", " ", "are", " ", "some", " ", "exporter", "s", " ", "tha", "t", " ", "incorrect", "ly", " ", "output", " ", "all", " ", "three", " ", "of", " ", "these", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wor", "se", ",", " ", "the", "y", " ", "actual", "ly", " ", "got", " ", "the", " ", "cac", "ulation", " ", "of", " ", "aspect", "\\u", "ratio", " ", "wrong", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "inst", "ead", " ", "of", " ", "faili", "ng", " ", "to", " ", "load", ",", " ", "let", "'", "s", " ", "just", " ", "add", " ", "one", " ", "more", " ", "hack", " ", "bec", "aus", "e", " ", "of", " ", "terr", "ibl", "e", " ", "exporter", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xma", "g_", "is_", "not_", "None_", "and_", "yma", "g_", "is_", "not_", "None_", "and_", "aspect", "\\u", "ratio_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aspect", "\\u", "ratio_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Ortho", "graphic", "Camera_", "(_", "id_", ",_", "zn", "ear_", ",_", "zf", "ar_", ",_", "xma", "g_", "=_", "xma", "g_", ",_", "yma", "g_", "=_", "yma", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "aspect", "\\u", "ratio_", ",_", "xml", "node_", "=_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 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,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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 import
gferreira/hTools2/Lib/hTools2/modules/ftp.py
[ { "content": "# [h] hTools2.modules.ftp\n\n\"\"\"Tools to connect to a FTP server, upload files etc.\"\"\"\n\n# This module uses the `ftplib` library to handle FTP connection and upload.\n# http://docs.python.org/library/ftplib.html\n\nimport os\nfrom ftplib import FTP\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def connect_to_server(url, login, password, folder, verbose=False):\n \"\"\"Connects to the FTP server using the given connection settings.\n\n Use the given ``url``, ``login`` and ``password`` information to make a connection. Move to the given ``folder`` (if it exists), and return a ``FTP`` object.\n\n To get to the lower level details about the FTP connection, use the optional parameter ``verbose=True``.\n\n \"\"\"\n # create FTP connection\n ftp = FTP(url, login, password)\n if verbose == True:\n print \"%s\" % ftp.getwelcome()\n # move to folder\n ftp.cwd(folder)\n if verbose == True:\n ftp.retrlines('LIST')\n print\n return ftp", "metadata": "root.connect_to_server", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def upload_file(filePath, FTPconnection):\n \"\"\"Upload the file at ``file_path`` to a FTP server, using the given ``ftp_connection``.\"\"\"\n file = open(filePath, 'rb')\n fileName = os.path.split(filePath)[1]\n FTPconnection.storbinary('STOR ' + fileName, file)\n file.close()", "metadata": "root.upload_file", "header": "['module', '___EOS___']", "index": 29 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "[", "h", "]", " ", "h", "Tool", "s2", ".", "module", "s", ".", "ftp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Tool", "s", " ", "to", " ", "connect", " ", "to", " ", "a", " ", "FTP", " ", "server", ",", " ", "upload", " ", "files", " ", "etc", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "use", "s", " ", "the", " ", "`", "ftp", "lib", "`", " ", "librar", "y", " ", "to", " ", "handle", " ", "FTP", " ", "connecti", "on", " ", "and", " ", "upload", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "docs", ".", "python", ".", "org", "/", "librar", "y", "/", "ftp", "lib", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ftp", "lib_", "import_", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "connect", "\\u", "to", "\\u", "server_", "(_", "url_", ",_", "login_", ",_", "password_", ",_", "folder_", ",_", "verbose_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", "s", " ", "to", " ", "the", " ", "FTP", " ", "server", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "connecti", "on", " ", "settings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "the", " ", "give", "n", " ", "``", "url", "``", ",", " ", "``", "login", "``", " ", "and", " ", "``", "password", "``", " ", "informati", "on", " ", "to", " ", "make", " ", "a", " ", "connecti", "on", ".", " ", "Move", " ", "to", " ", "the", " ", "give", "n", " ", "``", "folder", "``", " ", "(", "if", " ", "it", " ", "exist", "s", "),", " ", "and", " ", "return", " ", "a", " ", "``", "FTP", "``", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "get", " ", "to", " ", "the", " ", "lower", " ", "level", " ", "deta", "il", "s", " ", "abo", "ut", " ", "the", " ", "FTP", " ", "connecti", "on", ",", " ", "use", " ", "the", " ", "option", "al", " ", "parameter", " ", "``", "verbo", "se", "=", "Tru", "e", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "FTP", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "ftp_", "=_", "FTP", "_", "(_", "url_", ",_", "login_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbose_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", "\"_", "%_", "ftp_", "._", "getw", "el", "come", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "move", " ", "to", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ftp_", "._", "cwd_", "(_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verbose_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftp_", "._", "retr", "lines_", "(_", "'", "LIST", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ftp_", "\\u\\u\\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_", "upload", "\\u", "file_", "(_", "file", "Path_", ",_", "FTP", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Upload", " ", "the", " ", "file", " ", "at", " ", "``", "file", "\\u", "path", "``", " ", "to", " ", "a", " ", "FTP", " ", "server", ",", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "``", "ftp", "\\u", "connecti", "on", "``.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "open_", "(_", "file", "Path_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "file", "Path_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FTP", "connection_", "._", "stor", "binary_", "(_", "'", "STOR", " ", "'_", "+_", "file", "Name_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unnecessary pass
LabPy/lantz/lantz/drivers/labjack/_internal/u12.py
[ { "content": "class U12Exception(Exception):\n \"\"\"Custom Exception meant for dealing specifically with U12 Exceptions.\n\n Error codes are either going to be a LabJackUD error code or a -1. The -1 implies\n a python wrapper specific error.\n def __init__(self, ec = 0, errorString = ''):\n self.errorCode = ec\n self.errorString = errorString\n\n if not self.errorString:\n #try:\n self.errorString = getErrorString(ec)\n #except:\n # self.errorString = str(self.errorCode)\n \n def __str__(self):\n return self.errorString\n \n \"\"\"\n pass", "metadata": "root.U12Exception", "header": "['module', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "U1", "2E", "xcept", "ion_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Custom", " ", "Except", "ion", " ", "mean", "t", " ", "for", " ", "deal", "ing", " ", "specifica", "ll", "y", " ", "with", " ", "U1", "2", " ", "Except", "ion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Error", " ", "codes", " ", "are", " ", "eit", "her", " ", "goi", "ng", " ", "to", " ", "be", " ", "a", " ", "Lab", "Jack", "UD", " ", "error", " ", "code", " ", "or", " ", "a", " ", "-1", ".", " ", " ", "The", " ", "-1", " ", "implies", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "python", " ", "wrapp", "er", " ", "specific", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "init", "\\u\\u", "(", "self", ",", " ", "ec", " ", "=", " ", "0", ",", " ", "error", "String", " ", "=", " ", "''", "):", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "error", "Code", " ", "=", " ", "ec", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "error", "String", " ", "=", " ", "error", "String", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "self", ".", "error", "String", ":", "\\", "10", ";", " ", " ", " ", " ", "#", "try", ":", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "error", "String", " ", "=", " ", "get", "Error", "String", "(", "ec", ")", "\\", "10", ";", " ", " ", " ", " ", "#", "except", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", " ", " ", " ", "self", ".", "error", "String", " ", "=", " ", "str", "(", "self", ".", "error", "Code", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "str", "\\u\\u", "(", "self", "):", "\\", "10", ";", " ", " ", "return", " ", "self", ".", "error", "String", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Inconsistent equality and hashing
timonwong/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python3/genshi/template/eval.py
[ { "content": "class Code(object):\n \"\"\"Abstract base class for the `Expression` and `Suite` classes.\"\"\"\n __slots__ = ['source', 'code', 'ast', '_globals']\n\n\n\n\n\n\n", "metadata": "root.Code", "header": "['module', '___EOS___']", "index": 56 }, { "content": " def __init__(self, source, filename=None, lineno=-1, lookup='strict',\n xform=None):\n \"\"\"Create the code object, either from a string, or from an AST node.\n \n :param source: either a string containing the source code, or an AST\n node\n :param filename: the (preferably absolute) name of the file containing\n the code\n :param lineno: the number of the line on which the code was found\n :param lookup: the lookup class that defines how variables are looked\n up in the context; can be either \"strict\" (the default),\n \"lenient\", or a custom lookup class\n :param xform: the AST transformer that should be applied to the code;\n if `None`, the appropriate transformation is chosen\n depending on the mode\n \"\"\"\n if isinstance(source, str):\n self.source = source\n node = _parse(source, mode=self.mode)\n else:\n assert isinstance(source, _ast.AST), \\\n 'Expected string or AST node, but got %r' % source\n self.source = '?'\n if self.mode == 'eval':\n node = _ast.Expression()\n node.body = source\n else:\n node = _ast.Module()\n node.body = [source]\n\n self.ast = node\n self.code = _compile(node, self.source, mode=self.mode,\n filename=filename, lineno=lineno, xform=xform)\n if lookup is None:\n lookup = LenientLookup\n elif isinstance(lookup, str):\n lookup = {'lenient': LenientLookup, 'strict': StrictLookup}[lookup]\n self._globals = lookup.globals", "metadata": "root.Code.__init__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def __getstate__(self):\n state = {'source': self.source, 'ast': self.ast,\n 'lookup': self._globals.__self__}\n state['code'] = get_code_params(self.code)\n return state", "metadata": "root.Code.__getstate__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 99 }, { "content": " def __setstate__(self, state):\n self.source = state['source']\n self.ast = state['ast']\n self.code = CodeType(0, *state['code'])\n self._globals = state['lookup'].globals", "metadata": "root.Code.__setstate__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def __eq__(self, other):\n return (type(other) == type(self)) and (self.code == other.code)", "metadata": "root.Code.__eq__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 111 }, { "content": " def __hash__(self):\n return hash(self.code)", "metadata": "root.Code.__hash__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 114 }, { "content": " def __ne__(self, other):\n return not self == other", "metadata": "root.Code.__ne__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 117 }, { "content": " def __repr__(self):\n return '%s(%r)' % (type(self).__name__, self.source)", "metadata": "root.Code.__repr__", "header": "['class', 'Code', '(', 'object', ')', ':', '___EOS___']", "index": 120 } ]
[]
[]
0
false
[ "[CLS]_", "Inco", "nsis", "tent", "_", "equality", "_", "and_", "hashin", "g_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Abstract", " ", "base", " ", "class", " ", "for", " ", "the", " ", "`", "Expression", "`", " ", "and", " ", "`", "Suit", "e", "`", " ", "classe", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "[_", "'", "source", "'_", ",_", "'", "code", "'_", ",_", "'", "ast", "'_", ",_", "'\\u", "globals", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "source_", ",_", "filename_", "=_", "None_", ",_", "lineno_", "=_", "-_", "1_", ",_", "lookup_", "=_", "'", "strict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xform_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "the", " ", "code", " ", "object", ",", " ", "eit", "her", " ", "from", " ", "a", " ", "string", ",", " ", "or", " ", "from", " ", "an", " ", "AST", " ", "node", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "source", ":", " ", "eit", "her", " ", "a", " ", "string", " ", "contain", "ing", " ", "the", " ", "source", " ", "code", ",", " ", "or", " ", "an", " ", "AST", "\\", "10", ";", " ", " ", " ", " ", " ", "node", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "filename", ":", " ", "the", " ", "(", "prefer", "abl", "y", " ", "abs", "olute", ")", " ", "name", " ", "of", " ", "the", " ", "file", " ", "contain", "ing", "\\", "10", ";", " ", " ", " ", "the", " ", "code", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "linen", "o", ":", " ", "the", " ", "number", " ", "of", " ", "the", " ", "line", " ", "on", " ", "whi", "ch", " ", "the", " ", "code", " ", "was", " ", "found", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "look", "up", ":", " ", "the", " ", "look", "up", " ", "class", " ", "tha", "t", " ", "defin", "es", " ", "how", " ", "variab", "les", " ", "are", " ", "looke", "d", "\\", "10", ";", " ", " ", " ", " ", " ", "up", " ", "in", " ", "the", " ", "context", ";", " ", "can", " ", "be", " ", "eit", "her", " ", "\"", "strict", "\"", " ", "(", "the", " ", "default", "),", "\\", "10", ";", " ", " ", " ", " ", " ", "\"", "len", "ient", "\",", " ", "or", " ", "a", " ", "custom", " ", "look", "up", " ", "class", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "xform", ":", " ", "the", " ", "AST", " ", "transforme", "r", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "applied", " ", "to", " ", "the", " ", "code", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "`", "Non", "e", "`", ",", " ", "the", " ", "appropr", "iate", " ", "transformation", " ", "is", " ", "chosen", "\\", "10", ";", " ", " ", " ", " ", "depend", "ing", " ", "on", " ", "the", " ", "mode", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "source_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "\\u", "parse_", "(_", "source_", ",_", "mode_", "=_", "self_", "._", "mode_", ")_", "\\u\\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_", "isinstance_", "(_", "source_", ",_", "\\u", "ast_", "._", "AST_", ")_", ",_", "'", "Expect", "ed", " ", "string", " ", "or", " ", "AST", " ", "node", ",", " ", "but", " ", "got", " ", "%", "r", "'_", "%_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "'?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "mode_", "==_", "'", "eval", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "\\u", "ast_", "._", "Expression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "body_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "\\u", "ast_", "._", "Module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "body_", "=_", "[_", "source_", "]_", "\\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_", "._", "ast_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "\\u", "compile_", "(_", "node_", ",_", "self_", "._", "source_", ",_", "mode_", "=_", "self_", "._", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "filename_", ",_", "lineno_", "=_", "lineno_", ",_", "xform_", "=_", "xform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lookup_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lookup_", "=_", "Len", "ient", "Lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "lookup_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lookup_", "=_", "{_", "'", "len", "ient", "'_", ":_", "Len", "ient", "Lookup_", ",_", "'", "strict", "'_", ":_", "Stri", "ct", "Lookup_", "}_", "[_", "lookup_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "globals_", "=_", "lookup_", "._", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getstate", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "{_", "'", "source", "'_", ":_", "self_", "._", "source_", ",_", "'", "ast", "'_", ":_", "self_", "._", "ast_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "look", "up", "'_", ":_", "self_", "._", "\\u", "globals_", "._", "\\u\\u", "self", "\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "code", "'_", "]_", "=_", "get", "\\u", "code", "\\u", "params_", "(_", "self_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setstate", "\\u\\u_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "=_", "state_", "[_", "'", "source", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ast_", "=_", "state_", "[_", "'", "ast", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "Code", "Type_", "(_", "0_", ",_", "*_", "state_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "globals_", "=_", "state_", "[_", "'", "look", "up", "'_", "]_", "._", "globals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "type_", "(_", "other_", ")_", "==_", "type_", "(_", "self_", ")_", ")_", "and_", "(_", "self_", "._", "code_", "==_", "other_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hash_", "(_", "self_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "not_", "self_", "==_", "other_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", "(%", "r", ")'_", "%_", "(_", "type_", "(_", "self_", ")_", "._", "\\u\\u", "name\\u\\u_", ",_", "self_", "._", "source_", ")_", "\\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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 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 ]
Unused local variable
CenterForOpenScience/waterbutler/waterbutler/providers/osfstorage/tasks/utils.py
[ { "content": "def ensure_paths():\n paths = [\n settings.FILE_PATH_PENDING,\n settings.FILE_PATH_COMPLETE,\n ]\n for path in paths:\n ensure_path(path)", "metadata": "root.ensure_paths", "header": "['module', '___EOS___']", "index": 27 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ensure", "\\u", "paths_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "paths_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "FILE", "\\u", "PATH", "\\u", "PENDING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "FILE", "\\u", "PATH", "\\u", "COMPLETE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "path_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
letsencrypt/letsencrypt/certbot/plugins/util_test.py
[ { "content": "\"\"\"Tests for certbot.plugins.util.\"\"\"\nimport unittest\n\nimport mock\nimport psutil\n\n\n\nif __name__ == \"__main__\":\n unittest.main() # pragma: no cover\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AlreadyListeningTest(unittest.TestCase):\n \"\"\"Tests for certbot.plugins.already_listening.\"\"\"\n\n\n\n\n", "metadata": "root.AlreadyListeningTest", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def _call(self, *args, **kwargs):\n from certbot.plugins.util import already_listening\n return already_listening(*args, **kwargs)", "metadata": "root.AlreadyListeningTest._call", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " @mock.patch(\"certbot.plugins.util.psutil.net_connections\")\n @mock.patch(\"certbot.plugins.util.psutil.Process\")\n @mock.patch(\"certbot.plugins.util.zope.component.getUtility\")\n def test_race_condition(self, mock_get_utility, mock_process, mock_net):\n # This tests a race condition, or permission problem, or OS\n # incompatibility in which, for some reason, no process name can be\n # found to match the identified listening PID.\n from psutil._common import sconn\n conns = [\n sconn(fd=-1, family=2, type=1, laddr=(\"0.0.0.0\", 30),\n raddr=(), status=\"LISTEN\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"192.168.5.10\", 32783),\n raddr=(\"20.40.60.80\", 22), status=\"ESTABLISHED\", pid=1234),\n sconn(fd=-1, family=10, type=1, laddr=(\"::1\", 54321),\n raddr=(\"::1\", 111), status=\"CLOSE_WAIT\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"0.0.0.0\", 17),\n raddr=(), status=\"LISTEN\", pid=4416)]\n mock_net.return_value = conns\n mock_process.side_effect = psutil.NoSuchProcess(\"No such PID\")\n # We simulate being unable to find the process name of PID 4416,\n # which results in returning False.\n self.assertFalse(self._call(17))\n self.assertEqual(mock_get_utility.generic_notification.call_count, 0)\n mock_process.assert_called_once_with(4416)", "metadata": "root.AlreadyListeningTest.test_race_condition", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " @mock.patch(\"certbot.plugins.util.psutil.net_connections\")\n @mock.patch(\"certbot.plugins.util.psutil.Process\")\n @mock.patch(\"certbot.plugins.util.zope.component.getUtility\")\n def test_not_listening(self, mock_get_utility, mock_process, mock_net):\n from psutil._common import sconn\n conns = [\n sconn(fd=-1, family=2, type=1, laddr=(\"0.0.0.0\", 30),\n raddr=(), status=\"LISTEN\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"192.168.5.10\", 32783),\n raddr=(\"20.40.60.80\", 22), status=\"ESTABLISHED\", pid=1234),\n sconn(fd=-1, family=10, type=1, laddr=(\"::1\", 54321),\n raddr=(\"::1\", 111), status=\"CLOSE_WAIT\", pid=None)]\n mock_net.return_value = conns\n mock_process.name.return_value = \"inetd\"\n self.assertFalse(self._call(17))\n self.assertEqual(mock_get_utility.generic_notification.call_count, 0)\n self.assertEqual(mock_process.call_count, 0)", "metadata": "root.AlreadyListeningTest.test_not_listening", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 }, { "content": " @mock.patch(\"certbot.plugins.util.psutil.net_connections\")\n @mock.patch(\"certbot.plugins.util.psutil.Process\")\n @mock.patch(\"certbot.plugins.util.zope.component.getUtility\")\n def test_listening_ipv4(self, mock_get_utility, mock_process, mock_net):\n from psutil._common import sconn\n conns = [\n sconn(fd=-1, family=2, type=1, laddr=(\"0.0.0.0\", 30),\n raddr=(), status=\"LISTEN\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"192.168.5.10\", 32783),\n raddr=(\"20.40.60.80\", 22), status=\"ESTABLISHED\", pid=1234),\n sconn(fd=-1, family=10, type=1, laddr=(\"::1\", 54321),\n raddr=(\"::1\", 111), status=\"CLOSE_WAIT\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"0.0.0.0\", 17),\n raddr=(), status=\"LISTEN\", pid=4416)]\n mock_net.return_value = conns\n mock_process.name.return_value = \"inetd\"\n result = self._call(17)\n self.assertTrue(result)\n self.assertEqual(mock_get_utility.call_count, 1)\n mock_process.assert_called_once_with(4416)", "metadata": "root.AlreadyListeningTest.test_listening_ipv4", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " @mock.patch(\"certbot.plugins.util.psutil.net_connections\")\n @mock.patch(\"certbot.plugins.util.psutil.Process\")\n @mock.patch(\"certbot.plugins.util.zope.component.getUtility\")\n def test_listening_ipv6(self, mock_get_utility, mock_process, mock_net):\n from psutil._common import sconn\n conns = [\n sconn(fd=-1, family=2, type=1, laddr=(\"0.0.0.0\", 30),\n raddr=(), status=\"LISTEN\", pid=None),\n sconn(fd=3, family=2, type=1, laddr=(\"192.168.5.10\", 32783),\n raddr=(\"20.40.60.80\", 22), status=\"ESTABLISHED\", pid=1234),\n sconn(fd=-1, family=10, type=1, laddr=(\"::1\", 54321),\n raddr=(\"::1\", 111), status=\"CLOSE_WAIT\", pid=None),\n sconn(fd=3, family=10, type=1, laddr=(\"::\", 12345), raddr=(),\n status=\"LISTEN\", pid=4420),\n sconn(fd=3, family=2, type=1, laddr=(\"0.0.0.0\", 17),\n raddr=(), status=\"LISTEN\", pid=4416)]\n mock_net.return_value = conns\n mock_process.name.return_value = \"inetd\"\n result = self._call(12345)\n self.assertTrue(result)\n self.assertEqual(mock_get_utility.call_count, 1)\n mock_process.assert_called_once_with(4420)", "metadata": "root.AlreadyListeningTest.test_listening_ipv6", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " @mock.patch(\"certbot.plugins.util.psutil.net_connections\")\n def test_access_denied_exception(self, mock_net):\n mock_net.side_effect = psutil.AccessDenied(\"\")\n self.assertFalse(self._call(12345))", "metadata": "root.AlreadyListeningTest.test_access_denied_exception", "header": "['class', 'AlreadyListeningTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 100 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", "s", " ", "for", " ", "cert", "bot", ".", "plugin", "s", ".", "util", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "psutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "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_", "(_", ")_", "#", " ", "pragma", ":", " ", "no", " ", "cover_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "for", " ", "cert", "bot", ".", "plugin", "s", ".", "alr", "ead", "y", "\\u", "listen", "ing", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "call_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "cert", "bot_", "._", "plugins_", "._", "util_", "import_", "alr", "ead", "y", "\\u", "listen", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "alr", "ead", "y", "\\u", "listen", "ing_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "net", "\\u", "connections", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "Process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "zop", "e", ".", "component", ".", "get", "Utili", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "race", "\\u", "condition_", "(_", "self_", ",_", "mock", "\\u", "get", "\\u", "utility_", ",_", "mock", "\\u", "process_", ",_", "mock", "\\u", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "tests", " ", "a", " ", "race", " ", "condition", ",", " ", "or", " ", "permissi", "on", " ", "problem", ",", " ", "or", " ", "OS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "incomp", "ati", "bilit", "y", " ", "in", " ", "whi", "ch", ",", " ", "for", " ", "some", " ", "reason", ",", " ", "no", " ", "process", " ", "name", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "found", " ", "to", " ", "match", " ", "the", " ", "identifi", "ed", " ", "listen", "ing", " ", "PID", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "psutil_", "._", "\\u", "common_", "import_", "scon", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "192", ".1", "68.", "5.1", "0", "\"_", ",_", "327", "83_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\"", "20.", "40.", "60", ".8", "0", "\"_", ",_", "22_", ")_", ",_", "status_", "=_", "\"", "EST", "AB", "LIS", "HED", "\"_", ",_", "pid_", "=_", "1234_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "10_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "5432", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "111_", ")_", ",_", "status_", "=_", "\"", "CLOSE", "\\u", "WAIT", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "17_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "441", "6_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "net_", "._", "return", "\\u", "value_", "=_", "conns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "side", "\\u", "effect_", "=_", "psutil_", "._", "No", "Suc", "h", "Process_", "(_", "\"", "No", " ", "suc", "h", " ", "PID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "simulat", "e", " ", "bei", "ng", " ", "una", "ble", " ", "to", " ", "find", " ", "the", " ", "process", " ", "name", " ", "of", " ", "PID", " ", "441", "6", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "results", " ", "in", " ", "return", "ing", " ", "Fal", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "\\u", "call_", "(_", "17_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "get", "\\u", "utility_", "._", "gener", "ic", "\\u", "notification_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "441", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "net", "\\u", "connections", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "Process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "zop", "e", ".", "component", ".", "get", "Utili", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "not", "\\u", "listen", "ing_", "(_", "self_", ",_", "mock", "\\u", "get", "\\u", "utility_", ",_", "mock", "\\u", "process_", ",_", "mock", "\\u", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "psutil_", "._", "\\u", "common_", "import_", "scon", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "192", ".1", "68.", "5.1", "0", "\"_", ",_", "327", "83_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\"", "20.", "40.", "60", ".8", "0", "\"_", ",_", "22_", ")_", ",_", "status_", "=_", "\"", "EST", "AB", "LIS", "HED", "\"_", ",_", "pid_", "=_", "1234_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "10_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "5432", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "111_", ")_", ",_", "status_", "=_", "\"", "CLOSE", "\\u", "WAIT", "\"_", ",_", "pid_", "=_", "None_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "net_", "._", "return", "\\u", "value_", "=_", "conns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "name_", "._", "return", "\\u", "value_", "=_", "\"", "inet", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "\\u", "call_", "(_", "17_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "get", "\\u", "utility_", "._", "gener", "ic", "\\u", "notification_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "process_", "._", "call", "\\u", "count_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "net", "\\u", "connections", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "Process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "zop", "e", ".", "component", ".", "get", "Utili", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "listen", "ing", "\\u", "ipv4_", "(_", "self_", ",_", "mock", "\\u", "get", "\\u", "utility_", ",_", "mock", "\\u", "process_", ",_", "mock", "\\u", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "psutil_", "._", "\\u", "common_", "import_", "scon", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "192", ".1", "68.", "5.1", "0", "\"_", ",_", "327", "83_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\"", "20.", "40.", "60", ".8", "0", "\"_", ",_", "22_", ")_", ",_", "status_", "=_", "\"", "EST", "AB", "LIS", "HED", "\"_", ",_", "pid_", "=_", "1234_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "10_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "5432", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "111_", ")_", ",_", "status_", "=_", "\"", "CLOSE", "\\u", "WAIT", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "17_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "441", "6_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "net_", "._", "return", "\\u", "value_", "=_", "conns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "name_", "._", "return", "\\u", "value_", "=_", "\"", "inet", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "\\u", "call_", "(_", "17_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "get", "\\u", "utility_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "441", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "net", "\\u", "connections", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "Process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "zop", "e", ".", "component", ".", "get", "Utili", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "listen", "ing", "\\u", "ipv6_", "(_", "self_", ",_", "mock", "\\u", "get", "\\u", "utility_", ",_", "mock", "\\u", "process_", ",_", "mock", "\\u", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "psutil_", "._", "\\u", "common_", "import_", "scon", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "192", ".1", "68.", "5.1", "0", "\"_", ",_", "327", "83_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\"", "20.", "40.", "60", ".8", "0", "\"_", ",_", "22_", ")_", ",_", "status_", "=_", "\"", "EST", "AB", "LIS", "HED", "\"_", ",_", "pid_", "=_", "1234_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "-_", "1_", ",_", "family_", "=_", "10_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "5432", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", "\":", ":", "1", "\"_", ",_", "111_", ")_", ",_", "status_", "=_", "\"", "CLOSE", "\\u", "WAIT", "\"_", ",_", "pid_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "10_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\":", ":\"_", ",_", "12345_", ")_", ",_", "rad", "dr_", "=_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "442", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scon", "n_", "(_", "fd_", "=_", "3_", ",_", "family_", "=_", "2_", ",_", "type_", "=_", "1_", ",_", "lad", "dr_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "17_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rad", "dr_", "=_", "(_", ")_", ",_", "status_", "=_", "\"", "LISTEN", "\"_", ",_", "pid_", "=_", "441", "6_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "net_", "._", "return", "\\u", "value_", "=_", "conns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "name_", "._", "return", "\\u", "value_", "=_", "\"", "inet", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "\\u", "call_", "(_", "12345_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "get", "\\u", "utility_", "._", "call", "\\u", "count_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "process_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "442", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "read", "y", "Listen", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "cert", "bot", ".", "plugin", "s", ".", "util", ".", "psu", "til", ".", "net", "\\u", "connections", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "access", "\\u", "deni", "ed", "\\u", "exception_", "(_", "self_", ",_", "mock", "\\u", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "net_", "._", "side", "\\u", "effect_", "=_", "psutil_", "._", "Access", "Denied_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "\\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 ]
Except block handles 'BaseException'
twisted/twisted/twisted/python/lockfile.py
[ { "content": " def lock(self):\n \"\"\"\n Acquire this lock.\n\n @rtype: C{bool}\n @return: True if the lock is acquired, false otherwise.\n\n @raise: Any exception os.symlink() may raise, other than\n EEXIST.\n \"\"\"\n clean = True\n while True:\n try:\n symlink(str(os.getpid()), self.name)\n except OSError as e:\n if _windows and e.errno in (errno.EACCES, errno.EIO):\n # The lock is in the middle of being deleted because we're\n # on Windows where lock removal isn't atomic. Give up, we\n # don't know how long this is going to take.\n return False\n if e.errno == errno.EEXIST:\n try:\n pid = readlink(self.name)\n except (IOError, OSError) as e:\n if e.errno == errno.ENOENT:\n # The lock has vanished, try to claim it in the\n # next iteration through the loop.\n continue\n elif _windows and e.errno == errno.EACCES:\n # The lock is in the middle of being\n # deleted because we're on Windows where\n # lock removal isn't atomic. Give up, we\n # don't know how long this is going to\n # take.\n return False\n raise\n try:\n if kill is not None:\n kill(int(pid), 0)\n except OSError as e:\n if e.errno == errno.ESRCH:\n # The owner has vanished, try to claim it in the\n # next iteration through the loop.\n try:\n rmlink(self.name)\n except OSError as e:\n if e.errno == errno.ENOENT:\n # Another process cleaned up the lock.\n # Race them to acquire it in the next\n # iteration through the loop.\n continue\n raise\n clean = False\n continue\n raise\n return False\n raise\n self.locked = True\n self.clean = clean\n return True", "metadata": "root.FilesystemLock.lock", "header": "['class', 'FilesystemLock', '(', 'object', ')', ':', '___EOS___']", "index": 146 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Files", "yste", "m", "Lock_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lock_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Acquire", " ", "this", " ", "lock", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "rty", "pe", ":", " ", "C", "{", "bool", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "return", ":", " ", "Tru", "e", " ", "if", " ", "the", " ", "lock", " ", "is", " ", "acquired", ",", " ", "fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "raise", ":", " ", "Any", " ", "exception", " ", "os", ".", "symlink", "()", " ", "may", " ", "raise", ",", " ", "other", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "EE", "XIST", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symlink_", "(_", "str_", "(_", "os_", "._", "getpid_", "(_", ")_", ")_", ",_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "windows_", "and_", "e_", "._", "errno_", "in_", "(_", "errno_", "._", "EAC", "CES", "_", ",_", "errno_", "._", "EI", "O_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "lock", " ", "is", " ", "in", " ", "the", " ", "middle", " ", "of", " ", "bei", "ng", " ", "delete", "d", " ", "bec", "aus", "e", " ", "we", "'", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "Window", "s", " ", "where", " ", "lock", " ", "removal", " ", "isn", "'", "t", " ", "atomi", "c", ".", " ", " ", "Give", " ", "up", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "know", " ", "how", " ", "long", " ", "this", " ", "is", " ", "goi", "ng", " ", "to", " ", "take", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "EE", "XIST", "_", ":_", "\\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 ", " ", " _", "pid_", "=_", "readli", "nk_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "OSE", "rror_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "ENOENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "lock", " ", "has", " ", "vani", "shed", ",", " ", "try", " ", "to", " ", "claim", " ", "it", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "next", " ", "iterati", "on", " ", "through", " ", "the", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\\u", "windows_", "and_", "e_", "._", "errno_", "==_", "errno_", "._", "EAC", "CES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "lock", " ", "is", " ", "in", " ", "the", " ", "middle", " ", "of", " ", "bei", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", "d", " ", "bec", "aus", "e", " ", "we", "'", "re", " ", "on", " ", "Window", "s", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lock", " ", "removal", " ", "isn", "'", "t", " ", "atomi", "c", ".", " ", " ", "Give", " ", "up", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "know", " ", "how", " ", "long", " ", "this", " ", "is", " ", "goi", "ng", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\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_", "kill_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "kill_", "(_", "int_", "(_", "pid_", ")_", ",_", "0_", ")_", "\\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_", "e_", "._", "errno_", "==_", "errno_", "._", "ESR", "CH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "owner", " ", "has", " ", "vani", "shed", ",", " ", "try", " ", "to", " ", "claim", " ", "it", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "next", " ", "iterati", "on", " ", "through", " ", "the", " ", "loop", "._", "\\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 ", " ", " _", "rm", "link_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "e_", "._", "errno_", "==_", "errno_", "._", "ENOENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ano", "ther", " ", "process", " ", "clean", "ed", " ", "up", " ", "the", " ", "lock", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rac", "e", " ", "them", " ", "to", " ", "acquir", "e", " ", "it", " ", "in", " ", "the", " ", "next_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterati", "on", " ", "through", " ", "the", " ", "loop", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "locked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clean_", "=_", "clean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Constant in conditional expression or statement
Backblaze/B2_Command_Line_Tool/b2/exception.py
[ { "content": "def interpret_b2_error(status, code, message, post_params=None):\n post_params = post_params or {}\n if status == 400 and code == \"already_hidden\":\n return FileAlreadyHidden(post_params['fileName'])\n elif status == 400 and code == 'bad_json':\n return BadJson(message)\n elif status == 400 and code in (\"no_such_file\", \"file_not_present\"):\n # hide_file returns \"no_such_file\"\n # delete_file_version returns \"file_not_present\"\n return FileNotPresent(post_params['fileName'])\n elif status == 400 and code == \"duplicate_bucket_name\":\n return DuplicateBucketName(post_params['bucketName'])\n elif status == 400 and code == \"missing_part\":\n return MissingPart(post_params['fileId'])\n elif status == 400 and code == \"part_sha1_mismatch\":\n return PartSha1Mismatch(post_params['fileId'])\n elif status == 401 and code in (\"bad_auth_token\", \"expired_auth_token\"):\n return InvalidAuthToken(message, code)\n elif status == 403 and code == \"storage_cap_exceeded\":\n return StorageCapExceeded()\n elif status == 429:\n return TooManyRequests()\n elif 500 <= status and status < 600:\n return ServiceError('%d %s %s' % (status, code, message))\n else:\n return UnknownError('%d %s %s' % (status, code, message))", "metadata": "root.interpret_b2_error", "header": "['module', '___EOS___']", "index": 268 } ]
[]
[]
0
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interpret", "\\u", "b2", "\\u", "error_", "(_", "status_", ",_", "code_", ",_", "message_", ",_", "post", "\\u", "params_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "post", "\\u", "params_", "=_", "post", "\\u", "params_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "400_", "and_", "code_", "==_", "\"", "alr", "ead", "y", "\\u", "hidden", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "File", "Al", "read", "y", "Hidden_", "(_", "post", "\\u", "params_", "[_", "'", "file", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "400_", "and_", "code_", "==_", "'", "bad", "\\u", "json", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ba", "d", "Json_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "400_", "and_", "code_", "in_", "(_", "\"", "no", "\\u", "suc", "h", "\\u", "file", "\"_", ",_", "\"", "file", "\\u", "not", "\\u", "presen", "t", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hide", "\\u", "file", " ", "return", "s", " ", "\"", "no", "\\u", "suc", "h", "\\u", "file", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", "\\u", "file", "\\u", "version", " ", "return", "s", " ", "\"", "file", "\\u", "not", "\\u", "presen", "t", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "File", "Not", "Present_", "(_", "post", "\\u", "params_", "[_", "'", "file", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "400_", "and_", "code_", "==_", "\"", "duplicat", "e\\u", "bucket", "\\u", "name", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Duplicate", "Buck", "et", "Name_", "(_", "post", "\\u", "params_", "[_", "'", "bucket", "Name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "400_", "and_", "code_", "==_", "\"", "missi", "ng", "\\u", "part", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Missing", "Part_", "(_", "post", "\\u", "params_", "[_", "'", "file", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "400_", "and_", "code_", "==_", "\"", "part", "\\u", "sha1", "\\u", "mism", "atch", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Part", "Sha", "1", "Mismatch", "_", "(_", "post", "\\u", "params_", "[_", "'", "file", "Id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "401_", "and_", "code_", "in_", "(_", "\"", "bad", "\\u", "auth", "\\u", "token", "\"_", ",_", "\"", "expir", "ed", "\\u", "auth", "\\u", "token", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Inva", "lid", "Auth", "Token_", "(_", "message_", ",_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "403_", "and_", "code_", "==_", "\"", "storage", "\\u", "cap", "\\u", "exceed", "ed", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Stor", "age", "Cap", "Exce", "eded", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status_", "==_", "429", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Too", "Many", "Requests_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "500_", "<=_", "status_", "and_", "status_", "<_", "600_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Service", "Error_", "(_", "'%", "d", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "status_", ",_", "code_", ",_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Un", "know", "n", "Error_", "(_", "'%", "d", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "status_", ",_", "code_", ",_", "message_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 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 ]
Unused import
christabor/MoAL/MOAL/languages/formal_language_theory/grammars/attribute_context_free.py
[ { "content": "# -*- coding: utf-8 -*-\n\n__author__ = \"\"\"Chris Tabor ([email protected])\"\"\"\n\nif __name__ == '__main__':\n from os import getcwd\n from os import sys\n sys.path.append(getcwd())\n\nfrom MOAL.helpers.display import Section\nfrom MOAL.helpers.display import prnt\nfrom MOAL.helpers.text import uniqchars\nfrom MOAL.languages.formal_language_theory.grammars import context_free\nfrom random import randrange as rr\n\n\n\n\nif __name__ == '__main__':\n with Section('Grammar parser - basic'):\n\n attribute_cfg = AttributeContextFreeGrammar()\n rule_templates = [\n 'COMB => ST',\n 'S => S.value $',\n 'T => T.prop $',\n 'X => X.len $',\n 'Z => Z.chars $',\n ]\n map(attribute_cfg.add_rule, rule_templates)\n\n prnt(\n 'Attribute CFG evaluation result',\n attribute_cfg.evaluate(['COMB', 'COMB', 'Z', 'X', 'S', 'T']))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AttributeContextFreeGrammar(context_free.ContextFreeGrammar):\n \"\"\"An ACFG is effectively a CFG that allows attribute properties\n to be embedded in the ruleset for later evaluation -- this is pedestrian\n to any programming language that supports data structures, but it all\n comes from these simple foundations.\n\n For a formal definition and examples, see\n wikipedia.org/wiki/Attribute_grammar\"\"\"\n\n\n\n\n\n\n\n\n", "metadata": "root.AttributeContextFreeGrammar", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self):\n super(AttributeContextFreeGrammar, self).__init__()\n self.attr_token = '.'\n self.terminus = '$' # Terminal identifier\n self.DEBUG = True", "metadata": "root.AttributeContextFreeGrammar.__init__", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 25 }, { "content": " def __getitem__(self, attr):\n if attr == 'prop':\n return self._prop\n elif attr == 'value':\n return self._value\n elif attr == 'len':\n return self._len\n elif attr == 'chars':\n return self._chars\n else:\n return ''", "metadata": "root.AttributeContextFreeGrammar.__getitem__", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 31 }, { "content": " def _len(self, token):\n return 'L:{}'.format(len(token))", "metadata": "root.AttributeContextFreeGrammar._len", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 43 }, { "content": " def _prop(self, token):\n return 'U:{}'.format(token.upper())", "metadata": "root.AttributeContextFreeGrammar._prop", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 46 }, { "content": " def _value(self, token):\n return '(R:{})'.format(rr(len(token), 999))", "metadata": "root.AttributeContextFreeGrammar._value", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 49 }, { "content": " def _chars(self, token):\n return 'U:{}'.format(uniqchars(len(token)))", "metadata": "root.AttributeContextFreeGrammar._chars", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 52 }, { "content": " def _parse_terminal(self, attr, token):\n \"\"\"Parse a terminal value given a attribute and token.\n\n For this example, we won't get too fancy,\n just force a string on all values.\n \"\"\"\n return str(self[attr](token))", "metadata": "root.AttributeContextFreeGrammar._parse_terminal", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _attr(self, semantic_rule):\n \"\"\"Get the attribute name from the semantic rule.\n It comes in as a list of [object, attribute]\"\"\"\n return semantic_rule.replace(\n self.terminus, '').replace(' ', '').split(self.attr_token)[1]", "metadata": "root.AttributeContextFreeGrammar._attr", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 63 }, { "content": " def evaluate(self, tokens, evaluation=''):\n \"\"\"A basic parser for a custom attribute grammar.\n\n One thing to note is that ambiguous grammars need to be iterated over,\n since the duplicate rules can't be mapped via dictionary key.\n Unambiguous grammars are therefore more performant,\n because the lookup is O(1) vs. O(N).\n \"\"\"\n if self.DEBUG:\n prnt('Ruleset', self.rules)\n print('\\nEvaluating tokens: {}'.format(tokens))\n for token in tokens:\n for rule in self.rules:\n # Expressions are already parsed when adding: (L => R = [L, R])\n left, right = rule\n print('Current rule = {} => {}'.format(left, right))\n if token == left:\n is_attr = self.attr_token in right\n is_terminal = right.endswith(self.terminus)\n if is_attr and is_terminal:\n print('\\nEvaluating terminal: `{}`'.format(token))\n evaluation += self._parse_terminal(\n self._attr(right), token)\n else:\n non_terms = list(right)\n print('\\nEvaluating non-terminal {}'.format(non_terms))\n evaluation += self.evaluate(\n non_terms, evaluation=evaluation)\n return evaluation", "metadata": "root.AttributeContextFreeGrammar.evaluate", "header": "['class', 'AttributeContextFreeGrammar', '(', 'context_free', '.', 'ContextFreeGrammar', ')', ':', '___EOS___']", "index": 69 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"\"\"", "Chr", "is", " ", "Tab", "or", " ", "(", "dx", "dst", "udio", "@", "gma", "il", ".", "com", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "os_", "import_", "getcwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "display_", "import_", "Section_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "display_", "import_", "prn", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "text_", "import_", "uniq", "chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MO", "AL_", "._", "languages_", "._", "formal", "\\u", "language", "\\u", "theory", "_", "._", "grammar", "s_", "import_", "context", "\\u", "free_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "randrange_", "as_", "rr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "Section_", "(_", "'", "Gram", "mar", " ", "parser", " ", "-", " ", "basic", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attribute", "\\u", "cfg_", "=_", "Attribute", "Context", "Free", "Grammar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "templates_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COM", "B", " ", "=>", " ", "ST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "S", " ", "=>", " ", "S", ".", "value", " ", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "T", " ", "=>", " ", "T", ".", "prop", " ", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "X", " ", "=>", " ", "X", ".", "len", " ", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Z", " ", "=>", " ", "Z", ".", "char", "s", " ", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "(_", "attribute", "\\u", "cfg_", "._", "add", "\\u", "rule_", ",_", "rule", "\\u", "templates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prn", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Attribute", " ", "CF", "G", " ", "evaluat", "ion", " ", "result", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attribute", "\\u", "cfg_", "._", "evaluate_", "(_", "[_", "'", "COM", "B", "'_", ",_", "'", "COM", "B", "'_", ",_", "'", "Z", "'_", ",_", "'", "X", "'_", ",_", "'", "S", "'_", ",_", "'", "T", "'_", "]_", ")_", ")_", "\\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_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "AC", "FG", " ", "is", " ", "effective", "ly", " ", "a", " ", "CF", "G", " ", "tha", "t", " ", "allow", "s", " ", "attribute", " ", "proper", "ties", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "embedde", "d", " ", "in", " ", "the", " ", "ruleset", " ", "for", " ", "late", "r", " ", "evaluat", "ion", " ", "--", " ", "this", " ", "is", " ", "ped", "estr", "ian", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "any", " ", "program", "ming", " ", "language", " ", "tha", "t", " ", "support", "s", " ", "data", " ", "structure", "s", ",", " ", "but", " ", "it", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "come", "s", " ", "from", " ", "these", " ", "simple", " ", "foundation", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "a", " ", "formal", " ", "definit", "ion", " ", "and", " ", "example", "s", ",", " ", "see", "\\", "10", ";", " ", " ", " ", " ", "wikip", "edia", ".", "org", "/", "wiki", "/", "Attribute", "\\u", "grammar", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Attribute", "Context", "Free", "Grammar_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "attr", "\\u", "token_", "=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "termin", "us_", "=_", "'$'_", "#", " ", "Termin", "al", " ", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "==_", "'", "prop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "==_", "'", "value", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "==_", "'", "len", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "attr_", "==_", "'", "char", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "chars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\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", "len_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "L", ":{}'_", "._", "format_", "(_", "len_", "(_", "token_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "prop_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "U", ":{}'_", "._", "format_", "(_", "token_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "value_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'(", "R", ":{}", ")'_", "._", "format_", "(_", "rr_", "(_", "len_", "(_", "token_", ")_", ",_", "999_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "chars_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "U", ":{}'_", "._", "format_", "(_", "uniq", "chars_", "(_", "len_", "(_", "token_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "terminal_", "(_", "self_", ",_", "attr_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "a", " ", "termina", "l", " ", "value", " ", "give", "n", " ", "a", " ", "attribute", " ", "and", " ", "token", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "this", " ", "example", ",", " ", "we", " ", "won", "'", "t", " ", "get", " ", "too", " ", "fancy", ",", "\\", "10", ";", " ", " ", " ", " ", "just", " ", "force", " ", "a", " ", "string", " ", "on", " ", "all", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "(_", "self_", "[_", "attr_", "]_", "(_", "token_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "attr_", "(_", "self_", ",_", "sema", "ntic", "\\u", "rule_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "attribute", " ", "name", " ", "from", " ", "the", " ", "sema", "ntic", " ", "rule", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "come", "s", " ", "in", " ", "as", " ", "a", " ", "list", " ", "of", " ", "[", "object", ",", " ", "attribute", "]\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sema", "ntic", "\\u", "rule_", "._", "replace_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "termin", "us_", ",_", "''_", ")_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "._", "split_", "(_", "self_", "._", "attr", "\\u", "token_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Context", "Free", "Grammar_", "(_", "context", "\\u", "free_", "._", "Context", "Free", "Grammar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "evaluate_", "(_", "self_", ",_", "tokens_", ",_", "evaluation_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "basic", " ", "parser", " ", "for", " ", "a", " ", "custom", " ", "attribute", " ", "grammar", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "One", " ", "thing", " ", "to", " ", "note", " ", "is", " ", "tha", "t", " ", "ambiguous", " ", "grammar", "s", " ", "need", " ", "to", " ", "be", " ", "iterate", "d", " ", "over", ",", "\\", "10", ";", " ", " ", " ", " ", "sinc", "e", " ", "the", " ", "duplicat", "e", " ", "rule", "s", " ", "can", "'", "t", " ", "be", " ", "mapp", "ed", " ", "via", " ", "dictionar", "y", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "Una", "mbi", "guous", " ", "grammar", "s", " ", "are", " ", "there", "fore", " ", "more", " ", "perform", "ant", ",", "\\", "10", ";", " ", " ", " ", " ", "bec", "aus", "e", " ", "the", " ", "look", "up", " ", "is", " ", "O", "(", "1", ")", " ", "vs", ".", " ", "O", "(", "N", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prn", "t_", "(_", "'", "Rule", "set", "'_", ",_", "self_", "._", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Evaluati", "ng", " ", "token", "s", ":", " ", "{}'_", "._", "format_", "(_", "tokens_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "token_", "in_", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rule_", "in_", "self_", "._", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Expression", "s", " ", "are", " ", "alr", "ead", "y", " ", "parsed", " ", "whe", "n", " ", "addin", "g", ":", " ", "(", "L", " ", "=>", " ", "R", " ", "=", " ", "[", "L", ",", " ", "R", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Curr", "ent", " ", "rule", " ", "=", " ", "{}", " ", "=>", " ", "{}'_", "._", "format_", "(_", "left_", ",_", "right_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "token_", "==_", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "attr_", "=_", "self_", "._", "attr", "\\u", "token_", "in_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "terminal_", "=_", "right_", "._", "endswith_", "(_", "self_", "._", "termin", "us_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "attr_", "and_", "is", "\\u", "terminal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "(_", "'\\\\", "n", "Evaluati", "ng", " ", "termina", "l", ":", " ", "`{}`", "'_", "._", "format_", "(_", "token_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "evaluation_", "+=_", "self_", "._", "\\u", "parse", "\\u", "terminal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "attr_", "(_", "right_", ")_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "non", "\\u", "terms_", "=_", "list_", "(_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'\\\\", "n", "Evaluati", "ng", " ", "non", "-", "termina", "l", " ", "{}'_", "._", "format_", "(_", "non", "\\u", "terms_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "evaluation_", "+=_", "self_", "._", "evaluate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "terms_", ",_", "evaluation_", "=_", "evaluation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "evaluation_", "\\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, 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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 ]
Variable defined multiple times
puentesarrin/asyncflux/tests/user_test.py
[ { "content": " @gen_test\n def test_change_privileges(self):\n client = AsyncfluxClient()\n db_name = 'foo'\n db = client[db_name]\n username = 'foo'\n user = User(db, username)\n is_admin = True\n read_from = '^$'\n write_to = '^$'\n\n # Update permissions\n payload = {'isAdmin': is_admin, 'readFrom': read_from,\n 'writeTo': write_to}\n with self.patch_fetch_mock(client) as m:\n self.setup_fetch_mock(m, 200)\n response = yield user.change_privileges(is_admin,\n read_from=read_from,\n write_to=write_to)\n self.assertIsNone(response)\n self.assertEqual(user.is_admin, is_admin)\n self.assertEqual(user.read_from, read_from)\n self.assertEqual(user.write_to, write_to)\n\n self.assert_mock_args(m, '/db/%s/users/%s' % (db_name, username),\n method='POST', body=json.dumps(payload))\n\n payload = {'isAdmin': is_admin}\n with self.patch_fetch_mock(client) as m:\n self.setup_fetch_mock(m, 200)\n yield user.change_privileges(is_admin, None, None)\n self.assertIsNone(response)\n self.assertEqual(user.is_admin, is_admin)\n\n self.assert_mock_args(m, '/db/%s/users/%s' % (db_name, username),\n method='POST', body=json.dumps(payload))\n\n # Non-existing user\n payload = {'isAdmin': is_admin, 'readFrom': read_from,\n 'writeTo': write_to}\n response_body = \"Invalid username %s\" % username\n with self.patch_fetch_mock(client) as m:\n self.setup_fetch_mock(m, 400, body=response_body)\n with self.assertRaisesRegexp(AsyncfluxError, response_body):\n yield user.change_privileges(is_admin, read_from=read_from,\n write_to=write_to)\n self.assert_mock_args(m, '/db/%s/users/%s' % (db_name, username),\n method='POST', body=json.dumps(payload))\n\n # Invalid permission argument values\n exc_msg = 'You have to provide read and write permissions'\n with self.assertRaisesRegexp(ValueError, exc_msg):\n yield user.change_privileges(is_admin, read_from, None)\n\n with self.assertRaisesRegexp(ValueError, exc_msg):\n yield user.change_privileges(is_admin, None, write_to)", "metadata": "root.UserTestCase.test_change_privileges", "header": "['class', 'UserTestCase', '(', 'AsyncfluxTestCase', ')', ':', '___EOS___']", "index": 109 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "User", "Test", "Case_", "(_", "Async", "flux", "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_", "@_", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "change", "\\u", "privilege", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "Async", "flux", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "name_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "client_", "[_", "db", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "User_", "(_", "db_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "admin_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "from_", "=_", "'", "^", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "to_", "=_", "'", "^", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "permissions_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "{_", "'", "is", "Admi", "n", "'_", ":_", "is", "\\u", "admin_", ",_", "'", "read", "Fro", "m", "'_", ":_", "read", "\\u", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "To", "'_", ":_", "write", "\\u", "to_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "patch", "\\u", "fetch", "\\u", "mock_", "(_", "client_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "\\u", "fetch", "\\u", "mock_", "(_", "m_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "user_", "._", "change", "\\u", "privilege", "s_", "(_", "is", "\\u", "admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "from_", "=_", "read", "\\u", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "to_", "=_", "write", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user_", "._", "is", "\\u", "admin_", ",_", "is", "\\u", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user_", "._", "read", "\\u", "from_", ",_", "read", "\\u", "from_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user_", "._", "write", "\\u", "to_", ",_", "write", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "\\u", "mock", "\\u", "args_", "(_", "m_", ",_", "'/", "db", "/", "%", "s", "/", "users", "/", "%", "s", "'_", "%_", "(_", "db", "\\u", "name_", ",_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "payload_", "=_", "{_", "'", "is", "Admi", "n", "'_", ":_", "is", "\\u", "admin_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "patch", "\\u", "fetch", "\\u", "mock_", "(_", "client_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "\\u", "fetch", "\\u", "mock_", "(_", "m_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "user_", "._", "change", "\\u", "privilege", "s_", "(_", "is", "\\u", "admin_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user_", "._", "is", "\\u", "admin_", ",_", "is", "\\u", "admin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "\\u", "mock", "\\u", "args_", "(_", "m_", ",_", "'/", "db", "/", "%", "s", "/", "users", "/", "%", "s", "'_", "%_", "(_", "db", "\\u", "name_", ",_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Non", "-", "exist", "ing", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "payload_", "=_", "{_", "'", "is", "Admi", "n", "'_", ":_", "is", "\\u", "admin_", ",_", "'", "read", "Fro", "m", "'_", ":_", "read", "\\u", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "write", "To", "'_", ":_", "write", "\\u", "to_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "body_", "=_", "\"", "Inva", "lid", " ", "user", "name", " ", "%", "s", "\"_", "%_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "patch", "\\u", "fetch", "\\u", "mock_", "(_", "client_", ")_", "as_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup", "\\u", "fetch", "\\u", "mock_", "(_", "m_", ",_", "400_", ",_", "body_", "=_", "response", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "Async", "flux", "Error_", ",_", "response", "\\u", "body_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "user_", "._", "change", "\\u", "privilege", "s_", "(_", "is", "\\u", "admin_", ",_", "read", "\\u", "from_", "=_", "read", "\\u", "from_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "to_", "=_", "write", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "\\u", "mock", "\\u", "args_", "(_", "m_", ",_", "'/", "db", "/", "%", "s", "/", "users", "/", "%", "s", "'_", "%_", "(_", "db", "\\u", "name_", ",_", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "'", "POST", "'_", ",_", "body_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "permissi", "on", " ", "argu", "ment", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exc", "\\u", "msg_", "=_", "'", "You", " ", "have", " ", "to", " ", "provide", " ", "read", " ", "and", " ", "write", " ", "permissi", "ons", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "Value", "Error_", ",_", "exc", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "user_", "._", "change", "\\u", "privilege", "s_", "(_", "is", "\\u", "admin_", ",_", "read", "\\u", "from_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "Value", "Error_", ",_", "exc", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "user_", "._", "change", "\\u", "privilege", "s_", "(_", "is", "\\u", "admin_", ",_", "None_", ",_", "write", "\\u", "to_", ")_", "\\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,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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 ]
Imprecise assert
bloomberg/phabricator-tools/py/abd/abdt_differ__t.py
[ { "content": " def test_B_ReduceSmallChangeOnLargeFile(self):\n with phlgitu_fixture.lone_worker_context() as worker:\n\n # make a large file to base our changes on\n large_content = \"lorem ipsum\\n\" * 1000\n worker.commit_new_file(\n \"add large_file\", \"large_file\", large_content)\n\n worker.append_to_file_on_new_branch(\n \"diff_branch\", \"make small diff\", \"large_file\", \"test content\")\n\n def make_diff(max_bytes):\n return abdt_differ.make_raw_diff(\n worker.repo, \"master\", \"diff_branch\", max_bytes)\n\n # establish a baseline size for the diff\n diff_result = make_diff(100000)\n self.assertIn(\"test content\", diff_result.diff)\n original_diff_size = len(diff_result.diff)\n\n # [ B] a diff outside the limits can be reduced ok with less\n # context\n diff_result = make_diff(2000)\n self.assertIn(\"test content\", diff_result.diff)\n reduced_context_diff_size = len(diff_result.diff)\n self.assertTrue(\n any(\n isinstance(r, abdt_differ.LessContextReduction)\n for r in diff_result.reduction_list))\n self.assertLess(\n reduced_context_diff_size,\n original_diff_size)\n\n # [ B] a diff still outside the limits can be reduced ok with no\n # context\n diff_result = make_diff(500)\n self.assertIn(\"test content\", diff_result.diff)\n no_context_diff_size = len(diff_result.diff)\n self.assertTrue(\n any(\n isinstance(r, abdt_differ.RemoveContextReduction)\n for r in diff_result.reduction_list))\n self.assertLess(\n no_context_diff_size,\n reduced_context_diff_size)", "metadata": "root.Test.test_B_ReduceSmallChangeOnLargeFile", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_C_ReduceAddMassiveFile(self):\n with phlgitu_fixture.lone_worker_context() as worker:\n\n # make a large file to base our changes on\n large_content = \"lorem ipsum\\n\" * 1000\n worker.commit_new_file_on_new_branch(\n \"diff_branch\", \"add large_file\", \"large_file\", large_content)\n\n def make_diff(max_bytes):\n return abdt_differ.make_raw_diff(\n worker.repo, \"master\", \"diff_branch\", max_bytes)\n\n # establish a baseline size for the diff\n diff_result = make_diff(100000)\n self.assertIn(\"lorem ipsum\", diff_result.diff)\n original_diff_size = len(diff_result.diff)\n\n # [ C] a diff still outside the limits can be reduced\n # to the diffstat\n diff_result = make_diff(500)\n self.assertNotIn(\"lorem ipsum\", diff_result.diff)\n diffstat_diff_size = len(diff_result.diff)\n self.assertTrue(\n any(\n isinstance(r, abdt_differ.DiffStatReduction)\n for r in diff_result.reduction_list))\n self.assertLess(\n diffstat_diff_size,\n original_diff_size)", "metadata": "root.Test.test_C_ReduceAddMassiveFile", "header": "['class', 'Test', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "B", "\\u", "Reduce", "Small", "Change", "On", "Large", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "ph", "lg", "itu", "\\u", "fixture_", "._", "lone", "\\u", "worker", "\\u", "context_", "(_", ")_", "as_", "worker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "large", " ", "file", " ", "to", " ", "base", " ", "our", " ", "change", "s", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "large", "\\u", "content_", "=_", "\"", "lore", "m", " ", "ips", "um", "\\\\", "n", "\"_", "*_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker_", "._", "commit", "\\u", "new", "\\u", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", " ", "large", "\\u", "file", "\"_", ",_", "\"", "large", "\\u", "file", "\"_", ",_", "large", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worker_", "._", "append", "\\u", "to", "\\u", "file", "\\u", "on", "\\u", "new", "\\u", "branch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "diff", "\\u", "branch", "\"_", ",_", "\"", "make", " ", "small", " ", "diff", "\"_", ",_", "\"", "large", "\\u", "file", "\"_", ",_", "\"", "test", " ", "content", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "diff_", "(_", "max", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "abd", "t", "\\u", "differ", "_", "._", "make", "\\u", "raw", "\\u", "diff_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "worker_", "._", "repo_", ",_", "\"", "master", "\"_", ",_", "\"", "diff", "\\u", "branch", "\"_", ",_", "max", "\\u", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "establish", " ", "a", " ", "baseline", " ", "size", " ", "for", " ", "the", " ", "diff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "result_", "=_", "make", "\\u", "diff_", "(_", "100000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "test", " ", "content", "\"_", ",_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "diff", "\\u", "size_", "=_", "len_", "(_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", " ", "B", "]", " ", "a", " ", "diff", " ", "outsi", "de", " ", "the", " ", "limit", "s", " ", "can", " ", "be", " ", "reduce", "d", " ", "ok", " ", "with", " ", "less_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "result_", "=_", "make", "\\u", "diff_", "(_", "2000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "test", " ", "content", "\"_", ",_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reduce", "d\\u", "context", "\\u", "diff", "\\u", "size_", "=_", "len_", "(_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "r_", ",_", "abd", "t", "\\u", "differ", "_", "._", "Less", "Context", "Redu", "ction_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "diff", "\\u", "result_", "._", "reduc", "tion", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Less_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reduce", "d\\u", "context", "\\u", "diff", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "original", "\\u", "diff", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", " ", "B", "]", " ", "a", " ", "diff", " ", "still", " ", "outsi", "de", " ", "the", " ", "limit", "s", " ", "can", " ", "be", " ", "reduce", "d", " ", "ok", " ", "with", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "result_", "=_", "make", "\\u", "diff_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "test", " ", "content", "\"_", ",_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "context", "\\u", "diff", "\\u", "size_", "=_", "len_", "(_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "r_", ",_", "abd", "t", "\\u", "differ", "_", "._", "Remove", "Context", "Redu", "ction_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "diff", "\\u", "result_", "._", "reduc", "tion", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Less_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "context", "\\u", "diff", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reduce", "d\\u", "context", "\\u", "diff", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "C", "\\u", "Reduce", "Add", "Mass", "ive", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "ph", "lg", "itu", "\\u", "fixture_", "._", "lone", "\\u", "worker", "\\u", "context_", "(_", ")_", "as_", "worker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "large", " ", "file", " ", "to", " ", "base", " ", "our", " ", "change", "s", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "large", "\\u", "content_", "=_", "\"", "lore", "m", " ", "ips", "um", "\\\\", "n", "\"_", "*_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "worker_", "._", "commit", "\\u", "new", "\\u", "file", "\\u", "on", "\\u", "new", "\\u", "branch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "diff", "\\u", "branch", "\"_", ",_", "\"", "add", " ", "large", "\\u", "file", "\"_", ",_", "\"", "large", "\\u", "file", "\"_", ",_", "large", "\\u", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "diff_", "(_", "max", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "abd", "t", "\\u", "differ", "_", "._", "make", "\\u", "raw", "\\u", "diff_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "worker_", "._", "repo_", ",_", "\"", "master", "\"_", ",_", "\"", "diff", "\\u", "branch", "\"_", ",_", "max", "\\u", "bytes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "establish", " ", "a", " ", "baseline", " ", "size", " ", "for", " ", "the", " ", "diff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "diff", "\\u", "result_", "=_", "make", "\\u", "diff_", "(_", "100000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "\"", "lore", "m", " ", "ips", "um", "\"_", ",_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "diff", "\\u", "size_", "=_", "len_", "(_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "[", " ", "C", "]", " ", "a", " ", "diff", " ", "still", " ", "outsi", "de", " ", "the", " ", "limit", "s", " ", "can", " ", "be", " ", "reduced_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "to", " ", "the", " ", "diffs", "tat_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "result_", "=_", "make", "\\u", "diff_", "(_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\"", "lore", "m", " ", "ips", "um", "\"_", ",_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "diffs", "tat", "\\u", "diff", "\\u", "size_", "=_", "len_", "(_", "diff", "\\u", "result_", "._", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "r_", ",_", "abd", "t", "\\u", "differ", "_", "._", "Diff", "Stat", "Redu", "ction_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "diff", "\\u", "result_", "._", "reduc", "tion", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Less_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "diffs", "tat", "\\u", "diff", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "original", "\\u", "diff", "\\u", "size_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ryanmcgrath/twython/tests/test_endpoints.py
[ { "content": " @unittest.skip('skipping non-updated test')\n def test_verify_credentials(self):\n \"\"\"Test representation of the authenticated user call succeeds\"\"\"\n self.api.verify_credentials()", "metadata": "root.TwythonEndpointsTestCase.test_verify_credentials", "header": "['class', 'TwythonEndpointsTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 219 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tw", "yth", "on", "Endpoints", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "unittest_", "._", "skip_", "(_", "'", "skip", "ping", " ", "non", "-", "update", "d", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "verify", "\\u", "credentials_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "represent", "ation", " ", "of", " ", "the", " ", "authenticat", "ed", " ", "user", " ", "call", " ", "succeeds", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "api_", "._", "verify", "\\u", "credentials_", "(_", ")_", "\\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 ]
Unused local variable
WatchPeopleCode/WatchPeopleCode/wpc/forms.py
[ { "content": "class DashboardAddVideoForm(Form):\n link = StringField(\"YouTube link\", [validators.DataRequired()])\n submit_button = SubmitField('Add video to the archive')\n", "metadata": "root.DashboardAddVideoForm", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def validate_link(form, field):\n ytid = youtube_video_id(field.data)\n if not ytid:\n raise ValidationError(\"Invalid YouTube URL\")\n\n existing_stream = YoutubeStream.query.filter_by(ytid=ytid).first()\n if existing_stream and existing_stream.streamer:\n raise ValidationError(\"This video is already added by {}\".format(existing_stream.streamer.reddit_username))", "metadata": "root.DashboardAddVideoForm.validate_link", "header": "['class', 'DashboardAddVideoForm', '(', 'Form', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dash", "board", "Add", "Vid", "eo", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link_", "=_", "String", "Field_", "(_", "\"", "You", "Tu", "be", " ", "link", "\"_", ",_", "[_", "validators_", "._", "Data", "Required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "submit", "\\u", "button_", "=_", "Submit", "Field_", "(_", "'", "Add", " ", "video", " ", "to", " ", "the", " ", "archive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dash", "board", "Add", "Vid", "eo", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "link_", "(_", "form_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yti", "d_", "=_", "youtu", "be", "\\u", "video", "\\u", "id_", "(_", "field_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yti", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\"", "Inva", "lid", " ", "You", "Tu", "be", " ", "URL", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exist", "ing", "\\u", "stream_", "=_", "You", "tube", "Stream_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "yti", "d_", "=_", "yti", "d_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exist", "ing", "\\u", "stream_", "and_", "exist", "ing", "\\u", "stream_", "._", "streamer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\"", "Thi", "s", " ", "video", " ", "is", " ", "alr", "ead", "y", " ", "adde", "d", " ", "by", " ", "{}\"_", "._", "format_", "(_", "exist", "ing", "\\u", "stream_", "._", "streamer", "_", "._", "reddit", "\\u", "username_", ")_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openstack/rally/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py
[ { "content": "# Copyright 2014: Mirantis Inc.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport mock\nfrom oslo_config import cfg\nfrom oslo_utils import uuidutils\nfrom saharaclient.api import base as sahara_base\n\nfrom rally import consts\nfrom rally import exceptions\nfrom rally.plugins.openstack.scenarios.sahara import utils\nfrom tests.unit import test\n\nCONF = cfg.CONF\n\nSAHARA_UTILS = \"rally.plugins.openstack.scenarios.sahara.utils\"\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SaharaScenarioTestCase(test.ScenarioTestCase):\n # NOTE(stpierre): the Sahara utils generally do funny stuff with\n # wait_for() calls -- frequently the the is_ready and\n # update_resource arguments are functions defined in the Sahara\n # utils themselves instead of the more standard resource_is() and\n # get_from_manager() calls. As a result, the tests below do more\n # integrated/functional testing of wait_for() calls, and we can't\n # just mock out wait_for and friends the way we usually do.\n patch_benchmark_utils = False\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SaharaScenarioTestCase", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def setUp(self):\n super(SaharaScenarioTestCase, self).setUp()\n\n CONF.set_override(\"sahara_cluster_check_interval\", 0, \"benchmark\",\n enforce_type=True)\n CONF.set_override(\"sahara_job_check_interval\", 0, \"benchmark\",\n enforce_type=True)", "metadata": "root.SaharaScenarioTestCase.setUp", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 40 }, { "content": " def test_list_node_group_templates(self):\n ngts = []\n self.clients(\"sahara\").node_group_templates.list.return_value = ngts\n\n scenario = utils.SaharaScenario(self.context)\n return_ngts_list = scenario._list_node_group_templates()\n\n self.assertEqual(ngts, return_ngts_list)\n self._test_atomic_action_timer(scenario.atomic_actions(),\n \"sahara.list_node_group_templates\")", "metadata": "root.SaharaScenarioTestCase.test_list_node_group_templates", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 48 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"random_name\")\n @mock.patch(SAHARA_UTILS + \".sahara_consts\")\n def test_create_node_group_templates(\n self, mock_sahara_consts,\n mock_generate_random_name):\n\n scenario = utils.SaharaScenario(self.context)\n mock_processes = {\n \"test_plugin\": {\n \"test_version\": {\n \"master\": [\"p1\"],\n \"worker\": [\"p2\"]\n }\n }\n }\n\n mock_sahara_consts.NODE_PROCESSES = mock_processes\n\n scenario._create_master_node_group_template(\n flavor_id=\"test_flavor\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\"\n )\n scenario._create_worker_node_group_template(\n flavor_id=\"test_flavor\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\"\n )\n\n create_calls = [\n mock.call(\n name=\"random_name\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n flavor_id=\"test_flavor\",\n node_processes=[\"p1\"]),\n mock.call(\n name=\"random_name\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n flavor_id=\"test_flavor\",\n node_processes=[\"p2\"]\n )]\n self.clients(\"sahara\").node_group_templates.create.assert_has_calls(\n create_calls)\n\n self._test_atomic_action_timer(\n scenario.atomic_actions(),\n \"sahara.create_master_node_group_template\")\n self._test_atomic_action_timer(\n scenario.atomic_actions(),\n \"sahara.create_worker_node_group_template\")", "metadata": "root.SaharaScenarioTestCase.test_create_node_group_templates", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 59 }, { "content": " def test_delete_node_group_templates(self):\n scenario = utils.SaharaScenario(self.context)\n ng = mock.MagicMock(id=42)\n\n scenario._delete_node_group_template(ng)\n\n delete_mock = self.clients(\"sahara\").node_group_templates.delete\n delete_mock.assert_called_once_with(42)\n\n self._test_atomic_action_timer(scenario.atomic_actions(),\n \"sahara.delete_node_group_template\")", "metadata": "root.SaharaScenarioTestCase.test_delete_node_group_templates", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 113 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"random_name\")\n @mock.patch(SAHARA_UTILS + \".sahara_consts\")\n def test_launch_cluster(self, mock_sahara_consts,\n mock_generate_random_name):\n\n self.context.update({\n \"tenant\": {\n \"networks\": [\n {\n \"id\": \"test_neutron_id\",\n \"router_id\": \"test_router_id\"\n }\n ]\n }\n })\n\n self.clients(\"services\").values.return_value = [\n consts.Service.NEUTRON\n ]\n\n scenario = utils.SaharaScenario(context=self.context)\n\n mock_processes = {\n \"test_plugin\": {\n \"test_version\": {\n \"master\": [\"p1\"],\n \"worker\": [\"p2\"]\n }\n }\n }\n\n mock_configs = {\n \"test_plugin\": {\n \"test_version\": {\n \"target\": \"HDFS\",\n \"config_name\": \"dfs.replication\"\n }\n }\n }\n\n floating_ip_pool_uuid = uuidutils.generate_uuid()\n node_groups = [\n {\n \"name\": \"master-ng\",\n \"flavor_id\": \"test_flavor_m\",\n \"node_processes\": [\"p1\"],\n \"floating_ip_pool\": floating_ip_pool_uuid,\n \"count\": 1,\n \"auto_security_group\": True,\n \"security_groups\": [\"g1\", \"g2\"],\n \"node_configs\": {\"HDFS\": {\"local_config\": \"local_value\"}},\n }, {\n \"name\": \"worker-ng\",\n \"flavor_id\": \"test_flavor_w\",\n \"node_processes\": [\"p2\"],\n \"floating_ip_pool\": floating_ip_pool_uuid,\n \"volumes_per_node\": 5,\n \"volumes_size\": 10,\n \"count\": 42,\n \"auto_security_group\": True,\n \"security_groups\": [\"g1\", \"g2\"],\n \"node_configs\": {\"HDFS\": {\"local_config\": \"local_value\"}},\n }\n ]\n\n mock_sahara_consts.NODE_PROCESSES = mock_processes\n mock_sahara_consts.REPLICATION_CONFIGS = mock_configs\n\n self.clients(\"sahara\").clusters.create.return_value.id = (\n \"test_cluster_id\")\n\n self.clients(\"sahara\").clusters.get.return_value.status = (\n \"active\")\n\n scenario._launch_cluster(\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n master_flavor_id=\"test_flavor_m\",\n worker_flavor_id=\"test_flavor_w\",\n image_id=\"test_image\",\n floating_ip_pool=floating_ip_pool_uuid,\n volumes_per_node=5,\n volumes_size=10,\n auto_security_group=True,\n security_groups=[\"g1\", \"g2\"],\n workers_count=42,\n node_configs={\"HDFS\": {\"local_config\": \"local_value\"}}\n )\n\n self.clients(\"sahara\").clusters.create.assert_called_once_with(\n name=\"random_name\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n node_groups=node_groups,\n default_image_id=\"test_image\",\n cluster_configs={\"HDFS\": {\"dfs.replication\": 3}},\n net_id=\"test_neutron_id\",\n anti_affinity=None\n )\n\n self._test_atomic_action_timer(scenario.atomic_actions(),\n \"sahara.launch_cluster\")", "metadata": "root.SaharaScenarioTestCase.test_launch_cluster", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 125 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"random_name\")\n @mock.patch(SAHARA_UTILS + \".sahara_consts\")\n def test_launch_cluster_with_proxy(self, mock_sahara_consts,\n mock_generate_random_name):\n\n context = {\n \"tenant\": {\n \"networks\": [\n {\n \"id\": \"test_neutron_id\",\n \"router_id\": \"test_router_id\"\n }\n ]\n }\n }\n\n self.clients(\"services\").values.return_value = [\n consts.Service.NEUTRON\n ]\n\n scenario = utils.SaharaScenario(context=context)\n\n mock_processes = {\n \"test_plugin\": {\n \"test_version\": {\n \"master\": [\"p1\"],\n \"worker\": [\"p2\"]\n }\n }\n }\n\n mock_configs = {\n \"test_plugin\": {\n \"test_version\": {\n \"target\": \"HDFS\",\n \"config_name\": \"dfs.replication\"\n }\n }\n }\n\n floating_ip_pool_uuid = uuidutils.generate_uuid()\n node_groups = [\n {\n \"name\": \"master-ng\",\n \"flavor_id\": \"test_flavor_m\",\n \"node_processes\": [\"p1\"],\n \"floating_ip_pool\": floating_ip_pool_uuid,\n \"count\": 1,\n \"auto_security_group\": True,\n \"security_groups\": [\"g1\", \"g2\"],\n \"node_configs\": {\"HDFS\": {\"local_config\": \"local_value\"}},\n \"is_proxy_gateway\": True\n }, {\n \"name\": \"worker-ng\",\n \"flavor_id\": \"test_flavor_w\",\n \"node_processes\": [\"p2\"],\n \"volumes_per_node\": 5,\n \"volumes_size\": 10,\n \"count\": 40,\n \"auto_security_group\": True,\n \"security_groups\": [\"g1\", \"g2\"],\n \"node_configs\": {\"HDFS\": {\"local_config\": \"local_value\"}},\n }, {\n \"name\": \"proxy-ng\",\n \"flavor_id\": \"test_flavor_w\",\n \"node_processes\": [\"p2\"],\n \"floating_ip_pool\": floating_ip_pool_uuid,\n \"volumes_per_node\": 5,\n \"volumes_size\": 10,\n \"count\": 2,\n \"auto_security_group\": True,\n \"security_groups\": [\"g1\", \"g2\"],\n \"node_configs\": {\"HDFS\": {\"local_config\": \"local_value\"}},\n \"is_proxy_gateway\": True\n }\n ]\n\n mock_sahara_consts.NODE_PROCESSES = mock_processes\n mock_sahara_consts.REPLICATION_CONFIGS = mock_configs\n\n self.clients(\"sahara\").clusters.create.return_value = mock.MagicMock(\n id=\"test_cluster_id\")\n\n self.clients(\"sahara\").clusters.get.return_value = mock.MagicMock(\n status=\"active\")\n\n scenario._launch_cluster(\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n master_flavor_id=\"test_flavor_m\",\n worker_flavor_id=\"test_flavor_w\",\n image_id=\"test_image\",\n floating_ip_pool=floating_ip_pool_uuid,\n volumes_per_node=5,\n volumes_size=10,\n auto_security_group=True,\n security_groups=[\"g1\", \"g2\"],\n workers_count=42,\n node_configs={\"HDFS\": {\"local_config\": \"local_value\"}},\n enable_proxy=True\n )\n\n self.clients(\"sahara\").clusters.create.assert_called_once_with(\n name=\"random_name\",\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n node_groups=node_groups,\n default_image_id=\"test_image\",\n cluster_configs={\"HDFS\": {\"dfs.replication\": 3}},\n net_id=\"test_neutron_id\",\n anti_affinity=None\n )\n\n self._test_atomic_action_timer(scenario.atomic_actions(),\n \"sahara.launch_cluster\")", "metadata": "root.SaharaScenarioTestCase.test_launch_cluster_with_proxy", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 229 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"random_name\")\n @mock.patch(SAHARA_UTILS + \".sahara_consts\")\n def test_launch_cluster_error(self, mock_sahara_consts,\n mock_generate_random_name):\n\n scenario = utils.SaharaScenario(self.context)\n mock_processes = {\n \"test_plugin\": {\n \"test_version\": {\n \"master\": [\"p1\"],\n \"worker\": [\"p2\"]\n }\n }\n }\n\n mock_configs = {\n \"test_plugin\": {\n \"test_version\": {\n \"target\": \"HDFS\",\n \"config_name\": \"dfs.replication\"\n }\n }\n }\n\n mock_sahara_consts.NODE_PROCESSES = mock_processes\n mock_sahara_consts.REPLICATION_CONFIGS = mock_configs\n\n self.clients(\"sahara\").clusters.create.return_value = mock.MagicMock(\n id=\"test_cluster_id\")\n\n self.clients(\"sahara\").clusters.get.return_value = mock.MagicMock(\n status=\"error\")\n\n self.assertRaises(exceptions.GetResourceErrorStatus,\n scenario._launch_cluster,\n plugin_name=\"test_plugin\",\n hadoop_version=\"test_version\",\n master_flavor_id=\"test_flavor_m\",\n worker_flavor_id=\"test_flavor_w\",\n image_id=\"test_image\",\n floating_ip_pool=\"test_pool\",\n volumes_per_node=5,\n volumes_size=10,\n workers_count=42,\n node_configs={\"HDFS\": {\"local_config\":\n \"local_value\"}})", "metadata": "root.SaharaScenarioTestCase.test_launch_cluster_error", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 346 }, { "content": " def test_scale_cluster(self):\n scenario = utils.SaharaScenario(self.context)\n cluster = mock.MagicMock(id=42, node_groups=[{\n \"name\": \"random_master\",\n \"count\": 1\n }, {\n \"name\": \"random_worker\",\n \"count\": 41\n }])\n self.clients(\"sahara\").clusters.get.return_value = mock.MagicMock(\n id=42,\n status=\"active\")\n\n expected_scale_object = {\n \"resize_node_groups\": [{\n \"name\": \"random_worker\",\n \"count\": 42\n }]\n }\n\n scenario._scale_cluster(cluster, 1)\n self.clients(\"sahara\").clusters.scale.assert_called_once_with(\n 42, expected_scale_object)", "metadata": "root.SaharaScenarioTestCase.test_scale_cluster", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 394 }, { "content": " def test_delete_cluster(self):\n scenario = utils.SaharaScenario(self.context)\n cluster = mock.MagicMock(id=42)\n self.clients(\"sahara\").clusters.get.side_effect = [\n cluster, sahara_base.APIException()\n ]\n\n scenario._delete_cluster(cluster)\n delete_mock = self.clients(\"sahara\").clusters.delete\n delete_mock.assert_called_once_with(42)\n\n cl_get_expected = mock.call(42)\n self.clients(\"sahara\").clusters.get.assert_has_calls([cl_get_expected,\n cl_get_expected])\n\n self._test_atomic_action_timer(scenario.atomic_actions(),\n \"sahara.delete_cluster\")", "metadata": "root.SaharaScenarioTestCase.test_delete_cluster", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 418 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"42\")\n def test_create_output_ds(self, mock_generate_random_name):\n self.context.update({\n \"sahara\": {\n \"output_conf\": {\n \"output_type\": \"hdfs\",\n \"output_url_prefix\": \"hdfs://test_out/\"\n }\n }\n })\n\n scenario = utils.SaharaScenario(self.context)\n scenario._create_output_ds()\n\n self.clients(\"sahara\").data_sources.create.assert_called_once_with(\n name=\"42\",\n description=\"\",\n data_source_type=\"hdfs\",\n url=\"hdfs://test_out/42\"\n )", "metadata": "root.SaharaScenarioTestCase.test_create_output_ds", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 436 }, { "content": " @mock.patch(SAHARA_UTILS + \".SaharaScenario.generate_random_name\",\n return_value=\"42\")\n def test_create_output_ds_swift(self, mock_generate_random_name):\n self.context.update({\n \"sahara\": {\n \"output_conf\": {\n \"output_type\": \"swift\",\n \"output_url_prefix\": \"swift://test_out/\"\n }\n }\n })\n\n scenario = utils.SaharaScenario(self.context)\n self.assertRaises(exceptions.RallyException,\n scenario._create_output_ds)", "metadata": "root.SaharaScenarioTestCase.test_create_output_ds_swift", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 458 }, { "content": " def test_run_job_execution(self):\n self.clients(\"sahara\").job_executions.get.side_effect = [\n mock.MagicMock(info={\"status\": \"pending\"}, id=\"42\"),\n mock.MagicMock(info={\"status\": \"SUCCESS\"}, id=\"42\")]\n\n self.clients(\"sahara\").job_executions.create.return_value = (\n mock.MagicMock(id=\"42\"))\n\n scenario = utils.SaharaScenario(self.context)\n scenario._run_job_execution(job_id=\"test_job_id\",\n cluster_id=\"test_cluster_id\",\n input_id=\"test_input_id\",\n output_id=\"test_output_id\",\n configs={\"k\": \"v\"},\n job_idx=0)\n\n self.clients(\"sahara\").job_executions.create.assert_called_once_with(\n job_id=\"test_job_id\",\n cluster_id=\"test_cluster_id\",\n input_id=\"test_input_id\",\n output_id=\"test_output_id\",\n configs={\"k\": \"v\"}\n )\n\n je_get_expected = mock.call(\"42\")\n self.clients(\"sahara\").job_executions.get.assert_has_calls(\n [je_get_expected, je_get_expected]\n )", "metadata": "root.SaharaScenarioTestCase.test_run_job_execution", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 474 }, { "content": " def test_run_job_execution_fail(self):\n self.clients(\"sahara\").job_executions.get.side_effect = [\n mock.MagicMock(info={\"status\": \"pending\"}, id=\"42\"),\n mock.MagicMock(info={\"status\": \"killed\"}, id=\"42\")]\n\n self.clients(\"sahara\").job_executions.create.return_value = (\n mock.MagicMock(id=\"42\"))\n\n scenario = utils.SaharaScenario(self.context)\n self.assertRaises(exceptions.RallyException,\n scenario._run_job_execution,\n job_id=\"test_job_id\",\n cluster_id=\"test_cluster_id\",\n input_id=\"test_input_id\",\n output_id=\"test_output_id\",\n configs={\"k\": \"v\"},\n job_idx=0)\n\n self.clients(\"sahara\").job_executions.create.assert_called_once_with(\n job_id=\"test_job_id\",\n cluster_id=\"test_cluster_id\",\n input_id=\"test_input_id\",\n output_id=\"test_output_id\",\n configs={\"k\": \"v\"}\n )", "metadata": "root.SaharaScenarioTestCase.test_run_job_execution_fail", "header": "['class', 'SaharaScenarioTestCase', '(', 'test', '.', 'ScenarioTestCase', ')', ':', '___NEWLINE___', '# NOTE(stpierre): the Sahara utils generally do funny stuff with', '___NL___', '# wait_for() calls -- frequently the the is_ready and', '___NL___', '# update_resource arguments are functions defined in the Sahara', '___NL___', '# utils themselves instead of the more standard resource_is() and', '___NL___', '# get_from_manager() calls. As a result, the tests below do more', '___NL___', \"# integrated/functional testing of wait_for() calls, and we can't\", '___NL___', '# just mock out wait_for and friends the way we usually do.', '___NL___', '___EOS___']", "index": 503 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", ":", " ", "Mir", "anti", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "uuidutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "client_", "._", "api_", "import_", "base_", "as_", "sahara", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rally", "_", "import_", "consts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rally", "_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rally", "_", "._", "plugins_", "._", "openstack_", "._", "scenarios_", "._", "sahara", "_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tests_", "._", "unit_", "import_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "=_", "cfg_", "._", "CONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "=_", "\"", "rally", ".", "plugin", "s", ".", "openst", "ack", ".", "scen", "ario", "s", ".", "sahara", ".", "util", "s", "\"_", "\\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_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "patch", "\\u", "bench", "mark", "\\u", "utils_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Sa", "hara", "Scen", "ario", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONF_", "._", "set\\u", "override_", "(_", "\"", "sahara", "\\u", "cluster", "\\u", "check", "\\u", "interval", "\"_", ",_", "0_", ",_", "\"", "bench", "mark", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enforce", "\\u", "type_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "._", "set\\u", "override_", "(_", "\"", "sahara", "\\u", "job", "\\u", "check", "\\u", "interval", "\"_", ",_", "0_", ",_", "\"", "bench", "mark", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enforce", "\\u", "type_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "list", "\\u", "node", "\\u", "group", "\\u", "templates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ngt", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "node", "\\u", "group", "\\u", "templates_", "._", "list_", "._", "return", "\\u", "value_", "=_", "ngt", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "ngt", "s", "\\u", "list_", "=_", "scenario_", "._", "\\u", "list", "\\u", "node", "\\u", "group", "\\u", "templates_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ngt", "s_", ",_", "return", "\\u", "ngt", "s", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "list", "\\u", "node", "\\u", "group", "\\u", "template", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "random", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "sahara", "\\u", "const", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "node", "\\u", "group", "\\u", "templates_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "mock", "\\u", "sahara", "\\u", "consts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "processes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "master", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "worker", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", "\\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_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "NODE", "\\u", "PROCESS", "ES_", "=_", "mock", "\\u", "processes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "create", "\\u", "master", "\\u", "node", "\\u", "group", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scenario_", "._", "\\u", "create", "\\u", "worker", "\\u", "node", "\\u", "group", "\\u", "template_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "calls_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "processes_", "=_", "[_", "\"", "p1", "\"_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "processes_", "=_", "[_", "\"", "p2", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "node", "\\u", "group", "\\u", "templates_", "._", "create_", "._", "assert", "\\u", "has", "\\u", "calls_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "calls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "create", "\\u", "master", "\\u", "node", "\\u", "group", "\\u", "template", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "create", "\\u", "worker", "\\u", "node", "\\u", "group", "\\u", "template", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "delete", "\\u", "node", "\\u", "group", "\\u", "templates_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ng_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "id_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "delete", "\\u", "node", "\\u", "group", "\\u", "template_", "(_", "ng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "\\u", "mock_", "=_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "node", "\\u", "group", "\\u", "templates_", "._", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "delete", "\\u", "node", "\\u", "group", "\\u", "template", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "random", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "sahara", "\\u", "const", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "launch", "\\u", "cluster_", "(_", "self_", ",_", "mock", "\\u", "sahara", "\\u", "consts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "test\\u", "neut", "ron", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "router", "\\u", "id", "\"_", ":_", "\"", "test\\u", "router", "\\u", "id", "\"_", "\\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_", "self_", "._", "clients_", "(_", "\"", "service", "s", "\"_", ")_", "._", "values_", "._", "return", "\\u", "value_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "consts_", "._", "Service_", "._", "NEU", "TRO", "N_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "context_", "=_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "processes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "master", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "worker", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", "\\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_", "mock", "\\u", "configs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "\"_", ":_", "\"", "HDF", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "config", "\\u", "name", "\"_", ":_", "\"", "dfs", ".", "replication", "\"_", "\\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_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "groups_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "master", "-", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\\u", "id", "\"_", ":_", "\"", "test\\u", "flavor", "\\u", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "process", "es", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "float", "ing", "\\u", "ip", "\\u", "pool", "\"_", ":_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "security", "\\u", "group", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "configs", "\"_", ":_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "worker", "-", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\\u", "id", "\"_", ":_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "process", "es", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "float", "ing", "\\u", "ip", "\\u", "pool", "\"_", ":_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "per", "\\u", "node", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "size", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "42_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "security", "\\u", "group", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "configs", "\"_", ":_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "NODE", "\\u", "PROCESS", "ES_", "=_", "mock", "\\u", "processes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "REPLICA", "TIO", "N", "\\u", "CONFIG", "S_", "=_", "mock", "\\u", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "create_", "._", "return", "\\u", "value_", "._", "id_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "return", "\\u", "value_", "._", "status_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "launch", "\\u", "cluster_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "id_", "=_", "\"", "test\\u", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float", "ing", "\\u", "ip", "\\u", "pool_", "=_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "per", "\\u", "node_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "size_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "security", "\\u", "group_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "groups_", "=_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "s", "\\u", "count_", "=_", "42_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "configs_", "=_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "groups_", "=_", "node", "\\u", "groups_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "image", "\\u", "id_", "=_", "\"", "test\\u", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "configs_", "=_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "dfs", ".", "replication", "\"_", ":_", "3_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "\\u", "id_", "=_", "\"", "test\\u", "neut", "ron", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "anti", "\\u", "affinity", "_", "=_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "launch", "\\u", "cluster", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "random", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "sahara", "\\u", "const", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "launch", "\\u", "cluster", "\\u", "with", "\\u", "proxy_", "(_", "self_", ",_", "mock", "\\u", "sahara", "\\u", "consts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tenan", "t", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "s", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "\"", "test\\u", "neut", "ron", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "router", "\\u", "id", "\"_", ":_", "\"", "test\\u", "router", "\\u", "id", "\"_", "\\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_", "self_", "._", "clients_", "(_", "\"", "service", "s", "\"_", ")_", "._", "values_", "._", "return", "\\u", "value_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "consts_", "._", "Service_", "._", "NEU", "TRO", "N_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "processes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "master", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "worker", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", "\\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_", "mock", "\\u", "configs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "\"_", ":_", "\"", "HDF", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "config", "\\u", "name", "\"_", ":_", "\"", "dfs", ".", "replication", "\"_", "\\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_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", "=_", "uuidutils_", "._", "generat", "e\\u", "uuid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "groups_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "master", "-", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\\u", "id", "\"_", ":_", "\"", "test\\u", "flavor", "\\u", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "process", "es", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "float", "ing", "\\u", "ip", "\\u", "pool", "\"_", ":_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "security", "\\u", "group", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "configs", "\"_", ":_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", "\\u", "proxy", "\\u", "gateway", "\"_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "worker", "-", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\\u", "id", "\"_", ":_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "process", "es", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "per", "\\u", "node", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "size", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "40_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "security", "\\u", "group", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "configs", "\"_", ":_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "proxy", "-", "ng", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flavor", "\\u", "id", "\"_", ":_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "process", "es", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "float", "ing", "\\u", "ip", "\\u", "pool", "\"_", ":_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "per", "\\u", "node", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "s", "\\u", "size", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "security", "\\u", "group", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "security", "\\u", "group", "s", "\"_", ":_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "\\u", "configs", "\"_", ":_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", "\\u", "proxy", "\\u", "gateway", "\"_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "NODE", "\\u", "PROCESS", "ES_", "=_", "mock", "\\u", "processes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "REPLICA", "TIO", "N", "\\u", "CONFIG", "S_", "=_", "mock", "\\u", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "create_", "._", "return", "\\u", "value_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "return", "\\u", "value_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "launch", "\\u", "cluster_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "id_", "=_", "\"", "test\\u", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float", "ing", "\\u", "ip", "\\u", "pool_", "=_", "float", "ing", "\\u", "ip", "\\u", "pool", "\\u", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "per", "\\u", "node_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "size_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "security", "\\u", "group_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "groups_", "=_", "[_", "\"", "g1", "\"_", ",_", "\"", "g2", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "s", "\\u", "count_", "=_", "42_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "configs_", "=_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enable", "\\u", "proxy_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "groups_", "=_", "node", "\\u", "groups_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "image", "\\u", "id_", "=_", "\"", "test\\u", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "configs_", "=_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "dfs", ".", "replication", "\"_", ":_", "3_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "\\u", "id_", "=_", "\"", "test\\u", "neut", "ron", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "anti", "\\u", "affinity", "_", "=_", "None_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "launch", "\\u", "cluster", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "random", "\\u", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "sahara", "\\u", "const", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "launch", "\\u", "cluster", "\\u", "error_", "(_", "self_", ",_", "mock", "\\u", "sahara", "\\u", "consts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "processes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "master", "\"_", ":_", "[_", "\"", "p1", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "worker", "\"_", ":_", "[_", "\"", "p2", "\"_", "]_", "\\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_", "mock", "\\u", "configs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "plugin", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test\\u", "version", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "target", "\"_", ":_", "\"", "HDF", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "config", "\\u", "name", "\"_", ":_", "\"", "dfs", ".", "replication", "\"_", "\\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_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "NODE", "\\u", "PROCESS", "ES_", "=_", "mock", "\\u", "processes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "sahara", "\\u", "consts_", "._", "REPLICA", "TIO", "N", "\\u", "CONFIG", "S_", "=_", "mock", "\\u", "configs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "create_", "._", "return", "\\u", "value_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "return", "\\u", "value_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Get", "Reso", "urc", "e", "Error", "Status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "launch", "\\u", "cluster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugin", "\\u", "name_", "=_", "\"", "test\\u", "plugin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "version_", "=_", "\"", "test\\u", "version", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "flavor", "\\u", "id_", "=_", "\"", "test\\u", "flavor", "\\u", "w", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "id_", "=_", "\"", "test\\u", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float", "ing", "\\u", "ip", "\\u", "pool_", "=_", "\"", "test\\u", "pool", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "per", "\\u", "node_", "=_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "s", "\\u", "size_", "=_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "s", "\\u", "count_", "=_", "42_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "configs_", "=_", "{_", "\"", "HDF", "S", "\"_", ":_", "{_", "\"", "local", "\\u", "config", "\"_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "local", "\\u", "value", "\"_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "scale", "\\u", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "id_", "=_", "42_", ",_", "node", "\\u", "groups_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "random", "\\u", "master", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "random", "\\u", "worker", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "41_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "return", "\\u", "value_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "42_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected", "\\u", "scale", "\\u", "object_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "resiz", "e\\u", "node", "\\u", "group", "s", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "random", "\\u", "worker", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\"_", ":_", "42_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "scale", "\\u", "cluster_", "(_", "cluster_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "scale_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "42_", ",_", "expected", "\\u", "scale", "\\u", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "delete", "\\u", "cluster_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cluster_", "=_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "id_", "=_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "side", "\\u", "effect_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cluster_", ",_", "sahara", "\\u", "base_", "._", "API", "Exception_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "delete", "\\u", "cluster_", "(_", "cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "\\u", "mock_", "=_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "\\u", "mock_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cl", "\\u", "get", "\\u", "expected_", "=_", "mock_", "._", "call_", "(_", "42_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "clusters_", "._", "get_", "._", "assert", "\\u", "has", "\\u", "calls_", "(_", "[_", "cl", "\\u", "get", "\\u", "expected_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cl", "\\u", "get", "\\u", "expected_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "atomi", "c\\u", "action", "\\u", "timer_", "(_", "scenario_", "._", "atomi", "c\\u", "actions_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", ".", "delete", "\\u", "cluster", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "4", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "output", "\\u", "ds_", "(_", "self_", ",_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "conf", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "type", "\"_", ":_", "\"", "hdfs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "url", "\\u", "prefix", "\"_", ":_", "\"", "hdfs", "://", "test\\u", "out", "/\"_", "\\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_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scenario_", "._", "\\u", "create", "\\u", "output", "\\u", "ds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "data\\u", "sources_", "._", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "4", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "source", "\\u", "type_", "=_", "\"", "hdfs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "hdfs", "://", "test\\u", "out", "/", "4", "2", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "SA", "HAR", "A", "\\u", "UTIL", "S_", "+_", "\".", "Sa", "hara", "Scen", "ario", ".", "generat", "e\\u", "random", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "\"", "4", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "output", "\\u", "ds", "\\u", "swift_", "(_", "self_", ",_", "mock", "\\u", "generat", "e\\u", "random", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sahara", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "conf", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "type", "\"_", ":_", "\"", "swift", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "url", "\\u", "prefix", "\"_", ":_", "\"", "swift", "://", "test\\u", "out", "/\"_", "\\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_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Ra", "ll", "y", "Exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "create", "\\u", "output", "\\u", "ds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "run", "\\u", "job", "\\u", "execution_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "get_", "._", "side", "\\u", "effect_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "info_", "=_", "{_", "\"", "status", "\"_", ":_", "\"", "pend", "ing", "\"_", "}_", ",_", "id_", "=_", "\"", "4", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "info_", "=_", "{_", "\"", "status", "\"_", ":_", "\"", "SUCCESS", "\"_", "}_", ",_", "id_", "=_", "\"", "4", "2", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "create_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "id_", "=_", "\"", "4", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scenario_", "._", "\\u", "run", "\\u", "job", "\\u", "execution_", "(_", "job", "\\u", "id_", "=_", "\"", "test\\u", "job", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", "=_", "\"", "test\\u", "input", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "id_", "=_", "\"", "test\\u", "output", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "configs_", "=_", "{_", "\"", "k", "\"_", ":_", "\"", "v", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "idx_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", "=_", "\"", "test\\u", "job", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", "=_", "\"", "test\\u", "input", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "id_", "=_", "\"", "test\\u", "output", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "configs_", "=_", "{_", "\"", "k", "\"_", ":_", "\"", "v", "\"_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "je", "\\u", "get", "\\u", "expected_", "=_", "mock_", "._", "call_", "(_", "\"", "4", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "get_", "._", "assert", "\\u", "has", "\\u", "calls_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "je", "\\u", "get", "\\u", "expected_", ",_", "je", "\\u", "get", "\\u", "expected_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sa", "hara", "Scen", "ario", "Test", "Case_", "(_", "test_", "._", "Scen", "ario", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "stp", "ier", "re", "):", " ", "the", " ", "Sa", "hara", " ", "util", "s", " ", "genera", "ll", "y", " ", "do", " ", "funn", "y", " ", "stu", "ff", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wait", "\\u", "for", "()", " ", "calls", " ", "--", " ", "frequent", "ly", " ", "the", " ", "the", " ", "is", "\\u", "read", "y", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", "\\u", "resource", " ", "argu", "ment", "s", " ", "are", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Sa", "hara", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "util", "s", " ", "them", "sel", "ves", " ", "inst", "ead", " ", "of", " ", "the", " ", "more", " ", "standard", " ", "resource", "\\u", "is", "()", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", "\\u", "from", "\\u", "manage", "r", "()", " ", "calls", ".", " ", "As", " ", "a", " ", "result", ",", " ", "the", " ", "tests", " ", "belo", "w", " ", "do", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "integrated", "/", "functional", " ", "testi", "ng", " ", "of", " ", "wait", "\\u", "for", "()", " ", "calls", ",", " ", "and", " ", "we", " ", "can", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "mock", " ", "out", " ", "wait", "\\u", "for", " ", "and", " ", "friends", " ", "the", " ", "way", " ", "we", " ", "usual", "ly", " ", "do", "._", "\\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", "run", "\\u", "job", "\\u", "executi", "on", "\\u", "fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "get_", "._", "side", "\\u", "effect_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "info_", "=_", "{_", "\"", "status", "\"_", ":_", "\"", "pend", "ing", "\"_", "}_", ",_", "id_", "=_", "\"", "4", "2", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "info_", "=_", "{_", "\"", "status", "\"_", ":_", "\"", "kille", "d", "\"_", "}_", ",_", "id_", "=_", "\"", "4", "2", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "create_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mock_", "._", "Mag", "ic", "Mock_", "(_", "id_", "=_", "\"", "4", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "=_", "utils_", "._", "Sa", "hara", "Scenario_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Ra", "ll", "y", "Exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scenario_", "._", "\\u", "run", "\\u", "job", "\\u", "execution_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", "=_", "\"", "test\\u", "job", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", "=_", "\"", "test\\u", "input", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "id_", "=_", "\"", "test\\u", "output", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "configs_", "=_", "{_", "\"", "k", "\"_", ":_", "\"", "v", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "idx_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clients_", "(_", "\"", "sahara", "\"_", ")_", "._", "job", "\\u", "executions_", "._", "create_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "id_", "=_", "\"", "test\\u", "job", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "id_", "=_", "\"", "test\\u", "cluster", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "id_", "=_", "\"", "test\\u", "input", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "id_", "=_", "\"", "test\\u", "output", "\\u", "id", "\"_", ",_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
softlayer/softlayer-python/SoftLayer/CLI/iscsi/detail.py
[ { "content": "@click.command()\[email protected]('identifier')\[email protected]('--password',\n is_flag=True,\n help=\"Show credentials to access the iSCSI target\")\[email protected]_env\ndef cli(env, identifier, password):\n \"\"\"Get details for an iSCSI target.\"\"\"\n\n iscsi_mgr = SoftLayer.ISCSIManager(env.client)\n\n iscsi_id = helpers.resolve_id(iscsi_mgr.resolve_ids, identifier, 'iSCSI')\n result = iscsi_mgr.get_iscsi(iscsi_id)\n result = utils.NestedDict(result)\n\n table = formatting.KeyValueTable(['name', 'value'])\n table.align['name'] = 'r'\n table.align['value'] = 'l'\n\n table.add_row(['id', result['id']])\n table.add_row(['serviceResourceName', result['serviceResourceName']])\n table.add_row(['createDate', result['createDate']])\n table.add_row(['nasType', result['nasType']])\n table.add_row(['capacityGb', result['capacityGb']])\n\n if result['snapshotCapacityGb']:\n table.add_row(['snapshotCapacityGb', result['snapshotCapacityGb']])\n\n table.add_row(['mountableFlag', result['mountableFlag']])\n table.add_row(['serviceResourceBackendIpAddress',\n result['serviceResourceBackendIpAddress']])\n table.add_row(['price', result['billingItem']['recurringFee']])\n table.add_row(['BillingItemId', result['billingItem']['id']])\n if result.get('notes'):\n table.add_row(['notes', result['notes']])\n\n if password:\n pass_table = formatting.Table(['username', 'password'])\n pass_table.add_row([result['username'], result['password']])\n table.add_row(['users', pass_table])\n\n env.fout(table)", "metadata": "root.cli", "header": "['module', '___EOS___']", "index": 12 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "click_", "._", "command_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "argument_", "(_", "'", "identifi", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "click_", "._", "option_", "(_", "'--", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "flag_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Show", " ", "cred", "ential", "s", " ", "to", " ", "access", " ", "the", " ", "i", "SCS", "I", " ", "target", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "environment_", "._", "pass", "\\u", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "cli_", "(_", "env_", ",_", "identifier_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "deta", "il", "s", " ", "for", " ", "an", " ", "i", "SCS", "I", " ", "target", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iscsi", "\\u", "mgr_", "=_", "Sof", "t", "Layer_", "._", "ISCSI", "Manager_", "(_", "env_", "._", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iscsi", "\\u", "id_", "=_", "helpers_", "._", "resolve", "\\u", "id_", "(_", "iscsi", "\\u", "mgr_", "._", "resolve", "\\u", "ids_", ",_", "identifier_", ",_", "'", "i", "SCS", "I", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "iscsi", "\\u", "mgr_", "._", "get", "\\u", "iscsi", "_", "(_", "iscsi", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "utils_", "._", "Nest", "ed", "Dict_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "formatting_", "._", "Key", "Value", "Table_", "(_", "[_", "'", "name", "'_", ",_", "'", "value", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "align_", "[_", "'", "name", "'_", "]_", "=_", "'", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "align_", "[_", "'", "value", "'_", "]_", "=_", "'", "l", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "id", "'_", ",_", "result_", "[_", "'", "id", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "service", "Reso", "urc", "e", "Name", "'_", ",_", "result_", "[_", "'", "service", "Reso", "urc", "e", "Name", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "create", "Date", "'_", ",_", "result_", "[_", "'", "create", "Date", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "nas", "Type", "'_", ",_", "result_", "[_", "'", "nas", "Type", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "capacit", "y", "Gb", "'_", ",_", "result_", "[_", "'", "capacit", "y", "Gb", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "[_", "'", "snapshot", "Capacit", "y", "Gb", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "snapshot", "Capacit", "y", "Gb", "'_", ",_", "result_", "[_", "'", "snapshot", "Capacit", "y", "Gb", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "mount", "able", "Fla", "g", "'_", ",_", "result_", "[_", "'", "mount", "able", "Fla", "g", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "service", "Reso", "urc", "e", "Back", "end", "Ip", "Address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "[_", "'", "service", "Reso", "urc", "e", "Back", "end", "Ip", "Address", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "price", "'_", ",_", "result_", "[_", "'", "bill", "ing", "Item", "'_", "]_", "[_", "'", "recurring", "Fee", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "Bill", "ing", "Item", "Id", "'_", ",_", "result_", "[_", "'", "bill", "ing", "Item", "'_", "]_", "[_", "'", "id", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "get_", "(_", "'", "note", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "note", "s", "'_", ",_", "result_", "[_", "'", "note", "s", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass", "\\u", "table_", "=_", "formatting_", "._", "Table_", "(_", "[_", "'", "user", "name", "'_", ",_", "'", "password", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass", "\\u", "table_", "._", "add", "\\u", "row_", "(_", "[_", "result_", "[_", "'", "user", "name", "'_", "]_", ",_", "result_", "[_", "'", "password", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "table_", "._", "add", "\\u", "row_", "(_", "[_", "'", "users", "'_", ",_", "pass", "\\u", "table_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "fout_", "(_", "table_", ")_" ]
[ 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,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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 ]
Testing equality to None
bendavis78/python-gitmodel/gitmodel/utils/__init__.py
[ { "content": "def make_signature(name, email, timestamp=None, offset=None,\n default_offset=None):\n \"\"\"\n Creates a pygit2.Signature while making time and offset optional. By\n default, uses current time, and local offset as determined by\n ``dateutil.tz.tzlocal()``\n \"\"\"\n if timestamp is None:\n timestamp = time()\n\n if offset is None and default_offset is None:\n # Get local offset\n dt = datetime.fromtimestamp(timestamp)\n aware = datetime(dt.year, dt.month, dt.day, dt.hour, dt.minute,\n dt.second, dt.microsecond, tzinfo=tzlocal())\n seconds = aware.utcoffset().days * 86400\n seconds += aware.utcoffset().seconds\n offset = seconds / 60\n elif offset is None:\n offset = default_offset\n\n return pygit2.Signature(name, email, timestamp, offset)", "metadata": "root.make_signature", "header": "['module', '___EOS___']", "index": 18 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "make", "\\u", "signature_", "(_", "name_", ",_", "email_", ",_", "timestamp_", "=_", "None_", ",_", "offset_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "offset_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "pyg", "it", "2", ".", "Sign", "ature", " ", "whi", "le", " ", "mak", "ing", " ", "time", " ", "and", " ", "offset", " ", "option", "al", ".", " ", "By", "\\", "10", ";", " ", " ", " ", " ", "default", ",", " ", "use", "s", " ", "current", " ", "time", ",", " ", "and", " ", "local", " ", "offset", " ", "as", " ", "dete", "rmin", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "``", "date", "util", ".", "tz", ".", "tz", "local", "()``", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timestamp_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "offset_", "is_", "None_", "and_", "default", "\\u", "offset_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "local", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "datetime_", "._", "fromtimestamp_", "(_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aware_", "=_", "datetime_", "(_", "dt_", "._", "year_", ",_", "dt_", "._", "month_", ",_", "dt_", "._", "day_", ",_", "dt_", "._", "hour_", ",_", "dt_", "._", "minute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dt_", "._", "second_", ",_", "dt_", "._", "microsecond_", ",_", "tzinfo_", "=_", "tz", "local_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seconds_", "=_", "aware_", "._", "utc", "offset_", "(_", ")_", "._", "days_", "*_", "86400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seconds_", "+=_", "aware_", "._", "utc", "offset_", "(_", ")_", "._", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "seconds_", "/_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "offset_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset_", "=_", "default", "\\u", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pyg", "it", "2_", "._", "Signature_", "(_", "name_", ",_", "email_", ",_", "timestamp_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
modflowpy/flopy/autotest/t018_test.py
[ { "content": "def test_tpl_zoned():\n nlay = 3\n nrow = 20\n ncol = 20\n\n # Create the flopy model object and add the dis and lpf packages\n m = flopy.modflow.Modflow(modelname='tpl3', model_ws='./temp')\n dis = flopy.modflow.ModflowDis(m, nlay, nrow, ncol)\n lpf = flopy.modflow.ModflowLpf(m, hk=10.)\n\n # Create a zone array\n zonearray = np.ones((nlay, nrow, ncol), dtype=int)\n zonearray[0, 10:, 7:] = 2\n zonearray[0, 15:, 9:] = 3\n zonearray[1] = 4\n\n # Create a list of parameters for HK\n mfpackage = 'lpf'\n parzones = [2, 3, 4]\n parvals = [56.777, 78.999, 99.]\n lbound = 5\n ubound = 500\n transform = 'log'\n plisthk = params.zonearray2params(mfpackage, 'hk', parzones, lbound,\n ubound, parvals, transform, zonearray)\n\n # Create a list of parameters for VKA\n parzones = [1, 2]\n parvals = [0.001, 0.0005]\n zonearray = np.ones((nlay, nrow, ncol), dtype=int)\n zonearray[1] = 2\n plistvk = params.zonearray2params(mfpackage, 'vka', parzones, lbound,\n ubound, parvals, transform, zonearray)\n\n # Combine the HK and VKA parameters together\n plist = plisthk + plistvk\n\n # Write the template file\n tw = tplwriter.TemplateWriter(m, plist)\n tw.write_template()\n\n tplfile = os.path.join('./temp', 'tpl3.lpf.tpl')\n assert os.path.isfile(tplfile)\n\n return", "metadata": "root.test_tpl_zoned", "header": "['module', '___EOS___']", "index": 79 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tpl", "\\u", "zone", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nla", "y_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nrow_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ncol_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "the", " ", "flop", "y", " ", "model", " ", "object", " ", "and", " ", "add", " ", "the", " ", "dis", " ", "and", " ", "lp", "f", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "m_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow_", "(_", "model", "name_", "=_", "'", "tpl", "3", "'_", ",_", "model", "\\u", "ws_", "=_", "'./", "temp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dis_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow", "Dis", "_", "(_", "m_", ",_", "nla", "y_", ",_", "nrow_", ",_", "ncol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp", "f_", "=_", "flop", "y_", "._", "mod", "flow_", "._", "Mod", "flow", "Lp", "f_", "(_", "m_", ",_", "hk", "_", "=_", "10._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "zone", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "array_", "=_", "np_", "._", "ones_", "(_", "(_", "nla", "y_", ",_", "nrow_", ",_", "ncol_", ")_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "array_", "[_", "0_", ",_", "10_", ":_", ",_", "7_", ":_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "array_", "[_", "0_", ",_", "15_", ":_", ",_", "9_", ":_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "array_", "[_", "1_", "]_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "parameter", "s", " ", "for", " ", "HK", "_", "\\u\\u\\uNL\\u\\u\\u_", "mf", "package_", "=_", "'", "lp", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "zones_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "vals_", "=_", "[_", "56.", "777_", ",_", "78.", "999_", ",_", "99.", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lbo", "und_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ub", "ound_", "=_", "500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transform_", "=_", "'", "log", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plist", "hk", "_", "=_", "params_", "._", "zone", "array", "2p", "arams_", "(_", "mf", "package_", ",_", "'", "hk", "'_", ",_", "par", "zones_", ",_", "lbo", "und_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ub", "ound_", ",_", "par", "vals_", ",_", "transform_", ",_", "zone", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "parameter", "s", " ", "for", " ", "VK", "A_", "\\u\\u\\uNL\\u\\u\\u_", "par", "zones_", "=_", "[_", "1_", ",_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "par", "vals_", "=_", "[_", "0.001_", ",_", "0.0005", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "array_", "=_", "np_", "._", "ones_", "(_", "(_", "nla", "y_", ",_", "nrow_", ",_", "ncol_", ")_", ",_", "dtype_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "array_", "[_", "1_", "]_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plist", "vk_", "=_", "params_", "._", "zone", "array", "2p", "arams_", "(_", "mf", "package_", ",_", "'", "vk", "a", "'_", ",_", "par", "zones_", ",_", "lbo", "und_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ub", "ound_", ",_", "par", "vals_", ",_", "transform_", ",_", "zone", "array_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Combine", " ", "the", " ", "HK", " ", "and", " ", "VK", "A", " ", "parameter", "s", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "plist_", "=_", "plist", "hk", "_", "+_", "plist", "vk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Write", " ", "the", " ", "template", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "tw_", "=_", "tpl", "writer_", "._", "Templa", "te", "Writer_", "(_", "m_", ",_", "plist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tw_", "._", "write", "\\u", "template_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tpl", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'./", "temp", "'_", ",_", "'", "tpl", "3", ".", "lp", "f", ".", "tpl", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "tpl", "file_", ")_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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 ]
Variable defined multiple times
django-oscar/django-oscar/src/oscar/apps/catalogue/abstract_models.py
[ { "content": "@python_2_unicode_compatible\nclass AbstractProductCategory(models.Model):\n \"\"\"\n Joining model between products and categories. Exists to allow customising.\n \"\"\"\n product = models.ForeignKey('catalogue.Product', verbose_name=_(\"Product\"))\n category = models.ForeignKey('catalogue.Category',\n verbose_name=_(\"Category\"))\n\n class Meta:\n abstract = True\n app_label = 'catalogue'\n ordering = ['product', 'category']\n unique_together = ('product', 'category')\n verbose_name = _('Product category')\n verbose_name_plural = _('Product categories')\n", "metadata": "root.AbstractProductCategory", "header": "['module', '___EOS___']", "index": 221 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Abstract", "Product", "Category_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Join", "ing", " ", "model", " ", "bet", "ween", " ", "products", " ", "and", " ", "categor", "ies", ".", " ", "Exist", "s", " ", "to", " ", "allow", " ", "customi", "sing", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "catalogue", ".", "Product", "'_", ",_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Product", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "'", "catalogue", ".", "Cate", "gory", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Cate", "gory", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abstract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "label_", "=_", "'", "catalogue", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "[_", "'", "product", "'_", ",_", "'", "category", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "\\u", "together_", "=_", "(_", "'", "product", "'_", ",_", "'", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "'", "Product", " ", "category", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "'", "Product", " ", "categor", "ies", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 'else' clause in loop
uskudnik/amazon-glacier-cmd-interface/glacier/GlacierWrapper.py
[ { "content": " @glacier_connect\n @sdb_connect\n @log_class_call(\"Uploading archive.\",\n \"Upload of archive finished.\")\n def upload(self, vault_name, file_name, description, region,\n stdin, alternative_name, part_size, uploadid, resume):\n \"\"\"\n Uploads a file to Amazon Glacier.\n\n :param vault_name: Name of the vault.\n :type vault_name: str\n :param file_name: Name of the file to upload.\n :type file_name: str\n :param description: Description of the upload.\n :type description: str\n :param region: region where to upload to.\n :type region: str\n :param stdin: whether to use stdin to read data from.\n :type stdin: boolan\n :param part_size: the size (in MB) of the blocks to upload.\n :type part_size: int\n\n :returns: Tupple of (archive_id, sha256hash)\n :rtype: tupple\n :raises: :py:exc:`glacier.glacierexception.InputException`,\n :py:exc:`glacier.glacierexception.ResponseException`\n \"\"\"\n\n # Switch off debug logging for boto, as otherwise it's\n # filling up the log with the data sent!\n if self.logger.getEffectiveLevel() == 10:\n logging.getLogger('boto').setLevel(logging.INFO)\n\n # Do some sanity checking on the user values.\n self._check_vault_name(vault_name)\n self._check_region(region)\n if not description:\n description = file_name if file_name else 'No description.'\n\n if description:\n self._check_vault_description(description)\n\n if uploadid:\n self._check_id(uploadid, 'UploadId')\n\n if resume and stdin:\n raise InputException(\n 'You must provide the UploadId to resume upload of streams from stdin.\\nUse glacier-cmd listmultiparts <vault> to find the UploadId.',\n code='CommandError')\n\n # If file_name is given, try to use this file(s).\n # Otherwise try to read data from stdin.\n total_size = 0\n reader = None\n mmapped_file = None\n if not stdin:\n if not file_name:\n raise InputException(\n \"No file name given for upload.\",\n code='CommandError')\n\n try:\n f = open(file_name, 'rb')\n mmapped_file = mmap(f)\n total_size = os.path.getsize(file_name)\n except IOError as e:\n raise InputException(\n \"Could not access file: %s.\"% file_name,\n cause=e,\n code='FileError')\n\n elif select.select([sys.stdin,],[],[],0.0)[0]:\n reader = sys.stdin\n total_size = 0\n else:\n raise InputException(\n \"There is nothing to upload.\",\n code='CommandError')\n\n # Log the kind of upload we're going to do.\n if uploadid:\n self.logger.info('Attempting resumption of upload of %s to %s.'% (file_name if file_name else 'data from stdin', vault_name))\n elif resume:\n self.logger.info('Attempting resumption of upload of %s to %s.'% (file_name, vault_name))\n else:\n self.logger.info('Starting upload of %s to %s.\\nDescription: %s'% (file_name if file_name else 'data from stdin', vault_name, description))\n\n # If user did not specify part_size, compute the optimal (i.e. lowest\n # value to stay within the self.MAX_PARTS (10,000) block limit).\n part_size = self._check_part_size(part_size, total_size)\n part_size_in_bytes = part_size * 1024 * 1024\n\n # If we have an UploadId, check whether it is linked to a current\n # job. If so, check whether uploaded data matches the input data and\n # try to resume uploading.\n upload = None\n if uploadid:\n uploads = self.listmultiparts(vault_name)\n for upload in uploads:\n if uploadid == upload['MultipartUploadId']:\n self.logger.debug('Found a matching upload id. Continuing upload resumption attempt.')\n self.logger.debug(upload)\n part_size_in_bytes = upload['PartSizeInBytes']\n break\n else:\n raise InputException(\n 'Can not resume upload of this data as no existing job with this uploadid could be found.',\n code='IdError')\n\n # Initialise the writer task.\n writer = GlacierWriter(self.glacierconn, vault_name, description=description,\n part_size_in_bytes=part_size_in_bytes, uploadid=uploadid, logger=self.logger)\n\n if upload:\n marker = None\n while True:\n\n # Fetch a list of already uploaded parts and their SHA hashes.\n try:\n response = self.glacierconn.list_parts(vault_name, uploadid, marker=marker)\n except boto.glacier.exceptions.UnexpectedHTTPResponseError as e:\n raise ResponseException(\n 'Failed to get a list already uploaded parts for interrupted upload %s.'% uploadid,\n cause=self._decode_error_message(e.body),\n code=e.code)\n\n list_parts_response = response.copy()\n current_position = 0\n stop = 0\n # Process the parts list.\n # For each part of data, take the matching data range from\n # the local file, and compare hashes.\n # If recieving data over stdin, the parts must be sequential\n # and the first must start at 0. For file, we can use the seek()\n # function to handle non-sequential parts.\n for part in list_parts_response['Parts']:\n start, stop = (int(p) for p in part['RangeInBytes'].split('-'))\n stop += 1\n if not start == current_position:\n if stdin:\n raise InputException(\n 'Cannot verify non-sequential upload data from stdin.',\n code='ResumeError')\n if reader:\n reader.seek(start)\n\n if mmapped_file and stop > mmapped_file.size:\n raise InputException(\n 'File does not match uploaded data; please check your uploadid and try again.',\n cause='File is smaller than uploaded data.',\n code='ResumeError')\n\n # Try to read the chunk of data, and take the hash if we\n # have received anything.\n # If no data or hash mismatch, stop checking raise an\n # exception.\n data = None\n data = reader.read(stop-start) if reader else mmapped_file[start:stop]\n if data:\n data_hash = glaciercorecalls.tree_hash(glaciercorecalls.chunk_hashes(data))\n if glaciercorecalls.bytes_to_hex(data_hash) == part['SHA256TreeHash']:\n self.logger.debug('Part %s hash matches.'% part['RangeInBytes'])\n writer.tree_hashes.append(data_hash)\n else:\n raise InputException(\n 'Received data does not match uploaded data; please check your uploadid and try again.',\n cause='SHA256 hash mismatch.',\n code='ResumeError')\n\n else:\n raise InputException(\n 'Received data does not match uploaded data; please check your uploadid and try again.',\n cause='No or not enough data to match.',\n code='ResumeError')\n\n current_position += stop - start\n\n # If a marker is present, this means there are more pages\n # of parts available. If no marker, we have the last page.\n marker = list_parts_response['Marker']\n writer.uploaded_size = stop\n if not marker:\n break\n\n if total_size > 0:\n msg = 'Checked %s of %s (%s%%).' \\\n % (self._size_fmt(writer.uploaded_size),\n self._size_fmt(total_size),\n self._bold(str(int(100 * writer.uploaded_size/total_size))))\n else:\n msg = 'Checked %s.' \\\n % (self._size_fmt(writer.uploaded_size))\n\n self._progress(msg)\n\n # Finished checking; log this and print the final status update\n # before resuming the upload.\n self.logger.info('Already uploaded: %s. Continuing from there.'% self._size_fmt(stop))\n if total_size > 0:\n msg = 'Checked %s of %s (%s%%). Check done; resuming upload.' \\\n % (self._size_fmt(writer.uploaded_size),\n self._size_fmt(total_size),\n self._bold(str(int(100 * writer.uploaded_size/total_size))))\n else:\n msg = 'Checked %s. Check done; resuming upload.' \\\n % (self._size_fmt(writer.uploaded_size))\n\n self._progress(msg)\n\n # Read file in parts so we don't fill the whole memory.\n start_time = current_time = previous_time = time.time()\n start_bytes = writer.uploaded_size\n while True:\n if reader:\n part = reader.read(part_size_in_bytes)\n else:\n if mmapped_file.size > writer.uploaded_size+part_size_in_bytes:\n part = mmapped_file[writer.uploaded_size:writer.uploaded_size+part_size_in_bytes]\n else:\n part = mmapped_file[writer.uploaded_size:]\n\n if not part:\n break\n\n writer.write(part)\n current_time = time.time()\n overall_rate = int((writer.uploaded_size-start_bytes)/(current_time - start_time))\n if total_size > 0:\n\n # Calculate transfer rates in bytes per second.\n current_rate = int(part_size_in_bytes/(current_time - previous_time))\n\n # Estimate finish time, based on overall transfer rate.\n if overall_rate > 0:\n time_left = (total_size - writer.uploaded_size)/overall_rate\n eta_seconds = current_time + time_left\n if datetime.fromtimestamp(eta_seconds).day is not\\\n datetime.now().day:\n eta_template = \"%a, %d %b, %H:%M:%S\"\n else:\n eta_template = \"%H:%M:%S\"\n eta = time.strftime(eta_template,\n time.localtime(eta_seconds))\n else:\n time_left = \"Unknown\"\n eta = \"Unknown\"\n\n msg = 'Wrote %s of %s (%s%%). Rate %s/s, average %s/s, ETA %s.' \\\n % (self._size_fmt(writer.uploaded_size),\n self._size_fmt(total_size),\n self._bold(str(int(100 * writer.uploaded_size/total_size))),\n self._size_fmt(current_rate, 2),\n self._size_fmt(overall_rate, 2),\n eta)\n\n else:\n msg = 'Wrote %s. Rate %s/s.' \\\n % (self._size_fmt(writer.uploaded_size),\n self._size_fmt(overall_rate, 2))\n\n self._progress(msg)\n previous_time = current_time\n self.logger.debug(msg)\n\n writer.close()\n if not stdin:\n f.close()\n current_time = time.time()\n overall_rate = int(writer.uploaded_size/(current_time - start_time))\n msg = 'Wrote %s. Rate %s/s.\\n' % (self._size_fmt(writer.uploaded_size),\n self._size_fmt(overall_rate, 2))\n self._progress(msg)\n self.logger.info(msg)\n\n archive_id = writer.get_archive_id()\n sha256hash = writer.get_hash()\n location = writer.get_location()\n\n if self.bookkeeping:\n self.logger.info('Writing upload information into the bookkeeping database.')\n\n # Use the alternative name as given by --name <name> if we have it.\n file_name = alternative_name if alternative_name else file_name\n\n # If still no name this is an stdin job, so set name accordingly.\n file_name = file_name if file_name else 'Data from stdin.'\n file_attrs = {\n 'region': region,\n 'vault': vault_name,\n 'filename': file_name,\n 'archive_id': archive_id,\n 'location': location,\n 'description': description,\n 'date':'%s' % datetime.utcnow().replace(tzinfo=pytz.utc),\n 'hash': sha256hash,\n 'size': writer.uploaded_size\n }\n\n## if file_name:\n## file_attrs['filename'] = file_name\n## elif stdin:\n## file_attrs['filename'] = 'data from stdin'\n\n self.sdb_domain.put_attributes(file_attrs['filename'], file_attrs)\n\n return (archive_id, sha256hash)", "metadata": "root.GlacierWrapper.upload", "header": "['class', 'GlacierWrapper', '(', 'object', ')', ':', '___EOS___']", "index": 932 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Gla", "cier", "Wrapper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "gla", "cier", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "sdb", "\\u", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "log", "\\u", "class", "\\u", "call_", "(_", "\"", "Upload", "ing", " ", "archive", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Upload", " ", "of", " ", "archive", " ", "finish", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "upload_", "(_", "self_", ",_", "vau", "lt", "\\u", "name_", ",_", "file", "\\u", "name_", ",_", "description_", ",_", "region_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", ",_", "alternative", "\\u", "name_", ",_", "part", "\\u", "size_", ",_", "upload", "id_", ",_", "resume_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Upload", "s", " ", "a", " ", "file", " ", "to", " ", "Ama", "zon", " ", "Gla", "cier", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "vau", "lt", "\\u", "name", ":", " ", "Name", " ", "of", " ", "the", " ", "vau", "lt", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "vau", "lt", "\\u", "name", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "file", "\\u", "name", ":", " ", "Name", " ", "of", " ", "the", " ", "file", " ", "to", " ", "upload", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "file", "\\u", "name", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "description", ":", " ", "Descripti", "on", " ", "of", " ", "the", " ", "upload", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "description", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "region", ":", " ", "region", " ", "where", " ", "to", " ", "upload", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "region", ":", " ", "str", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "std", "in", ":", " ", "whe", "ther", " ", "to", " ", "use", " ", "std", "in", " ", "to", " ", "read", " ", "data", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "std", "in", ":", " ", "bool", "an", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "part", "\\u", "size", ":", " ", "the", " ", "size", " ", "(", "in", " ", "MB", ")", " ", "of", " ", "the", " ", "blocks", " ", "to", " ", "upload", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "part", "\\u", "size", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "Tup", "ple", " ", "of", " ", "(", "archive", "\\u", "id", ",", " ", "sha2", "56", "hash", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "tup", "ple", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "py", ":", "exc", ":`", "gla", "cier", ".", "gla", "cier", "exception", ".", "Inp", "ut", "Except", "ion", "`", ",", "\\", "10", ";", " ", " ", " ", " ", " ", ":", "py", ":", "exc", ":`", "gla", "cier", ".", "gla", "cier", "exception", ".", "Respons", "e", "Except", "ion", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Switch", " ", "off", " ", "debug", " ", "logg", "ing", " ", "for", " ", "boto", ",", " ", "as", " ", "other", "wis", "e", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filling", " ", "up", " ", "the", " ", "log", " ", "with", " ", "the", " ", "data", " ", "sent", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "logger_", "._", "get", "Effe", "ctive", "Level_", "(_", ")_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "get", "Logger_", "(_", "'", "boto", "'_", ")_", "._", "set", "Level_", "(_", "logging_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "some", " ", "sanity", " ", "checking", " ", "on", " ", "the", " ", "user", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "vau", "lt", "\\u", "name_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "region_", "(_", "region_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "description_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "file", "\\u", "name_", "if_", "file", "\\u", "name_", "else_", "'", "No", " ", "description", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "description_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "vau", "lt", "\\u", "description_", "(_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upload", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "id_", "(_", "upload", "id_", ",_", "'", "Upload", "Id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "resume_", "and_", "stdin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "must", " ", "provide", " ", "the", " ", "Upload", "Id", " ", "to", " ", "resum", "e", " ", "upload", " ", "of", " ", "stream", "s", " ", "from", " ", "std", "in", ".\\\\", "n", "Us", "e", " ", "gla", "cier", "-", "cmd", " ", "list", "multip", "arts", " ", "<", "vau", "lt", ">", " ", "to", " ", "find", " ", "the", " ", "Upload", "Id", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Command", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "file", "\\u", "name", " ", "is", " ", "give", "n", ",", " ", "try", " ", "to", " ", "use", " ", "this", " ", "file", "(", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "try", " ", "to", " ", "read", " ", "data", " ", "from", " ", "std", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "\\u", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mma", "pped", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "stdin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "file", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "file", " ", "name", " ", "give", "n", " ", "for", " ", "upload", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Command", "Error", "'_", ")_", "\\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 ", " _", "f_", "=_", "open_", "(_", "file", "\\u", "name_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mma", "pped", "\\u", "file_", "=_", "mmap_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "size_", "=_", "os_", "._", "path_", "._", "getsize_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Cou", "ld", " ", "not", " ", "access", " ", "file", ":", " ", "%", "s", ".\"_", "%_", "file", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "File", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "select_", "._", "select_", "(_", "[_", "sys_", "._", "stdin_", ",_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "0.0_", ")_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "sys_", "._", "stdin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "size_", "=_", "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 ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "There", " ", "is", " ", "not", "hing", " ", "to", " ", "upload", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Command", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Log", " ", "the", " ", "kind", " ", "of", " ", "upload", " ", "we", "'", "re", " ", "goi", "ng", " ", "to", " ", "do", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upload", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "'", "Atte", "mpt", "ing", " ", "resum", "ption", " ", "of", " ", "upload", " ", "of", " ", "%", "s", " ", "to", " ", "%", "s", ".'_", "%_", "(_", "file", "\\u", "name_", "if_", "file", "\\u", "name_", "else_", "'", "data", " ", "from", " ", "std", "in", "'_", ",_", "vau", "lt", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "resume_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "'", "Atte", "mpt", "ing", " ", "resum", "ption", " ", "of", " ", "upload", " ", "of", " ", "%", "s", " ", "to", " ", "%", "s", ".'_", "%_", "(_", "file", "\\u", "name_", ",_", "vau", "lt", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "'", "Start", "ing", " ", "upload", " ", "of", " ", "%", "s", " ", "to", " ", "%", "s", ".\\\\", "n", "Descripti", "on", ":", " ", "%", "s", "'_", "%_", "(_", "file", "\\u", "name_", "if_", "file", "\\u", "name_", "else_", "'", "data", " ", "from", " ", "std", "in", "'_", ",_", "vau", "lt", "\\u", "name_", ",_", "description_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "user", " ", "did", " ", "not", " ", "speci", "fy", " ", "part", "\\u", "size", ",", " ", "compute", " ", "the", " ", "optim", "al", " ", "(", "i", ".", "e", ".", " ", "lowe", "st_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "to", " ", "stay", " ", "within", " ", "the", " ", "self", ".", "MAX", "\\u", "PART", "S", " ", "(", "10", ",", "000", ")", " ", "block", " ", "limit", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "part", "\\u", "size_", "=_", "self_", "._", "\\u", "check", "\\u", "part", "\\u", "size_", "(_", "part", "\\u", "size_", ",_", "total", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "=_", "part", "\\u", "size_", "*_", "1024_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "an", " ", "Upload", "Id", ",", " ", "check", " ", "whe", "ther", " ", "it", " ", "is", " ", "linked", " ", "to", " ", "a", " ", "current_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "job", ".", " ", "If", " ", "so", ",", " ", "check", " ", "whe", "ther", " ", "uploade", "d", " ", "data", " ", "matche", "s", " ", "the", " ", "input", " ", "data", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "resum", "e", " ", "upload", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "upload_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "upload", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uploads", "_", "=_", "self_", "._", "list", "multip", "arts", "_", "(_", "vau", "lt", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "upload_", "in_", "uploads", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "upload", "id_", "==_", "upload_", "[_", "'", "Multipart", "Upload", "Id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Foun", "d", " ", "a", " ", "matchi", "ng", " ", "upload", " ", "id", ".", " ", "Continu", "ing", " ", "upload", " ", "resum", "ption", " ", "atte", "mpt", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "upload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "=_", "upload_", "[_", "'", "Part", "Size", "In", "Byte", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Can", " ", "not", " ", "resum", "e", " ", "upload", " ", "of", " ", "this", " ", "data", " ", "as", " ", "no", " ", "exist", "ing", " ", "job", " ", "with", " ", "this", " ", "upload", "id", " ", "coul", "d", " ", "be", " ", "found", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Id", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initialise", " ", "the", " ", "writer", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "=_", "Gla", "cier", "Writer_", "(_", "self_", "._", "gla", "cier", "conn_", ",_", "vau", "lt", "\\u", "name_", ",_", "description_", "=_", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "=_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", ",_", "upload", "id_", "=_", "upload", "id_", ",_", "logger_", "=_", "self_", "._", "logger_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "upload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "marker_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "a", " ", "list", " ", "of", " ", "alr", "ead", "y", " ", "uploade", "d", " ", "part", "s", " ", "and", " ", "thei", "r", " ", "SHA", " ", "hashe", "s", "._", "\\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 ", " ", "_", "response_", "=_", "self_", "._", "gla", "cier", "conn_", "._", "list", "\\u", "parts_", "(_", "vau", "lt", "\\u", "name_", ",_", "upload", "id_", ",_", "marker_", "=_", "marker_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "gla", "cier", "_", "._", "exceptions_", "._", "Une", "xpe", "cte", "d", "HTTP", "Respons", "e", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Respons", "e", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fail", "ed", " ", "to", " ", "get", " ", "a", " ", "list", " ", "alr", "ead", "y", " ", "uploade", "d", " ", "part", "s", " ", "for", " ", "interrupted", " ", "upload", " ", "%", "s", ".'_", "%_", "upload", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "self_", "._", "\\u", "decode", "\\u", "error", "\\u", "message_", "(_", "e_", "._", "body_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "part", "s", "\\u", "response_", "=_", "response_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "position_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Process", " ", "the", " ", "part", "s", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "part", " ", "of", " ", "data", ",", " ", "take", " ", "the", " ", "matchi", "ng", " ", "data", " ", "range", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "local", " ", "file", ",", " ", "and", " ", "compare", " ", "hashe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "reci", "evi", "ng", " ", "data", " ", "over", " ", "std", "in", ",", " ", "the", " ", "part", "s", " ", "must", " ", "be", " ", "sequential", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", " ", "first", " ", "must", " ", "start", " ", "at", " ", "0.", " ", "For", " ", "file", ",", " ", "we", " ", "can", " ", "use", " ", "the", " ", "seek", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "to", " ", "handle", " ", "non", "-", "sequential", " ", "part", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "part_", "in_", "list", "\\u", "part", "s", "\\u", "response_", "[_", "'", "Part", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "start_", ",_", "stop_", "=_", "(_", "int_", "(_", "p_", ")_", "for_", "p_", "in_", "part_", "[_", "'", "Range", "In", "Byte", "s", "'_", "]_", "._", "split_", "(_", "'-'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "start_", "==_", "current", "\\u", "position_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "stdin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cann", "ot", " ", "verify", " ", "non", "-", "sequential", " ", "upload", " ", "data", " ", "from", " ", "std", "in", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Resu", "me", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "reader_", "._", "seek_", "(_", "start_", ")_", "\\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_", "mma", "pped", "\\u", "file_", "and_", "stop_", ">_", "mma", "pped", "\\u", "file_", "._", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "File", " ", "doe", "s", " ", "not", " ", "match", " ", "uploade", "d", " ", "data", ";", " ", "plea", "se", " ", "check", " ", "your", " ", "upload", "id", " ", "and", " ", "try", " ", "again", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "'", "File", " ", "is", " ", "small", "er", " ", "than", " ", "uploade", "d", " ", "data", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Resu", "me", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "read", " ", "the", " ", "chunk", " ", "of", " ", "data", ",", " ", "and", " ", "take", " ", "the", " ", "hash", " ", "if", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "receive", "d", " ", "anyt", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "data", " ", "or", " ", "hash", " ", "mism", "atch", ",", " ", "stop", " ", "checking", " ", "raise", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "reader_", "._", "read_", "(_", "stop_", "-_", "start_", ")_", "if_", "reader_", "else_", "mma", "pped", "\\u", "file_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data\\u", "hash_", "=_", "gla", "cier", "core", "calls_", "._", "tree", "\\u", "hash_", "(_", "gla", "cier", "core", "calls_", "._", "chunk", "\\u", "hashes_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gla", "cier", "core", "calls_", "._", "bytes", "\\u", "to", "\\u", "hex_", "(_", "data\\u", "hash_", ")_", "==_", "part_", "[_", "'", "SHA", "256", "Tree", "Hash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Part", " ", "%", "s", " ", "hash", " ", "matche", "s", ".'_", "%_", "part_", "[_", "'", "Range", "In", "Byte", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "tree", "\\u", "hashes_", "._", "append_", "(_", "data\\u", "hash_", ")_", "\\u\\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_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Receive", "d", " ", "data", " ", "doe", "s", " ", "not", " ", "match", " ", "uploade", "d", " ", "data", ";", " ", "plea", "se", " ", "check", " ", "your", " ", "upload", "id", " ", "and", " ", "try", " ", "again", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "'", "SHA", "256", " ", "hash", " ", "mism", "atch", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Resu", "me", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "Inp", "ut", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Receive", "d", " ", "data", " ", "doe", "s", " ", "not", " ", "match", " ", "uploade", "d", " ", "data", ";", " ", "plea", "se", " ", "check", " ", "your", " ", "upload", "id", " ", "and", " ", "try", " ", "again", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cause_", "=_", "'", "No", " ", "or", " ", "not", " ", "eno", "ugh", " ", "data", " ", "to", " ", "match", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "'", "Resu", "me", "Error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "position_", "+=_", "stop_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "marker", " ", "is", " ", "presen", "t", ",", " ", "this", " ", "means", " ", "there", " ", "are", " ", "more", " ", "pages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "part", "s", " ", "avail", "able", ".", " ", "If", " ", "no", " ", "marker", ",", " ", "we", " ", "have", " ", "the", " ", "last", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "marker_", "=_", "list", "\\u", "part", "s", "\\u", "response_", "[_", "'", "Mark", "er", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "uploade", "d\\u", "size_", "=_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "marker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "total", "\\u", "size_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "'", "Check", "ed", " ", "%", "s", " ", "of", " ", "%", "s", " ", "(%", "s", "%%", ").'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "total", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "bold_", "(_", "str_", "(_", "int_", "(_", "100_", "*_", "writer_", "._", "uploade", "d\\u", "size_", "/_", "total", "\\u", "size_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "'", "Check", "ed", " ", "%", "s", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finish", "ed", " ", "checking", ";", " ", "log", " ", "this", " ", "and", " ", "print", " ", "the", " ", "final", " ", "status", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "resum", "ing", " ", "the", " ", "upload", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "'", "Al", "read", "y", " ", "uploade", "d", ":", " ", "%", "s", ".", " ", "Continu", "ing", " ", "from", " ", "there", ".'_", "%_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "stop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "\\u", "size_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Check", "ed", " ", "%", "s", " ", "of", " ", "%", "s", " ", "(%", "s", "%%", ").", " ", "Check", " ", "don", "e", ";", " ", "resum", "ing", " ", "upload", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "total", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "bold_", "(_", "str_", "(_", "int_", "(_", "100_", "*_", "writer_", "._", "uploade", "d\\u", "size_", "/_", "total", "\\u", "size_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Check", "ed", " ", "%", "s", ".", " ", "Check", " ", "don", "e", ";", " ", "resum", "ing", " ", "upload", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "file", " ", "in", " ", "part", "s", " ", "so", " ", "we", " ", "don", "'", "t", " ", "fill", " ", "the", " ", "whole", " ", "memory", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "time_", "=_", "current", "\\u", "time_", "=_", "previ", "ous", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "bytes_", "=_", "writer_", "._", "uploade", "d\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "part_", "=_", "reader_", "._", "read_", "(_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", ")_", "\\u\\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_", "mma", "pped", "\\u", "file_", "._", "size_", ">_", "writer_", "._", "uploade", "d\\u", "size_", "+_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "part_", "=_", "mma", "pped", "\\u", "file_", "[_", "writer_", "._", "uploade", "d\\u", "size_", ":_", "writer_", "._", "uploade", "d\\u", "size_", "+_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "part_", "=_", "mma", "pped", "\\u", "file_", "[_", "writer_", "._", "uploade", "d\\u", "size_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "part_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "write_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "rate_", "=_", "int_", "(_", "(_", "writer_", "._", "uploade", "d\\u", "size_", "-_", "start", "\\u", "bytes_", ")_", "/_", "(_", "current", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total", "\\u", "size_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "transfer", " ", "rate", "s", " ", "in", " ", "bytes", " ", "per", " ", "second", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "rate_", "=_", "int_", "(_", "part", "\\u", "size", "\\u", "in", "\\u", "bytes_", "/_", "(_", "current", "\\u", "time_", "-_", "previ", "ous", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Estimat", "e", " ", "finish", " ", "time", ",", " ", "based", " ", "on", " ", "over", "all", " ", "transfer", " ", "rate", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "over", "all", "\\u", "rate_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "left_", "=_", "(_", "total", "\\u", "size_", "-_", "writer_", "._", "uploade", "d\\u", "size_", ")_", "/_", "over", "all", "\\u", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eta", "\\u", "seconds_", "=_", "current", "\\u", "time_", "+_", "time", "\\u", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "datetime_", "._", "fromtimestamp_", "(_", "eta", "\\u", "seconds_", ")_", "._", "day_", "is_", "not_", "datetime_", "._", "now_", "(_", ")_", "._", "day_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "eta", "\\u", "template_", "=_", "\"%", "a", ",", " ", "%", "d", " ", "%", "b", ",", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "eta", "\\u", "template_", "=_", "\"%", "H", ":", "%", "M", ":", "%", "S", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eta_", "=_", "time_", "._", "strftime_", "(_", "eta", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "localtime_", "(_", "eta", "\\u", "seconds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "left_", "=_", "\"", "Un", "know", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eta_", "=_", "\"", "Un", "know", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "'", "Wro", "te", " ", "%", "s", " ", "of", " ", "%", "s", " ", "(%", "s", "%%", ").", " ", "Rat", "e", " ", "%", "s", "/", "s", ",", " ", "averag", "e", " ", "%", "s", "/", "s", ",", " ", "ETA", " ", "%", "s", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "total", "\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "bold_", "(_", "str_", "(_", "int_", "(_", "100_", "*_", "writer_", "._", "uploade", "d\\u", "size_", "/_", "total", "\\u", "size_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "current", "\\u", "rate_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "over", "all", "\\u", "rate_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", ")_", "\\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 ", " _", "msg_", "=_", "'", "Wro", "te", " ", "%", "s", ".", " ", "Rat", "e", " ", "%", "s", "/", "s", ".'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "over", "all", "\\u", "rate_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "previ", "ous", "\\u", "time_", "=_", "current", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "writer_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "stdin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "over", "all", "\\u", "rate_", "=_", "int_", "(_", "writer_", "._", "uploade", "d\\u", "size_", "/_", "(_", "current", "\\u", "time_", "-_", "start", "\\u", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "'", "Wro", "te", " ", "%", "s", ".", " ", "Rat", "e", " ", "%", "s", "/", "s", ".\\\\", "n", "'_", "%_", "(_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "writer_", "._", "uploade", "d\\u", "size_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "size", "\\u", "fmt_", "(_", "over", "all", "\\u", "rate_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "progress_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "archive", "\\u", "id_", "=_", "writer_", "._", "get", "\\u", "archive", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sha2", "56", "hash_", "=_", "writer_", "._", "get", "\\u", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "writer_", "._", "get", "\\u", "location_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "book", "keep", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "'", "Writ", "ing", " ", "upload", " ", "informati", "on", " ", "int", "o", " ", "the", " ", "book", "keep", "ing", " ", "databa", "se", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "alternative", " ", "name", " ", "as", " ", "give", "n", " ", "by", " ", "--", "name", " ", "<", "name", ">", " ", "if", " ", "we", " ", "have", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "name_", "=_", "alternative", "\\u", "name_", "if_", "alternative", "\\u", "name_", "else_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "still", " ", "no", " ", "name", " ", "this", " ", "is", " ", "an", " ", "std", "in", " ", "job", ",", " ", "so", " ", "set", " ", "name", " ", "according", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "name_", "=_", "file", "\\u", "name_", "if_", "file", "\\u", "name_", "else_", "'", "Data", " ", "from", " ", "std", "in", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "attrs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "region", "'_", ":_", "region_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vau", "lt", "'_", ":_", "vau", "lt", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filename", "'_", ":_", "file", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "archive", "\\u", "id", "'_", ":_", "archive", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "location_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "'%", "s", "'_", "%_", "datetime_", "._", "utcnow_", "(_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "pytz_", "._", "utc_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hash", "'_", ":_", "sha2", "56", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "writer_", "._", "uploade", "d\\u", "size_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "if", " ", "file", "\\u", "name", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "file", "\\u", "attr", "s", "['", "filename", "']", " ", "=", " ", "file", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "eli", "f", " ", "std", "in", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "file", "\\u", "attr", "s", "['", "filename", "']", " ", "=", " ", "'", "data", " ", "from", " ", "std", "in", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sdb", "\\u", "domain_", "._", "put", "\\u", "attributes_", "(_", "file", "\\u", "attrs_", "[_", "'", "filename", "'_", "]_", ",_", "file", "\\u", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "archive", "\\u", "id_", ",_", "sha2", "56", "hash_", ")_", "\\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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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 ]
Except block handles 'BaseException'
datastax/python-driver/tests/unit/test_util_types.py
[ { "content": "# Copyright 2013-2016 DataStax, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest # noqa\n\nimport datetime\n\nfrom cassandra.util import Date, Time\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Data", "Sta", "x", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest2_", "as_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "unittest_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cassandra_", "._", "util_", "import_", "Date_", ",_", "Time_", "\\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 ]
Missing call to `__init__` during object initialization
snare/voltron/voltron/plugins/debugger/dbg_vdb.py
[ { "content": " class NotAStringError(Exception):\n pass", "metadata": "root.NotAStringError", "header": "['module', '___EOS___']", "index": 25 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Not", "AS", "tring", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
imwilsonxu/fbone/fbone/config.py
[ { "content": "class DefaultConfig(BaseConfig):\n\n DEBUG = True\n\n # Flask-Sqlalchemy: http://packages.python.org/Flask-SQLAlchemy/config.html\n SQLALCHEMY_ECHO = True\n # SQLITE for prototyping.\n SQLALCHEMY_DATABASE_URI = 'sqlite:///' + INSTANCE_FOLDER_PATH + '/db.sqlite'\n # MYSQL for production.\n #SQLALCHEMY_DATABASE_URI = 'mysql://username:password@server/db?charset=utf8'\n\n # Flask-babel: http://pythonhosted.org/Flask-Babel/\n ACCEPT_LANGUAGES = ['zh']\n BABEL_DEFAULT_LOCALE = 'en'\n\n # Flask-cache: http://pythonhosted.org/Flask-Cache/\n CACHE_TYPE = 'simple'\n CACHE_DEFAULT_TIMEOUT = 60\n\n # Flask-mail: http://pythonhosted.org/flask-mail/\n # https://bitbucket.org/danjac/flask-mail/issue/3/problem-with-gmails-smtp-server\n MAIL_DEBUG = DEBUG\n MAIL_SERVER = 'smtp.gmail.com'\n MAIL_PORT = 587\n MAIL_USE_TLS = True\n MAIL_USE_SSL = False\n # Should put MAIL_USERNAME and MAIL_PASSWORD in production under instance folder.\n MAIL_USERNAME = '[email protected]'\n MAIL_PASSWORD = 'yourpass'\n MAIL_DEFAULT_SENDER = MAIL_USERNAME\n\n # Flask-openid: http://pythonhosted.org/Flask-OpenID/\n OPENID_FS_STORE_PATH = os.path.join(INSTANCE_FOLDER_PATH, 'openid')\n make_dir(OPENID_FS_STORE_PATH)", "metadata": "root.DefaultConfig", "header": "['module', '___EOS___']", "index": 34 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Default", "Config_", "(_", "Base", "Config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "Sq", "lal", "chem", "y", ":", " ", "http", "://", "package", "s", ".", "python", ".", "org", "/", "Fla", "sk", "-", "SQL", "Al", "chem", "y", "/", "config", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "SQL", "ALC", "HEM", "Y", "\\u", "ECHO", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "SQL", "ITE", " ", "for", " ", "protot", "ypi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "SQL", "ALC", "HEM", "Y", "\\u", "DATA", "BASE", "\\u", "URI_", "=_", "'", "sql", "ite", ":///", "'_", "+_", "INSTANCE", "\\u", "FOLDER", "\\u", "PATH_", "+_", "'/", "db", ".", "sql", "ite", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "MYSQL", " ", "for", " ", "producti", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "SQL", "ALC", "HEM", "Y", "\\u", "DATA", "BASE", "\\u", "URI", " ", "=", " ", "'", "mysql", "://", "user", "name", ":", "password", "@", "server", "/", "db", "?", "charset", "=", "utf", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "babel", ":", " ", "http", "://", "python", "hoste", "d", ".", "org", "/", "Fla", "sk", "-", "Bab", "el", "/_", "\\u\\u\\uNL\\u\\u\\u_", "ACCEPT", "\\u", "LANGUAGES_", "=_", "[_", "'", "zh", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BA", "BEL", "\\u", "DEF", "AUL", "T", "\\u", "LOCALE", "_", "=_", "'", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "cache", ":", " ", "http", "://", "python", "hoste", "d", ".", "org", "/", "Fla", "sk", "-", "Cache", "/_", "\\u\\u\\uNL\\u\\u\\u_", "CACHE", "\\u", "TYPE_", "=_", "'", "simple", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CACHE", "\\u", "DEF", "AUL", "T", "\\u", "TIMEOUT_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "mail", ":", " ", "http", "://", "python", "hoste", "d", ".", "org", "/", "fla", "sk", "-", "mail", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "bitb", "ucket", ".", "org", "/", "dan", "jac", "/", "fla", "sk", "-", "mail", "/", "issue", "/", "3", "/", "problem", "-", "with", "-", "gma", "il", "s", "-", "smt", "p", "-", "server_", "\\u\\u\\uNL\\u\\u\\u_", "MAIL", "\\u", "DEBUG_", "=_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "SERVER_", "=_", "'", "smt", "p", ".", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "PORT_", "=_", "587", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "USE", "\\u", "TLS", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "USE", "\\u", "SSL_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "put", " ", "MAIL", "\\u", "USER", "NAME", " ", "and", " ", "MAIL", "\\u", "PASS", "WORD", " ", "in", " ", "producti", "on", " ", "under", " ", "instance", " ", "folder", "._", "\\u\\u\\uNL\\u\\u\\u_", "MAIL", "\\u", "USERNAME_", "=_", "'", "your", "mail", "@", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "PASSWORD_", "=_", "'", "your", "pass", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAIL", "\\u", "DEF", "AUL", "T", "\\u", "SEND", "ER_", "=_", "MAIL", "\\u", "USERNAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "openid", ":", " ", "http", "://", "python", "hoste", "d", ".", "org", "/", "Fla", "sk", "-", "Open", "ID", "/_", "\\u\\u\\uNL\\u\\u\\u_", "OPEN", "ID", "\\u", "FS", "\\u", "STORE", "\\u", "PATH_", "=_", "os_", "._", "path_", "._", "join_", "(_", "INSTANCE", "\\u", "FOLDER", "\\u", "PATH_", ",_", "'", "openid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "make", "\\u", "dir_", "(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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 ]
Unused local variable
codebox/markov-text/sql.py
[ { "content": "class Sql:\n WORD_COL_NAME_PREFIX = 'word'\n COUNT_COL_NAME = 'count'\n WORD_TABLE_NAME = 'word'\n INDEX_NAME = 'i_word'\n PARAM_TABLE_NAME = 'param'\n KEY_COL_NAME = 'name'\n VAL_COL_NAME = 'value'\n \n \n \n\n \n \n \n\n \n \n \n \n ", "metadata": "root.Sql", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "class_", "Sql_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "WORD", "\\u", "COL", "\\u", "NAME", "\\u", "PREFIX_", "=_", "'", "word", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COUNT", "\\u", "COL", "\\u", "NAME_", "=_", "'", "count", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORD", "\\u", "TAB", "LE", "\\u", "NAME_", "=_", "'", "word", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INDE", "X", "\\u", "NAME_", "=_", "'", "i", "\\u", "word", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PARAM", "\\u", "TAB", "LE", "\\u", "NAME_", "=_", "'", "param", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "KEY", "\\u", "COL", "\\u", "NAME_", "=_", "'", "name", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VAL", "\\u", "COL", "\\u", "NAME_", "=_", "'", "value", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
ecdavis/pants/pants/server.py
[ { "content": " def __init__(self, engine, server, addr, backlog):\n Server.__init__(self, engine=engine)\n self.server = server\n\n # Now, listen our way.\n if server._socket.family == socket.AF_INET6:\n family = socket.AF_INET\n else:\n family = socket.AF_INET6\n\n sock = socket.socket(family, socket.SOCK_STREAM)\n self._socket_set(sock)\n self.engine.add_channel(self)\n\n try:\n self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)\n except AttributeError:\n pass\n\n try:\n self._socket_bind(addr)\n self._socket_listen(backlog)\n except socket.error as err:\n self.close()\n raise\n\n self._remote_address = None\n self._local_address = None\n\n self.listening = True\n\n self.on_accept = self.server.on_accept", "metadata": "root._SlaveServer.__init__", "header": "['class', '_SlaveServer', '(', 'Server', ')', ':', '___EOS___']", "index": 498 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "\\u", "Sla", "ve", "Server_", "(_", "Server_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "engine_", ",_", "server_", ",_", "addr_", ",_", "backlog", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Server_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "engine_", "=_", "engine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "listen", " ", "our", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "server_", "._", "\\u", "socket_", "._", "family_", "==_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "socket_", "._", "AF", "\\u", "INET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "family_", "=_", "socket_", "._", "AF", "\\u", "INE", "T6", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "family_", ",_", "socket_", "._", "SOCK", "\\u", "STREAM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket", "\\u", "set_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "engine_", "._", "add", "\\u", "channel_", "(_", "self_", ")_", "\\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_", "._", "\\u", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "PORT_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "socket", "\\u", "bind_", "(_", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket", "\\u", "listen_", "(_", "backlog", "_", ")_", "\\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 ", " _", "self_", "._", "close_", "(_", ")_", "\\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_", "self_", "._", "\\u", "remote", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "local", "\\u", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "listen", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "on", "\\u", "accept_", "=_", "self_", "._", "server_", "._", "on", "\\u", "accept_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django/django/django/contrib/sites/requests.py
[ { "content": "from __future__ import unicode_literals\n\nfrom django.utils.encoding import python_2_unicode_compatible\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@python_2_unicode_compatible\nclass RequestSite(object):\n \"\"\"\n A class that shares the primary interface of Site (i.e., it has\n ``domain`` and ``name`` attributes) but gets its data from a Django\n HttpRequest object rather than from a database.\n\n The save() and delete() methods raise NotImplementedError.\n \"\"\"\n\n\n", "metadata": "root.RequestSite", "header": "['module', '___EOS___']", "index": 5 }, { "content": " def __init__(self, request):\n self.domain = self.name = request.get_host()", "metadata": "root.RequestSite.__init__", "header": "['class', 'RequestSite', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def __str__(self):\n return self.domain", "metadata": "root.RequestSite.__str__", "header": "['class', 'RequestSite', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": " def save(self, force_insert=False, force_update=False):\n raise NotImplementedError('RequestSite cannot be saved.')", "metadata": "root.RequestSite.save", "header": "['class', 'RequestSite', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def delete(self):\n raise NotImplementedError('RequestSite cannot be deleted.')", "metadata": "root.RequestSite.delete", "header": "['class', 'RequestSite', '(', 'object', ')', ':', '___EOS___']", "index": 23 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\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_", "@_", "python", "\\u", "2", "\\u", "unicode", "\\u", "compatible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Request", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "class", " ", "tha", "t", " ", "share", "s", " ", "the", " ", "primary", " ", "interface", " ", "of", " ", "Site", " ", "(", "i", ".", "e", ".,", " ", "it", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "``", "domain", "``", " ", "and", " ", "``", "name", "``", " ", "attribute", "s", ")", " ", "but", " ", "gets", " ", "its", " ", "data", " ", "from", " ", "a", " ", "Dj", "ang", "o", "\\", "10", ";", " ", " ", " ", " ", "Http", "Request", " ", "object", " ", "rat", "her", " ", "than", " ", "from", " ", "a", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "save", "()", " ", "and", " ", "delete", "()", " ", "method", "s", " ", "raise", " ", "Not", "Impl", "ement", "ed", "Error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Request", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "domain_", "=_", "self_", "._", "name_", "=_", "request_", "._", "get", "\\u", "host_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "force", "\\u", "insert_", "=_", "False_", ",_", "force", "\\u", "update_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Request", "Site", " ", "cann", "ot", " ", "be", " ", "saved", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Site_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "Request", "Site", " ", "cann", "ot", " ", "be", " ", "delete", "d", ".'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
django-nonrel/djangoappengine/djangoappengine/tests/test_mapreduce.py
[ { "content": "from django.db import models\nfrom django.test import TestCase\nfrom django.utils import unittest\n\nfrom google.appengine.api.datastore import Key\n\ntry:\n from djangoappengine.mapreduce.input_readers import DjangoModelInputReader, DjangoModelIterator\n\n import mapreduce\n\n from mapreduce import input_readers\n from mapreduce.lib import key_range\n from mapreduce import model\nexcept ImportError:\n mapreduce = None\n\n\nENTITY_KIND = '%s.%s' % (TestModel.__module__, TestModel.__name__)\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestModel(models.Model):\n test_property = models.IntegerField(default=0)\n", "metadata": "root.TestModel", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __unicode__(self):\n return str(self.test_property)", "metadata": "root.TestModel.__unicode__", "header": "['class', 'TestModel', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 20 }, { "content": "def key(entity_id, kind=TestModel):\n return Key.from_path(kind._meta.db_table, entity_id)", "metadata": "root.key", "header": "['module', '___EOS___']", "index": 25 }, { "content": "@unittest.skipUnless(mapreduce, 'mapreduce not installed')\nclass DjangoModelInputReaderTest(TestCase):\n \"\"\"Test DjangoModelInputReader class.\"\"\"\n\n\n\n\n", "metadata": "root.DjangoModelInputReaderTest", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def testValidate_Passes(self):\n \"\"\"Test validate function accepts valid parameters.\"\"\"\n params = {\n \"entity_kind\": ENTITY_KIND,\n }\n mapper_spec = model.MapperSpec(\n \"FooHandler\",\n \"djangoappengine.mapreduce.input_readers.DjangoModelInputReader\",\n params, 1)\n DjangoModelInputReader.validate(mapper_spec)", "metadata": "root.DjangoModelInputReaderTest.testValidate_Passes", "header": "['class', 'DjangoModelInputReaderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def testValidate_NoEntityFails(self):\n \"\"\"Test validate function raises exception with no entity parameter.\"\"\"\n params = {}\n mapper_spec = model.MapperSpec(\n \"FooHandler\",\n \"djangoappengine.mapreduce.input_readers.DjangoModelInputReader\",\n params, 1)\n self.assertRaises(input_readers.BadReaderParamsError,\n DjangoModelInputReader.validate,\n mapper_spec)", "metadata": "root.DjangoModelInputReaderTest.testValidate_NoEntityFails", "header": "['class', 'DjangoModelInputReaderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def testValidate_BadEntityKind(self):\n \"\"\"Test validate function with bad entity kind.\"\"\"\n params = {\n \"entity_kind\": \"foo\",\n }\n mapper_spec = model.MapperSpec(\n \"FooHandler\",\n \"djangoappengine.mapreduce.input_readers.DjangoModelInputReader\",\n params, 1)\n self.assertRaises(input_readers.BadReaderParamsError,\n DjangoModelInputReader.validate,\n mapper_spec)", "metadata": "root.DjangoModelInputReaderTest.testValidate_BadEntityKind", "header": "['class', 'DjangoModelInputReaderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def testValidate_BadNamespace(self):\n \"\"\"Test validate function with bad namespace.\"\"\"\n params = {\n \"entity_kind\": ENTITY_KIND,\n \"namespace\": 'namespace',\n }\n mapper_spec = model.MapperSpec(\n \"FooHandler\",\n \"djangoappengine.mapreduce.input_readers.DjangoModelInputReader\",\n params, 1)\n self.assertRaises(input_readers.BadReaderParamsError,\n DjangoModelInputReader.validate,\n mapper_spec)", "metadata": "root.DjangoModelInputReaderTest.testValidate_BadNamespace", "header": "['class', 'DjangoModelInputReaderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 67 }, { "content": " def testGeneratorWithKeyRange(self):\n \"\"\"Test DjangoModelInputReader as generator using KeyRanges.\"\"\"\n expected_entities = []\n for i in range(0, 100):\n entity = TestModel(test_property=i)\n entity.save()\n expected_entities.append(entity)\n\n params = {\n \"entity_kind\": ENTITY_KIND,\n }\n mapper_spec = model.MapperSpec(\n \"FooHandler\",\n \"djangoappengine.mapreduce.input_readers.DjangoModelInputReader\",\n params, 1)\n\n input_ranges = DjangoModelInputReader.split_input(mapper_spec)\n\n entities = []\n for query_range in input_ranges:\n for entity in query_range:\n entities.append(entity)\n\n self.assertEquals(100, len(entities))\n self.assertEquals(expected_entities, entities)", "metadata": "root.DjangoModelInputReaderTest.testGeneratorWithKeyRange", "header": "['class', 'DjangoModelInputReaderTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": "@unittest.skipUnless(mapreduce, 'mapreduce not installed')\nclass DjangoModelIteratorTest(TestCase):\n", "metadata": "root.DjangoModelIteratorTest", "header": "['module', '___EOS___']", "index": 107 }, { "content": " def setUp(self):\n expected_entities = []\n for i in range(0, 100):\n entity = TestModel(test_property=i)\n entity.save()\n expected_entities.append(entity)\n\n self.expected_entities = expected_entities", "metadata": "root.DjangoModelIteratorTest.setUp", "header": "['class', 'DjangoModelIteratorTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 109 }, { "content": " def testCursors(self):\n qs = model.QuerySpec(TestModel, model_class_path=ENTITY_KIND)\n kr = key_range.KeyRange(key_start=key(1), key_end=key(10000), direction=\"ASC\")\n\n json = { 'key_range': kr.to_json(), 'query_spec': qs.to_json(), 'cursor': None }\n\n entities = []\n while True:\n model_iter = DjangoModelIterator.from_json(json)\n\n c = False\n count = 0\n for entity in model_iter:\n count += 1\n entities.append(entity)\n if count == 10:\n c = True\n break\n\n if c:\n json = model_iter.to_json()\n else:\n break\n\n self.assertEquals(100, len(entities))\n self.assertEquals(self.expected_entities, entities)", "metadata": "root.DjangoModelIteratorTest.testCursors", "header": "['class', 'DjangoModelIteratorTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 118 } ]
[]
[]
0
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_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "._", "datastore_", "import_", "Key_", "\\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_", "django", "appengine_", "._", "mapreduce", "_", "._", "input", "\\u", "readers_", "import_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", ",_", "Dj", "ang", "o", "Model", "Iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mapreduce", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "input", "\\u", "readers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "._", "lib_", "import_", "key", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "model_", "\\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 ", " _", "mapreduce", "_", "=_", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ENTITY", "\\u", "KIND", "_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "Test", "Model_", "._", "\\u\\u", "module\\u\\u_", ",_", "Test", "Model_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Model_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "property_", "=_", "models_", "._", "Integer", "Field_", "(_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Model_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "str_", "(_", "self_", "._", "test\\u", "property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "key_", "(_", "entity", "\\u", "id_", ",_", "kind_", "=_", "Test", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Key_", "._", "from", "\\u", "path_", "(_", "kind_", "._", "\\u", "meta_", "._", "db", "\\u", "table_", ",_", "entity", "\\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_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "mapreduce", "_", ",_", "'", "mapreduce", " ", "not", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test", "Validate", "\\u", "Passe", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "validat", "e", " ", "function", " ", "accepts", " ", "valid", " ", "parameter", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entity", "\\u", "kind", "\"_", ":_", "ENTITY", "\\u", "KIND", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Handle", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", "appengine", ".", "mapreduce", ".", "input", "\\u", "reader", "s", ".", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", "._", "validate_", "(_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Validate", "\\u", "No", "Entit", "y", "Fail", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "validat", "e", " ", "function", " ", "raise", "s", " ", "exception", " ", "with", " ", "no", " ", "entity", " ", "parameter", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Handle", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", "appengine", ".", "mapreduce", ".", "input", "\\u", "reader", "s", ".", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "input", "\\u", "readers_", "._", "Ba", "d", "Read", "er", "Param", "s", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", "._", "validate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Validate", "\\u", "Ba", "d", "Entit", "y", "Kind_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "validat", "e", " ", "function", " ", "with", " ", "bad", " ", "entity", " ", "kind", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entity", "\\u", "kind", "\"_", ":_", "\"", "foo", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Handle", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", "appengine", ".", "mapreduce", ".", "input", "\\u", "reader", "s", ".", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "input", "\\u", "readers_", "._", "Ba", "d", "Read", "er", "Param", "s", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", "._", "validate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Validate", "\\u", "Ba", "d", "Namespace_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "validat", "e", " ", "function", " ", "with", " ", "bad", " ", "namespace", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entity", "\\u", "kind", "\"_", ":_", "ENTITY", "\\u", "KIND", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "namespace", "\"_", ":_", "'", "namespace", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Handle", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", "appengine", ".", "mapreduce", ".", "input", "\\u", "reader", "s", ".", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "input", "\\u", "readers_", "._", "Ba", "d", "Read", "er", "Param", "s", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", "._", "validate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Generat", "or", "With", "Key", "Range_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", " ", "as", " ", "generat", "or", " ", "usi", "ng", " ", "Key", "Range", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "entities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "=_", "Test", "Model_", "(_", "test\\u", "property_", "=_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "entities_", "._", "append_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "entity", "\\u", "kind", "\"_", ":_", "ENTITY", "\\u", "KIND", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Foo", "Handle", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "django", "appengine", ".", "mapreduce", ".", "input", "\\u", "reader", "s", ".", "Dj", "ang", "o", "Model", "Inp", "ut", "Read", "er", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "ranges_", "=_", "Dj", "ang", "o", "Model", "Inp", "ut", "Reader_", "._", "split", "\\u", "input_", "(_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "entities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "query", "\\u", "range_", "in_", "input", "\\u", "ranges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "entity_", "in_", "query", "\\u", "range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entities_", "._", "append_", "(_", "entity_", ")_", "\\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_", "._", "assert", "Equals_", "(_", "100_", ",_", "len_", "(_", "entities_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "expected", "\\u", "entities_", ",_", "entities_", ")_", "\\u\\u\\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_", "@_", "unittest_", "._", "skip", "Unless_", "(_", "mapreduce", "_", ",_", "'", "mapreduce", " ", "not", " ", "install", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Dj", "ang", "o", "Model", "Iterat", "or", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Iterat", "or", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "entities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "=_", "Test", "Model_", "(_", "test\\u", "property_", "=_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "entities_", "._", "append_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "expected", "\\u", "entities_", "=_", "expected", "\\u", "entities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dj", "ang", "o", "Model", "Iterat", "or", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Curs", "ors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qs_", "=_", "model_", "._", "Query", "Spec_", "(_", "Test", "Model_", ",_", "model", "\\u", "class", "\\u", "path_", "=_", "ENTITY", "\\u", "KIND", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kr", "_", "=_", "key", "\\u", "range_", "._", "Key", "Range_", "(_", "key", "\\u", "start_", "=_", "key_", "(_", "1_", ")_", ",_", "key", "\\u", "end_", "=_", "key_", "(_", "10000_", ")_", ",_", "direction_", "=_", "\"", "ASC", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "=_", "{_", "'", "key", "\\u", "range", "'_", ":_", "kr", "_", "._", "to", "\\u", "json_", "(_", ")_", ",_", "'", "query", "\\u", "spec", "'_", ":_", "qs_", "._", "to", "\\u", "json_", "(_", ")_", ",_", "'", "cursor", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "entities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model", "\\u", "iter_", "=_", "Dj", "ang", "o", "Model", "Iterator_", "._", "from", "\\u", "json_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity_", "in_", "model", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entities_", "._", "append_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", "==_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "c_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "=_", "model", "\\u", "iter_", "._", "to", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "100_", ",_", "len_", "(_", "entities_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "expected", "\\u", "entities_", ",_", "entities_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
pallets/werkzeug/examples/cupoftee/application.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"\n cupoftee.application\n ~~~~~~~~~~~~~~~~~~~~\n\n The WSGI appliction for the cup of tee browser.\n\n :copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.\n :license: BSD, see LICENSE for more details.\n\"\"\"\nimport time\nfrom os import path\nfrom threading import Thread\nfrom cupoftee.db import Database\nfrom cupoftee.network import ServerBrowser\nfrom werkzeug.templates import Template\nfrom werkzeug.wrappers import Request, Response\nfrom werkzeug.wsgi import SharedDataMiddleware\nfrom werkzeug.exceptions import HTTPException, NotFound\nfrom werkzeug.routing import Map, Rule\n\n\ntemplates = path.join(path.dirname(__file__), 'templates')\npages = {}\nurl_map = Map([Rule('/shared/<file>', endpoint='shared')])\n\n\n\n\n\n\n\n\n\n\nfrom cupoftee.pages import MissingPage\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "cup", "oft", "ee", ".", "applica", "tion", "\\", "10", ";", " ", " ", " ", " ", "~~~~~~~~~~~", "~~~~~", "~~~", "~", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "WS", "GI", " ", "appli", "ction", " ", "for", " ", "the", " ", "cup", " ", "of", " ", "tee", " ", "browse", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "200", "9", " ", "by", " ", "the", " ", "Wer", "kz", "eu", "g", " ", "Tea", "m", ",", " ", "see", " ", "AUTHOR", "S", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "license", ":", " ", "BS", "D", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "threading_", "import_", "Thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cup", "oft", "ee_", "._", "db_", "import_", "Database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cup", "oft", "ee_", "._", "network_", "import_", "Server", "Browser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "templates_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "wrappers_", "import_", "Request_", ",_", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "wsgi_", "import_", "Share", "d", "Data", "Middleware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "exceptions_", "import_", "HTTP", "Exception_", ",_", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "routing_", "import_", "Map_", ",_", "Rule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "templates_", "=_", "path_", "._", "join_", "(_", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "template", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "map_", "=_", "Map_", "(_", "[_", "Rule_", "(_", "'/", "shared", "/", "<", "file", ">'_", ",_", "endpoint_", "=_", "'", "shared", "'_", ")_", "]_", ")_", "\\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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 ]
Imprecise assert
anchor/make-magic/tests/test.py
[ { "content": "\tdef test_iterate_item_dependencies(self):\n\t\ttoporder = deptools.GraphDependencyStrategy.iterate_item_dependencies(self.A)\n\t\tself.assertEqual(list(toporder), [self.C,self.B,self.A])", "metadata": "root.GraphStrategyTests.test_iterate_item_dependencies", "header": "['class', 'GraphStrategyTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Graph", "Strat", "eg", "y", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "iterate", "\\u", "item", "\\u", "dependencies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "topo", "rder", "_", "=_", "dept", "ools_", "._", "Graph", "Dependenc", "y", "Strategy_", "._", "iterate", "\\u", "item", "\\u", "dependencies_", "(_", "self_", "._", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "topo", "rder", "_", ")_", ",_", "[_", "self_", "._", "C_", ",_", "self_", "._", "B_", ",_", "self_", "._", "A_", "]_", ")_", "\\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 ]
Testing equality to None
pteichman/cobe/cobe/instatrace.py
[ { "content": "@contextmanager\ndef trace_ms(statName):\n if _instatrace is None:\n yield\n return\n\n # Millisecond resolution, integer now\n now = _instatrace.now_ms()\n yield\n _instatrace.trace(statName, _instatrace.now_ms() - now)", "metadata": "root.trace_ms", "header": "['module', '___EOS___']", "index": 62 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "trace", "\\u", "ms_", "(_", "stat", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "insta", "trace_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Milli", "second", " ", "resolu", "tion", ",", " ", "integ", "er", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "\\u", "insta", "trace_", "._", "now", "\\u", "ms_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "insta", "trace_", "._", "trace_", "(_", "stat", "Name_", ",_", "\\u", "insta", "trace_", "._", "now", "\\u", "ms_", "(_", ")_", "-_", "now_", ")_" ]
[ 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 ]
Unused import
Stiivi/bubbles/bubbles/backends/mongo/ops.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom .objects import MongoDBCollection\n\nfrom ...metadata import *\nfrom ...errors import *\nfrom ...prototypes import *\nfrom ...objects import *\n\n\n\n#############################################################################\n# Metadata Operations\n\n\n#############################################################################\n# Row Operations\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def prepare_mongo_key(key):\n key = prepare_key(key)\n return {name:1 for name in key}", "metadata": "root.prepare_mongo_key", "header": "['module', '___EOS___']", "index": 8 }, { "content": "@field_filter.register(\"mongo\")\ndef _(ctx, obj, keep=None, drop=None, rename=None, filter=None):\n\n if rename:\n raise NotImplementedError(\"Renaming of MongoDB fields is not \"\n \"implemented\")\n\n if filter:\n if keep or drop or rename:\n raise OperationError(\"Either filter or keep, drop, rename should \"\n \"be used\")\n else:\n field_filter = filter\n else:\n field_filter = FieldFilter(keep=keep, drop=drop, rename=rename)\n\n new_fields = field_filter.filter(obj.fields)\n\n # No need to actually do anything just pretend that we have new fields.\n\n return obj.clone(fields=new_fields)", "metadata": "root._", "header": "['module', '___EOS___']", "index": 16 }, { "content": "@distinct.register(\"mongo\")\ndef _(ctx, obj, key=None):\n\n if not key:\n key = obj.fields.names()\n\n key = prepare_mongo_key(key)\n\n new_fields = obj.fields.fields(key)\n cursor = obj.collection.group(key, {}, {}, \"function(obj, prev){}\")\n return IterableRecordsDataSource(cursor, new_fields)", "metadata": "root._", "header": "['module', '___EOS___']", "index": 42 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "objects_", "import_", "Mon", "go", "DB", "Collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "..._", "metadata_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "errors_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "protot", "ypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "objects_", "import_", "*_", "\\u\\u\\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_", "#", " ", "Meta", "data", " ", "Operations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Row", " ", "Operations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e\\u", "mongo", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "prepar", "e\\u", "key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "name_", ":_", "1_", "for_", "name_", "in_", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "field", "\\u", "filter_", "._", "register_", "(_", "\"", "mongo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "ctx_", ",_", "obj_", ",_", "keep_", "=_", "None_", ",_", "drop_", "=_", "None_", ",_", "rename_", "=_", "None_", ",_", "filter_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "rename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Ren", "amin", "g", " ", "of", " ", "Mon", "go", "DB", " ", "fields", " ", "is", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "implemented", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keep_", "or_", "drop_", "or_", "rename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Opera", "tion", "Error_", "(_", "\"", "Ei", "ther", " ", "filter", " ", "or", " ", "keep", ",", " ", "drop", ",", " ", "rename", " ", "shou", "ld", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "filter_", "=_", "filter_", "\\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 ", " _", "field", "\\u", "filter_", "=_", "Field", "Filter_", "(_", "keep_", "=_", "keep_", ",_", "drop_", "=_", "drop_", ",_", "rename_", "=_", "rename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "fields_", "=_", "field", "\\u", "filter_", "._", "filter_", "(_", "obj_", "._", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "need", " ", "to", " ", "actual", "ly", " ", "do", " ", "anyt", "hing", " ", "just", " ", "prete", "nd", " ", "tha", "t", " ", "we", " ", "have", " ", "new", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "obj_", "._", "clone_", "(_", "fields_", "=_", "new", "\\u", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "distinct_", "._", "register_", "(_", "\"", "mongo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u_", "(_", "ctx_", ",_", "obj_", ",_", "key_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "obj_", "._", "fields_", "._", "names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "prepar", "e\\u", "mongo", "\\u", "key_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "fields_", "=_", "obj_", "._", "fields_", "._", "fields_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "obj_", "._", "collection_", "._", "group_", "(_", "key_", ",_", "{_", "}_", ",_", "{_", "}_", ",_", "\"", "function", "(", "obj", ",", " ", "prev", "){", "}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "It", "era", "ble", "Record", "s", "Data", "Source_", "(_", "cursor_", ",_", "new", "\\u", "fields_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
sky-shiny/smolder/charcoal/charcoal.py
[ { "content": " def __repr__(self):\n LOG.debug(self.inputs)\n if \"headers\" in self.inputs:\n if self.inputs[\"headers\"] != '':\n header_list = ['\"{0}: {1}\"'.format(k, v) for k, v in list(self.inputs[\"headers\"].items())]\n header = \"-H \" + (\" -H \".join(header_list))\n else:\n header = self.inputs[\"headers\"]\n else:\n header = ''\n if \"data\" in self.inputs:\n data = '-d' + str(self.inputs[\"data\"])\n else:\n data = ''\n\n if not self.verify and self.test[\"protocol\"] == \"https\":\n curl_insecure = '--insecure'\n else:\n curl_insecure = ''\n\n # Adding curl output to allow simple debugging of the requests\n command = 'curl {curl_insecure} -v -s -o /dev/null {headers} {data} -X {method} \"{uri}\"'\n output = command.format(method=str(self.test['method']).upper(), headers=header, data=data,\n uri=self.inputs['url'], curl_insecure=curl_insecure)\n return output", "metadata": "root.Charcoal.__repr__", "header": "['class', 'Charcoal', '(', 'object', ')', ':', '___EOS___']", "index": 241 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Char", "coal", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "debug_", "(_", "self_", "._", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "header", "s", "\"_", "in_", "self_", "._", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "inputs_", "[_", "\"", "header", "s", "\"_", "]_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header", "\\u", "list_", "=_", "[_", "'\"{", "0", "}:", " ", "{", "1", "}\"'_", "._", "format_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "list_", "(_", "self_", "._", "inputs_", "[_", "\"", "header", "s", "\"_", "]_", "._", "items_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "\"-", "H", " ", "\"_", "+_", "(_", "\"", " ", "-", "H", " ", "\"_", "._", "join_", "(_", "header", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "self_", "._", "inputs_", "[_", "\"", "header", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "data", "\"_", "in_", "self_", "._", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "'-", "d", "'_", "+_", "str_", "(_", "self_", "._", "inputs_", "[_", "\"", "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 ", " _", "data_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "verify_", "and_", "self_", "._", "test_", "[_", "\"", "protoc", "ol", "\"_", "]_", "==_", "\"", "https", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl", "\\u", "insecure", "_", "=_", "'--", "insecure", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curl", "\\u", "insecure", "_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "curl", " ", "output", " ", "to", " ", "allow", " ", "simple", " ", "debugg", "ing", " ", "of", " ", "the", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "'", "curl", " ", "{", "curl", "\\u", "insecure", "}", " ", "-", "v", " ", "-", "s", " ", "-", "o", " ", "/", "dev", "/", "null", " ", "{", "header", "s", "}", " ", "{", "data", "}", " ", "-", "X", " ", "{", "method", "}", " ", "\"{", "uri", "}\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "command_", "._", "format_", "(_", "method_", "=_", "str_", "(_", "self_", "._", "test_", "[_", "'", "method", "'_", "]_", ")_", "._", "upper_", "(_", ")_", ",_", "headers_", "=_", "header_", ",_", "data_", "=_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uri_", "=_", "self_", "._", "inputs_", "[_", "'", "url", "'_", "]_", ",_", "curl", "\\u", "insecure", "_", "=_", "curl", "\\u", "insecure", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Azure/azure-sdk-for-python/azure-mgmt-scheduler/azure/mgmt/scheduler/models/job_collection_definition_paged.py
[ { "content": "# coding=utf-8\n# --------------------------------------------------------------------------\n# Copyright (c) Microsoft and contributors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# 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#\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n# Code generated by Microsoft (R) AutoRest Code Generator.\n# Changes may cause incorrect behavior and will be lost if the code is\n# regenerated.\n# --------------------------------------------------------------------------\n\nfrom msrest.paging import Paged\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class JobCollectionDefinitionPaged(Paged):\n \"\"\"\n A paging container for iterating over a list of JobCollectionDefinition object\n \"\"\"\n\n _attribute_map = {\n 'next_link': {'key': 'nextLink', 'type': 'str'},\n 'current_page': {'key': 'value', 'type': '[JobCollectionDefinition]'}\n }\n", "metadata": "root.JobCollectionDefinitionPaged", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self, *args, **kwargs):\n\n super(JobCollectionDefinitionPaged, self).__init__(*args, **kwargs)", "metadata": "root.JobCollectionDefinitionPaged.__init__", "header": "['class', 'JobCollectionDefinitionPaged', '(', 'Paged', ')', ':', '___EOS___']", "index": 34 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Micro", "soft", " ", "and", " ", "contributor", "s", ".", " ", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "#", "_", "\\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_", "#", " ", "Code", " ", "generat", "ed", " ", "by", " ", "Micro", "soft", " ", "(", "R", ")", " ", "Auto", "Rest", " ", "Code", " ", "Generat", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", "s", " ", "may", " ", "caus", "e", " ", "incorrect", " ", "behavior", " ", "and", " ", "will", " ", "be", " ", "lost", " ", "if", " ", "the", " ", "code", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regenerate", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "msrest_", "._", "paging", "_", "import_", "Page", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Jo", "b", "Collecti", "on", "Definit", "ion", "Page", "d_", "(_", "Page", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "paging", " ", "container", " ", "for", " ", "iterati", "ng", " ", "over", " ", "a", " ", "list", " ", "of", " ", "Jo", "b", "Collecti", "on", "Definit", "ion", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "attribute", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "\\u", "link", "'_", ":_", "{_", "'", "key", "'_", ":_", "'", "next", "Link", "'_", ",_", "'", "type", "'_", ":_", "'", "str", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "page", "'_", ":_", "{_", "'", "key", "'_", ":_", "'", "value", "'_", ",_", "'", "type", "'_", ":_", "'[", "Jo", "b", "Collecti", "on", "Definit", "ion", "]'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Jo", "b", "Collecti", "on", "Definit", "ion", "Page", "d_", "(_", "Page", "d_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Jo", "b", "Collecti", "on", "Definit", "ion", "Page", "d_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
mikrosimage/OpenRenderManagement/src/octopus/core/framework/__init__.py
[ { "content": "import tornado\nimport logging\nimport httplib\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\nfrom octopus.core.framework.wsappframework import WSAppFramework, MainLoopApplication\nfrom octopus.core.framework.webservice import MappingSet\n\nfrom octopus.core.communication.http import Http400\nfrom octopus.core.tools import Workload\n\n\n__all__ = ['WSAppFramework', 'MainLoopApplication']\n__all__ += ['Controller', 'ControllerError', 'ResourceNotFoundErro', 'BaseResource']\n\nlogger = logging.getLogger('main.dispatcher.webservice')\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def queue(func):\n def queued_func(self, *args, **kwargs):\n return self.queueAndWait(func, self, *args, **kwargs)\n return queued_func", "metadata": "root.queue", "header": "['module', '___EOS___']", "index": 21 }, { "content": "class ControllerError(Exception):\n \"\"\"\n Raised by a controller to report a problem. Subclass at will.\n \"\"\"", "metadata": "root.ControllerError", "header": "['module', '___EOS___']", "index": 27 }, { "content": "class ResourceNotFoundError(ControllerError):\n \"\"\"\n Raised by a controller to report access to a missing resource.\n \"\"\"", "metadata": "root.ResourceNotFoundError", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def __init__(self, *args, **kwargs):\n Exception.__init__(self, *args)\n for name, value in kwargs.items():\n setattr(self, name, value)", "metadata": "root.ResourceNotFoundError.__init__", "header": "['class', 'ResourceNotFoundError', '(', 'ControllerError', ')', ':', '___EOS___']", "index": 37 }, { "content": "class Controller(object):\n\n\n\n", "metadata": "root.Controller", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self, framework, root):\n self.framework = framework\n self.root = root\n self.mappings = MappingSet()", "metadata": "root.Controller.__init__", "header": "['class', 'Controller', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def __call__(self, request, path, *args):\n return self.mappings.match(request, path, *args)", "metadata": "root.Controller.__call__", "header": "['class', 'Controller', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def getDispatchTree(self):\n return self.framework.application.dispatchTree", "metadata": "root.Controller.getDispatchTree", "header": "['class', 'Controller', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def map(self, pathPattern, methodDict):\n self.mappings.add((pathPattern, methodDict))", "metadata": "root.Controller.map", "header": "['class', 'Controller', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": "class BaseResource(tornado.web.RequestHandler):\n\n\n\n\n\n\n", "metadata": "root.BaseResource", "header": "['module', '___EOS___']", "index": 60 }, { "content": " def initialize(self, framework):\n self.framework = framework", "metadata": "root.BaseResource.initialize", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 61 }, { "content": " def getDispatchTree(self):\n return self.framework.application.dispatchTree", "metadata": "root.BaseResource.getDispatchTree", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 64 }, { "content": " def get_error_html(self, status_code, exception=None, **kwargs):\n message = httplib.responses[status_code]\n if exception is not None and isinstance(exception, tornado.web.HTTPError):\n message = exception.log_message\n return \"%(code)d: %(message)s\" % {\n \"code\": status_code,\n \"message\": message,\n }", "metadata": "root.BaseResource.get_error_html", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 67 }, { "content": " @property\n def dispatcher(self):\n return self.framework.application", "metadata": "root.BaseResource.dispatcher", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 76 }, { "content": " def getBodyAsJSON(self):\n try:\n if self.request.body == \"\" or self.request.body is None:\n return \"\"\n return json.loads(self.request.body)\n except:\n raise Http400(\"The HTTP body is not a valid JSON object\")", "metadata": "root.BaseResource.getBodyAsJSON", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 80 }, { "content": " def getServerAddress(self):\n server_address = self.request.host.split(':')\n if len(server_address) == 2:\n return server_address[0], server_address[1]\n return server_address[0], \"\"", "metadata": "root.BaseResource.getServerAddress", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 88 }, { "content": " def queueAndWait(self, func, *args):\n workload = Workload(lambda: func(*args))\n self.framework.application.queueWorkload(workload)\n return workload.wait()", "metadata": "root.BaseResource.queueAndWait", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 94 }, { "content": " def writeCallback(self, chunk):\n data = self.request.arguments\n if 'callback' in data:\n chunk = ('%s(%s);' % (data['callback'][0], chunk))\n self.write(chunk)", "metadata": "root.BaseResource.writeCallback", "header": "['class', 'BaseResource', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 99 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "tornado_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "octop", "us_", "._", "core_", "._", "framework_", "._", "ws", "app", "framework_", "import_", "WS", "App", "Framework_", ",_", "Main", "Loop", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "octop", "us_", "._", "core_", "._", "framework_", "._", "webservice", "_", "import_", "Map", "ping", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "octop", "us_", "._", "core_", "._", "communication", "_", "._", "http_", "import_", "Http", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "octop", "us_", "._", "core_", "._", "tools_", "import_", "Work", "load_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "WS", "App", "Frame", "work", "'_", ",_", "'", "Main", "Loop", "Applica", "tion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "+=_", "[_", "'", "Controlle", "r", "'_", ",_", "'", "Controlle", "r", "Error", "'_", ",_", "'", "Reso", "urc", "e", "Not", "Foun", "d", "Err", "o", "'_", ",_", "'", "Base", "Reso", "urc", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "main", ".", "dispatcher", ".", "webservice", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "queue_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "queue", "d\\u", "func_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "queue", "And", "Wait_", "(_", "func_", ",_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "queue", "d\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controlle", "r", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "by", " ", "a", " ", "controlle", "r", " ", "to", " ", "report", " ", "a", " ", "problem", ".", " ", "Subc", "lass", " ", "at", " ", "will", ".", "\\", "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_", "class_", "Reso", "urc", "e", "Not", "Foun", "d", "Error_", "(_", "Controlle", "r", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rai", "sed", " ", "by", " ", "a", " ", "controlle", "r", " ", "to", " ", "report", " ", "access", " ", "to", " ", "a", " ", "missi", "ng", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Not", "Foun", "d", "Error_", "(_", "Controlle", "r", "Error_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Exception_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "kwargs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Controller_", "(_", "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_", ",_", "framework_", ",_", "root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "framework_", "=_", "framework_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "root_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mappings_", "=_", "Map", "ping", "Set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "request_", ",_", "path_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "mappings_", "._", "match_", "(_", "request_", ",_", "path_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Dispa", "tch", "Tree_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "framework_", "._", "application_", "._", "dispatch", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controller_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "map_", "(_", "self_", ",_", "path", "Pattern_", ",_", "method", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mappings_", "._", "add_", "(_", "(_", "path", "Pattern_", ",_", "method", "Dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "initialize_", "(_", "self_", ",_", "framework_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "framework_", "=_", "framework_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Dispa", "tch", "Tree_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "framework_", "._", "application_", "._", "dispatch", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "error", "\\u", "html_", "(_", "self_", ",_", "status", "\\u", "code_", ",_", "exception_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "httplib_", "._", "responses_", "[_", "status", "\\u", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exception_", "is_", "not_", "None_", "and_", "isinstance_", "(_", "exception_", ",_", "tornado_", "._", "web_", "._", "HTTP", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "exception_", "._", "log", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"%", "(", "code", ")", "d", ":", " ", "%", "(", "message", ")", "s", "\"_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "code", "\"_", ":_", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "\"_", ":_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\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_", "dispatcher_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "framework_", "._", "application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bod", "y", "As", "JSON_", "(_", "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 ", " _", "if_", "self_", "._", "request_", "._", "body_", "==_", "\"\"_", "or_", "self_", "._", "request_", "._", "body_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "self_", "._", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http", "400_", "(_", "\"", "The", " ", "HTTP", " ", "body", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "JSO", "N", " ", "object", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Server", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "\\u", "address_", "=_", "self_", "._", "request_", "._", "host_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "server", "\\u", "address_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "server", "\\u", "address_", "[_", "0_", "]_", ",_", "server", "\\u", "address_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "server", "\\u", "address_", "[_", "0_", "]_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "queue", "And", "Wait_", "(_", "self_", ",_", "func_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "workload_", "=_", "Work", "load_", "(_", "lambda_", ":_", "func_", "(_", "*_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "framework_", "._", "application_", "._", "queue", "Work", "load_", "(_", "workload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "workload_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Resource_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "Callback_", "(_", "self_", ",_", "chunk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "request_", "._", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "callback", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "=_", "(_", "'%", "s", "(%", "s", ");'_", "%_", "(_", "data_", "[_", "'", "callback", "'_", "]_", "[_", "0_", "]_", ",_", "chunk_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write_", "(_", "chunk_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
deanhiller/databus/webapp/play1.3.x/python/Lib/symtable.py
[ { "content": " def get_frees(self):\n if self.__frees is None:\n is_free = lambda x:((x >> SCOPE_OFF) & SCOPE_MASK) == FREE\n self.__frees = self.__idents_matching(is_free)\n return self.__frees", "metadata": "root.Function.get_frees", "header": "['class', 'Function', '(', 'SymbolTable', ')', ':', '___NEWLINE___', '___NL___', '# Default values for instance variables', '___NL___', '___EOS___']", "index": 150 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Function_", "(_", "Sym", "bol", "Table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "values", " ", "for", " ", "instance", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "frees", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "frees", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "free_", "=_", "lambda_", "x_", ":_", "(_", "(_", "x_", ">>_", "SCOPE", "\\u", "OFF_", ")_", "&_", "SCOPE", "\\u", "MASK_", ")_", "==_", "FREE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "frees", "_", "=_", "self_", "._", "\\u\\u", "ident", "s", "\\u", "matching_", "(_", "is", "\\u", "free_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "frees", "_", "\\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 ]
Unused import
kmmbvnr/django-any/django_any/tests/field_attr_choices.py
[ { "content": "# -*- coding: utf-8; mode: django -*-\n\"\"\"\nhttps://docs.djangoproject.com/en/1.3/ref/models/fields/#choices\n\"\"\"\nfrom django.test import TestCase\nfrom django.db import models\nfrom django_any import any_field\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AttrChoices(TestCase):\n", "metadata": "root.AttrChoices", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def test_one_case_selection(self):\n \"\"\"\n Even there is only one choice, it should be returned always\n \"\"\"\n field = models.BooleanField(choices=[\n (False, 'This sentence is wrong')])\n\n result = any_field(field)\n\n self.assertEqual(bool, type(result))\n self.assertEqual(False, result)", "metadata": "root.AttrChoices.test_one_case_selection", "header": "['class', 'AttrChoices', '(', 'TestCase', ')', ':', '___EOS___']", "index": 9 }, { "content": " def test_choices_named_groups_support(self):\n \"\"\"\n Group names completely ignored\n \"\"\"\n MEDIA_CHOICES = (\n ('Audio', (\n ('vinyl', 'Vinyl'),\n ('cd', 'CD'),\n )),\n ('Video', (\n ('vhs', 'VHS Tape'),\n ('dvd', 'DVD'),\n )),\n ('unknown', 'Unknown'))\n media = models.CharField(max_length=25, choices=MEDIA_CHOICES)\n\n result = any_field(media)\n\n self.assertTrue(result in ['vinyl', 'cd', 'vhs', 'dvd', 'unknown'])", "metadata": "root.AttrChoices.test_choices_named_groups_support", "header": "['class', 'AttrChoices', '(', 'TestCase', ')', ':', '___EOS___']", "index": 21 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", ";", " ", "mode", ":", " ", "django", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "https", "://", "docs", ".", "django", "project", ".", "com", "/", "en", "/", "1.3", "/", "ref", "/", "model", "s", "/", "fields", "/", "#", "choice", "s", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "any_", "import_", "any", "\\u", "field_", "\\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_", "Attr", "Choices_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Attr", "Choices_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "one", "\\u", "case", "\\u", "selection_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Even", " ", "there", " ", "is", " ", "only", " ", "one", " ", "choice", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "return", "ed", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "choices_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "False_", ",_", "'", "Thi", "s", " ", "sentence", " ", "is", " ", "wrong", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "any", "\\u", "field_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "bool_", ",_", "type_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attr", "Choices_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "choice", "s", "\\u", "named", "\\u", "group", "s", "\\u", "support_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Group", " ", "names", " ", "complete", "ly", " ", "ignore", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MEDIA", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Audi", "o", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "vin", "yl", "'_", ",_", "'", "Vin", "yl", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "cd", "'_", ",_", "'", "CD", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Vid", "eo", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "vh", "s", "'_", ",_", "'", "VH", "S", " ", "Tap", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dvd", "'_", ",_", "'", "DVD", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "unknown", "'_", ",_", "'", "Un", "know", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "media_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "25_", ",_", "choices_", "=_", "MEDIA", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "any", "\\u", "field_", "(_", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "result_", "in_", "[_", "'", "vin", "yl", "'_", ",_", "'", "cd", "'_", ",_", "'", "vh", "s", "'_", ",_", "'", "dvd", "'_", ",_", "'", "unknown", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
google/encrypted-bigquery-client/src/paillier_test.py
[ { "content": " def testEncryptDecryptFloatSmallNormalNumbers(self):\n logging.debug('Running testEncryptDecryptFloatSmallNormalNumbers method.')\n # small positive numbers\n c_1_0 = _PAILLIER1.EncryptFloat(1.0)\n self.assertEquals(1.0, _PAILLIER1.DecryptFloat(c_1_0))\n c_15_1234 = _PAILLIER1.EncryptFloat(15.1234)\n self.assertEquals(15.1234, _PAILLIER1.DecryptFloat(c_15_1234))\n # small negative numbers\n c_1_0neg = _PAILLIER1.EncryptFloat(-1.0)\n self.assertEquals(-1.0, _PAILLIER1.DecryptFloat(c_1_0neg))\n c_15_1234neg = _PAILLIER1.EncryptFloat(-15.1234)\n self.assertEquals(-15.1234, _PAILLIER1.DecryptFloat(c_15_1234neg))\n\n # numbers close to 1.0\n # smallest number > than 1.0\n data = 1.0000000000000002\n c_smallest_gt_1 = _PAILLIER1.EncryptFloat(data)\n self.assertEquals(data,\n _PAILLIER1.DecryptFloat(c_smallest_gt_1))\n self.assertNotEquals(1.0, _PAILLIER1.DecryptFloat(c_smallest_gt_1))\n # smaller than 1.0000000000000002 is rounded to 1.0\n data = 1.0000000000000001\n self.assertEquals(\n 1.0, _PAILLIER1.DecryptFloat(_PAILLIER1.EncryptFloat(data)))\n # negative number < than -1.0\n data = -1.0000000000000002\n c_smallest_lt_1neg = _PAILLIER1.EncryptFloat(data)\n self.assertEquals(data,\n _PAILLIER1.DecryptFloat(c_smallest_lt_1neg))\n self.assertNotEquals(-1.0, _PAILLIER1.DecryptFloat(c_smallest_lt_1neg))\n # negative smaller than -1.0000000000000002 is rounded to -1.0\n self.assertEquals(-1.0,\n _PAILLIER1.DecryptFloat(_PAILLIER1.EncryptFloat(\n -1.0000000000000001)))\n\n # one third\n c_onethird = _PAILLIER1.EncryptFloat(1.0/3.0)\n self.assertEquals(1.0/3.0, _PAILLIER1.DecryptFloat(c_onethird))\n # negative one third\n c_onethird = _PAILLIER1.EncryptFloat(-1.0/3.0)\n self.assertEquals(-1.0/3.0, _PAILLIER1.DecryptFloat(c_onethird))\n\n # check small fractions close to 0 on the positive and negative side.\n # smallest normal exponent\n smallest_normal = 2**-389\n self.assertEquals(smallest_normal, _PAILLIER1.DecryptFloat(\n _PAILLIER1.EncryptFloat(smallest_normal)))\n # slightly larger than smallest normal exponent\n near_smallest_normal = 1.23456789 * 2**-389\n self.assertEquals(near_smallest_normal, _PAILLIER1.DecryptFloat(\n _PAILLIER1.EncryptFloat(near_smallest_normal)))\n # negative number with smallest normal exponent\n smallest_normal = -2**-389\n self.assertEquals(smallest_normal, _PAILLIER1.DecryptFloat(\n _PAILLIER1.EncryptFloat(smallest_normal)))\n # negative number that has slightly larger than the smallest exponent.\n near_smallest_normal = -1.23456789 * 2**-389\n self.assertEquals(near_smallest_normal, _PAILLIER1.DecryptFloat(\n _PAILLIER1.EncryptFloat(near_smallest_normal)))", "metadata": "root.PaillierTest.testEncryptDecryptFloatSmallNormalNumbers", "header": "['class', 'PaillierTest', '(', 'googletest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 333 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pai", "lli", "er", "Test_", "(_", "google", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Encrypt", "Decrypt", "Float", "Small", "Normal", "Numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "Run", "ning", " ", "test", "Encrypt", "Decrypt", "Float", "Small", "Normal", "Number", "s", " ", "method", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "small", " ", "posit", "ive", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "1", "\\u", "0_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "1", "\\u", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "15", "\\u", "1234_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "15.", "1234_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "15.", "1234_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "15", "\\u", "1234_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "small", " ", "negati", "ve", " ", "numbers_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "1", "\\u", "0", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "1", "\\u", "0", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "15", "\\u", "1234", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "15.", "1234_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "15.", "1234_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "15", "\\u", "1234", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "numbers", " ", "close", " ", "to", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "smallest", " ", "number", " ", ">", " ", "than", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "1.000000", "000000000", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "smallest", "\\u", "gt", "\\u", "1_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "smallest", "\\u", "gt", "\\u", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "smallest", "\\u", "gt", "\\u", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "small", "er", " ", "than", " ", "1.000000", "000000000", "2", " ", "is", " ", "rounded", " ", "to", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "1.000000", "000000000", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negati", "ve", " ", "number", " ", "<", " ", "than", " ", "-1", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "-_", "1.000000", "000000000", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c\\u", "smallest", "\\u", "lt", "\\u", "1", "neg_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "smallest", "\\u", "lt", "\\u", "1", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "-_", "1.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "smallest", "\\u", "lt", "\\u", "1", "neg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negati", "ve", " ", "small", "er", " ", "than", " ", "-1", ".0000", "00000000000", "2", " ", "is", " ", "rounded", " ", "to", " ", "-1", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "-_", "1.000000", "000000000", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "third_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "onet", "hir", "d_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "1.0_", "/_", "3.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "1.0_", "/_", "3.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "onet", "hir", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negati", "ve", " ", "one", " ", "third_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "onet", "hir", "d_", "=_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "-_", "1.0_", "/_", "3.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "-_", "1.0_", "/_", "3.0_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "c\\u", "onet", "hir", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "small", " ", "fract", "ion", "s", " ", "close", " ", "to", " ", "0", " ", "on", " ", "the", " ", "posit", "ive", " ", "and", " ", "negati", "ve", " ", "side", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "smallest", " ", "normal", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "smallest", "\\u", "normal_", "=_", "2_", "**_", "-_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "smallest", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "smallest", "\\u", "normal_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "slight", "ly", " ", "large", "r", " ", "than", " ", "smallest", " ", "normal", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "near", "\\u", "smallest", "\\u", "normal_", "=_", "1.23", "4567", "89_", "*_", "2_", "**_", "-_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "near", "\\u", "smallest", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "near", "\\u", "smallest", "\\u", "normal_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negati", "ve", " ", "number", " ", "with", " ", "smallest", " ", "normal", " ", "exponent_", "\\u\\u\\uNL\\u\\u\\u_", "smallest", "\\u", "normal_", "=_", "-_", "2_", "**_", "-_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "smallest", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "smallest", "\\u", "normal_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "negati", "ve", " ", "number", " ", "tha", "t", " ", "has", " ", "slight", "ly", " ", "large", "r", " ", "than", " ", "the", " ", "smallest", " ", "expon", "ent", "._", "\\u\\u\\uNL\\u\\u\\u_", "near", "\\u", "smallest", "\\u", "normal_", "=_", "-_", "1.23", "4567", "89_", "*_", "2_", "**_", "-_", "389", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "near", "\\u", "smallest", "\\u", "normal_", ",_", "\\u", "PAI", "LL", "IER", "1_", "._", "Decrypt", "Float_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PAI", "LL", "IER", "1_", "._", "Encrypt", "Float_", "(_", "near", "\\u", "smallest", "\\u", "normal_", ")_", ")_", ")_", "\\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,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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 ]
Unused local variable
huoxy/farmer/farmer/tests.py
[ { "content": " def setUp(self):\n User.objects.create_superuser('testuser',\n '[email protected]',\n 'password')", "metadata": "root.FarmerTestCase.setUp", "header": "['class', 'FarmerTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 7 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Far", "mer", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "User_", "._", "objects_", "._", "create", "\\u", "superuser_", "(_", "'", "testu", "ser", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "testu", "ser", "@", "douban", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ")_", "\\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 ]
Variable defined multiple times
ipython/ipython-py3k/IPython/core/tests/test_handlers.py
[ { "content": "def test_handlers():\n # alias expansion\n\n # We're using 'true' as our syscall of choice because it doesn't\n # write anything to stdout.\n\n # Turn off actual execution of aliases, because it's noisy\n old_system_cmd = ip.system\n ip.system = lambda cmd: None\n\n\n ip.alias_manager.alias_table['an_alias'] = (0, 'true')\n # These are useful for checking a particular recursive alias issue\n ip.alias_manager.alias_table['top'] = (0, 'd:/cygwin/top')\n ip.alias_manager.alias_table['d'] = (0, 'true')\n run([(\"an_alias\", 'get_ipython().system(\"true \")'), # alias\n # Below: recursive aliases should expand whitespace-surrounded\n # chars, *not* initial chars which happen to be aliases:\n (\"top\", 'get_ipython().system(\"d:/cygwin/top \")'),\n ])\n ip.system = old_system_cmd\n\n call_idx = CallableIndexable()\n ip.user_ns['call_idx'] = call_idx\n\n # For many of the below, we're also checking that leading whitespace\n # turns off the esc char, which it should unless there is a continuation\n # line.\n run([('\"no change\"', '\"no change\"'), # normal\n (\"!true\", 'get_ipython().system(\"true\")'), # shell_escapes\n (\"!! true\", 'get_ipython().magic(\"sx true\")'), # shell_escapes + magic\n (\"!!true\", 'get_ipython().magic(\"sx true\")'), # shell_escapes + magic\n (\"%lsmagic\", 'get_ipython().magic(\"lsmagic \")'), # magic\n (\"lsmagic\", 'get_ipython().magic(\"lsmagic \")'), # magic\n #(\"a = b # PYTHON-MODE\", '_i'), # emacs -- avoids _in cache\n\n # post-esc-char whitespace goes inside\n (\"! true\", 'get_ipython().system(\" true\")'), \n\n # handle_help\n\n # These are weak tests -- just looking at what the help handlers\n # logs, which is not how it really does its work. But it still\n # lets us check the key paths through the handler.\n\n (\"x=1 # what?\", \"x=1 # what?\"), # no help if valid python\n ])\n\n # multi_line_specials\n ip.prefilter_manager.multi_line_specials = False\n # W/ multi_line_specials off, leading ws kills esc chars/autoexpansion\n run([\n ('if 1:\\n !true', 'if 1:\\n !true'),\n ('if 1:\\n lsmagic', 'if 1:\\n lsmagic'),\n ('if 1:\\n an_alias', 'if 1:\\n an_alias'),\n ])\n\n ip.prefilter_manager.multi_line_specials = True\n # initial indents must be preserved.\n run([\n ('if 1:\\n !true', 'if 1:\\n get_ipython().system(\"true\")'),\n ('if 2:\\n lsmagic', 'if 2:\\n get_ipython().magic(\"lsmagic \")'),\n ('if 1:\\n an_alias', 'if 1:\\n get_ipython().system(\"true \")'),\n # Weird one\n ('if 1:\\n !!true', 'if 1:\\n get_ipython().magic(\"sx true\")'),\n\n # Even with m_l_s on, autocall is off even with special chars\n ('if 1:\\n /fun 1 2', 'if 1:\\n /fun 1 2'), \n ('if 1:\\n ;fun 1 2', 'if 1:\\n ;fun 1 2'),\n ('if 1:\\n ,fun 1 2', 'if 1:\\n ,fun 1 2'),\n ('if 1:\\n ?fun 1 2', 'if 1:\\n ?fun 1 2'),\n # What about !! \n ])\n\n # Objects which are instances of IPyAutocall are *always* autocalled\n autocallable = Autocallable()\n ip.user_ns['autocallable'] = autocallable\n\n # auto \n ip.magic('autocall 0')\n # Only explicit escapes or instances of IPyAutocallable should get\n # expanded\n run([\n ('len \"abc\"', 'len \"abc\"'), \n ('autocallable', 'autocallable()'), \n (\",list 1 2 3\", 'list(\"1\", \"2\", \"3\")'),\n (\";list 1 2 3\", 'list(\"1 2 3\")'), \n (\"/len range(1,4)\", 'len(range(1,4))'),\n ])\n ip.magic('autocall 1')\n run([\n (\",list 1 2 3\", 'list(\"1\", \"2\", \"3\")'),\n (\";list 1 2 3\", 'list(\"1 2 3\")'), \n (\"/len range(1,4)\", 'len(range(1,4))'),\n ('len \"abc\"', 'len(\"abc\")'),\n ('len \"abc\";', 'len(\"abc\");'), # ; is special -- moves out of parens\n # Autocall is turned off if first arg is [] and the object\n # is both callable and indexable. Like so:\n ('len [1,2]', 'len([1,2])'), # len doesn't support __getitem__...\n ('call_idx [1]', 'call_idx [1]'), # call_idx *does*..\n ('call_idx 1', 'call_idx(1)'),\n ('len', 'len '), # only at 2 does it auto-call on single args\n ])\n ip.magic('autocall 2')\n run([\n (\",list 1 2 3\", 'list(\"1\", \"2\", \"3\")'),\n (\";list 1 2 3\", 'list(\"1 2 3\")'), \n (\"/len range(1,4)\", 'len(range(1,4))'),\n ('len \"abc\"', 'len(\"abc\")'),\n ('len \"abc\";', 'len(\"abc\");'),\n ('len [1,2]', 'len([1,2])'), \n ('call_idx [1]', 'call_idx [1]'),\n ('call_idx 1', 'call_idx(1)'),\n # This is what's different:\n ('len', 'len()'), # only at 2 does it auto-call on single args\n ])\n ip.magic('autocall 1')\n\n nt.assert_equals(failures, [])", "metadata": "root.test_handlers", "header": "['module', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "handlers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "alias", " ", "expansion", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "usi", "ng", " ", "'", "true", "'", " ", "as", " ", "our", " ", "syscall", " ", "of", " ", "choice", " ", "bec", "aus", "e", " ", "it", " ", "doe", "sn", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "anyt", "hing", " ", "to", " ", "stdout", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Turn", " ", "off", " ", "actual", " ", "executi", "on", " ", "of", " ", "alias", "es", ",", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "noisy", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "system", "\\u", "cmd_", "=_", "ip_", "._", "system_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "system_", "=_", "lambda_", "cmd_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "alias", "\\u", "manager_", "._", "alias", "\\u", "table_", "[_", "'", "an", "\\u", "alias", "'_", "]_", "=_", "(_", "0_", ",_", "'", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "usef", "ul", " ", "for", " ", "checking", " ", "a", " ", "partic", "ular", " ", "recurs", "ive", " ", "alias", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "alias", "\\u", "manager_", "._", "alias", "\\u", "table_", "[_", "'", "top", "'_", "]_", "=_", "(_", "0_", ",_", "'", "d", ":/", "cyg", "win", "/", "top", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "alias", "\\u", "manager_", "._", "alias", "\\u", "table_", "[_", "'", "d", "'_", "]_", "=_", "(_", "0_", ",_", "'", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "[_", "(_", "\"", "an", "\\u", "alias", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "system", "(\"", "true", " ", "\")'_", ")_", ",_", "#", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Below", ":", " ", "recurs", "ive", " ", "alias", "es", " ", "shou", "ld", " ", "expand", " ", "whitespace", "-", "surround", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "char", "s", ",", " ", "*", "not", "*", " ", "initial", " ", "char", "s", " ", "whi", "ch", " ", "happ", "en", " ", "to", " ", "be", " ", "alias", "es", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "top", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "system", "(\"", "d", ":/", "cyg", "win", "/", "top", " ", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "system_", "=_", "old", "\\u", "system", "\\u", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "call", "\\u", "idx_", "=_", "Call", "able", "Index", "able_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "call", "\\u", "idx", "'_", "]_", "=_", "call", "\\u", "idx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "many", " ", "of", " ", "the", " ", "belo", "w", ",", " ", "we", "'", "re", " ", "als", "o", " ", "checking", " ", "tha", "t", " ", "lead", "ing", " ", "whitespace_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "turns", " ", "off", " ", "the", " ", "esc", " ", "char", ",", " ", "whi", "ch", " ", "it", " ", "shou", "ld", " ", "unl", "ess", " ", "there", " ", "is", " ", "a", " ", "continuation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "[_", "(_", "'\"", "no", " ", "change", "\"'_", ",_", "'\"", "no", " ", "change", "\"'_", ")_", ",_", "#", " ", "normal_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"!", "true", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "system", "(\"", "true", "\")'_", ")_", ",_", "#", " ", "shell", "\\u", "escape", "s_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"!!", " ", "true", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "sx", " ", " ", "true", "\")'_", ")_", ",_", "#", " ", "shell", "\\u", "escape", "s", " ", "+", " ", "magic_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"!!", "true", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "sx", " ", "true", "\")'_", ")_", ",_", "#", " ", "shell", "\\u", "escape", "s", " ", "+", " ", "magic_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"%", "ls", "magic", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "ls", "magic", " ", "\")'_", ")_", ",_", "#", " ", "magic_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "ls", "magic", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "ls", "magic", " ", "\")'_", ")_", ",_", "#", " ", "magic_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "\"", "a", " ", "=", " ", "b", " ", "#", " ", "PYTHON", "-", "MODE", "\",", " ", "'\\u", "i", "')", ",", " ", " ", "#", " ", "ema", "cs", " ", "--", " ", "avoid", "s", " ", "\\u", "in", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "post", "-", "esc", "-", "char", " ", "whitespace", " ", "go", "es", " ", "inside_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"!", " ", "true", "\"_", ",_", "'", "get", "\\u", "ipython", "()", ".", "system", "(\"", " ", "true", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handle", "\\u", "help_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "are", " ", "weak", " ", "tests", " ", "--", " ", "just", " ", "look", "ing", " ", "at", " ", "what", " ", "the", " ", "help", " ", "handlers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logs", ",", " ", "whi", "ch", " ", "is", " ", "not", " ", "how", " ", "it", " ", "reall", "y", " ", "doe", "s", " ", "its", " ", "work", ".", " ", " ", "Bu", "t", " ", "it", " ", "still", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lets", " ", "us", " ", "check", " ", "the", " ", "key", " ", "path", "s", " ", "through", " ", "the", " ", "handler", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "x", "=", "1", " ", "#", " ", "what", "?\"_", ",_", "\"", "x", "=", "1", " ", "#", " ", "what", "?\"_", ")_", ",_", "#", " ", "no", " ", "help", " ", "if", " ", "valid", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "multi", "\\u", "line", "\\u", "specials", "_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "prefi", "lter", "\\u", "manager_", "._", "multi", "\\u", "line", "\\u", "specials", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "W", "/", " ", "multi", "\\u", "line", "\\u", "specials", " ", "off", ",", " ", "lead", "ing", " ", "ws", " ", "kills", " ", "esc", " ", "char", "s", "/", "autoe", "xpa", "nsion", "_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "!", "true", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "!", "true", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "ls", "magic", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "ls", "magic", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "an", "\\u", "alias", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "an", "\\u", "alias", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "prefi", "lter", "\\u", "manager_", "._", "multi", "\\u", "line", "\\u", "specials", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initial", " ", "indent", "s", " ", "must", " ", "be", " ", "preserved", "._", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "!", "true", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "get", "\\u", "ipython", "()", ".", "system", "(\"", "true", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "2", ":\\\\", "n", " ", " ", " ", " ", "ls", "magic", "'_", ",_", "'", "if", " ", "2", ":\\\\", "n", " ", " ", " ", " ", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "ls", "magic", " ", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "an", "\\u", "alias", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "get", "\\u", "ipython", "()", ".", "system", "(\"", "true", " ", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wei", "rd", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "!!", "true", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "get", "\\u", "ipython", "()", ".", "magic", "(\"", "sx", " ", "true", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Even", " ", "with", " ", "m", "\\u", "l\\u", "s", " ", "on", ",", " ", "autoc", "all", " ", "is", " ", "off", " ", "even", " ", "with", " ", "special", " ", "chars_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "/", "fun", " ", "1", " ", "2", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "/", "fun", " ", "1", " ", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", ";", "fun", " ", "1", " ", "2", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", ";", "fun", " ", "1", " ", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", ",", "fun", " ", "1", " ", "2", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", ",", "fun", " ", "1", " ", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "?", "fun", " ", "1", " ", "2", "'_", ",_", "'", "if", " ", "1", ":\\\\", "n", " ", " ", " ", " ", "?", "fun", " ", "1", " ", "2", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "What", " ", "abo", "ut", " ", "!!", " _", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Object", "s", " ", "whi", "ch", " ", "are", " ", "instance", "s", " ", "of", " ", "IP", "y", "Auto", "call", " ", "are", " ", "*", "alw", "ay", "s", "*", " ", "autoc", "alle", "d_", "\\u\\u\\uNL\\u\\u\\u_", "autoc", "alla", "ble_", "=_", "Auto", "callable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "autoc", "alla", "ble", "'_", "]_", "=_", "autoc", "alla", "ble_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "auto", " _", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "magic_", "(_", "'", "autoc", "all", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "explicit", " ", "escape", "s", " ", "or", " ", "instance", "s", " ", "of", " ", "IP", "y", "Auto", "calla", "ble", " ", "shou", "ld", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expanded_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "\"", "abc", "\"'_", ",_", "'", "len", " ", "\"", "abc", "\"'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "autoc", "alla", "ble", "'_", ",_", "'", "autoc", "alla", "ble", "()'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\",", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", "\",", " ", "\"", "2", "\",", " ", "\"", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\";", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", " ", "2", " ", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"/", "len", " ", "range", "(", "1", ",", "4", ")\"_", ",_", "'", "len", "(", "range", "(", "1", ",", "4", "))'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "magic_", "(_", "'", "autoc", "all", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\",", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", "\",", " ", "\"", "2", "\",", " ", "\"", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\";", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", " ", "2", " ", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"/", "len", " ", "range", "(", "1", ",", "4", ")\"_", ",_", "'", "len", "(", "range", "(", "1", ",", "4", "))'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "\"", "abc", "\"'_", ",_", "'", "len", "(\"", "abc", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "\"", "abc", "\";", "'_", ",_", "'", "len", "(\"", "abc", "\");", "'_", ")_", ",_", "#", " ", ";", " ", "is", " ", "special", " ", "--", " ", "moves", " ", "out", " ", "of", " ", "paren", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "call", " ", "is", " ", "turn", "ed", " ", "off", " ", "if", " ", "first", " ", "arg", " ", "is", " ", "[]", " ", "and", " ", "the", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "bot", "h", " ", "calla", "ble", " ", "and", " ", "index", "able", ".", " ", " ", "Lik", "e", " ", "so", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "[", "1", ",", "2", "]'_", ",_", "'", "len", "([", "1", ",", "2", "])'_", ")_", ",_", "#", " ", "len", " ", "doe", "sn", "'", "t", " ", "support", " ", "\\u\\u", "getitem", "\\u\\u", "..._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "call", "\\u", "idx", " ", "[", "1", "]'_", ",_", "'", "call", "\\u", "idx", " ", "[", "1", "]'_", ")_", ",_", "#", " ", "call", "\\u", "idx", " ", "*", "doe", "s", "*.", "._", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "call", "\\u", "idx", " ", "1", "'_", ",_", "'", "call", "\\u", "idx", "(", "1", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", "'_", ",_", "'", "len", " ", "'_", ")_", ",_", "#", " ", "only", " ", "at", " ", "2", " ", "doe", "s", " ", "it", " ", "auto", "-", "call", " ", "on", " ", "single", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "magic_", "(_", "'", "autoc", "all", " ", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\",", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", "\",", " ", "\"", "2", "\",", " ", "\"", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\";", "list", " ", "1", " ", "2", " ", "3", "\"_", ",_", "'", "list", "(\"", "1", " ", "2", " ", "3", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"/", "len", " ", "range", "(", "1", ",", "4", ")\"_", ",_", "'", "len", "(", "range", "(", "1", ",", "4", "))'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "\"", "abc", "\"'_", ",_", "'", "len", "(\"", "abc", "\")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "\"", "abc", "\";", "'_", ",_", "'", "len", "(\"", "abc", "\");", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", " ", "[", "1", ",", "2", "]'_", ",_", "'", "len", "([", "1", ",", "2", "])'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "call", "\\u", "idx", " ", "[", "1", "]'_", ",_", "'", "call", "\\u", "idx", " ", "[", "1", "]'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "call", "\\u", "idx", " ", "1", "'_", ",_", "'", "call", "\\u", "idx", "(", "1", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "what", "'", "s", " ", "different", ":_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "len", "'_", ",_", "'", "len", "()'_", ")_", ",_", "#", " ", "only", " ", "at", " ", "2", " ", "doe", "s", " ", "it", " ", "auto", "-", "call", " ", "on", " ", "single", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "magic_", "(_", "'", "autoc", "all", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nt_", "._", "assert", "\\u", "equals_", "(_", "failures_", ",_", "[_", "]_", ")_" ]
[ 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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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
spotify/pyschema/pyschema_extensions/avro.py
[ { "content": "# Copyright (c) 2013 Spotify AB\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under\n# the License.\n\"\"\"\nExtension for generating Avro schemas from PySchema Record classes\n\nUsage:\n\n>>> class MyRecord(pyschema.Record):\n>>> foo = Text()\n>>> bar = Integer()\n>>>\n>>> [pyschema_extensions.avro.]get_schema_string(MyRecord)\n\n'{\"fields\": [{\"type\": \"string\", \"name\": \"foo\"},\n{\"type\": \"long\", \"name\": \"bar\"}],\n\"type\": \"record\", \"name\": \"MyRecord\"}'\n\n\"\"\"\nimport warnings\nfrom pyschema import core\nfrom pyschema.types import Field, Boolean, Integer, Float\nfrom pyschema.types import Bytes, Text, Enum, List, Map, SubRecord\ntry:\n import simplejson as json\nexcept ImportError:\n import json\n\n\nBoolean.avro_type_name = \"boolean\"\nBytes.avro_type_name = \"bytes\"\nText.avro_type_name = \"string\"\n# \"ENUM\" is the avro 'type name' of all enums generated by pyschema\n# this is pyschema convention, not avro, so it might change if\n# need b\nEnum.avro_type_name = \"ENUM\"\nList.avro_type_name = \"array\"\nMap.avro_type_name = \"map\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Schema generation\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@Float.mixin\nclass FloatMixin:", "metadata": "root.FloatMixin", "header": "['module', '___EOS___']", "index": 50 }, { "content": " @property\n def avro_type_name(self):\n if self.size <= 4:\n return 'float'\n return 'double'", "metadata": "root.FloatMixin.avro_type_name", "header": "['class', 'FloatMixin', ':', '___EOS___']", "index": 52 }, { "content": "@Integer.mixin\nclass IntegerMixin:", "metadata": "root.IntegerMixin", "header": "['module', '___EOS___']", "index": 59 }, { "content": " @property\n def avro_type_name(self):\n if self.size <= 4:\n return 'int'\n return 'long'", "metadata": "root.IntegerMixin.avro_type_name", "header": "['class', 'IntegerMixin', ':', '___EOS___']", "index": 61 }, { "content": "@Field.mixin\nclass FieldMixin:\n\n\n\n", "metadata": "root.FieldMixin", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def avro_type_schema(self, state):\n \"\"\"Full type specification for the field\n\n I.e. the same as would go into the \"type\" field.\n For most field, only simplified_avro_type_schema has\n to be implemented.\n \"\"\"\n simple_type = self.simplified_avro_type_schema(state)\n if self.nullable:\n # first value in union needs to be same as default\n if self.default in (None, core.NO_DEFAULT):\n return [\"null\", simple_type]\n else:\n return [simple_type, \"null\"]\n else:\n return simple_type", "metadata": "root.FieldMixin.avro_type_schema", "header": "['class', 'FieldMixin', ':', '___EOS___']", "index": 70 }, { "content": " def simplified_avro_type_schema(self, state):\n \"\"\"The basic avro type for this field\n\n Not including nullability.\n \"\"\"\n return self.avro_type_name", "metadata": "root.FieldMixin.simplified_avro_type_schema", "header": "['class', 'FieldMixin', ':', '___EOS___']", "index": 87 }, { "content": " def avro_dump(self, o):\n if o is None:\n return None\n else:\n # relying on the reference json dump behavior\n # could be a bit dangerous\n if self.nullable:\n return {self.avro_type_name: self.dump(o)}\n else:\n return self.dump(o)", "metadata": "root.FieldMixin.avro_dump", "header": "['class', 'FieldMixin', ':', '___EOS___']", "index": 94 }, { "content": " def avro_load(self, o):\n if o is None:\n return None\n else:\n if self.nullable:\n return self.load(o[self.avro_type_name])\n else:\n return self.load(o)", "metadata": "root.FieldMixin.avro_load", "header": "['class', 'FieldMixin', ':', '___EOS___']", "index": 105 }, { "content": " def avro_default_value(self):\n return self.default", "metadata": "root.FieldMixin.avro_default_value", "header": "['class', 'FieldMixin', ':', '___EOS___']", "index": 114 }, { "content": "@List.mixin\nclass ListMixin:\n\n", "metadata": "root.ListMixin", "header": "['module', '___EOS___']", "index": 118 }, { "content": " def simplified_avro_type_schema(self, state):\n return {\n \"type\": \"array\",\n \"items\": self.field_type.avro_type_schema(state)\n }", "metadata": "root.ListMixin.simplified_avro_type_schema", "header": "['class', 'ListMixin', ':', '___EOS___']", "index": 120 }, { "content": " def avro_dump(self, obj):\n if obj is None:\n return None\n else:\n l = [self.field_type.avro_dump(o) for o in obj]\n if self.nullable:\n return {self.avro_type_name: l}\n else:\n return l", "metadata": "root.ListMixin.avro_dump", "header": "['class', 'ListMixin', ':', '___EOS___']", "index": 126 }, { "content": " def avro_load(self, obj):\n if obj is None:\n return None\n else:\n if self.nullable:\n obj = obj[self.avro_type_name]\n return [\n self.field_type.avro_load(o)\n for o in obj\n ]", "metadata": "root.ListMixin.avro_load", "header": "['class', 'ListMixin', ':', '___EOS___']", "index": 136 }, { "content": "@Enum.mixin\nclass EnumMixin:\n", "metadata": "root.EnumMixin", "header": "['module', '___EOS___']", "index": 148 }, { "content": " @property\n def avro_type_name(self):\n if self.name is None:\n return \"ENUM\"\n return self.name", "metadata": "root.EnumMixin.avro_type_name", "header": "['class', 'EnumMixin', ':', '___EOS___']", "index": 150 }, { "content": " def simplified_avro_type_schema(self, state):\n return {\n \"type\": \"enum\",\n \"name\": self.avro_type_name,\n \"symbols\": list(self.values)\n }", "metadata": "root.EnumMixin.simplified_avro_type_schema", "header": "['class', 'EnumMixin', ':', '___EOS___']", "index": 156 }, { "content": "@SubRecord.mixin\nclass SubRecordMixin:\n\n\n\n", "metadata": "root.SubRecordMixin", "header": "['module', '___EOS___']", "index": 164 }, { "content": " def simplified_avro_type_schema(self, state):\n return get_schema_dict(self._schema, state)", "metadata": "root.SubRecordMixin.simplified_avro_type_schema", "header": "['class', 'SubRecordMixin', ':', '___EOS___']", "index": 166 }, { "content": " @property\n def avro_type_name(self):\n return core.get_full_name(self._schema)", "metadata": "root.SubRecordMixin.avro_type_name", "header": "['class', 'SubRecordMixin', ':', '___EOS___']", "index": 169 }, { "content": " def avro_dump(self, obj):\n if obj is None:\n return None\n if self.nullable:\n return {self.avro_type_name: to_json_compatible(obj)}\n else:\n return to_json_compatible(obj)", "metadata": "root.SubRecordMixin.avro_dump", "header": "['class', 'SubRecordMixin', ':', '___EOS___']", "index": 173 }, { "content": " def _get_record_data(self, obj):\n \"\"\"\n Try to get the data for this subrecord using the full_name including namespace.\n If no data is given for the fullname, we will fallback to use the SubRecord name without namespace.\n\n Doing this allows namespace addition to a schema while being able to read legacy data missing a namespace.\n \"\"\"\n if self.avro_type_name in obj:\n return obj[self.avro_type_name]\n else:\n base_name = self.avro_type_name.split('.')[-1]\n return obj[base_name]", "metadata": "root.SubRecordMixin._get_record_data", "header": "['class', 'SubRecordMixin', ':', '___EOS___']", "index": 181 }, { "content": " def avro_load(self, obj):\n if obj is None:\n return None\n if self.nullable:\n return from_json_compatible(\n self._schema,\n self._get_record_data(obj)\n )\n else:\n return from_json_compatible(\n self._schema,\n obj\n )", "metadata": "root.SubRecordMixin.avro_load", "header": "['class', 'SubRecordMixin', ':', '___EOS___']", "index": 194 }, { "content": "@Map.mixin\nclass MapMixin:\n\n", "metadata": "root.MapMixin", "header": "['module', '___EOS___']", "index": 209 }, { "content": " def simplified_avro_type_schema(self, state):\n assert isinstance(self.key_type, Text)\n return {\n \"type\": \"map\",\n \"values\": self.value_type.avro_type_schema(state)\n }", "metadata": "root.MapMixin.simplified_avro_type_schema", "header": "['class', 'MapMixin', ':', '___EOS___']", "index": 211 }, { "content": " def avro_dump(self, obj):\n if obj is None:\n return None\n else:\n m = dict([(\n # using json loader for key is kind of a hack\n # since this isn't an actual type in avro (always text)\n self.key_type.dump(k),\n self.value_type.avro_dump(v)\n ) for k, v in obj.iteritems()])\n if self.nullable:\n return {self.avro_type_name: m}\n else:\n return m", "metadata": "root.MapMixin.avro_dump", "header": "['class', 'MapMixin', ':', '___EOS___']", "index": 218 }, { "content": " def avro_load(self, obj):\n if obj is None:\n return None\n else:\n if self.nullable:\n obj = obj[self.avro_type_name]\n m = dict([(\n # using json loader for key is kind of a hack\n # since this isn't an actual type in avro (always text)\n self.key_type.load(k),\n self.value_type.avro_load(v)\n ) for k, v in obj.iteritems()])\n return m", "metadata": "root.MapMixin.avro_load", "header": "['class', 'MapMixin', ':', '___EOS___']", "index": 233 }, { "content": "class SchemaGeneratorState(object):", "metadata": "root.SchemaGeneratorState", "header": "['module', '___EOS___']", "index": 249 }, { "content": " def __init__(self):\n self.declared_records = set()", "metadata": "root.SchemaGeneratorState.__init__", "header": "['class', 'SchemaGeneratorState', '(', 'object', ')', ':', '___EOS___']", "index": 250 }, { "content": "def get_schema_dict(record, state=None):\n state = state or SchemaGeneratorState()\n\n full_name = core.get_full_name(record)\n if full_name in state.declared_records:\n return full_name\n state.declared_records.add(full_name)\n\n if '.' in full_name:\n namespace, _ = full_name.rsplit('.', 1)\n else:\n namespace = None\n\n avro_record = {\n \"type\": \"record\",\n \"name\": record._schema_name,\n }\n if namespace:\n avro_record[\"namespace\"] = namespace\n\n if record.__doc__ is not None:\n avro_record[\"doc\"] = record.__doc__\n\n avro_fields = []\n for field_name, field_type in record._fields.iteritems():\n field_spec = {\n \"name\": field_name,\n \"type\": field_type.avro_type_schema(state)\n }\n if field_type.default is not core.NO_DEFAULT:\n field_spec[\"default\"] = field_type.avro_default_value()\n if field_type.description is not None:\n field_spec[\"doc\"] = field_type.description\n avro_fields.append(field_spec)\n\n avro_record[\"fields\"] = avro_fields\n return avro_record", "metadata": "root.get_schema_dict", "header": "['module', '___EOS___']", "index": 254 }, { "content": "def get_schema_string(record):\n return json.dumps(get_schema_dict(record))", "metadata": "root.get_schema_string", "header": "['module', '___EOS___']", "index": 293 }, { "content": "def dumps(record):\n return json.dumps(to_json_compatible(record))", "metadata": "root.dumps", "header": "['module', '___EOS___']", "index": 297 }, { "content": "def to_json_compatible(record):\n dct = {}\n for name, fieldtype in record._fields.iteritems():\n value = getattr(record, name)\n dct[name] = fieldtype.avro_dump(value)\n return dct", "metadata": "root.to_json_compatible", "header": "['module', '___EOS___']", "index": 301 }, { "content": "def from_json_compatible(schema, dct):\n \"Load from json-encodable\"\n kwargs = {}\n\n for key in dct:\n field_type = schema._fields.get(key)\n if field_type is None:\n warnings.warn(\"Unexpected field encountered in line for record %s: %r\" % (schema.__name__, key))\n continue\n kwargs[key] = field_type.avro_load(dct[key])\n\n return schema(**kwargs)", "metadata": "root.from_json_compatible", "header": "['module', '___EOS___']", "index": 309 }, { "content": "def loads(\n s,\n record_store=None,\n schema=None,\n record_class=None # deprecated - replaced by `schema`\n):\n if record_class is not None:\n warnings.warn(\n \"The record_class parameter is deprecated in favour of schema\",\n DeprecationWarning,\n stacklevel=2\n )\n schema = record_class\n\n return core.loads(s, record_store, schema, from_json_compatible)", "metadata": "root.loads", "header": "['module', '___EOS___']", "index": 323 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Spot", "if", "y", " ", "AB_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ation", "s", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Ext", "ensi", "on", " ", "for", " ", "generat", "ing", " ", "Av", "ro", " ", "schema", "s", " ", "from", " ", "Py", "Schema", " ", "Record", " ", "classe", "s", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", "\\", "10", ";", ">>>", " ", "class", " ", "My", "Record", "(", "pys", "chema", ".", "Record", "):", "\\", "10", ";", ">>>", " ", "foo", " ", "=", " ", "Text", "()", "\\", "10", ";", ">>>", " ", "bar", " ", "=", " ", "Integer", "()", "\\", "10", ";", ">>>", "\\", "10", ";", ">>>", " ", "[", "pys", "chema", "\\u", "extensi", "ons", ".", "avro", ".]", "get", "\\u", "schema", "\\u", "string", "(", "My", "Record", ")", "\\", "10", ";", "\\", "10", ";'", "{", "\"", "fields", "\":", " ", "[{", "\"", "type", "\":", " ", "\"", "string", "\",", " ", "\"", "name", "\":", " ", "\"", "foo", "\"},", "\\", "10", ";", "{", "\"", "type", "\":", " ", "\"", "long", "\",", " ", "\"", "name", "\":", " ", "\"", "bar", "\"}]", ",", "\\", "10", ";", "\"", "type", "\":", " ", "\"", "record", "\",", " ", "\"", "name", "\":", " ", "\"", "My", "Record", "\"}", "'", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "chema", "_", "import_", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "chema", "_", "._", "types_", "import_", "Field_", ",_", "Boolean_", ",_", "Integer_", ",_", "Float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "chema", "_", "._", "types_", "import_", "Bytes_", ",_", "Text_", ",_", "Enum_", ",_", "List_", ",_", "Map_", ",_", "Sub", "Record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Boolean_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "boolean", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Bytes_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "bytes", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Text_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "string", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\"", "ENUM", "\"", " ", "is", " ", "the", " ", "avro", " ", "'", "type", " ", "name", "'", " ", "of", " ", "all", " ", "enum", "s", " ", "generat", "ed", " ", "by", " ", "pys", "chema", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "pys", "chema", " ", "convention", ",", " ", "not", " ", "avro", ",", " ", "so", " ", "it", " ", "mig", "ht", " ", "change", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "b_", "\\u\\u\\uNL\\u\\u\\u_", "Enum_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "ENUM", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "List_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "array", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Map_", "._", "avro", "\\u", "type", "\\u", "name_", "=_", "\"", "map", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Schema", " ", "generation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "Float_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Float", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "avro", "\\u", "type", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "size_", "<=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "float", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "double", "'_", "\\u\\u\\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_", "@_", "Integer_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Integer", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Integer", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "avro", "\\u", "type", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "size_", "<=_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "int", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", "long", "'_", "\\u\\u\\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_", "@_", "Field_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Field", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Field", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Full", " ", "type", " ", "specifica", "tion", " ", "for", " ", "the", " ", "field", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "I", ".", "e", ".", " ", "the", " ", "same", " ", "as", " ", "wou", "ld", " ", "go", " ", "int", "o", " ", "the", " ", "\"", "type", "\"", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "most", " ", "field", ",", " ", "only", " ", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "be", " ", "implemented", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple", "\\u", "type_", "=_", "self_", "._", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "value", " ", "in", " ", "uni", "on", " ", "need", "s", " ", "to", " ", "be", " ", "same", " ", "as", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "default_", "in_", "(_", "None_", ",_", "core_", "._", "NO", "\\u", "DEFAULT_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\"", "null", "\"_", ",_", "simple", "\\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 ", " _", "return_", "[_", "simple", "\\u", "type_", ",_", "\"", "null", "\"_", "]_", "\\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_", "simple", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field", "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_", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "basic", " ", "avro", " ", "type", " ", "for", " ", "this", " ", "field", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", " ", "inclu", "ding", " ", "null", "abilit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "dump_", "(_", "self_", ",_", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "rely", "ing", " ", "on", " ", "the", " ", "reference", " ", "json", " ", "dump", " ", "behavior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "be", " ", "a", " ", "bit", " ", "danger", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", ":_", "self_", "._", "dump_", "(_", "o_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "dump_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "load_", "(_", "self_", ",_", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "load_", "(_", "o_", "[_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "load_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Field", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "default", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "List_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "List", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "List", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "array", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "items", "\"_", ":_", "self_", "._", "field", "\\u", "type_", "._", "avro", "\\u", "type", "\\u", "schema_", "(_", "state_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "dump_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "[_", "self_", "._", "field", "\\u", "type_", "._", "avro", "\\u", "dump_", "(_", "o_", ")_", "for_", "o_", "in_", "obj_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", ":_", "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 ", " _", "return_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "load_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "obj_", "[_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "field", "\\u", "type_", "._", "avro", "\\u", "load_", "(_", "o_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "o_", "in_", "obj_", "\\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_", "@_", "Enum_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Enum", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Enum", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "avro", "\\u", "type", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "ENUM", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enum", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "enum", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "symbols", "\"_", ":_", "list_", "(_", "self_", "._", "values_", ")_", "\\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_", "@_", "Sub", "Record_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Sub", "Record", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Record", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "schema", "\\u", "dict_", "(_", "self_", "._", "\\u", "schema_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Record", "Mixin_", ":_", "\\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_", "avro", "\\u", "type", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "core_", "._", "get", "\\u", "full", "\\u", "name_", "(_", "self_", "._", "\\u", "schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Record", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "dump_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", ":_", "to", "\\u", "json", "\\u", "compatible_", "(_", "obj_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "to", "\\u", "json", "\\u", "compatible_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Record", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "record", "\\u", "data_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "get", " ", "the", " ", "data", " ", "for", " ", "this", " ", "subre", "cord", " ", "usi", "ng", " ", "the", " ", "full", "\\u", "name", " ", "inclu", "ding", " ", "namespace", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "data", " ", "is", " ", "give", "n", " ", "for", " ", "the", " ", "full", "name", ",", " ", "we", " ", "will", " ", "fall", "back", " ", "to", " ", "use", " ", "the", " ", "Sub", "Record", " ", "name", " ", "with", "out", " ", "namespace", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Do", "ing", " ", "this", " ", "allow", "s", " ", "namespace", " ", "addition", " ", "to", " ", "a", " ", "schema", " ", "whi", "le", " ", "bei", "ng", " ", "able", " ", "to", " ", "read", " ", "lega", "cy", " ", "data", " ", "missi", "ng", " ", "a", " ", "namespace", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "in_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "[_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "name_", "=_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "[_", "base", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sub", "Record", "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_", "avro", "\\u", "load_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "json", "\\u", "compatible_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "schema_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "record", "\\u", "data_", "(_", "obj_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "from", "\\u", "json", "\\u", "compatible_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "schema_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "\\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_", "@_", "Map_", "._", "mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Map", "Mixin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Map", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "simplified", "\\u", "avro", "\\u", "type", "\\u", "schema_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "self_", "._", "key", "\\u", "type_", ",_", "Text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "map", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "values", "\"_", ":_", "self_", "._", "value", "\\u", "type_", "._", "avro", "\\u", "type", "\\u", "schema_", "(_", "state_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "dump_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "dict_", "(_", "[_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "json", " ", "load", "er", " ", "for", " ", "key", " ", "is", " ", "kind", " ", "of", " ", "a", " ", "hack", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "this", " ", "isn", "'", "t", " ", "an", " ", "actual", " ", "type", " ", "in", " ", "avro", " ", "(", "alw", "ay", "s", " ", "text", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "key", "\\u", "type_", "._", "dump_", "(_", "k_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "value", "\\u", "type_", "._", "avro", "\\u", "dump_", "(_", "v_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "k_", ",_", "v_", "in_", "obj_", "._", "iteritems_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", ":_", "m_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "Mixin_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "avro", "\\u", "load_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "nullable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "obj_", "[_", "self_", "._", "avro", "\\u", "type", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "dict_", "(_", "[_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "json", " ", "load", "er", " ", "for", " ", "key", " ", "is", " ", "kind", " ", "of", " ", "a", " ", "hack", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "this", " ", "isn", "'", "t", " ", "an", " ", "actual", " ", "type", " ", "in", " ", "avro", " ", "(", "alw", "ay", "s", " ", "text", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "key", "\\u", "type_", "._", "load_", "(_", "k_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "value", "\\u", "type_", "._", "avro", "\\u", "load_", "(_", "v_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "k_", ",_", "v_", "in_", "obj_", "._", "iteritems_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "m_", "\\u\\u\\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_", "Schema", "Generat", "or", "State_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schema", "Generat", "or", "State_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "declared", "\\u", "records_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "schema", "\\u", "dict_", "(_", "record_", ",_", "state_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "state_", "or_", "Schema", "Generat", "or", "State_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "name_", "=_", "core_", "._", "get", "\\u", "full", "\\u", "name_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "full", "\\u", "name_", "in_", "state_", "._", "declared", "\\u", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "full", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "._", "declared", "\\u", "records_", "._", "add_", "(_", "full", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'.'_", "in_", "full", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", ",_", "\\u_", "=_", "full", "\\u", "name_", "._", "rsplit_", "(_", "'.'_", ",_", "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 ", " _", "namespace_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avro", "\\u", "record_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "\"", "record", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "record_", "._", "\\u", "schema", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "namespace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avro", "\\u", "record_", "[_", "\"", "namespace", "\"_", "]_", "=_", "namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record_", "._", "\\u\\u", "doc\\u\\u_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "avro", "\\u", "record_", "[_", "\"", "doc", "\"_", "]_", "=_", "record_", "._", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avro", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field", "\\u", "name_", ",_", "field", "\\u", "type_", "in_", "record_", "._", "\\u", "fields_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "spec_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "field", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "type", "\"_", ":_", "field", "\\u", "type_", "._", "avro", "\\u", "type", "\\u", "schema_", "(_", "state_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "._", "default_", "is_", "not_", "core_", "._", "NO", "\\u", "DEFAULT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "spec_", "[_", "\"", "default", "\"_", "]_", "=_", "field", "\\u", "type_", "._", "avro", "\\u", "default", "\\u", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "field", "\\u", "type_", "._", "description_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "spec_", "[_", "\"", "doc", "\"_", "]_", "=_", "field", "\\u", "type_", "._", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avro", "\\u", "fields_", "._", "append_", "(_", "field", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "avro", "\\u", "record_", "[_", "\"", "fields", "\"_", "]_", "=_", "avro", "\\u", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "avro", "\\u", "record_", "\\u\\u\\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", "schema", "\\u", "string_", "(_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "get", "\\u", "schema", "\\u", "dict_", "(_", "record_", ")_", ")_", "\\u\\u\\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_", "dumps_", "(_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "to", "\\u", "json", "\\u", "compatible_", "(_", "record_", ")_", ")_", "\\u\\u\\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_", "to", "\\u", "json", "\\u", "compatible_", "(_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dct_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "field", "type_", "in_", "record_", "._", "\\u", "fields_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "getattr_", "(_", "record_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dct_", "[_", "name_", "]_", "=_", "field", "type_", "._", "avro", "\\u", "dump_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dct_", "\\u\\u\\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_", "from", "\\u", "json", "\\u", "compatible_", "(_", "schema_", ",_", "dct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Load", " ", "from", " ", "json", "-", "enco", "dable", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "dct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "\\u", "type_", "=_", "schema_", "._", "\\u", "fields_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Une", "xpe", "cte", "d", " ", "field", " ", "encounter", "ed", " ", "in", " ", "line", " ", "for", " ", "record", " ", "%", "s", ":", " ", "%", "r", "\"_", "%_", "(_", "schema_", "._", "\\u\\u", "name\\u\\u_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "key_", "]_", "=_", "field", "\\u", "type_", "._", "avro", "\\u", "load_", "(_", "dct_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "schema_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\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_", "loads_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "store_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "record", "\\u", "class_", "=_", "None_", "#", " ", "depre", "cated", " ", "-", " ", "replaced", " ", "by", " ", "`", "schema", "`_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "record", "\\u", "class_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "record", "\\u", "class", " ", "parameter", " ", "is", " ", "depre", "cated", " ", "in", " ", "fav", "our", " ", "of", " ", "schema", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stacklevel_", "=_", "2_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "record", "\\u", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "core_", "._", "loads_", "(_", "s_", ",_", "record", "\\u", "store_", ",_", "schema_", ",_", "from", "\\u", "json", "\\u", "compatible_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jbrew/pt-write/pt-write.py
[ { "content": "#The MIT License (MIT)\n#Copyright (c) 2016 Jamie Brew\n\n#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n# documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n#THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n__author__ = 'jamie brew'\n\nimport operator\nimport string\nimport textwrap\nimport os\nclear = lambda: os.system('cls')\n\n# This script takes a source material and stores each unique word in it as an entry in a python dictionary.\n\n# Each entry in the dictionary (for word w) is a tuple of (frequency(w), subdictionary1, subdictionary2)\n\n# subdictionary1 is a dictionary of all words that have occurred one after w\n# subdictionary2 is a dictionary of all words that have occurred two after w\n\n# Subdictionary entries have the exact same format as dictionary entries\n# e.g. D['foo'][sub1]['zoo'] is a tuple of (frequency(zoo|foo),subdict1,subdict2)\n# Where those subdictionaries are now dictionaries of words that follow 'zoo' GIVEN THAT 'zoo' followed 'foo'\n\n# shorthand for indexing into the dictionary\nfreq = 0 #frequency\nsub1 = 1 #possible next words\nsub2 = 2 #possible words after next word\n\n# The predwrite function operates on the constructed nested dictionary to come up with a list of suggestions\n# for the likely next word.\n\n# In generating its list of top suggestions, the program uses a weighted combination of\n# 1. words likely to follow the most recent word you typed\n# 2. words likely to follow 2 after the second most recent word\n# 3. words likely to satisfy both of the above conditions (i.e., following that 2-gram sequence)\n# 4. the baseline frequency of words in the source\n\nvision = 2 # this defines how many words back the program looks. in this iteration of the program, it has to be 2\nweight_baseline = .01 # weight given to the list of most frequent words in the overall dictionary\nweight_2 = 1 # weight given to the list of words occurring most frequently 2 after the 2nd most recent word typed\nweight_1 = 3 # weight given to the list of words occurring most frequently 1 after the 1st most recent word typed\nweight_21 = 4 # weight given to the list of words occurring most frequently after the conjunction of 1st and 2nd\ndefault_wts = [.0000001,2,1,10] # this is passed to predwrite, then to weightedCombination\n\n# prints the log in a readable way\n\n#takes a list of dictionaries and a list of associated weights, returns a single list\n\n# given a dictionary, returns a list of all words in it, ranked by frequency\n\n# give a string of the filename, opens the file and returns a list of sentences (splitting the file at '.')\n\n# adds all the words in a sentence to D\n\n# Add word at position pos in sentence s to dictionary D with vision v. Returns a dictionary.\n\n# given a dictionary of keys with freqs in position [0], returns a dictionary with these frequencies rescaled to sum to 1\n# calls itself on all subdictionaries\n\n# prints all the info about a word in D\n\n# prints a dictionary (can also be called on subdictionaries)\n\n# given a filename, returns a dictionary of words with info about that filename\n\n# main writing function. takes a dictionary, an integer number of options, and a list of weights\n\n\n### SAMPLE USE ###\n# assumes subdirectory called 'texts' with a document called 'strunk' in it\n\nstrunk = makedict('strunk1918')\npredwrite(strunk,20,[.0000001,2,1,10])\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def printSentence(log):\n toPrint = \"\"\n for w in log:\n toPrint = toPrint + \" \" + w\n print textwrap.fill(toPrint,80)", "metadata": "root.printSentence", "header": "['module', '___EOS___']", "index": 56 }, { "content": "def weightedCombination(dlist,wtlist):\n\n if len(dlist) != len(wtlist) or len(dlist) < 2:\n print \"Please input two lists of equal length greater than 2\"\n return\n\n combined = {}\n\n for n in range(0,len(dlist)):\n for w in dlist[n]:\n if w in combined:\n combined[w] = (combined[w][0]+dlist[n][w][0]*wtlist[n],{},{})\n else:\n combined[w] = (dlist[n][w][0]*wtlist[n],{},{})\n\n normalizeFreqs(combined)\n\n return combined", "metadata": "root.weightedCombination", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def ranked(D):\n cur = 0\n toReturn = []\n for w in D:\n toReturn.append([w,D[w][0]])\n\n ranked = sorted(toReturn, key=operator.itemgetter(1))\n return list(reversed(ranked))", "metadata": "root.ranked", "header": "['module', '___EOS___']", "index": 83 }, { "content": "def getsentences(filename):\n path = 'texts/' + filename\n f = open(path,\"r\")\n sentences = f.read().split('.')\n for s in range (0,len(sentences)):\n sentences[s] = sentences[s].strip('\\n')\n sentences[s] = sentences[s].translate(string.maketrans(\"\",\"\"), string.punctuation)\n sentences[s] = sentences[s].lower()\n sentences[s] = sentences[s].split()\n return sentences", "metadata": "root.getsentences", "header": "['module', '___EOS___']", "index": 93 }, { "content": "def addsentence(s,D):\n # v sets the 'vision' of the function, which is how many words it looks ahead, i.e. how many levels deep it goes\n v = vision\n for w in range(0,len(s)):\n D = addWord(D,s,w,v)\n return D", "metadata": "root.addsentence", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def addWord(D,s,pos,v):\n #extract string of word from the sentence\n word = s[pos]\n #base case. v is 0, so we're just returning D with the frequency of s[w] incremented, not altering subdictionaries\n if v == 0:\n # increment the frequency if the word already exists\n if word in D:\n D[word] =(D[word][freq]+1,D[word][sub1],D[word][sub2])\n # otherwise, create a new entry in D\n else:\n D[word] =(1,{},{})\n return D\n\n # if v is greater than 0, we increment the frequency and ask for subdictionaries\n elif v>0:\n if word in D:\n newsub1 = D[word][sub1]\n if pos < len(s)-1:\n newsub1 = addWord(D[word][sub1],s,pos+1,v-1)\n\n newsub2 = D[word][sub2]\n if v>1 and pos < len(s)-2:\n newsub2 = addWord(D[word][sub2],s,pos+2,v-2)\n\n D[word] =(D[word][freq]+1,newsub1,newsub2)\n return D\n else:\n D[word] =(1,{},{})\n\n newsub1 = {}\n if pos < len(s)-1:\n newsub1 = addWord(D[word][sub1],s,pos+1,v-1)\n\n newsub2 = {}\n if v>1 and pos < len(s)-2:\n newsub2 = addWord(D[word][sub2],s,pos+2,v-2)\n\n\n D[word] =(D[word][freq]+1,newsub1,newsub2)\n return D", "metadata": "root.addWord", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def normalizeFreqs(D):\n if not D:\n return D\n s = 0\n #take the sum of all frequencies in D\n for k in D:\n s = s + D[k][0]\n # divide each frequency by the sum\n for k in D:\n D[k] = (D[k][0]/float(s),normalizeFreqs(D[k][1]),normalizeFreqs(D[k][2]))\n return D", "metadata": "root.normalizeFreqs", "header": "['module', '___EOS___']", "index": 156 }, { "content": "def printEntry(D,w):\n print w\n print \"freq: \" + str(D[w][0])\n print \"\\nFIRST\"\n printD(D[w][sub1],\"\")\n print \"\\nSECOND\"\n printD(D[w][sub2],\"\")", "metadata": "root.printEntry", "header": "['module', '___EOS___']", "index": 169 }, { "content": "def printD(D,indent):\n for x in reversed(sorted(D.items(), key=operator.itemgetter(1))):\n word = x[0]\n print indent + word + \": \" + str(D[word][0])\n print indent + word + '[sub1]:'\n printD(D[word][1],indent+\" \")\n print indent + word + '[sub2]:'\n printD(D[word][2],indent+\" \")\n if indent == \"\":\n print '\\n'", "metadata": "root.printD", "header": "['module', '___EOS___']", "index": 178 }, { "content": "def makedict(filename):\n print \"Making dictionary...\"\n sentences = getsentences(filename)\n dictionary = {}\n for s in sentences:\n dictionary = addsentence(s,dictionary)\n dictionary = normalizeFreqs(dictionary)\n return dictionary", "metadata": "root.makedict", "header": "['module', '___EOS___']", "index": 190 }, { "content": "def predwrite(D,num_opts,wtlist):\n fullLog = []\n linelog = []\n cur = 0\n baseline = D\n\n while 1:\n rankings = ranked(baseline)\n if len(linelog) == 0: # if nothing written, predict with no prior context, using whole-dict freqs\n rankings = rankings # do not change from the baseline\n if len(linelog) == 1:\n prev1 = linelog[0]\n if prev1 in D:\n subdict1 = D[prev1][1] #subdict of words coming 1 after the first chosen word\n rankings = ranked(weightedCombination([baseline,subdict1],[wtlist[0],wtlist[1]]))\n if len(linelog) > 1:\n prev1 = linelog[cur - 1]\n prev2 = linelog[cur - 2]\n if prev1 in D:\n subdict1 = {}\n if D[prev1][1]:\n subdict1 = D[prev1][1] # subdict of words coming 1 after word at [cur-1]\n rankings = ranked(weightedCombination([baseline,subdict1],[wtlist[0],wtlist[1]]))\n elif prev2 in D:\n subdict2 = {}\n if D[prev2][2]:\n subdict2 = D[prev2][2] # subdict of words coming 2 after word at [cur-2]\n rankings = ranked(weightedCombination([baseline,subdict2],[wtlist[0],wtlist[1]]))\n if prev1 in D and prev2 in D:\n subdict1 = {}\n if D[prev1][1]:\n subdict1 = D[prev1][1] # subdict of words coming 1 after word at [cur-1]\n subdict2 = {}\n if D[prev2][2]:\n subdict2 = D[prev2][2] # subdict of words coming 2 after word at [cur-2]\n subdict2_1 = {}\n if prev1 in D[prev2][1]:\n subdict2_1 = D[prev2][1][prev1][1] # subdict of words following conjunction of ([cur-2],[cur-1])\n rankings = ranked(weightedCombination([baseline, subdict1, subdict2, subdict2_1],\n [wtlist[0], wtlist[1], wtlist[2], wtlist[3]]\n ))\n\n for n in range(0,num_opts): #print the options for the user\n print str(n+1) + \" = \" + str(rankings[n][0])\n\n response = raw_input('Choose a word from above.\\n')\n if response.isdigit():\n response = int(response)\n print \"\\n\"\n if response >= 1 and response <= num_opts:\n linelog = linelog + [str(rankings[response-1][0])]\n cur += 1\n printSentence(fullLog+linelog)\n elif response == 0:\n print 'Final output: '\n fullLog = fullLog + linelog\n print ' '.join(fullLog)\n return linelog\n elif response == 'x': #todo handle empty string case\n del linelog[-1] # remove last element of current line\n cur -= 1\n printSentence(fullLog+linelog)\n elif response == '.' or response=='?': # starts a new sentence\n linelog = linelog + [response]\n fullLog = fullLog + linelog\n linelog = []\n cur = 0\n printSentence(fullLog+linelog)\n elif isinstance(response, str):\n linelog = linelog + [response]\n cur += 1\n printSentence(fullLog+linelog)\n else:\n print \"Invalid input. Choose a number between 1 and \" + str(num_opts) + \" or enter a word present in the source\"\n printSentence(fullLog+linelog)\n\n print '\\n'\n clear()\n return", "metadata": "root.predwrite", "header": "['module', '___EOS___']", "index": 200 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Copy", "right", " ", "(", "c", ")", " ", "2016", " ", "Jam", "ie", " ", "Bre", "w_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "jam", "ie", " ", "brew", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear_", "=_", "lambda_", ":_", "os_", "._", "system_", "(_", "'", "cls", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "script", " ", "take", "s", " ", "a", " ", "source", " ", "material", " ", "and", " ", "store", "s", " ", "each", " ", "unique", " ", "word", " ", "in", " ", "it", " ", "as", " ", "an", " ", "entry", " ", "in", " ", "a", " ", "python", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ea", "ch", " ", "entry", " ", "in", " ", "the", " ", "dictionar", "y", " ", "(", "for", " ", "word", " ", "w", ")", " ", "is", " ", "a", " ", "tuple", " ", "of", " ", "(", "freque", "nc", "y", "(", "w", "),", " ", "subd", "ict", "ionar", "y1", ",", " ", "subd", "ict", "ionar", "y2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subd", "ict", "ionar", "y1", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "all", " ", "words", " ", "tha", "t", " ", "have", " ", "occur", "red", " ", "one", " ", "after", " ", "w_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subd", "ict", "ionar", "y2", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "all", " ", "words", " ", "tha", "t", " ", "have", " ", "occur", "red", " ", "two", " ", "after", " ", "w_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Subd", "ict", "ionar", "y", " ", "entri", "es", " ", "have", " ", "the", " ", "exact", " ", "same", " ", "format", " ", "as", " ", "dictionar", "y", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "D", "['", "foo", "']", "[", "sub", "1", "]['", "zoo", "']", " ", "is", " ", "a", " ", "tuple", " ", "of", " ", "(", "freque", "nc", "y", "(", "zoo", "|", "foo", "),", "subd", "ict", "1", ",", "subd", "ict", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "re", " ", "tho", "se", " ", "subd", "ict", "ionar", "ies", " ", "are", " ", "now", " ", "dictionar", "ies", " ", "of", " ", "words", " ", "tha", "t", " ", "follow", " ", "'", "zoo", "'", " ", "GI", "VEN", " ", "THA", "T", " ", "'", "zoo", "'", " ", "followe", "d", " ", "'", "foo", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "short", "hand", " ", "for", " ", "indexing", " ", "int", "o", " ", "the", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "freq_", "=_", "0_", "#", "frequency_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub", "1_", "=_", "1_", "#", "possib", "le", " ", "next", " ", "words_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub", "2_", "=_", "2_", "#", "possib", "le", " ", "words", " ", "after", " ", "next", " ", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pred", "write", " ", "function", " ", "operate", "s", " ", "on", " ", "the", " ", "construct", "ed", " ", "nest", "ed", " ", "dictionar", "y", " ", "to", " ", "come", " ", "up", " ", "with", " ", "a", " ", "list", " ", "of", " ", "suggestions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "like", "ly", " ", "next", " ", "word", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "generat", "ing", " ", "its", " ", "list", " ", "of", " ", "top", " ", "suggestions", ",", " ", "the", " ", "program", " ", "use", "s", " ", "a", " ", "weight", "ed", " ", "combinat", "ion", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "words", " ", "like", "ly", " ", "to", " ", "follow", " ", "the", " ", "most", " ", "recent", " ", "word", " ", "you", " ", "typed", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "words", " ", "like", "ly", " ", "to", " ", "follow", " ", "2", " ", "after", " ", "the", " ", "second", " ", "most", " ", "recent", " ", "word_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", "words", " ", "like", "ly", " ", "to", " ", "satisfy", " ", "bot", "h", " ", "of", " ", "the", " ", "above", " ", "condition", "s", " ", "(", "i", ".", "e", ".,", " ", "follow", "ing", " ", "tha", "t", " ", "2", "-", "gram", " ", "sequence", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ".", " ", "the", " ", "baseline", " ", "freque", "nc", "y", " ", "of", " ", "words", " ", "in", " ", "the", " ", "source_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vision", "_", "=_", "2_", "#", " ", "this", " ", "defin", "es", " ", "how", " ", "many", " ", "words", " ", "back", " ", "the", " ", "program", " ", "look", "s", ".", " ", "in", " ", "this", " ", "iterati", "on", " ", "of", " ", "the", " ", "program", ",", " ", "it", " ", "has", " ", "to", " ", "be", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight", "\\u", "baseline_", "=_", ".01_", "#", " ", "weight", " ", "give", "n", " ", "to", " ", "the", " ", "list", " ", "of", " ", "most", " ", "frequent", " ", "words", " ", "in", " ", "the", " ", "over", "all", " ", "dictionary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight", "\\u", "2_", "=_", "1_", "#", " ", "weight", " ", "give", "n", " ", "to", " ", "the", " ", "list", " ", "of", " ", "words", " ", "occur", "ring", " ", "most", " ", "frequent", "ly", " ", "2", " ", "after", " ", "the", " ", "2n", "d", " ", "most", " ", "recent", " ", "word", " ", "typed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight", "\\u", "1_", "=_", "3_", "#", " ", "weight", " ", "give", "n", " ", "to", " ", "the", " ", "list", " ", "of", " ", "words", " ", "occur", "ring", " ", "most", " ", "frequent", "ly", " ", "1", " ", "after", " ", "the", " ", "1s", "t", " ", "most", " ", "recent", " ", "word", " ", "typed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weight", "\\u", "21_", "=_", "4_", "#", " ", "weight", " ", "give", "n", " ", "to", " ", "the", " ", "list", " ", "of", " ", "words", " ", "occur", "ring", " ", "most", " ", "frequent", "ly", " ", "after", " ", "the", " ", "conjunction", " ", "of", " ", "1s", "t", " ", "and", " ", "2n", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "wt", "s_", "=_", "[_", ".0000", "001_", ",_", "2_", ",_", "1_", ",_", "10_", "]_", "#", " ", "this", " ", "is", " ", "pass", "ed", " ", "to", " ", "pred", "write", ",", " ", "then", " ", "to", " ", "weight", "ed", "Combinat", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "s", " ", "the", " ", "log", " ", "in", " ", "a", " ", "reada", "ble", " ", "way_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "take", "s", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "and", " ", "a", " ", "list", " ", "of", " ", "associate", "d", " ", "weight", "s", ",", " ", "return", "s", " ", "a", " ", "single", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", "n", " ", "a", " ", "dictionar", "y", ",", " ", "return", "s", " ", "a", " ", "list", " ", "of", " ", "all", " ", "words", " ", "in", " ", "it", ",", " ", "ranked", " ", "by", " ", "frequency_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "a", " ", "string", " ", "of", " ", "the", " ", "filename", ",", " ", "opens", " ", "the", " ", "file", " ", "and", " ", "return", "s", " ", "a", " ", "list", " ", "of", " ", "sentence", "s", " ", "(", "splitting", " ", "the", " ", "file", " ", "at", " ", "'.'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adds", " ", "all", " ", "the", " ", "words", " ", "in", " ", "a", " ", "sentence", " ", "to", " ", "D_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "word", " ", "at", " ", "position", " ", "pos", " ", "in", " ", "sentence", " ", "s", " ", "to", " ", "dictionar", "y", " ", "D", " ", "with", " ", "vision", " ", "v", ".", " ", "Return", "s", " ", "a", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", "n", " ", "a", " ", "dictionar", "y", " ", "of", " ", "keys", " ", "with", " ", "freqs", " ", "in", " ", "position", " ", "[", "0", "],", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "with", " ", "these", " ", "freque", "ncie", "s", " ", "rescale", "d", " ", "to", " ", "sum", " ", "to", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calls", " ", "its", "elf", " ", "on", " ", "all", " ", "subd", "ict", "ionar", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "s", " ", "all", " ", "the", " ", "info", " ", "abo", "ut", " ", "a", " ", "word", " ", "in", " ", "D_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "s", " ", "a", " ", "dictionar", "y", " ", "(", "can", " ", "als", "o", " ", "be", " ", "call", "ed", " ", "on", " ", "subd", "ict", "ionar", "ies", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", "n", " ", "a", " ", "filename", ",", " ", "return", "s", " ", "a", " ", "dictionar", "y", " ", "of", " ", "words", " ", "with", " ", "info", " ", "abo", "ut", " ", "tha", "t", " ", "filename_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "main", " ", "writ", "ing", " ", "function", ".", " ", "take", "s", " ", "a", " ", "dictionar", "y", ",", " ", "an", " ", "integ", "er", " ", "number", " ", "of", " ", "options", ",", " ", "and", " ", "a", " ", "list", " ", "of", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "SAMPLE", " ", "USE", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assume", "s", " ", "subdirectory", " ", "call", "ed", " ", "'", "texts", "'", " ", "with", " ", "a", " ", "document", " ", "call", "ed", " ", "'", "stru", "nk", "'", " ", "in", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stru", "nk_", "=_", "maked", "ict_", "(_", "'", "stru", "nk", "191", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pred", "write_", "(_", "stru", "nk_", ",_", "20_", ",_", "[_", ".0000", "001_", ",_", "2_", ",_", "1_", ",_", "10_", "]_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "Sentence", "_", "(_", "log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "Print_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w_", "in_", "log_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "Print_", "=_", "to", "Print_", "+_", "\"", " ", "\"_", "+_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "textwrap_", "._", "fill_", "(_", "to", "Print_", ",_", "80_", ")_", "\\u\\u\\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_", "weight", "ed", "Combinat", "ion_", "(_", "dlist", "_", ",_", "wt", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "dlist", "_", ")_", "!=_", "len_", "(_", "wt", "list_", ")_", "or_", "len_", "(_", "dlist", "_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ple", "ase", " ", "input", " ", "two", " ", "lists", " ", "of", " ", "equal", " ", "length", " ", "great", "er", " ", "than", " ", "2", "\"_", "\\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_", "combined_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "dlist", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "w_", "in_", "dlist", "_", "[_", "n_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "w_", "in_", "combined_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combined_", "[_", "w_", "]_", "=_", "(_", "combined_", "[_", "w_", "]_", "[_", "0_", "]_", "+_", "dlist", "_", "[_", "n_", "]_", "[_", "w_", "]_", "[_", "0_", "]_", "*_", "wt", "list_", "[_", "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 ", " _", "combined_", "[_", "w_", "]_", "=_", "(_", "dlist", "_", "[_", "n_", "]_", "[_", "w_", "]_", "[_", "0_", "]_", "*_", "wt", "list_", "[_", "n_", "]_", ",_", "{_", "}_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normali", "ze", "Freq", "s_", "(_", "combined_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "combined_", "\\u\\u\\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_", "ranked", "_", "(_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "Return_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "Return_", "._", "append_", "(_", "[_", "w_", ",_", "D_", "[_", "w_", "]_", "[_", "0_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ranked", "_", "=_", "sorted_", "(_", "to", "Return_", ",_", "key_", "=_", "operator_", "._", "itemgetter_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list_", "(_", "reversed_", "(_", "ranked", "_", ")_", ")_", "\\u\\u\\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_", "gets", "ente", "nces_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "'", "texts", "/'_", "+_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "path_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "=_", "f_", "._", "read_", "(_", ")_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "sentences_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sentences_", "[_", "s_", "]_", "=_", "sentences_", "[_", "s_", "]_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "[_", "s_", "]_", "=_", "sentences_", "[_", "s_", "]_", "._", "translate_", "(_", "string_", "._", "maket", "rans_", "(_", "\"\"_", ",_", "\"\"_", ")_", ",_", "string_", "._", "punctuation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "[_", "s_", "]_", "=_", "sentences_", "[_", "s_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "[_", "s_", "]_", "=_", "sentences_", "[_", "s_", "]_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sentences_", "\\u\\u\\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_", "adds", "ente", "nce_", "(_", "s_", ",_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "v", " ", "sets", " ", "the", " ", "'", "vision", "'", " ", "of", " ", "the", " ", "function", ",", " ", "whi", "ch", " ", "is", " ", "how", " ", "many", " ", "words", " ", "it", " ", "look", "s", " ", "ahe", "ad", ",", " ", "i", ".", "e", ".", " ", "how", " ", "many", " ", "level", "s", " ", "deep", " ", "it", " ", "go", "es_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "vision", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "w_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "s_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "add", "Word_", "(_", "D_", ",_", "s_", ",_", "w_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Word_", "(_", "D_", ",_", "s_", ",_", "pos_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "extract", " ", "string", " ", "of", " ", "word", " ", "from", " ", "the", " ", "sentence_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "s_", "[_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "base", " ", "case", ".", " ", "v", " ", "is", " ", "0", ",", " ", "so", " ", "we", "'", "re", " ", "just", " ", "return", "ing", " ", "D", " ", "with", " ", "the", " ", "freque", "nc", "y", " ", "of", " ", "s", "[", "w", "]", " ", "increment", "ed", ",", " ", "not", " ", "alter", "ing", " ", "subd", "ict", "ionar", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "increment", " ", "the", " ", "freque", "nc", "y", " ", "if", " ", "the", " ", "word", " ", "alr", "ead", "y", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "word_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "[_", "word_", "]_", "=_", "(_", "D_", "[_", "word_", "]_", "[_", "freq_", "]_", "+_", "1_", ",_", "D_", "[_", "word_", "]_", "[_", "sub", "1_", "]_", ",_", "D_", "[_", "word_", "]_", "[_", "sub", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "create", " ", "a", " ", "new", " ", "entry", " ", "in", " ", "D_", "\\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 ", " _", "D_", "[_", "word_", "]_", "=_", "(_", "1_", ",_", "{_", "}_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "v", " ", "is", " ", "great", "er", " ", "than", " ", "0", ",", " ", "we", " ", "increment", " ", "the", " ", "freque", "nc", "y", " ", "and", " ", "ask", " ", "for", " ", "subd", "ict", "ionar", "ies_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "v_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "word_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "news", "ub", "1_", "=_", "D_", "[_", "word_", "]_", "[_", "sub", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "<_", "len_", "(_", "s_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "news", "ub", "1_", "=_", "add", "Word_", "(_", "D_", "[_", "word_", "]_", "[_", "sub", "1_", "]_", ",_", "s_", ",_", "pos_", "+_", "1_", ",_", "v_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "news", "ub", "2_", "=_", "D_", "[_", "word_", "]_", "[_", "sub", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", ">_", "1_", "and_", "pos_", "<_", "len_", "(_", "s_", ")_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "news", "ub", "2_", "=_", "add", "Word_", "(_", "D_", "[_", "word_", "]_", "[_", "sub", "2_", "]_", ",_", "s_", ",_", "pos_", "+_", "2_", ",_", "v_", "-_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "D_", "[_", "word_", "]_", "=_", "(_", "D_", "[_", "word_", "]_", "[_", "freq_", "]_", "+_", "1_", ",_", "news", "ub", "1_", ",_", "news", "ub", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "D_", "[_", "word_", "]_", "=_", "(_", "1_", ",_", "{_", "}_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "news", "ub", "1_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "<_", "len_", "(_", "s_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "news", "ub", "1_", "=_", "add", "Word_", "(_", "D_", "[_", "word_", "]_", "[_", "sub", "1_", "]_", ",_", "s_", ",_", "pos_", "+_", "1_", ",_", "v_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "news", "ub", "2_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", ">_", "1_", "and_", "pos_", "<_", "len_", "(_", "s_", ")_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "news", "ub", "2_", "=_", "add", "Word_", "(_", "D_", "[_", "word_", "]_", "[_", "sub", "2_", "]_", ",_", "s_", ",_", "pos_", "+_", "2_", ",_", "v_", "-_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "D_", "[_", "word_", "]_", "=_", "(_", "D_", "[_", "word_", "]_", "[_", "freq_", "]_", "+_", "1_", ",_", "news", "ub", "1_", ",_", "news", "ub", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "normali", "ze", "Freq", "s_", "(_", "D_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "take", " ", "the", " ", "sum", " ", "of", " ", "all", " ", "freque", "ncie", "s", " ", "in", " ", "D_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "s_", "+_", "D_", "[_", "k_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "divide", " ", "each", " ", "freque", "nc", "y", " ", "by", " ", "the", " ", "sum_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "[_", "k_", "]_", "=_", "(_", "D_", "[_", "k_", "]_", "[_", "0_", "]_", "/_", "float_", "(_", "s_", ")_", ",_", "normali", "ze", "Freq", "s_", "(_", "D_", "[_", "k_", "]_", "[_", "1_", "]_", ")_", ",_", "normali", "ze", "Freq", "s_", "(_", "D_", "[_", "k_", "]_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "Entry_", "(_", "D_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "freq", ":", " ", "\"_", "+_", "str_", "(_", "D_", "[_", "w_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "FIR", "ST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "D_", "(_", "D_", "[_", "w_", "]_", "[_", "sub", "1_", "]_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "n", "SECOND", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "D_", "(_", "D_", "[_", "w_", "]_", "[_", "sub", "2_", "]_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "D_", "(_", "D_", ",_", "indent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "reversed_", "(_", "sorted_", "(_", "D_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "operator_", "._", "itemgetter_", "(_", "1_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "x_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "indent_", "+_", "word_", "+_", "\":", " ", "\"_", "+_", "str_", "(_", "D_", "[_", "word_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "indent_", "+_", "word_", "+_", "'[", "sub", "1", "]:", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "D_", "(_", "D_", "[_", "word_", "]_", "[_", "1_", "]_", ",_", "indent_", "+_", "\"", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "indent_", "+_", "word_", "+_", "'[", "sub", "2", "]:", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "D_", "(_", "D_", "[_", "word_", "]_", "[_", "2_", "]_", ",_", "indent_", "+_", "\"", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indent_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maked", "ict_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Maki", "ng", " ", "dictionar", "y", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "=_", "gets", "ente", "nces_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dictionary_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "sentences_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dictionary_", "=_", "adds", "ente", "nce_", "(_", "s_", ",_", "dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dictionary_", "=_", "normali", "ze", "Freq", "s_", "(_", "dictionary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dictionary_", "\\u\\u\\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_", "pred", "write_", "(_", "D_", ",_", "num", "\\u", "opts_", ",_", "wt", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "Log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline_", "=_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ranking", "s_", "=_", "ranked", "_", "(_", "baseline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "line", "log_", ")_", "==_", "0_", ":_", "#", " ", "if", " ", "not", "hing", " ", "writt", "en", ",", " ", "predi", "ct", " ", "with", " ", "no", " ", "prior", " ", "context", ",", " ", "usi", "ng", " ", "whole", "-", "dict", " ", "freqs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ranking", "s_", "=_", "ranking", "s_", "#", " ", "do", " ", "not", " ", "change", " ", "from", " ", "the", " ", "baseline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "line", "log_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "1_", "=_", "line", "log_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "1_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ict", "1_", "=_", "D_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", "#", "subd", "ict", " ", "of", " ", "words", " ", "comi", "ng", " ", "1", " ", "after", " ", "the", " ", "first", " ", "chosen", " ", "word_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ranking", "s_", "=_", "ranked", "_", "(_", "weight", "ed", "Combinat", "ion_", "(_", "[_", "baseline_", ",_", "subd", "ict", "1_", "]_", ",_", "[_", "wt", "list_", "[_", "0_", "]_", ",_", "wt", "list_", "[_", "1_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "line", "log_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "1_", "=_", "line", "log_", "[_", "cur_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "2_", "=_", "line", "log_", "[_", "cur_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "1_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ict", "1_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "D_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subd", "ict", "1_", "=_", "D_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", "#", " ", "subd", "ict", " ", "of", " ", "words", " ", "comi", "ng", " ", "1", " ", "after", " ", "word", " ", "at", " ", "[", "cur", "-1", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ranking", "s_", "=_", "ranked", "_", "(_", "weight", "ed", "Combinat", "ion_", "(_", "[_", "baseline_", ",_", "subd", "ict", "1_", "]_", ",_", "[_", "wt", "list_", "[_", "0_", "]_", ",_", "wt", "list_", "[_", "1_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "prev", "2_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ict", "2_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "D_", "[_", "prev", "2_", "]_", "[_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subd", "ict", "2_", "=_", "D_", "[_", "prev", "2_", "]_", "[_", "2_", "]_", "#", " ", "subd", "ict", " ", "of", " ", "words", " ", "comi", "ng", " ", "2", " ", "after", " ", "word", " ", "at", " ", "[", "cur", "-", "2", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ranking", "s_", "=_", "ranked", "_", "(_", "weight", "ed", "Combinat", "ion_", "(_", "[_", "baseline_", ",_", "subd", "ict", "2_", "]_", ",_", "[_", "wt", "list_", "[_", "0_", "]_", ",_", "wt", "list_", "[_", "1_", "]_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prev", "1_", "in_", "D_", "and_", "prev", "2_", "in_", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ict", "1_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "D_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subd", "ict", "1_", "=_", "D_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", "#", " ", "subd", "ict", " ", "of", " ", "words", " ", "comi", "ng", " ", "1", " ", "after", " ", "word", " ", "at", " ", "[", "cur", "-1", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ict", "2_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "D_", "[_", "prev", "2_", "]_", "[_", "2_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subd", "ict", "2_", "=_", "D_", "[_", "prev", "2_", "]_", "[_", "2_", "]_", "#", " ", "subd", "ict", " ", "of", " ", "words", " ", "comi", "ng", " ", "2", " ", "after", " ", "word", " ", "at", " ", "[", "cur", "-", "2", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ict", "2", "\\u", "1_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "1_", "in_", "D_", "[_", "prev", "2_", "]_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subd", "ict", "2", "\\u", "1_", "=_", "D_", "[_", "prev", "2_", "]_", "[_", "1_", "]_", "[_", "prev", "1_", "]_", "[_", "1_", "]_", "#", " ", "subd", "ict", " ", "of", " ", "words", " ", "follow", "ing", " ", "conjunction", " ", "of", " ", "([", "cur", "-", "2", "],[", "cur", "-1", "])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ranking", "s_", "=_", "ranked", "_", "(_", "weight", "ed", "Combinat", "ion_", "(_", "[_", "baseline_", ",_", "subd", "ict", "1_", ",_", "subd", "ict", "2_", ",_", "subd", "ict", "2", "\\u", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "wt", "list_", "[_", "0_", "]_", ",_", "wt", "list_", "[_", "1_", "]_", ",_", "wt", "list_", "[_", "2_", "]_", ",_", "wt", "list_", "[_", "3_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "range_", "(_", "0_", ",_", "num", "\\u", "opts_", ")_", ":_", "#", "print", " ", "the", " ", "options", " ", "for", " ", "the", " ", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "str_", "(_", "n_", "+_", "1_", ")_", "+_", "\"", " ", "=", " ", "\"_", "+_", "str_", "(_", "ranking", "s_", "[_", "n_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "raw", "\\u", "input_", "(_", "'", "Choose", " ", "a", " ", "word", " ", "from", " ", "above", ".\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "int_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", ">=_", "1_", "and_", "response_", "<=_", "num", "\\u", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "log_", "=_", "line", "log_", "+_", "[_", "str_", "(_", "ranking", "s_", "[_", "response_", "-_", "1_", "]_", "[_", "0_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Sentence", "_", "(_", "full", "Log_", "+_", "line", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Final", " ", "output", ":", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Log_", "=_", "full", "Log_", "+_", "line", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", "'_", "._", "join_", "(_", "full", "Log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "line", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "==_", "'", "x", "'_", ":_", "#", "todo", " ", "handle", " ", "empty", " ", "string", " ", "case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "line", "log_", "[_", "-_", "1_", "]_", "#", " ", "remove", " ", "last", " ", "element", " ", "of", " ", "current", " ", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Sentence", "_", "(_", "full", "Log_", "+_", "line", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response_", "==_", "'.'_", "or_", "response_", "==_", "'?'_", ":_", "#", " ", "starts", " ", "a", " ", "new", " ", "sentence_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "log_", "=_", "line", "log_", "+_", "[_", "response_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full", "Log_", "=_", "full", "Log_", "+_", "line", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Sentence", "_", "(_", "full", "Log_", "+_", "line", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "response_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "log_", "=_", "line", "log_", "+_", "[_", "response_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Sentence", "_", "(_", "full", "Log_", "+_", "line", "log_", ")_", "\\u\\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_", "\"", "Inva", "lid", " ", "input", ".", " ", "Choose", " ", "a", " ", "number", " ", "bet", "ween", " ", "1", " ", "and", " ", "\"_", "+_", "str_", "(_", "num", "\\u", "opts_", ")_", "+_", "\"", " ", "or", " ", "enter", " ", "a", " ", "word", " ", "presen", "t", " ", "in", " ", "the", " ", "source", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "Sentence", "_", "(_", "full", "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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 ]
Unused import
AppScale/appscale/AppServer/lib/PyAMF-0.6.1/pyamf/adapters/_sets.py
[ { "content": "# Copyright (c) The PyAMF Project.\n# See LICENSE.txt for details.\n\n\"\"\"\nAdapter for the stdlib C{sets} module.\n\n@since: 0.4\n\"\"\"\n\nimport sets\n\nimport pyamf\nfrom pyamf.adapters import util\n\n\nif hasattr(sets, 'ImmutableSet'):\n pyamf.add_type(sets.ImmutableSet, util.to_tuple)\n\nif hasattr(sets, 'Set'):\n pyamf.add_type(sets.Set, util.to_tuple)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "The", " ", "Py", "AM", "F", " ", "Project", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", ".", "txt", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Adapt", "er", " ", "for", " ", "the", " ", "stdlib", " ", "C", "{", "sets", "}", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", "@", "sinc", "e", ":", " ", "0.", "4", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pya", "mf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pya", "mf_", "._", "adapters_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "sets_", ",_", "'", "Immu", "table", "Set", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pya", "mf_", "._", "add", "\\u", "type_", "(_", "sets_", "._", "Immu", "table", "Set_", ",_", "util_", "._", "to", "\\u", "tuple_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "sets_", ",_", "'", "Set", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pya", "mf_", "._", "add", "\\u", "type_", "(_", "sets_", "._", "Set_", ",_", "util_", "._", "to", "\\u", "tuple_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
nasa/RHEAS/src/datasets/prism.py
[ { "content": "\"\"\" RHEAS module for retrieving PRISM meteorological data.\n\n.. module:: prism\n :synopsis: Retrieve PRISM meteorological data\n\n.. moduleauthor:: Kostas Andreadis <[email protected]>\n\n\"\"\"\n\n\nfrom ftplib import FTP\nimport datasets\nfrom datetime import datetime\nimport tempfile\nimport subprocess\nimport zipfile\nimport dbio\n\n\ntable = {\"ppt\": \"precip.prism\", \"tmax\": \"tmax.prism\", \"tmin\": \"tmin.prism\"}\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def dates(dbname):\n dts = datasets.dates(dbname, table['ppt'])\n return dts", "metadata": "root.dates", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def _downloadVariable(varname, dbname, dts, bbox):\n \"\"\"Downloads the PRISM data products for a specific variable and a set of\n dates *dt*. *varname* can be ppt, tmax or tmin.\"\"\"\n url = \"prism.oregonstate.edu\"\n ftp = FTP(url)\n ftp.login()\n ftp.cwd(\"daily/{0}\".format(varname))\n outpath = tempfile.mkdtemp()\n years = list(set([t.year for t in dts]))\n for yr in years:\n ftp.cwd(\"{0}\".format(yr))\n filenames = [f for f in ftp.nlst() if datetime.strptime(f.split(\"_\")[-2], \"%Y%m%d\") >= dts[0] and datetime.strptime(f.split(\"_\")[-2], \"%Y%m%d\") <= dts[1]]\n for fname in filenames:\n dt = datetime.strptime(fname.split(\"_\")[-2], \"%Y%m%d\")\n with open(\"{0}/{1}\".format(outpath, fname), 'wb') as f:\n ftp.retrbinary(\"RETR {0}\".format(fname), f.write)\n if fname.endswith(\"zip\"):\n fz = zipfile.ZipFile(\"{0}/{1}\".format(outpath, fname))\n lfilename = filter(lambda s: s.endswith(\"bil\"), fz.namelist())[0]\n fz.extractall(outpath)\n else:\n lfilename = fname\n tfilename = lfilename.replace(\".bil\", \".tif\")\n if bbox is not None:\n subprocess.call([\"gdal_translate\", \"-projwin\", \"{0}\".format(bbox[0]), \"{0}\".format(bbox[3]), \"{0}\".format(bbox[2]), \"{0}\".format(bbox[1]), \"{0}/{1}\".format(outpath, lfilename), \"{0}/{1}\".format(outpath, tfilename)])\n dbio.ingest(dbname, \"{0}/{1}\".format(outpath, tfilename), dt, table[varname], False)\n else:\n dbio.ingest(dbname, \"{0}/{1}\".format(outpath, lfilename), dt, table[varname], False)\n ftp.cwd(\"..\")", "metadata": "root._downloadVariable", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def download(dbname, dts, bbox):\n \"\"\"Downloads the PRISM data products for a set of\n dates *dt* and imports them into the PostGIS database *dbname*.\"\"\"\n for varname in [\"ppt\", \"tmax\", \"tmin\"]:\n _downloadVariable(varname, dbname, dts, bbox)", "metadata": "root.download", "header": "['module', '___EOS___']", "index": 58 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", " ", "RHE", "AS", " ", "module", " ", "for", " ", "retrie", "ving", " ", "PRI", "SM", " ", "mete", "oro", "logical", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "module", "::", " ", "pris", "m", "\\", "10", ";", " ", " ", " ", ":", "synopsis", ":", " ", "Retrieve", " ", "PRI", "SM", " ", "mete", "oro", "logical", " ", "data", "\\", "10", ";", "\\", "10", ";", "..", " ", "module", "author", "::", " ", "Ko", "sta", "s", " ", "Andre", "adi", "s", " ", "<", "kan", "dre", "ad", "@", "jp", "l", ".", "nasa", ".", "gov", ">", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ftp", "lib_", "import_", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datasets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "dbi", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "{_", "\"", "ppt", "\"_", ":_", "\"", "precip", ".", "pris", "m", "\"_", ",_", "\"", "tma", "x", "\"_", ":_", "\"", "tma", "x", ".", "pris", "m", "\"_", ",_", "\"", "tmi", "n", "\"_", ":_", "\"", "tmi", "n", ".", "pris", "m", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "dates_", "(_", "dbname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dts_", "=_", "datasets_", "._", "dates_", "(_", "dbname_", ",_", "table_", "[_", "'", "ppt", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dts_", "\\u\\u\\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", "download", "Variable_", "(_", "varname_", ",_", "dbname_", ",_", "dts_", ",_", "bbox_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Down", "load", "s", " ", "the", " ", "PRI", "SM", " ", "data", " ", "products", " ", "for", " ", "a", " ", "specific", " ", "variab", "le", " ", "and", " ", "a", " ", "set", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "dates", " ", "*", "dt", "*.", " ", "*", "varname", "*", " ", "can", " ", "be", " ", "ppt", ",", " ", "tma", "x", " ", "or", " ", "tmi", "n", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "\"", "pris", "m", ".", "ore", "gon", "state", ".", "edu", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "=_", "FTP", "_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "._", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ftp_", "._", "cwd_", "(_", "\"", "daily", "/{", "0", "}\"_", "._", "format_", "(_", "varname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outpath_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "years_", "=_", "list_", "(_", "set_", "(_", "[_", "t_", "._", "year_", "for_", "t_", "in_", "dts_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "yr_", "in_", "years_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftp_", "._", "cwd_", "(_", "\"{", "0", "}\"_", "._", "format_", "(_", "yr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filenames_", "=_", "[_", "f_", "for_", "f_", "in_", "ftp_", "._", "nl", "st_", "(_", ")_", "if_", "datetime_", "._", "strptime_", "(_", "f_", "._", "split_", "(_", "\"\\u\"_", ")_", "[_", "-_", "2_", "]_", ",_", "\"%", "Y", "%", "m", "%", "d", "\"_", ")_", ">=_", "dts_", "[_", "0_", "]_", "and_", "datetime_", "._", "strptime_", "(_", "f_", "._", "split_", "(_", "\"\\u\"_", ")_", "[_", "-_", "2_", "]_", ",_", "\"%", "Y", "%", "m", "%", "d", "\"_", ")_", "<=_", "dts_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fname_", "in_", "filenames_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "datetime_", "._", "strptime_", "(_", "fname_", "._", "split_", "(_", "\"\\u\"_", ")_", "[_", "-_", "2_", "]_", ",_", "\"%", "Y", "%", "m", "%", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "fname_", ")_", ",_", "'", "wb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ftp_", "._", "retr", "binary_", "(_", "\"", "RET", "R", " ", "{", "0", "}\"_", "._", "format_", "(_", "fname_", ")_", ",_", "f_", "._", "write_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "\"", "zip", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fz", "_", "=_", "zipfile_", "._", "Zip", "File_", "(_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "fname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lfil", "ename_", "=_", "filter_", "(_", "lambda_", "s_", ":_", "s_", "._", "endswith_", "(_", "\"", "bil", "\"_", ")_", ",_", "fz", "_", "._", "namelist_", "(_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fz", "_", "._", "extracta", "ll_", "(_", "outpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lfil", "ename_", "=_", "fname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tfi", "lename", "_", "=_", "lfil", "ename_", "._", "replace_", "(_", "\".", "bil", "\"_", ",_", "\".", "tif", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bbox_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "call_", "(_", "[_", "\"", "gdal", "\\u", "translat", "e", "\"_", ",_", "\"-", "proj", "win", "\"_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "bbox_", "[_", "0_", "]_", ")_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "bbox_", "[_", "3_", "]_", ")_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "bbox_", "[_", "2_", "]_", ")_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "bbox_", "[_", "1_", "]_", ")_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "lfil", "ename_", ")_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "tfi", "lename", "_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbi", "o_", "._", "ingest", "_", "(_", "dbname_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "tfi", "lename", "_", ")_", ",_", "dt_", ",_", "table_", "[_", "varname_", "]_", ",_", "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 ", " _", "dbi", "o_", "._", "ingest", "_", "(_", "dbname_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "outpath_", ",_", "lfil", "ename_", ")_", ",_", "dt_", ",_", "table_", "[_", "varname_", "]_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ftp_", "._", "cwd_", "(_", "\"..\"_", ")_", "\\u\\u\\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_", "download_", "(_", "dbname_", ",_", "dts_", ",_", "bbox_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Down", "load", "s", " ", "the", " ", "PRI", "SM", " ", "data", " ", "products", " ", "for", " ", "a", " ", "set", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "dates", " ", "*", "dt", "*", " ", "and", " ", "import", "s", " ", "them", " ", "int", "o", " ", "the", " ", "Post", "GI", "S", " ", "databa", "se", " ", "*", "db", "name", "*.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "varname_", "in_", "[_", "\"", "ppt", "\"_", ",_", "\"", "tma", "x", "\"_", ",_", "\"", "tmi", "n", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "download", "Variable_", "(_", "varname_", ",_", "dbname_", ",_", "dts_", ",_", "bbox_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cloudera/hue/desktop/core/ext-py/pycrypto-2.6.1/pct-speedtest.py
[ { "content": " def test_hash_large(self, hash_name, module):\n self.announce_start(\"%s (single large input)\" % (hash_name,))\n\n blocks = self.random_blocks(16384, 10000)\n\n # Perform hashing\n t0 = time.time()\n h = module.new()\n for b in blocks:\n h.update(b)\n h.digest()\n t = time.time()\n\n hash_speed = len(blocks) * len(blocks[0]) / (t - t0)\n self.announce_result(hash_speed / 10**6, \"MBps\")", "metadata": "root.Benchmark.test_hash_large", "header": "['class', 'Benchmark', ':', '___EOS___']", "index": 149 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Benchmark", "_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hash", "\\u", "large_", "(_", "self_", ",_", "hash", "\\u", "name_", ",_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "announce", "\\u", "start_", "(_", "\"%", "s", " ", "(", "single", " ", "large", " ", "input", ")\"_", "%_", "(_", "hash", "\\u", "name_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blocks_", "=_", "self_", "._", "random", "\\u", "blocks_", "(_", "1638", "4_", ",_", "10000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Perform", " ", "hashin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "module_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "blocks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "._", "update_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "\\u", "speed_", "=_", "len_", "(_", "blocks_", ")_", "*_", "len_", "(_", "blocks_", "[_", "0_", "]_", ")_", "/_", "(_", "t_", "-_", "t0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "announce", "\\u", "result_", "(_", "hash", "\\u", "speed_", "/_", "10_", "**_", "6_", ",_", "\"", "MB", "ps", "\"_", ")_", "\\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 ]
Except block handles 'BaseException'
ganeti/ganeti/test/py/ganeti.ssconf_unittest.py
[ { "content": " def testNonExistantFile(self):\n testfile = utils.PathJoin(self.tmpdir, \"does.not.exist\")\n\n self.assertFalse(os.path.exists(testfile))\n\n try:\n ssconf.ReadSsconfFile(testfile)\n except EnvironmentError, err:\n self.assertEqual(err.errno, errno.ENOENT)\n else:\n self.fail(\"Exception was not raised\")", "metadata": "root.TestReadSsconfFile.testNonExistantFile", "header": "['class', 'TestReadSsconfFile', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 57 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Read", "Ss", "conf", "File_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Non", "Exist", "ant", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testfile_", "=_", "utils_", "._", "Path", "Join_", "(_", "self_", "._", "tmpdir_", ",_", "\"", "doe", "s", ".", "not", ".", "exist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "testfile_", ")_", ")_", "\\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 ", " _", "ssc", "onf_", "._", "Read", "Ss", "conf", "File_", "(_", "testfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Environ", "ment", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "errno_", ",_", "errno_", "._", "ENOENT_", ")_", "\\u\\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_", "(_", "\"", "Except", "ion", " ", "was", " ", "not", " ", "raise", "d", "\"_", ")_", "\\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 ]
Unnecessary 'else' clause in loop
hyde/hyde/hyde/ext/publishers/pyfs.py
[ { "content": " def publish(self):\n super(PyFS, self).publish()\n deploy_fs = OSFS(self.site.config.deploy_root_path.path)\n for (dirnm, local_filenms) in deploy_fs.walk():\n logger.info(\"Making directory: %s\", dirnm)\n self.fs.makedir(dirnm, allow_recreate=True)\n remote_fileinfos = self.fs.listdirinfo(dirnm, files_only=True)\n # Process each local file, to see if it needs updating.\n for filenm in local_filenms:\n filepath = pathjoin(dirnm, filenm)\n # Try to find an existing remote file, to compare metadata.\n for (nm, info) in remote_fileinfos:\n if nm == filenm:\n break\n else:\n info = {}\n # Skip it if the etags match\n if self.check_etag and \"etag\" in info:\n with deploy_fs.open(filepath, \"rb\") as f:\n local_etag = self._calculate_etag(f)\n if info[\"etag\"] == local_etag:\n logger.info(\"Skipping file [etag]: %s\", filepath)\n continue\n # Skip it if the mtime is more recent remotely.\n if self.check_mtime and \"modified_time\" in info:\n local_mtime = deploy_fs.getinfo(filepath)[\"modified_time\"]\n if info[\"modified_time\"] > local_mtime:\n logger.info(\"Skipping file [mtime]: %s\", filepath)\n continue\n # Upload it to the remote filesystem.\n logger.info(\"Uploading file: %s\", filepath)\n with deploy_fs.open(filepath, \"rb\") as f:\n self.fs.setcontents(filepath, f)\n # Process each remote file, to see if it needs deleting.\n for (filenm, info) in remote_fileinfos:\n filepath = pathjoin(dirnm, filenm)\n if filenm not in local_filenms:\n logger.info(\"Removing file: %s\", filepath)\n self.fs.remove(filepath)", "metadata": "root.PyFS.publish", "header": "['class', 'PyFS', '(', 'Publisher', ')', ':', '___EOS___']", "index": 57 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Py", "FS_", "(_", "Publisher_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publish_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Py", "FS_", ",_", "self_", ")_", "._", "publish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "\\u", "fs_", "=_", "OS", "FS_", "(_", "self_", "._", "site_", "._", "config_", "._", "deploy", "\\u", "root", "\\u", "path_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "dir", "nm_", ",_", "local", "\\u", "filen", "ms_", ")_", "in_", "deploy", "\\u", "fs_", "._", "walk_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "info_", "(_", "\"", "Maki", "ng", " ", "director", "y", ":", " ", "%", "s", "\"_", ",_", "dir", "nm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fs_", "._", "maked", "ir_", "(_", "dir", "nm_", ",_", "allow", "\\u", "recreate", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "filein", "fos", "_", "=_", "self_", "._", "fs_", "._", "listd", "iri", "nfo_", "(_", "dir", "nm_", ",_", "files", "\\u", "only_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Process", " ", "each", " ", "local", " ", "file", ",", " ", "to", " ", "see", " ", "if", " ", "it", " ", "need", "s", " ", "updat", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filen", "m_", "in_", "local", "\\u", "filen", "ms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", "=_", "path", "join_", "(_", "dir", "nm_", ",_", "filen", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Tr", "y", " ", "to", " ", "find", " ", "an", " ", "exist", "ing", " ", "remote", " ", "file", ",", " ", "to", " ", "compare", " ", "metadata", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "nm_", ",_", "info_", ")_", "in_", "remote", "\\u", "filein", "fos", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "nm_", "==_", "filen", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Ski", "p", " ", "it", " ", "if", " ", "the", " ", "eta", "gs", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "check", "\\u", "etag_", "and_", "\"", "eta", "g", "\"_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "with_", "deploy", "\\u", "fs_", "._", "open_", "(_", "filepath_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "local", "\\u", "etag_", "=_", "self_", "._", "\\u", "calcul", "ate", "\\u", "etag_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info_", "[_", "\"", "eta", "g", "\"_", "]_", "==_", "local", "\\u", "etag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "info_", "(_", "\"", "Ski", "ppi", "ng", " ", "file", " ", "[", "eta", "g", "]:", " ", "%", "s", "\"_", ",_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Ski", "p", " ", "it", " ", "if", " ", "the", " ", "mti", "me", " ", "is", " ", "more", " ", "recent", " ", "remote", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "check", "\\u", "mtime_", "and_", "\"", "modifi", "ed", "\\u", "time", "\"_", "in_", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "local", "\\u", "mtime_", "=_", "deploy", "\\u", "fs_", "._", "getin", "fo_", "(_", "filepath_", ")_", "[_", "\"", "modifi", "ed", "\\u", "time", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "info_", "[_", "\"", "modifi", "ed", "\\u", "time", "\"_", "]_", ">_", "local", "\\u", "mtime_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "info_", "(_", "\"", "Ski", "ppi", "ng", " ", "file", " ", "[", "mti", "me", "]:", " ", "%", "s", "\"_", ",_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Upload", " ", "it", " ", "to", " ", "the", " ", "remote", " ", "filesystem", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Upload", "ing", " ", "file", ":", " ", "%", "s", "\"_", ",_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "deploy", "\\u", "fs_", "._", "open_", "(_", "filepath_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fs_", "._", "setc", "onte", "nts_", "(_", "filepath_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", "Process", " ", "each", " ", "remote", " ", "file", ",", " ", "to", " ", "see", " ", "if", " ", "it", " ", "need", "s", " ", "delet", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "(_", "filen", "m_", ",_", "info_", ")_", "in_", "remote", "\\u", "filein", "fos", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filepath_", "=_", "path", "join_", "(_", "dir", "nm_", ",_", "filen", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filen", "m_", "not_", "in_", "local", "\\u", "filen", "ms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "\"", "Remo", "ving", " ", "file", ":", " ", "%", "s", "\"_", ",_", "filepath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fs_", "._", "remove_", "(_", "filepath_", ")_", "\\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, 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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 ]
Unreachable code
charanpald/APGL/apgl/graph/test/GraphUtilsTest.py
[ { "content": " def testNormalisedLaplacianSym(self):\n numVertices = 10\n numFeatures = 0\n\n vList = VertexList(numVertices, numFeatures)\n graph = SparseGraph(vList)\n\n ell = 2\n m = 2\n generator = BarabasiAlbertGenerator(ell, m)\n graph = generator.generate(graph)\n\n k = 10\n W = graph.getSparseWeightMatrix()\n L = GraphUtils.shiftLaplacian(W)\n\n L2 = graph.normalisedLaplacianSym()\n\n tol = 10**-6\n self.assertTrue(numpy.linalg.norm(L + L2 - 2*numpy.eye(numVertices)) < tol)\n\n #Test zero rows/cols \n W = scipy.sparse.csr_matrix((5, 5))\n W[1, 0] = 1\n W[0, 1] = 1\n L = GraphUtils.normalisedLaplacianSym(W)\n \n for i in range(2, 5): \n self.assertEquals(L[i, i], 0)", "metadata": "root.AbstractMatrixGraphTest.testNormalisedLaplacianSym", "header": "['class', 'AbstractMatrixGraphTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Abstract", "Matrix", "Graph", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Normal", "ise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "Vertices_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "Features_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "v", "List_", "=_", "Vertex", "List_", "(_", "num", "Vertices_", ",_", "num", "Features_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "Spar", "se", "Graph_", "(_", "v", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Bar", "aba", "si", "Alb", "ert", "Generator_", "(_", "ell_", ",_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "generator_", "._", "generate_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "=_", "graph_", "._", "get", "Spar", "se", "Weig", "ht", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "shift", "Lap", "lac", "ian_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "L2_", "=_", "graph_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tol_", "=_", "10_", "**_", "-_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "numpy_", "._", "linalg_", "._", "norm_", "(_", "L_", "+_", "L2_", "-_", "2_", "*_", "numpy_", "._", "eye_", "(_", "num", "Vertices_", ")_", ")_", "<_", "tol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "zero", " ", "rows", "/", "cols", " _", "\\u\\u\\uNL\\u\\u\\u_", "W_", "=_", "scipy_", "._", "sparse_", "._", "csr", "\\u", "matrix_", "(_", "(_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "1_", ",_", "0_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "W_", "[_", "0_", ",_", "1_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "Graph", "Utils_", "._", "normalise", "d", "Lap", "lac", "ian", "Sym", "_", "(_", "W_", ")_", "\\u\\u\\uNEWLINE\\u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, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
openstack/neutron/neutron/openstack/common/cache/_backends/memory.py
[ { "content": " def _append_tail(self, key, tail):\n return self._incr_append(key, tail)", "metadata": "root.MemoryBackend._append_tail", "header": "['class', 'MemoryBackend', '(', 'backends', '.', 'BaseCache', ')', ':', '___EOS___']", "index": 113 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Memo", "ry", "Backend_", "(_", "backends_", "._", "Base", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "append", "\\u", "tail_", "(_", "self_", ",_", "key_", ",_", "tail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "incr", "\\u", "append_", "(_", "key_", ",_", "tail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
dragondjf/QMarkdowner/dpkt/vrrp.py
[ { "content": " def __len__(self):\n return self.__hdr_len__ + (4 * self.count) + len(self.auth)", "metadata": "root.VRRP.__len__", "header": "['class', 'VRRP', '(', 'dpkt', '.', 'Packet', ')', ':', '___EOS___']", "index": 39 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "VR", "RP", "_", "(_", "dp", "kt_", "._", "Packet_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "hdr", "\\u", "len\\u\\u_", "+_", "(_", "4_", "*_", "self_", "._", "count_", ")_", "+_", "len_", "(_", "self_", "._", "auth_", ")_", "\\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 ]
Unused import
allegro/ralph/src/ralph/tests/admin.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom ralph.admin import RalphAdmin, register\nfrom ralph.admin.m2m import RalphTabularM2MInline\nfrom ralph.attachments.admin import AttachmentsMixin\nfrom ralph.lib.transitions.admin import TransitionAdminMixin\nfrom ralph.tests.models import Bar, Car, Car2, Foo, Manufacturer, Order\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@register(Car)\nclass CarAdmin(RalphAdmin):\n ordering = ['name']\n list_filter = ['year']\n search_fields = ['name', 'foos__bar']", "metadata": "root.CarAdmin", "header": "['module', '___EOS___']", "index": 10 }, { "content": "@register(Bar)\nclass BarAdmin(RalphAdmin):\n list_filter = ['date', 'name', 'created', 'price', 'count']", "metadata": "root.BarAdmin", "header": "['module', '___EOS___']", "index": 17 }, { "content": "class BarsM2MInline(RalphTabularM2MInline):\n model = Bar\n fields = ('name', 'date', 'price', 'count')\n extra = 1\n verbose_name = _('Bars')", "metadata": "root.BarsM2MInline", "header": "['module', '___EOS___']", "index": 22 }, { "content": "@register(Foo)\nclass FooAdmin(RalphAdmin):\n inlines = [BarsM2MInline]", "metadata": "root.FooAdmin", "header": "['module', '___EOS___']", "index": 29 }, { "content": "@register(Car2)\nclass Car2Admin(RalphAdmin):\n list_filter = ['manufacturer']", "metadata": "root.Car2Admin", "header": "['module', '___EOS___']", "index": 34 }, { "content": "@register(Manufacturer)\nclass ManufacturerAdmin(RalphAdmin):\n ordering = ['name', '-country']", "metadata": "root.ManufacturerAdmin", "header": "['module', '___EOS___']", "index": 39 }, { "content": "@register(Order)\nclass OrderAdmin(AttachmentsMixin, TransitionAdminMixin, RalphAdmin):\n change_views = []", "metadata": "root.OrderAdmin", "header": "['module', '___EOS___']", "index": 44 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ral", "ph_", "._", "admin_", "import_", "Ra", "lph", "Admin_", ",_", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ral", "ph_", "._", "admin_", "._", "m2", "m_", "import_", "Ra", "lph", "Tab", "ular", "M2", "MI", "nline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ral", "ph_", "._", "attachments_", "._", "admin_", "import_", "Attach", "ment", "s", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ral", "ph_", "._", "lib_", "._", "transitions_", "._", "admin_", "import_", "Transiti", "on", "Admi", "n", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ral", "ph_", "._", "tests_", "._", "models_", "import_", "Bar_", ",_", "Car", "_", ",_", "Car", "2_", ",_", "Foo_", ",_", "Manufacturer", "_", ",_", "Order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "register_", "(_", "Car", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Car", "Admin_", "(_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ordering_", "=_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "[_", "'", "year", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields_", "=_", "[_", "'", "name", "'_", ",_", "'", "foo", "s", "\\u\\u", "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_", "@_", "register_", "(_", "Bar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Bar", "Admin_", "(_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "filter_", "=_", "[_", "'", "date", "'_", ",_", "'", "name", "'_", ",_", "'", "created", "'_", ",_", "'", "price", "'_", ",_", "'", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bar", "s", "M2", "MI", "nline", "_", "(_", "Ra", "lph", "Tab", "ular", "M2", "MI", "nline", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "'", "name", "'_", ",_", "'", "date", "'_", ",_", "'", "price", "'_", ",_", "'", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "'", "Bar", "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_", "@_", "register_", "(_", "Foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Foo", "Admin_", "(_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inlines_", "=_", "[_", "Bar", "s", "M2", "MI", "nline", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "(_", "Car", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Car", "2", "Admin_", "(_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "filter_", "=_", "[_", "'", "manufactur", "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_", "@_", "register_", "(_", "Manufacturer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Manufacturer", "Admin_", "(_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ordering_", "=_", "[_", "'", "name", "'_", ",_", "'-", "countr", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "(_", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Order", "Admin_", "(_", "Attach", "ment", "s", "Mixin_", ",_", "Transiti", "on", "Admi", "n", "Mixin_", ",_", "Ra", "lph", "Admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "views_", "=_", "[_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
dongying/dear/dear/spectrogram.py
[ { "content": "#-*- coding: utf-8 -*-\n\nimport numpy as np\nimport matplotlib\n#matplotlib.use('GTKAgg')\nimport matplotlib.pyplot as plt\nimport matplotlib.cm as cm\nfrom matplotlib.image import NonUniformImage\nimport matplotlib.colors as colo\n\nfrom dear.spectrum import cqt, dft, auditory, SpectrogramFile\nfrom dear.analysis import MFCCs\n\n\n\n\nif __name__ == '__main__':\n import getopt, sys\n\n\n try:\n opts, args = getopt.getopt(sys.argv[1:], \"g:s:t:o:h:w:q:n:f:b:rc\")\n except getopt.GetoptError as ex:\n print ex\n exit_with_usage()\n if len(args) != 1:\n #print args\n exit_with_usage()\n\n import dear.io as io\n decoder = io.get_decoder(name='audioread')\n audio = decoder.Audio(args[0])\n print \"SampleRate: %d Hz\\nChannel(s): %d\\nDuration: %d sec\"\\\n % (audio.samplerate, audio.channels, audio.duration)\n\n graph = 'dft'\n st = 0\n to = None\n outfile = None\n norm=colo.LogNorm(vmin=0.000001)\n\n for o, a in opts:\n if o == '-s':\n st = float(a)\n elif o == '-t':\n to = float(a)\n elif o == '-g':\n graph = a\n assert graph in ('dft','cqt','cnt','gmt','Y1','Y2','Y3','Y4','Y5','mfcc')\n elif o == '-o':\n outfile = a\n\n if to is None or to > audio.duration:\n r_to = audio.duration\n else:\n r_to = to\n\n if graph == 'dft':\n win = 2048\n hop = 512\n for o, a in opts:\n if o == '-w':\n win = int(a)\n elif o == '-h':\n hop = int(a)\n spec = [[]]\n gram = dft.PowerSpectrum(audio)\n for freqs in gram.walk(win, hop, start=st, end=to, join_channels=True):\n spec[0].append(freqs)\n #\n elif graph == 'mfcc':\n N = 20\n fmin, fmax = 0., 7040.\n win = 2048\n hop = 1024\n for o, a in opts:\n if o == '-w':\n win = int(a)\n elif o == '-h':\n hop = int(a)\n elif o == '-n':\n N = int(a)\n elif o == '-f':\n fmin, fmax = [float(f) for f in a.split(',',1)]\n spec = [[]]\n gram = MFCCs(audio)\n for freqs in gram.walk(N, fmin, fmax, win, hop, st, to):\n spec[0].append(freqs)\n norm = colo.Normalize()\n #\n elif graph == 'cqt':\n Q = 34\n hop = 0.02\n for o, a in opts:\n if o == '-q':\n Q = int(a)\n elif o == '-h':\n hop = float(a)\n spec = [[]]\n gram = cqt.CQTPowerSpectrum(audio)\n print 'total:', int((r_to-st)/hop)\n for t,freqs in enumerate(gram.walk(Q=Q, freq_base=55., freq_max=7040, hop=hop, start=st, end=to, join_channels=True)):\n if t%100 == 0:\n sys.stdout.write('%d...' % t)\n sys.stdout.flush()\n spec[0].append(freqs)\n #\n elif graph == 'cnt':\n N = 24\n hop = 0.02\n rw = False\n for o, a in opts:\n if o == '-n':\n N = int(a)\n elif o == '-h':\n hop = float(a)\n elif o == '-r':\n rw = True\n spec = [[]]\n gram = cqt.CNTPowerSpectrum(audio)\n print 'total:', int((r_to-st)/hop)\n for t, freqs in enumerate(\n gram.walk(N=N, freq_base=55., freq_max=7040, hop=hop, start=st, end=to, resize_win=rw)):\n if t%100==0:\n sys.stdout.write('%d...' % t)\n sys.stdout.flush()\n spec[0].append(freqs)\n print \"\"\n #\n elif graph == 'gmt':\n N = 64\n win = 0.025\n hop = 0.010\n freqs = [110., 4435.]\n combine=False\n for o, a in opts:\n if o == '-n':\n N = int(a)\n elif o == '-h':\n hop = float(a)\n elif o == '-w':\n win = float(a)\n elif o == '-f':\n freqs = [float(f) for f in a.split(',',1)]\n elif o == '-c':\n combine=True\n spec = [[]]\n gram = auditory.GammatoneSpectrum(audio)\n print 'total:', int((r_to-st)/hop)\n for t, freqs in enumerate(\n gram.walk(N=N, freq_base=freqs[0], freq_max=freqs[1], \n start=st, end=to, combine=combine, twin=win, thop=hop)):\n if t%100==0:\n sys.stdout.write('%d...' % t)\n sys.stdout.flush()\n spec[0].append(freqs)\n print \"\"\n #\n elif graph in ('Y1','Y2','Y3','Y4','Y5'):\n N = 64\n win = 0.025\n hop = 0.010\n freqs = [110., 4435.]\n combine = False\n for o, a in opts:\n if o == '-n':\n N = int(a)\n elif o == '-h':\n hop = float(a)\n elif o == '-w':\n win = float(a)\n elif o == '-f':\n freqs = [float(f) for f in a.split(',',1)]\n elif o == '-c':\n combine=True\n spec = [[]]\n gram = getattr(auditory,graph)\n gram = gram(audio)\n print 'total:', int((r_to-st)/hop)\n for t, freqs in enumerate(\n gram.walk(N=N, freq_base=freqs[0], freq_max=freqs[1], \n start=st, end=to, combine=combine, twin=win, thop=hop)):\n if t%100==0:\n sys.stdout.write('%d...' % t)\n sys.stdout.flush()\n spec[0].append(freqs)\n print \"\"\n\n # to dB scale\n dBmax, dBmin = -15., -70.\n if graph in ('dft','cqt','cnt'):\n magmin = 10**(dBmin/20)\n for g in spec:\n for i,frame in enumerate(g):\n g[i] = 20*np.log10(np.maximum(frame/20.,magmin))\n norm = colo.Normalize(vmin=dBmin, vmax=dBmax) \n elif graph in ('gmt','Y1','Y2','Y3','Y4','Y5'):\n magmin = 10**(dBmin/20)\n for g in spec:\n for i,frame in enumerate(g):\n g[i] = 20*np.log10(np.maximum(frame,magmin))\n norm = colo.Normalize(vmin=dBmin, vmax=dBmax) \n\n figname = \"%s - %s\" % (graph, audio.path)\n plot_spectrogram(np.array(spec), (0,len(spec[0])), (0,len(spec[0][0])), norm=norm, figname=figname)\n if outfile:\n out = SpectrogramFile(outfile, 'w')\n out.dump(spec[0])\n out.close()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "mat", "plotlib", ".", "use", "('", "GTK", "Agg", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "cm_", "as_", "cm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "image_", "import_", "Non", "Uniform", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "colors_", "as_", "colo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "dea", "r_", "._", "spectrum_", "import_", "cq", "t_", ",_", "dft", "_", ",_", "audit", "ory", "_", ",_", "Spect", "rogr", "am", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dea", "r_", "._", "analysis_", "import_", "MF", "CC", "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\\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 ", " _", "import_", "getopt_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "\"", "g", ":", "s", ":", "t", ":", "o", ":", "h", ":", "w", ":", "q", ":", "n", ":", "f", ":", "b", ":", "rc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "Get", "opt", "Error_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit", "\\u", "with", "\\u", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exit", "\\u", "with", "\\u", "usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "dea", "r_", "._", "io_", "as_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decoder_", "=_", "io_", "._", "get", "\\u", "decoder_", "(_", "name_", "=_", "'", "audio", "read", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "audio_", "=_", "decoder_", "._", "Audio_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Sampl", "e", "Rat", "e", ":", " ", "%", "d", " ", "H", "z", "\\\\", "n", "Chan", "nel", "(", "s", "):", " ", "%", "d", "\\\\", "n", "Dur", "ation", ":", " ", "%", "d", " ", "sec", "\"_", "%_", "(_", "audio_", "._", "samplerate", "_", ",_", "audio_", "._", "channels_", ",_", "audio_", "._", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "'", "dft", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outfile_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm_", "=_", "colo", "_", "._", "Log", "Norm_", "(_", "vmin_", "=_", "0.000001", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "st_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "g", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "graph_", "in_", "(_", "'", "dft", "'_", ",_", "'", "cq", "t", "'_", ",_", "'", "cnt", "'_", ",_", "'", "gmt", "'_", ",_", "'", "Y", "1", "'_", ",_", "'", "Y", "2", "'_", ",_", "'", "Y", "3", "'_", ",_", "'", "Y", "4", "'_", ",_", "'", "Y", "5", "'_", ",_", "'", "mfc", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "o", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to_", "is_", "None_", "or_", "to_", ">_", "audio_", "._", "duration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "to_", "=_", "audio_", "._", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\\u", "to_", "=_", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "graph_", "==_", "'", "dft", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "2048_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "dft", "_", "._", "Power", "Spectrum_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "freqs_", "in_", "gram_", "._", "walk_", "(_", "win_", ",_", "hop_", ",_", "start_", "=_", "st_", ",_", "end_", "=_", "to_", ",_", "join", "\\u", "channels_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\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_", "graph_", "==_", "'", "mfc", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmin", "_", ",_", "fmax", "_", "=_", "0._", ",_", "704", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "=_", "2048_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmin", "_", ",_", "fmax", "_", "=_", "[_", "float_", "(_", "f_", ")_", "for_", "f_", "in_", "a_", "._", "split_", "(_", "','_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "MF", "CC", "s_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "freqs_", "in_", "gram_", "._", "walk_", "(_", "N_", ",_", "fmin", "_", ",_", "fmax", "_", ",_", "win_", ",_", "hop_", ",_", "st_", ",_", "to_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "norm_", "=_", "colo", "_", "._", "Normalize", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "graph_", "==_", "'", "cq", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Q_", "=_", "34_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "q", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Q_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "cq", "t_", "._", "CQ", "TP", "ower", "Spectrum_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "total", ":'_", ",_", "int_", "(_", "(_", "r", "\\u", "to_", "-_", "st_", ")_", "/_", "hop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", ",_", "freqs_", "in_", "enumerate_", "(_", "gram_", "._", "walk_", "(_", "Q_", "=_", "Q_", ",_", "freq", "\\u", "base_", "=_", "55.", "_", ",_", "freq", "\\u", "max_", "=_", "704", "0_", ",_", "hop_", "=_", "hop_", ",_", "start_", "=_", "st_", ",_", "end_", "=_", "to_", ",_", "join", "\\u", "channels_", "=_", "True_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'%", "d", "...'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\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_", "graph_", "==_", "'", "cnt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "0.02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rw_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rw_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "cq", "t_", "._", "CNT", "Power", "Spectrum_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "total", ":'_", ",_", "int_", "(_", "(_", "r", "\\u", "to_", "-_", "st_", ")_", "/_", "hop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", ",_", "freqs_", "in_", "enumerate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gram_", "._", "walk_", "(_", "N_", "=_", "N_", ",_", "freq", "\\u", "base_", "=_", "55.", "_", ",_", "freq", "\\u", "max_", "=_", "704", "0_", ",_", "hop_", "=_", "hop_", ",_", "start_", "=_", "st_", ",_", "end_", "=_", "to_", ",_", "resiz", "e\\u", "win_", "=_", "rw_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'%", "d", "...'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "graph_", "==_", "'", "gmt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "=_", "0.025", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "0.010", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "freqs_", "=_", "[_", "110", "._", ",_", "443", "5._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "combine_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freqs_", "=_", "[_", "float_", "(_", "f_", ")_", "for_", "f_", "in_", "a_", "._", "split_", "(_", "','_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combine_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "audit", "ory", "_", "._", "Gamma", "tone", "Spectrum_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "total", ":'_", ",_", "int_", "(_", "(_", "r", "\\u", "to_", "-_", "st_", ")_", "/_", "hop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", ",_", "freqs_", "in_", "enumerate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gram_", "._", "walk_", "(_", "N_", "=_", "N_", ",_", "freq", "\\u", "base_", "=_", "freqs_", "[_", "0_", "]_", ",_", "freq", "\\u", "max_", "=_", "freqs_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "st_", ",_", "end_", "=_", "to_", ",_", "combine_", "=_", "combine_", ",_", "twin", "_", "=_", "win_", ",_", "tho", "p_", "=_", "hop_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'%", "d", "...'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "graph_", "in_", "(_", "'", "Y", "1", "'_", ",_", "'", "Y", "2", "'_", ",_", "'", "Y", "3", "'_", ",_", "'", "Y", "4", "'_", ",_", "'", "Y", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "=_", "0.025", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hop_", "=_", "0.010", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "freqs_", "=_", "[_", "110", "._", ",_", "443", "5._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "combine_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "o_", ",_", "a_", "in_", "opts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "o_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "int_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "h", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hop_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "=_", "float_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "freqs_", "=_", "[_", "float_", "(_", "f_", ")_", "for_", "f_", "in_", "a_", "._", "split_", "(_", "','_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "o_", "==_", "'-", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "combine_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "=_", "[_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "getattr_", "(_", "audit", "ory", "_", ",_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gram_", "=_", "gram_", "(_", "audio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "total", ":'_", ",_", "int_", "(_", "(_", "r", "\\u", "to_", "-_", "st_", ")_", "/_", "hop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", ",_", "freqs_", "in_", "enumerate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "gram_", "._", "walk_", "(_", "N_", "=_", "N_", ",_", "freq", "\\u", "base_", "=_", "freqs_", "[_", "0_", "]_", ",_", "freq", "\\u", "max_", "=_", "freqs_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "st_", ",_", "end_", "=_", "to_", ",_", "combine_", "=_", "combine_", ",_", "twin", "_", "=_", "win_", ",_", "tho", "p_", "=_", "hop_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "write_", "(_", "'%", "d", "...'_", "%_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spec_", "[_", "0_", "]_", "._", "append_", "(_", "freqs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "d", "B", " ", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d", "Bm", "ax_", ",_", "d", "Bm", "in_", "=_", "-_", "15.", "_", ",_", "-_", "70.", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "graph_", "in_", "(_", "'", "dft", "'_", ",_", "'", "cq", "t", "'_", ",_", "'", "cnt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mag", "min_", "=_", "10_", "**_", "(_", "d", "Bm", "in_", "/_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "frame_", "in_", "enumerate_", "(_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "[_", "i_", "]_", "=_", "20_", "*_", "np_", "._", "log10_", "(_", "np_", "._", "maximum_", "(_", "frame_", "/_", "20._", ",_", "mag", "min_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "norm_", "=_", "colo", "_", "._", "Normalize", "_", "(_", "vmin_", "=_", "d", "Bm", "in_", ",_", "vmax_", "=_", "d", "Bm", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "graph_", "in_", "(_", "'", "gmt", "'_", ",_", "'", "Y", "1", "'_", ",_", "'", "Y", "2", "'_", ",_", "'", "Y", "3", "'_", ",_", "'", "Y", "4", "'_", ",_", "'", "Y", "5", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mag", "min_", "=_", "10_", "**_", "(_", "d", "Bm", "in_", "/_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "g_", "in_", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "frame_", "in_", "enumerate_", "(_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "[_", "i_", "]_", "=_", "20_", "*_", "np_", "._", "log10_", "(_", "np_", "._", "maximum_", "(_", "frame_", ",_", "mag", "min_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "norm_", "=_", "colo", "_", "._", "Normalize", "_", "(_", "vmin_", "=_", "d", "Bm", "in_", ",_", "vmax_", "=_", "d", "Bm", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fign", "ame_", "=_", "\"%", "s", " ", "-", " ", "%", "s", "\"_", "%_", "(_", "graph_", ",_", "audio_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plot", "\\u", "spectrogram", "_", "(_", "np_", "._", "array_", "(_", "spec_", ")_", ",_", "(_", "0_", ",_", "len_", "(_", "spec_", "[_", "0_", "]_", ")_", ")_", ",_", "(_", "0_", ",_", "len_", "(_", "spec_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", ")_", ",_", "norm_", "=_", "norm_", ",_", "fign", "ame_", "=_", "fign", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "outfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "Spect", "rogr", "am", "File_", "(_", "outfile_", ",_", "'",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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 ]
Comparison of constants
flosch/simpleapi/simpleapi/server/response.py
[ { "content": " def build(self):\n if len(self.responses) == 1:\n return self.responses[0].build()\n else:\n results = []\n for response in self.responses:\n if response.has_errors():\n results.append(response.build(\n managed=True,\n skip_features=True\n ))\n else:\n results.append(response.build(\n managed=True\n ))\n\n # TODO FIXME XXX: only JSON is supported\n result = u'[%s]' % u','.join(map(lambda x: x['result'], results))\n\n return Response._build_response_obj(\n sapi_request=self.sapi_request,\n response={\n 'result': result,\n 'mimetype': results[0]['mimetype']\n }\n )", "metadata": "root.ResponseMerger.build", "header": "['class', 'ResponseMerger', '(', 'object', ')', ':', '___EOS___']", "index": 33 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Respons", "e", "Merge", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "responses_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "responses_", "[_", "0_", "]_", "._", "build_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "response_", "in_", "self_", "._", "responses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "._", "has", "\\u", "errors_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "response_", "._", "build_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "managed_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "features_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "response_", "._", "build_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "managed_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "FIX", "ME", " ", "XX", "X", ":", " ", "only", " ", "JSO", "N", " ", "is", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "u", "'[", "%", "s", "]'_", "%_", "u", "','_", "._", "join_", "(_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "'", "result", "'_", "]_", ",_", "results_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Response_", "._", "\\u", "build", "\\u", "response", "\\u", "obj_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sapi", "\\u", "request_", "=_", "self_", "._", "sapi", "\\u", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "results_", "[_", "0_", "]_", "[_", "'", "mime", "type", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
graphite-project/carbon/lib/carbon/storage.py
[ { "content": "def loadAggregationSchemas():\n # NOTE: This abuses the Schema classes above, and should probably be refactored.\n schemaList = []\n config = OrderedConfigParser()\n\n try:\n config.read(STORAGE_AGGREGATION_CONFIG)\n except (IOError, CarbonConfigException):\n log.msg(\"%s not found or wrong perms, ignoring.\" % STORAGE_AGGREGATION_CONFIG)\n\n for section in config.sections():\n options = dict( config.items(section) )\n matchAll = options.get('match-all')\n pattern = options.get('pattern')\n listName = options.get('list')\n\n xFilesFactor = options.get('xfilesfactor')\n aggregationMethod = options.get('aggregationmethod')\n\n try:\n if xFilesFactor is not None:\n xFilesFactor = float(xFilesFactor)\n assert 0 <= xFilesFactor <= 1\n if aggregationMethod is not None:\n assert aggregationMethod in whisper.aggregationMethods\n except ValueError:\n log.msg(\"Invalid schemas found in %s.\" % section)\n continue\n\n archives = (xFilesFactor, aggregationMethod)\n\n if matchAll:\n mySchema = DefaultSchema(section, archives)\n\n elif pattern:\n mySchema = PatternSchema(section, pattern, archives)\n\n elif listName:\n mySchema = ListSchema(section, listName, archives)\n\n schemaList.append(mySchema)\n\n schemaList.append(defaultAggregation)\n return schemaList", "metadata": "root.loadAggregationSchemas", "header": "['module', '___EOS___']", "index": 146 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "Aggregation", "Schema", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "abu", "ses", " ", "the", " ", "Schema", " ", "classe", "s", " ", "above", ",", " ", "and", " ", "shou", "ld", " ", "probab", "ly", " ", "be", " ", "refactor", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schema", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Order", "ed", "Config", "Parser_", "(_", ")_", "\\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 ", " _", "config_", "._", "read_", "(_", "STOR", "AGE", "\\u", "AGG", "REG", "ATION", "\\u", "CONFIG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "Car", "bon", "Config", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "msg_", "(_", "\"%", "s", " ", "not", " ", "found", " ", "or", " ", "wrong", " ", "perm", "s", ",", " ", "ign", "orin", "g", ".\"_", "%_", "STOR", "AGE", "\\u", "AGG", "REG", "ATION", "\\u", "CONFIG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "section_", "in_", "config_", "._", "sections_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "dict_", "(_", "config_", "._", "items_", "(_", "section_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "All_", "=_", "options_", "._", "get_", "(_", "'", "match", "-", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "options_", "._", "get_", "(_", "'", "pattern", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "Name_", "=_", "options_", "._", "get_", "(_", "'", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x", "Files", "Factor_", "=_", "options_", "._", "get_", "(_", "'", "xfi", "les", "factor", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aggregation", "Method_", "=_", "options_", "._", "get_", "(_", "'", "aggregation", "method", "'_", ")_", "\\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_", "x", "Files", "Factor_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "Files", "Factor_", "=_", "float_", "(_", "x", "Files", "Factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0_", "<=_", "x", "Files", "Factor_", "<=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "aggregation", "Method_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "aggregation", "Method_", "in_", "whis", "per_", "._", "aggregation", "Methods_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "msg_", "(_", "\"", "Inva", "lid", " ", "schema", "s", " ", "found", " ", "in", " ", "%", "s", ".\"_", "%_", "section_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "archives", "_", "=_", "(_", "x", "Files", "Factor_", ",_", "aggregation", "Method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "match", "All_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Schema_", "=_", "Default", "Schema_", "(_", "section_", ",_", "archives", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "pattern_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Schema_", "=_", "Pat", "tern", "Schema_", "(_", "section_", ",_", "pattern_", ",_", "archives", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "list", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "Schema_", "=_", "List", "Schema_", "(_", "section_", ",_", "list", "Name_", ",_", "archives", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schema", "List_", "._", "append_", "(_", "my", "Schema_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schema", "List_", "._", "append_", "(_", "default", "Aggregation", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "schema", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pyjs/pyjs/examples/libtest/FunctionTest.py
[ { "content": "from UnitTest import UnitTest\n\nfrom ClassTest import PassMeAClass\nfrom ClassTest import ExampleChildClass\nfrom ClassTest import ExampleMultiSuperclassParent1\nimport Factory2\n\nimport imports.decors # must be in this form\nimport imports.enum.Late\n\n\n\n\n\n\n\n\n\n\n\n\n\nx = 'global test'\n\nname = 'mapping-test'\n\n\n\nlate_global = 'late_global'\n\n# Text is a reserved javascript word\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Handler:\n\n", "metadata": "root.Handler", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, x):\n self._x = x", "metadata": "root.Handler.__init__", "header": "['class', 'Handler', ':', '___EOS___']", "index": 12 }, { "content": " def handle(self, y):\n return self._x is y", "metadata": "root.Handler.handle", "header": "['class', 'Handler', ':', '___EOS___']", "index": 15 }, { "content": "class Callable(object):", "metadata": "root.Callable", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __call__(self):\n return 5", "metadata": "root.Callable.__call__", "header": "['class', 'Callable', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": "def aProcedure():\n x = 1\n if x is 2:\n # a return statement which is not reached\n return \"something\"\n #this is a comment", "metadata": "root.aProcedure", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def aFunctionWithOnlyDoc():\n \"\"\"Only a doc string\"\"\"", "metadata": "root.aFunctionWithOnlyDoc", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def aFunctionReturningNone():\n return None", "metadata": "root.aFunctionReturningNone", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def aFunctionReturningParam(param):\n return param", "metadata": "root.aFunctionReturningParam", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def aFunctionReturningFunction():\n return aFunctionReturningParam", "metadata": "root.aFunctionReturningFunction", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def aFunctionReturningGlobalX1():\n return x", "metadata": "root.aFunctionReturningGlobalX1", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def aFunctionReturningGlobalX2():\n return x", "metadata": "root.aFunctionReturningGlobalX2", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def aFunctionReturningGlobalX3():\n a = x\n return a", "metadata": "root.aFunctionReturningGlobalX3", "header": "['module', '___EOS___']", "index": 47 }, { "content": "def aFunctionReturningLocalX():\n x = 'local test'\n return x", "metadata": "root.aFunctionReturningLocalX", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def aFunctionReturningArgX(x):\n return x", "metadata": "root.aFunctionReturningArgX", "header": "['module', '___EOS___']", "index": 55 }, { "content": "def call(default, arguments, this, label=None):\n return (name, default, arguments, this, label)", "metadata": "root.call", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def functionDefaults(s = \"\", l = []):\n n = len(l)\n s = s + \"%d\" % n\n l.append(n)\n return s, l", "metadata": "root.functionDefaults", "header": "['module', '___EOS___']", "index": 64 }, { "content": "class FunctionTest(UnitTest):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.FunctionTest", "header": "['module', '___EOS___']", "index": 70 }, { "content": " def testLambda(self):\n f = lambda x: x\n self.assertEqual(f(1), 1)\n f = lambda x=1: x\n self.assertEqual(f(), 1)\n self.assertEqual(f(2), 2)\n\n f = lambda x, y: x*y\n self.assertEqual(f(2,3), 6)\n f = lambda x, y=4: x*y\n self.assertEqual(f(2), 8)\n h = Handler(5)\n f = lambda x: h.handle(x)\n self.assertTrue(f(5))\n self.assertFalse(f(4))\n\n f = lambda a, b=1, **kw: (a,b,kw)\n v = f(b = 2, c = 3, a = 1)\n self.assertEqual(v[0], 1)\n self.assertEqual(v[1], 2)\n self.assertEqual(v[2]['c'], 3)\n\n f = lambda a, b=1, *args: (a, b, args)\n v = f(1,2,3,4)\n self.assertEqual(v[2][0], 3)\n self.assertEqual(v[2][1], 4)\n\n try:\n class ClassWithLambdas1:\n f1 = [lambda *args: args[0]]\n except:\n self.fail(\"issue #385 - lambda in class definition\")\n else:\n c = ClassWithLambdas1()\n self.assertEqual(c.f1[0](1), 1, 'issue #385 - lambda function called as bound method')\n\n try:\n class ClassWithLambdas2:\n f2 = lambda *args: args[0]\n except:\n self.fail(\"issue #385 - lambda in class definition\")\n else:\n c = ClassWithLambdas2()\n self.assertEqual(c.f2(1), c, 'issue #385 - bound method lambda called as function')", "metadata": "root.FunctionTest.testLambda", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 72 }, { "content": " def test_callable(self):\n try:\n self.assertEqual(Callable()(), 5)\n except:\n self.fail(\"Bug #572 Callable()() __call__ not supported\")\n self.assertTrue(callable(Callable))\n self.assertTrue(\n callable(Callable()),\n \"Bug #572 callable(Callable()) __call__ not supported\",\n )", "metadata": "root.FunctionTest.test_callable", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 117 }, { "content": " def testProcedure(self):\n self.assertTrue(aFunctionReturningNone() is None,\n \"Function should return None\")\n self.assertTrue(aProcedure() is None,\n \"Procedures should always return None\")", "metadata": "root.FunctionTest.testProcedure", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 128 }, { "content": " def testVariableFunction(self):\n self.assertEqual((aFunctionReturningParam)(\"foo\"), \"foo\")\n self.assertEqual(aFunctionReturningFunction()(\"foo\"), \"foo\")", "metadata": "root.FunctionTest.testVariableFunction", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 134 }, { "content": " def testLookup(self):\n expected_result1 = 'global test'\n expected_result2 = 'local test'\n self.assertEqual(aFunctionReturningGlobalX1(), expected_result1)\n self.assertEqual(aFunctionReturningGlobalX2(), expected_result1)\n self.assertEqual(aFunctionReturningGlobalX3(), expected_result1)\n self.assertEqual(aFunctionReturningLocalX(), expected_result2)\n self.assertEqual(aFunctionReturningArgX('test'), 'test')", "metadata": "root.FunctionTest.testLookup", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 138 }, { "content": " def testLookupLate(self):\n self.assertEqual(late_global, 'late_global')\n\n def local_lookup1():\n self.assertEqual(late_local, 'late_local')\n self.assertTrue(callable(local_lookup2))\n self.assertEqual(local_lookup2(), 'late_local')\n try:\n local_lookup3()\n self.fail(\"lookup3\")\n except NotImplementedError, e:\n self.assertTrue(True)\n\n def local_lookup2():\n return late_local\n\n def local_lookup3():\n raise NotImplementedError\n\n\n late_local = 'late_local'\n local_lookup1()\n\n late = imports.enum.Late.getLate()\n self.assertEqual(late.value, 'late')", "metadata": "root.FunctionTest.testLookupLate", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 147 }, { "content": " def testNameMapping(self):\n r = call(1, 2, this=3, label=4)\n self.assertEqual(r[0], 'mapping-test')\n self.assertEqual(r[1], 1)\n self.assertEqual(r[2], 2)\n self.assertEqual(r[3], 3)\n self.assertEqual(r[4], 4)\n try:\n self.assertEqual(Text('foo'), 'Text: foo')\n except:\n self.fail(\"Bug #574: javascript keywords\")", "metadata": "root.FunctionTest.testNameMapping", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 173 }, { "content": " def testFactory(self):\n\n Factory2.gregister(\"passme\", PassMeAClass)\n Factory2.gregister(\"exchild\", ExampleChildClass)\n Factory2.gregister(\"mscp1\", ExampleMultiSuperclassParent1)\n\n pmc = Factory2.ggetObject(\"passme\")\n self.assertEqual(pmc.foo(), \"foo in PassMeAClass\")\n\n try:\n pmc = Factory2.ggetObject(\"mscp1\", 5)\n except:\n self.assertEqual(False, True, \"Exception indicates bug in compiler: 'Error: uncaught exception: ExampleMultiSuperclassParent1() arguments after ** must be a dictionary 5'\")\n else:\n self.assertEqual(pmc.x, 5)\n try:\n pmc = Factory2.ggetObject(\"exchild\", 5, 7) # 5 is ignored\n except:\n self.assertEqual(False, True, \"Exception indicates bug in compiler: 'Error: uncaught exception: ExampleChildClass() arguments after ** must be a dictionary 7'\")\n else:\n self.assertEqual(pmc.prop_a, 1)\n self.assertEqual(pmc.prop_b, 7)", "metadata": "root.FunctionTest.testFactory", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 185 }, { "content": " def testSliceFunc(self):\n s = \"123 \"\n s = s[1:].rstrip()\n self.assertEqual(s, \"23\")", "metadata": "root.FunctionTest.testSliceFunc", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 208 }, { "content": " def testFunctionDefaults(self):\n s, l = functionDefaults()\n self.assertEqual(s, '0')\n self.assertTrue(l == [0], \"First mutable default mismatch\")\n\n s, l = functionDefaults()\n #self.assertEqual(s, '1') # can be enabled when the next line is fixed\n self.assertTrue(l == [0, 1], \"Second mutable default mismatch bug #214\")\n\n inittest = 1\n def f(inittest = inittest):\n return inittest\n self.assertEqual(f(), inittest)", "metadata": "root.FunctionTest.testFunctionDefaults", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 213 }, { "content": " def testKwargs(self):\n def f(**kwargs):\n return kwargs\n\n self.assertEqual(f(), {})\n self.assertEqual(f(a=1), dict(a=1))", "metadata": "root.FunctionTest.testKwargs", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 227 }, { "content": " def testFunctionDecorating(self):\n log = []\n def deco1(f):\n def fn(*args, **kwargs):\n log.append(\"deco1 begin\")\n res = f(*args, **kwargs)\n log.append(\"deco1 end\")\n return res\n return fn\n\n def deco2(f):\n def fn(*args, **kwargs):\n log.append(\"deco2 begin\")\n res = f(*args, **kwargs)\n log.append(\"deco2 end\")\n return res\n return fn\n\n @deco1\n def fn1(a, b = 0):\n return a, b\n\n @deco1\n @deco2\n def fn2(a, b = 0):\n return a, b\n\n res = fn1(1,2)\n self.assertEqual(res[0], 1)\n self.assertEqual(res[1], 2)\n self.assertEqual(len(log), 2)\n self.assertEqual(log[0], \"deco1 begin\")\n self.assertEqual(log[1], \"deco1 end\")\n\n log = []\n res = fn2(a=3)\n self.assertEqual(res[0], 3)\n self.assertEqual(res[1], 0)\n self.assertEqual(len(log), 4)\n self.assertEqual(log[0], \"deco1 begin\")\n self.assertEqual(log[1], \"deco2 begin\")\n self.assertEqual(log[2], \"deco2 end\")\n self.assertEqual(log[3], \"deco1 end\")\n\n @imports.decors.othermoduledeco1\n def fn3(x):\n return \"b\"\n\n self.assertEqual(fn3(\"b\"), \"abc\")\n\n def shiftdecorator(si):\n def wrapper(fn):\n def decorated(*args, **kw):\n return fn(*args, **kw) + si\n return decorated\n return wrapper\n\n def fn4(v):\n return v\n\n @shiftdecorator(1)\n def fn4d1(v):\n return v\n @shiftdecorator(2)\n def fn4d2(v):\n return v\n fn4d3 = shiftdecorator(2)(fn4)\n\n self.assertEqual(fn4d1(1), 2)\n self.assertEqual(fn4d2(1), 3)\n self.assertEqual(fn4d3(1), 3)", "metadata": "root.FunctionTest.testFunctionDecorating", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 234 }, { "content": " def testTopLevelContionalFunction(self):\n self.assertEqual(imports.conditional_func(), \"overridden\")", "metadata": "root.FunctionTest.testTopLevelContionalFunction", "header": "['class', 'FunctionTest', '(', 'UnitTest', ')', ':', '___EOS___']", "index": 306 }, { "content": "def Text(x):\n return str(\"Text: %s\" % x)", "metadata": "root.Text", "header": "['module', '___EOS___']", "index": 312 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Unit", "Test_", "import_", "Unit", "Test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Class", "Test_", "import_", "Pass", "Me", "AC", "lass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Class", "Test_", "import_", "Exam", "ple", "Chil", "d", "Class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Class", "Test_", "import_", "Exam", "ple", "Multi", "Super", "class", "Parent", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Factor", "y2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "imports_", "._", "deco", "rs_", "#", " ", "must", " ", "be", " ", "in", " ", "this", " ", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imports_", "._", "enum_", "._", "Late", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "x_", "=_", "'", "global", " ", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "mapping", "-", "test", "'_", "\\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_", "late", "\\u", "global_", "=_", "'", "late", "\\u", "global", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Text", " ", "is", " ", "a", " ", "reserve", "d", " ", "javascript", " ", "word_", "\\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_", "Handler_", ":_", "\\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_", "Handler_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handler_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "x_", "is_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Callable_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Callable_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Proce", "dur", "e_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "is_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "return", " ", "statem", "ent", " ", "whi", "ch", " ", "is", " ", "not", " ", "reache", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "somet", "hing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "is", " ", "a", " ", "comment_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "With", "On", "ly", "Doc_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "On", "ly", " ", "a", " ", "doc", " ", "string", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "Return", "ing", "None_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "Return", "ing", "Param_", "(_", "param_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "param_", "\\u\\u\\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_", "a", "Function", "Return", "ing", "Function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a", "Function", "Return", "ing", "Param_", "\\u\\u\\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_", "a", "Function", "Return", "ing", "Global", "X1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "Return", "ing", "Global", "X2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "Return", "ing", "Global", "X", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "\\u\\u\\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_", "a", "Function", "Return", "ing", "Local", "X_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "'", "local", " ", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a", "Function", "Return", "ing", "Arg", "X_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "call_", "(_", "default_", ",_", "arguments_", ",_", "this_", ",_", "label_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "name_", ",_", "default_", ",_", "arguments_", ",_", "this_", ",_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "function", "Defaults_", "(_", "s_", "=_", "\"\"_", ",_", "l_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "len_", "(_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "+_", "\"%", "d", "\"_", "%_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "append_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", ",_", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Lambda_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "1_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "lambda_", "x_", "=_", "1_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "2_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "lambda_", "x_", ",_", "y_", ":_", "x_", "*_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "2_", ",_", "3_", ")_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "lambda_", "x_", ",_", "y_", "=_", "4_", ":_", "x_", "*_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "2_", ")_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "Handler_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "lambda_", "x_", ":_", "h_", "._", "handle_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "(_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "f_", "(_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "lambda_", "a_", ",_", "b_", "=_", "1_", ",_", "**_", "kw_", ":_", "(_", "a_", ",_", "b_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "f_", "(_", "b_", "=_", "2_", ",_", "c_", "=_", "3_", ",_", "a_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", "[_", "2_", "]_", "[_", "'", "c", "'_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "lambda_", "a_", ",_", "b_", "=_", "1_", ",_", "*_", "args_", ":_", "(_", "a_", ",_", "b_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "f_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", "[_", "2_", "]_", "[_", "0_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "v_", "[_", "2_", "]_", "[_", "1_", "]_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Class", "With", "Lam", "bda", "s1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f1_", "=_", "[_", "lambda_", "*_", "args_", ":_", "args_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "issue", " ", "#", "385", " ", "-", " ", "lambda", " ", "in", " ", "class", " ", "definit", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Class", "With", "Lam", "bda", "s1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "f1_", "[_", "0_", "]_", "(_", "1_", ")_", ",_", "1_", ",_", "'", "issue", " ", "#", "385", " ", "-", " ", "lambda", " ", "function", " ", "call", "ed", " ", "as", " ", "bound", " ", "method", "'_", ")_", "\\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 ", " _", "class_", "Class", "With", "Lam", "bda", "s2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f2_", "=_", "lambda_", "*_", "args_", ":_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "issue", " ", "#", "385", " ", "-", " ", "lambda", " ", "in", " ", "class", " ", "definit", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Class", "With", "Lam", "bda", "s2_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "f2_", "(_", "1_", ")_", ",_", "c_", ",_", "'", "issue", " ", "#", "385", " ", "-", " ", "bound", " ", "method", " ", "lambda", " ", "call", "ed", " ", "as", " ", "function", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "callable_", "(_", "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_", "._", "assert", "Equal_", "(_", "Callable_", "(_", ")_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Bug", " ", "#", "572", " ", "Call", "able", "()(", ")", " ", "\\u\\u", "call", "\\u\\u", " ", "not", " ", "support", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "Callable_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "callable_", "(_", "Callable_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Bug", " ", "#", "572", " ", "calla", "ble", "(", "Call", "able", "())", " ", "\\u\\u", "call", "\\u\\u", " ", "not", " ", "support", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Proce", "dur", "e_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "a", "Function", "Return", "ing", "None_", "(_", ")_", "is_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Function", " ", "shou", "ld", " ", "return", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a", "Proce", "dur", "e_", "(_", ")_", "is_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Proce", "dur", "es", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "return", " ", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Varia", "ble", "Function_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "(_", "a", "Function", "Return", "ing", "Param_", ")_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Function_", "(_", ")_", "(_", "\"", "foo", "\"_", ")_", ",_", "\"", "foo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Lookup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "result1_", "=_", "'", "global", " ", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "result2_", "=_", "'", "local", " ", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Global", "X1_", "(_", ")_", ",_", "expected", "\\u", "result1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Global", "X2_", "(_", ")_", ",_", "expected", "\\u", "result1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Global", "X", "3_", "(_", ")_", ",_", "expected", "\\u", "result1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Local", "X_", "(_", ")_", ",_", "expected", "\\u", "result2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a", "Function", "Return", "ing", "Arg", "X_", "(_", "'", "test", "'_", ")_", ",_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Look", "up", "Late", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "late", "\\u", "global_", ",_", "'", "late", "\\u", "global", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "local", "\\u", "look", "up", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "late", "\\u", "local_", ",_", "'", "late", "\\u", "local", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "callable_", "(_", "local", "\\u", "look", "up", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "local", "\\u", "look", "up", "2_", "(_", ")_", ",_", "'", "late", "\\u", "local", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local", "\\u", "look", "up", "3_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "look", "up", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "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_", "def_", "local", "\\u", "look", "up", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "late", "\\u", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "local", "\\u", "look", "up", "3_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "late", "\\u", "local_", "=_", "'", "late", "\\u", "local", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "look", "up", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "_", "=_", "imports_", "._", "enum_", "._", "Late", "_", "._", "get", "Late", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "late", "_", "._", "value_", ",_", "'", "late", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Name", "Mapping_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "call_", "(_", "1_", ",_", "2_", ",_", "this_", "=_", "3_", ",_", "label_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "[_", "0_", "]_", ",_", "'", "mapping", "-", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "[_", "1_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "[_", "2_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "[_", "3_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "r_", "[_", "4_", "]_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "Text_", "(_", "'", "foo", "'_", ")_", ",_", "'", "Text", ":", " ", "foo", "'_", ")_", "\\u\\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_", "(_", "\"", "Bug", " ", "#", "574", ":", " ", "javascript", " ", "keywords", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Factory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Factor", "y2_", "._", "greg", "iste", "r_", "(_", "\"", "pass", "me", "\"_", ",_", "Pass", "Me", "AC", "lass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Factor", "y2_", "._", "greg", "iste", "r_", "(_", "\"", "exc", "hild", "\"_", ",_", "Exam", "ple", "Chil", "d", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Factor", "y2_", "._", "greg", "iste", "r_", "(_", "\"", "msc", "p1", "\"_", ",_", "Exam", "ple", "Multi", "Super", "class", "Parent", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pmc", "_", "=_", "Factor", "y2_", "._", "gge", "t", "Object_", "(_", "\"", "pass", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pmc", "_", "._", "foo_", "(_", ")_", ",_", "\"", "foo", " ", "in", " ", "Pass", "Me", "AC", "lass", "\"_", ")_", "\\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 ", " _", "pmc", "_", "=_", "Factor", "y2_", "._", "gge", "t", "Object_", "(_", "\"", "msc", "p1", "\"_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "False_", ",_", "True_", ",_", "\"", "Except", "ion", " ", "indicat", "es", " ", "bug", " ", "in", " ", "compiler", ":", " ", "'", "Error", ":", " ", "unca", "ugh", "t", " ", "exception", ":", " ", "Exam", "ple", "Multi", "Super", "class", "Parent", "1", "()", " ", "argu", "ment", "s", " ", "after", " ", "**", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "5", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "pmc", "_", "._", "x_", ",_", "5_", ")_", "\\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 ", " _", "pmc", "_", "=_", "Factor", "y2_", "._", "gge", "t", "Object_", "(_", "\"", "exc", "hild", "\"_", ",_", "5_", ",_", "7_", ")_", "#", " ", "5", " ", "is", " ", "ignored_", "\\u\\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_", "._", "assert", "Equal_", "(_", "False_", ",_", "True_", ",_", "\"", "Except", "ion", " ", "indicat", "es", " ", "bug", " ", "in", " ", "compiler", ":", " ", "'", "Error", ":", " ", "unca", "ugh", "t", " ", "exception", ":", " ", "Exam", "ple", "Chil", "d", "Class", "()", " ", "argu", "ment", "s", " ", "after", " ", "**", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "7", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "pmc", "_", "._", "prop", "\\u", "a_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "pmc", "_", "._", "prop", "\\u", "b_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Slice", "Func_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "\"", "123", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "s_", "[_", "1_", ":_", "]_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", ",_", "\"", "23", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Function", "Defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", ",_", "l_", "=_", "function", "Defaults_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", ",_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "l_", "==_", "[_", "0_", "]_", ",_", "\"", "Fi", "rst", " ", "mutable", " ", "default", " ", "mism", "atch", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", ",_", "l_", "=_", "function", "Defaults_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "assert", "Equal", "(", "s", ",", " ", "'", "1", "')", " ", "#", " ", "can", " ", "be", " ", "enable", "d", " ", "whe", "n", " ", "the", " ", "next", " ", "line", " ", "is", " ", "fixed_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "l_", "==_", "[_", "0_", ",_", "1_", "]_", ",_", "\"", "Second", " ", "mutable", " ", "default", " ", "mism", "atch", " ", "bug", " ", "#", "214", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "init", "test_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "f_", "(_", "init", "test_", "=_", "init", "test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "init", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", ")_", ",_", "init", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Kwargs", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "f_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "f_", "(_", "a_", "=_", "1_", ")_", ",_", "dict_", "(_", "a_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Function", "Decorat", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "deco", "1_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "append_", "(_", "\"", "deco", "1", " ", "begin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "f_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "append_", "(_", "\"", "deco", "1", " ", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deco", "2_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fn_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "append_", "(_", "\"", "deco", "2", " ", "begin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "f_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "append_", "(_", "\"", "deco", "2", " ", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "deco", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "1_", "(_", "a_", ",_", "b_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", ",_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "deco", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "deco", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "2_", "(_", "a_", ",_", "b_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", ",_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "fn", "1_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "1_", "]_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "log_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "0_", "]_", ",_", "\"", "deco", "1", " ", "begin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "1_", "]_", ",_", "\"", "deco", "1", " ", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "fn", "2_", "(_", "a_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "0_", "]_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", "[_", "1_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "log_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "0_", "]_", ",_", "\"", "deco", "1", " ", "begin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "1_", "]_", ",_", "\"", "deco", "2", " ", "begin", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "2_", "]_", ",_", "\"", "deco", "2", " ", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "log_", "[_", "3_", "]_", ",_", "\"", "deco", "1", " ", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "imports_", "._", "deco", "rs_", "._", "other", "module", "deco", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "3_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "3_", "(_", "\"", "b", "\"_", ")_", ",_", "\"", "abc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "shift", "decorator_", "(_", "si_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "wrapper_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "decorated_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "fn_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "+_", "si_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fn", "4_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "shift", "decorator_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "4d", "1_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "shift", "decorator_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "fn", "4d", "2_", "(_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fn", "4d", "3_", "=_", "shift", "decorator_", "(_", "2_", ")_", "(_", "fn", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "4d", "1_", "(_", "1_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "4d", "2_", "(_", "1_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "fn", "4d", "3_", "(_", "1_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Function", "Test_", "(_", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Top", "Leve", "l", "Conti", "onal", "Function_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "imports_", "._", "conditional", "\\u", "func_", "(_", ")_", ",_", "\"", "overrid", "den", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Text_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "\"", "Text", ":", " ", "%", "s", "\"_", "%_", "x_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Use of 'global' at module level
rusthon/Rusthon/rusthon.py
[ { "content": "def bootstrap_rusthon():\n\tglobal BOOTSTRAPED\n\tlocaldir = os.path.dirname(unicode(os.path.realpath(__file__), sys.getfilesystemencoding()))\n\t#raise RuntimeError(localdir)\n\tmods = new_module()\n\timport_md( os.path.join(localdir,'src/main.md'), modules=mods )\n\tsrc = []\n\tmods_sorted_by_index = sorted(mods['python'], key=lambda mod: mod.get('index'))\n\tfor mod in mods_sorted_by_index: ## this is simplified because rusthon's source is pure python\n\t\tsrc.append( mod['code'] )\n\tsrc = '\\n'.join(src)\n\tBOOTSTRAPED = src\n\n\tif '--dump' in sys.argv: open('/tmp/bootstrap-rusthon.py', 'wb').write(src.encode('utf-8'))\n\texec(src, globals())\n\n\tif '--test' in sys.argv:\n\t\ttest_typedpython() ## runs some basic tests on the extended syntax\n\n\tif '--runtime' in sys.argv:\n\t\tprint('creating new runtime: pythonjs.js')\n\t\tjsruntime = generate_js_runtime()\n\t\tif os.path.isdir('./pythonjs'):\n\t\t\tprint 'saving runtime to pythonjs/pythonjs.js'\n\t\t\topen('pythonjs/pythonjs.js', 'wb').write( jsruntime )\n\t\treturn jsruntime", "metadata": "root.bootstrap_rusthon", "header": "['module', '___EOS___']", "index": 1919 } ]
[]
[]
0
true
[ "[CLS]_", "Use_", "of_", "'", "global", "'_", "at_", "module_", "level_", "[SEP]_", "module_", "\\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_", "boots", "trap", "\\u", "rust", "hon", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "global_", "BOOT", "STRA", "PED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locald", "ir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "unicode_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Run", "time", "Error", "(", "locald", "ir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "mods_", "=_", "new", "\\u", "module_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import", "\\u", "md_", "(_", "os_", "._", "path_", "._", "join_", "(_", "locald", "ir_", ",_", "'", "src", "/", "main", ".", "md", "'_", ")_", ",_", "modules_", "=_", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "mods_", "[_", "'", "python", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "##", " ", "this", " ", "is", " ", "simplified", " ", "bec", "aus", "e", " ", "rust", "hon", "'", "s", " ", "source", " ", "is", " ", "pure", " ", "python_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "src_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BOOT", "STRA", "PED", "_", "=_", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "dump", "'_", "in_", "sys_", "._", "argv_", ":_", "open_", "(_", "'/", "tmp", "/", "boots", "trap", "-", "rust", "hon", ".", "py", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "src_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "src_", ",_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "test", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "test\\u", "typed", "python_", "(_", ")_", "##", " ", "runs", " ", "some", " ", "basic", " ", "tests", " ", "on", " ", "the", " ", "extend", "ed", " ", "syntax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'--", "runt", "ime", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "'", "creati", "ng", " ", "new", " ", "runt", "ime", ":", " ", "python", "js", ".", "js", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js", "runtime_", "=_", "generat", "e\\u", "js", "\\u", "runtime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "'./", "python", "js", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "'", "saving", " ", "runt", "ime", " ", "to", " ", "python", "js", "/", "python", "js", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'", "python", "js", "/", "python", "js", ".", "js", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "js", "runtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "js", "runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
reverse-shell/routersploit/routersploit/modules/exploits/asus/infosvr_backdoor_rce.py
[ { "content": " def check(self):\n NUM_CHECKS = 5 # we try 5 times because the exploit, tends to be unstable\n\n for i in xrange(NUM_CHECKS):\n # maybe random mark should be implemented\n random_value = \"116b8df6aee055a05032ed26726c032914dc5dae\"\n cmd = \"echo {}\".format(random_value)\n try:\n retval = self.execute(cmd)\n except socket.timeout:\n continue\n if random_value in retval:\n return True\n return False", "metadata": "root.Exploit.check", "header": "['class', 'Exploit', '(', 'exploits', '.', 'Exploit', ')', ':', '___EOS___']", "index": 96 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Explo", "it_", "(_", "exploit", "s_", "._", "Explo", "it_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NUM", "\\u", "CHECKS", "_", "=_", "5_", "#", " ", "we", " ", "try", " ", "5", " ", "times", " ", "bec", "aus", "e", " ", "the", " ", "exploit", ",", " ", "tend", "s", " ", "to", " ", "be", " ", "unstable", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "NUM", "\\u", "CHECKS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "may", "be", " ", "random", " ", "mark", " ", "shou", "ld", " ", "be", " ", "implemented", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random", "\\u", "value_", "=_", "\"", "116", "b8", "df", "6a", "ee", "055", "a0", "503", "2e", "d2", "672", "6c", "032", "914", "dc", "5d", "ae", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"", "echo", " ", "{}\"_", "._", "format_", "(_", "random", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "self_", "._", "execute_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "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_", "random", "\\u", "value_", "in_", "retval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_" ]
[ 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 ]
`__init__` method calls overridden method
hyde/hyde/hyde/model.py
[ { "content": "class Expando(object):\n\n \"\"\"\n A generic expando class that creates attributes from\n the passed in dictionary.\n \"\"\"\n\n\n\n\n\n\n", "metadata": "root.Expando", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def __init__(self, d):\n super(Expando, self).__init__()\n self.update(d)", "metadata": "root.Expando.__init__", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def __iter__(self):\n \"\"\"\n Returns an iterator for all the items in the\n dictionary as key value pairs.\n \"\"\"\n return iteritems(self.__dict__)", "metadata": "root.Expando.__iter__", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " def update(self, d):\n \"\"\"\n Updates the expando with a new dictionary\n \"\"\"\n d = d or {}\n if isinstance(d, dict):\n for key, value in d.items():\n self.set_expando(key, value)\n elif isinstance(d, Expando):\n self.update(d.to_dict())", "metadata": "root.Expando.update", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def set_expando(self, key, value):\n \"\"\"\n Sets the expando attribute after\n transforming the value.\n \"\"\"\n setattr(self, str(key), make_expando(value))", "metadata": "root.Expando.set_expando", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": " def __repr__(self):\n return str(self.to_dict())", "metadata": "root.Expando.__repr__", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def to_dict(self):\n \"\"\"\n Reverse transform an expando to dict\n \"\"\"\n result = {}\n d = self.__dict__\n for k, v in d.items():\n if isinstance(v, Expando):\n result[k] = v.to_dict()\n elif isinstance(v, SEQS):\n seq = type(v)\n result[k] = seq(item.to_dict()\n if isinstance(item, Expando)\n else item for item in v\n )\n else:\n result[k] = v\n return result", "metadata": "root.Expando.to_dict", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def get(self, key, default=None):\n \"\"\"\n Dict like get helper method\n \"\"\"\n return self.__dict__.get(key, default)", "metadata": "root.Expando.get", "header": "['class', 'Expando', '(', 'object', ')', ':', '___EOS___']", "index": 90 }, { "content": "class Config(Expando):\n\n \"\"\"\n Represents the hyde configuration file\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Config", "header": "['module', '___EOS___']", "index": 159 }, { "content": " def __init__(self, sitepath, config_file=None, config_dict=None):\n self.default_config = dict(\n mode='production',\n simple_copy=[],\n content_root='content',\n deploy_root='deploy',\n media_root='media',\n layout_root='layout',\n media_url='/media',\n base_url=\"/\",\n encode_safe=None,\n not_found='404.html',\n plugins=[],\n ignore=[\"*~\", \"*.bak\", \".hg\", \".git\", \".svn\"],\n meta={\n \"nodemeta\": 'meta.yaml'\n }\n )\n self.config_file = config_file\n self.config_dict = config_dict\n self.load_time = datetime.min\n self.config_files = []\n self.sitepath = Folder(sitepath)\n super(Config, self).__init__(self.load())", "metadata": "root.Config.__init__", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 165 }, { "content": " @property\n def last_modified(self):\n return max((conf.last_modified for conf in self.config_files))", "metadata": "root.Config.last_modified", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 190 }, { "content": " def needs_refresh(self):\n if not self.config_files:\n return True\n return any((conf.has_changed_since(self.load_time)\n for conf in self.config_files))", "metadata": "root.Config.needs_refresh", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 194 }, { "content": " def load(self):\n conf = dict(**self.default_config)\n conf.update(self.read_config(self.config_file))\n if self.config_dict:\n conf.update(self.config_dict)\n return conf", "metadata": "root.Config.load", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 200 }, { "content": " def reload(self):\n if not self.config_file:\n return\n self.update(self.load())", "metadata": "root.Config.reload", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 207 }, { "content": " def read_config(self, config_file):\n \"\"\"\n Reads the configuration file and updates this\n object while allowing for inherited configurations.\n \"\"\"\n conf_file = self.sitepath.child(\n config_file if\n config_file else 'site.yaml')\n conf = {}\n if File(conf_file).exists:\n self.config_files.append(File(conf_file))\n logger.info(\"Reading site configuration from [%s]\", conf_file)\n with codecs.open(conf_file, 'r', 'utf-8') as stream:\n conf = yaml.load(stream)\n if 'extends' in conf:\n parent = self.read_config(conf['extends'])\n parent.update(conf)\n conf = parent\n self.load_time = datetime.now()\n return conf", "metadata": "root.Config.read_config", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 212 }, { "content": " @property\n def deploy_root_path(self):\n \"\"\"\n Derives the deploy root path from the site path\n \"\"\"\n return _expand_path(self.sitepath, self.deploy_root)", "metadata": "root.Config.deploy_root_path", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 233 }, { "content": " @property\n def content_root_path(self):\n \"\"\"\n Derives the content root path from the site path\n \"\"\"\n return _expand_path(self.sitepath, self.content_root)", "metadata": "root.Config.content_root_path", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 240 }, { "content": " @property\n def media_root_path(self):\n \"\"\"\n Derives the media root path from the content path\n \"\"\"\n path = Folder(self.content_root).child(self.media_root)\n return _expand_path(self.sitepath, path)", "metadata": "root.Config.media_root_path", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 247 }, { "content": " @property\n def layout_root_path(self):\n \"\"\"\n Derives the layout root path from the site path\n \"\"\"\n return _expand_path(self.sitepath, self.layout_root)", "metadata": "root.Config.layout_root_path", "header": "['class', 'Config', '(', 'Expando', ')', ':', '___EOS___']", "index": 255 } ]
[]
[]
0
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "gener", "ic", " ", "expand", "o", " ", "class", " ", "tha", "t", " ", "create", "s", " ", "attribute", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "pass", "ed", " ", "in", " ", "dictionar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Expand", "o_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "iter", "ator", " ", "for", " ", "all", " ", "the", " ", "items", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dictionar", "y", " ", "as", " ", "key", " ", "value", " ", "pair", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "iteritems_", "(_", "self_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", "s", " ", "the", " ", "expand", "o", " ", "with", " ", "a", " ", "new", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "d_", "or_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "d_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "d_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "expand", "o_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "d_", ",_", "Expand", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "update_", "(_", "d_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "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_", "set\\u", "expand", "o_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "expand", "o", " ", "attribute", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "transform", "ing", " ", "the", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "self_", ",_", "str_", "(_", "key_", ")_", ",_", "make", "\\u", "expand", "o_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Revers", "e", " ", "transform", " ", "an", " ", "expand", "o", " ", "to", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "d_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "v_", ",_", "Expand", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "k_", "]_", "=_", "v_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "v_", ",_", "SEQ", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seq_", "=_", "type_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "k_", "]_", "=_", "seq_", "(_", "item_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "item_", ",_", "Expand", "o_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "item_", "for_", "item_", "in_", "v_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Expand", "o_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Dict", " ", "like", " ", "get", " ", "help", "er", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "get_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Represent", "s", " ", "the", " ", "hy", "de", " ", "configura", "tion", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "site", "path_", ",_", "config", "\\u", "file_", "=_", "None_", ",_", "config", "\\u", "dict_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default", "\\u", "config_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "producti", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "simple", "\\u", "copy_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "root_", "=_", "'", "content", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "\\u", "root_", "=_", "'", "deploy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "media", "\\u", "root_", "=_", "'", "media", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "root_", "=_", "'", "layout", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "media", "\\u", "url_", "=_", "'/", "media", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "=_", "\"/\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "\\u", "safe_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "not", "\\u", "found_", "=_", "'", "404", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "plugins_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore_", "=_", "[_", "\"*", "~\"", "_", ",_", "\"*", ".", "bak", "\"_", ",_", "\".", "hg", "\"_", ",_", "\".", "git", "\"_", ",_", "\".", "svn", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "meta_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", "meta", "\"_", ":_", "'", "meta", ".", "yaml", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "file_", "=_", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "dict_", "=_", "config", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "load", "\\u", "time_", "=_", "datetime_", "._", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "site", "path_", "=_", "Folder_", "(_", "site", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Config_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "load_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\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_", "last", "\\u", "modified_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max_", "(_", "(_", "conf_", "._", "last", "\\u", "modified_", "for_", "conf_", "in_", "self_", "._", "config", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "need", "s", "\\u", "refresh_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "config", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "any_", "(_", "(_", "conf_", "._", "has", "\\u", "change", "d\\u", "since_", "(_", "self_", "._", "load", "\\u", "time_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "conf_", "in_", "self_", "._", "config", "\\u", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "dict_", "(_", "**_", "self_", "._", "default", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "update_", "(_", "self_", "._", "read", "\\u", "config_", "(_", "self_", "._", "config", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "config", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "._", "update_", "(_", "self_", "._", "config", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reload_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "config", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "update_", "(_", "self_", "._", "load_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "config_", "(_", "self_", ",_", "config", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", "s", " ", "the", " ", "configura", "tion", " ", "file", " ", "and", " ", "update", "s", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "whi", "le", " ", "allow", "ing", " ", "for", " ", "inherited", " ", "configura", "tion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf", "\\u", "file_", "=_", "self_", "._", "site", "path_", "._", "child_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "file_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "file_", "else_", "'", "site", ".", "yaml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "File_", "(_", "conf", "\\u", "file_", ")_", "._", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "files_", "._", "append_", "(_", "File_", "(_", "conf", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Reading", " ", "site", " ", "configura", "tion", " ", "from", " ", "[", "%", "s", "]\"_", ",_", "conf", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "codecs_", "._", "open_", "(_", "conf", "\\u", "file_", ",_", "'", "r", "'_", ",_", "'", "utf", "-", "8", "'_", ")_", "as_", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "yaml_", "._", "load_", "(_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "extend", "s", "'_", "in_", "conf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parent_", "=_", "self_", "._", "read", "\\u", "config_", "(_", "conf_", "[_", "'", "extend", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "update_", "(_", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "parent_", "\\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_", "._", "load", "\\u", "time_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\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_", "deploy", "\\u", "root", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Derive", "s", " ", "the", " ", "deploy", " ", "root", " ", "path", " ", "from", " ", "the", " ", "site", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "expand", "\\u", "path_", "(_", "self_", "._", "site", "path_", ",_", "self_", "._", "deploy", "\\u", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\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_", "content", "\\u", "root", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Derive", "s", " ", "the", " ", "content", " ", "root", " ", "path", " ", "from", " ", "the", " ", "site", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "expand", "\\u", "path_", "(_", "self_", "._", "site", "path_", ",_", "self_", "._", "content", "\\u", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\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_", "media", "\\u", "root", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Derive", "s", " ", "the", " ", "media", " ", "root", " ", "path", " ", "from", " ", "the", " ", "content", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "Folder_", "(_", "self_", "._", "content", "\\u", "root_", ")_", "._", "child_", "(_", "self_", "._", "media", "\\u", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "expand", "\\u", "path_", "(_", "self_", "._", "site", "path_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config_", "(_", "Expand", "o_", ")_", ":_", "\\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_", "layout", "\\u", "root", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Derive", "s", " ", "the", " ", "layout", " ", "root", " ", "path", " ", "from", " ", "the", " ", "site", " ", "path", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "expand", "\\u", "path_", "(_", "self_", "._", "site", "path_", ",_", "self_", "._", "layout", "\\u", "root_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Knewton/pettingzoo-python/pettingzoo/leader_queue.py
[ { "content": "\tdef _handle_remove(self, del_id): \n\t\t'''\n\t\tCalled on delete. Updates the candidate by predecessor dict.\n\n\t\t:param del_id: (int) id of deleted candidate\n\t\t:rtype: None\n\t\t'''\n\n\t\twith self.lock:\n\t\t\tcandidate = self.candidate_by_predecessor.get(del_id, None)\n\t\t\tif del_id == None:\n\t\t\t\tget_logger().warning(\n\t\t\t\t\t\"LeaderQueue._handle_remove Unknown candidate %s\" %\n\t\t\t\t\t(del_id))\n\t\t\telif candidate == None: \n\t\t\t\tget_logger().debug(\n\t\t\t\t\t\"LeaderQueue._handle_remove Removed candidate is not\"\n\t\t\t\t\t+ \" a predecessor %s\" % (del_id))\n\t\t\telse:\n\t\t\t\tself._update_predecessor_dict(del_id, candidate)\n\t\t\t\tdel self.candidate_by_predecessor[del_id]\n\t\treturn None", "metadata": "root.LeaderQueue._handle_remove", "header": "['class', 'LeaderQueue', '(', 'object', ')', ':', '___EOS___']", "index": 112 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Leader", "Queue_", "(_", "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", "handle", "\\u", "remove_", "(_", "self_", ",_", "del", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", "\\", "10", ";", "\t", "\t", "Call", "ed", " ", "on", " ", "delete", ".", " ", "Update", "s", " ", "the", " ", "candidate", " ", "by", " ", "predecessor", " ", "dict", ".", "\\", "10", ";", "\\", "10", ";", "\t", "\t", ":", "param", " ", "del", "\\u", "id", ":", " ", "(", "int", ")", " ", "id", " ", "of", " ", "delete", "d", " ", "candidate", "\\", "10", ";", "\t", "\t", ":", "rty", "pe", ":", " ", "Non", "e", "\\", "10", ";", "\t", "\t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "candidate_", "=_", "self_", "._", "candidate", "\\u", "by", "\\u", "predecessor", "_", "._", "get_", "(_", "del", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "del", "\\u", "id_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "get", "\\u", "logger_", "(_", ")_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Leader", "Queue", ".\\u", "handle", "\\u", "remove", " ", "Un", "know", "n", " ", "candidate", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "del", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "candidate_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "get", "\\u", "logger_", "(_", ")_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Leader", "Queue", ".\\u", "handle", "\\u", "remove", " ", "Remove", "d", " ", "candidate", " ", "is", " ", "not", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "\"", " ", "a", " ", "predecessor", " ", "%", "s", "\"_", "%_", "(_", "del", "\\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\t", "\t\t\t_", "self_", "._", "\\u", "update", "\\u", "predecessor", "\\u", "dict_", "(_", "del", "\\u", "id_", ",_", "candidate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "candidate", "\\u", "by", "\\u", "predecessor", "_", "[_", "del", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
spulec/freezegun/tests/test_operations.py
[ { "content": "@freeze_time(\"2012-01-14\")\ndef test_subtraction():\n now = datetime.datetime.now()\n before = now - datetime.timedelta(days=1)\n other_before = now - relativedelta(days=1)\n how_long = now - before\n assert utils.is_fake_datetime(before)\n assert utils.is_fake_datetime(other_before)\n assert isinstance(how_long, datetime.timedelta)\n\n today = datetime.date.today()\n yesterday = today - datetime.timedelta(days=1)\n other_yesterday = today - relativedelta(days=1)\n how_long = today - yesterday\n assert utils.is_fake_date(yesterday)\n assert utils.is_fake_date(other_yesterday)\n assert isinstance(how_long, datetime.timedelta)", "metadata": "root.test_subtraction", "header": "['module', '___EOS___']", "index": 22 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "freez", "e\\u", "time_", "(_", "\"", "2012", "-0", "1", "-1", "4", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "subtract", "ion_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "before_", "=_", "now_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "before_", "=_", "now_", "-_", "relativedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "how", "\\u", "long_", "=_", "now_", "-_", "before_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "utils_", "._", "is", "\\u", "fake", "\\u", "datetime_", "(_", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "utils_", "._", "is", "\\u", "fake", "\\u", "datetime_", "(_", "other", "\\u", "before_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "how", "\\u", "long_", ",_", "datetime_", "._", "timedelta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "today_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yesterday", "_", "=_", "today_", "-_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "yesterday", "_", "=_", "today_", "-_", "relativedelta_", "(_", "days_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "how", "\\u", "long_", "=_", "today_", "-_", "yesterday", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "utils_", "._", "is", "\\u", "fake", "\\u", "date_", "(_", "yesterday", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "utils_", "._", "is", "\\u", "fake", "\\u", "date_", "(_", "other", "\\u", "yesterday", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "how", "\\u", "long_", ",_", "datetime_", "._", "timedelta_", ")_", "\\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 ]
Variable defined multiple times
boundlessgeo/gsconfig/src/geoserver/resource.py
[ { "content": "class WmsLayer(ResourceInfo):\n resource_type = \"wmsLayer\"\n save_method = \"PUT\"\n\n\n\n\n title = xml_property(\"title\")\n description = xml_property(\"description\")\n abstract = xml_property(\"abstract\")\n keywords = xml_property(\"keywords\", string_list)\n # nativeCRS\n projection = xml_property(\"srs\")\n native_bbox = xml_property(\"nativeBoundingBox\", bbox)\n latlon_bbox = xml_property(\"latLonBoundingBox\", bbox)\n projection_policy = xml_property(\"projectionPolicy\")\n enabled = xml_property(\"enabled\", lambda x: x.text == \"true\")\n advertised = xml_property(\"advertised\", lambda x: x.text == \"true\", default=True)\n metadata_links = xml_property(\"metadataLinks\", metadata_link_list)\n\n writers = dict(\n title = write_string(\"title\"),\n description = write_string(\"description\"),\n abstract = write_string(\"abstract\"),\n keywords = write_string_list(\"keywords\"),\n # nativeCRS\n srs = write_string(\"srs\"),\n nativeBoundingBox = write_bbox(\"nativeBoundingBox\"),\n latLonBoundingBox = write_bbox(\"latLonBoundingBox\"),\n projectionPolicy = write_string(\"projectionPolicy\"),\n enabled = write_bool(\"enabled\"),\n advertised = write_bool(\"advertised\"),\n metadataLinks = write_metadata_link_list(\"metadataLinks\")\n )", "metadata": "root.WmsLayer", "header": "['module', '___EOS___']", "index": 222 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Wm", "s", "Layer_", "(_", "Reso", "urc", "e", "Info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource", "\\u", "type_", "=_", "\"", "wms", "Layer", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "method_", "=_", "\"", "PU", "T", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "title_", "=_", "xml", "\\u", "property_", "(_", "\"", "title", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "xml", "\\u", "property_", "(_", "\"", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abstract_", "=_", "xml", "\\u", "property_", "(_", "\"", "abstract", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keywords_", "=_", "xml", "\\u", "property_", "(_", "\"", "keywords", "\"_", ",_", "string", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "nativ", "e", "CR", "S_", "\\u\\u\\uNL\\u\\u\\u_", "projection_", "=_", "xml", "\\u", "property_", "(_", "\"", "sr", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nativ", "e\\u", "bbox_", "=_", "xml", "\\u", "property_", "(_", "\"", "nativ", "e", "Bound", "ing", "Box", "\"_", ",_", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "latlon", "\\u", "bbox_", "=_", "xml", "\\u", "property_", "(_", "\"", "lat", "Lon", "Bound", "ing", "Box", "\"_", ",_", "bbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "projecti", "on", "\\u", "policy_", "=_", "xml", "\\u", "property_", "(_", "\"", "projecti", "on", "Polic", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enabled_", "=_", "xml", "\\u", "property_", "(_", "\"", "enable", "d", "\"_", ",_", "lambda_", "x_", ":_", "x_", "._", "text_", "==_", "\"", "true", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "advertise", "d_", "=_", "xml", "\\u", "property_", "(_", "\"", "advertise", "d", "\"_", ",_", "lambda_", "x_", ":_", "x_", "._", "text_", "==_", "\"", "true", "\"_", ",_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata", "\\u", "links_", "=_", "xml", "\\u", "property_", "(_", "\"", "metadata", "Link", "s", "\"_", ",_", "metadata", "\\u", "link", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "writers_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "write", "\\u", "string_", "(_", "\"", "title", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "write", "\\u", "string_", "(_", "\"", "description", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "abstract_", "=_", "write", "\\u", "string_", "(_", "\"", "abstract", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "write", "\\u", "string", "\\u", "list_", "(_", "\"", "keywords", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nativ", "e", "CR", "S_", "\\u\\u\\uNL\\u\\u\\u_", "srs_", "=_", "write", "\\u", "string_", "(_", "\"", "sr", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nativ", "e", "Bound", "ing", "Box_", "=_", "write", "\\u", "bbox_", "(_", "\"", "nativ", "e", "Bound", "ing", "Box", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lat", "Lon", "Bound", "ing", "Box_", "=_", "write", "\\u", "bbox_", "(_", "\"", "lat", "Lon", "Bound", "ing", "Box", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "projecti", "on", "Policy_", "=_", "write", "\\u", "string_", "(_", "\"", "projecti", "on", "Polic", "y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enabled_", "=_", "write", "\\u", "bool_", "(_", "\"", "enable", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "advertise", "d_", "=_", "write",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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 ]
Except block handles 'BaseException'
MeetMe/newrelic-plugin-agent/newrelic_plugin_agent/plugins/redis.py
[ { "content": " def fetch_data(self, connection):\n \"\"\"Loop in and read in all the data until we have received it all.\n\n :param socket connection: The connection\n :rtype: dict\n\n \"\"\"\n connection.send(\"*0\\r\\ninfo\\r\\n\")\n\n # Read in the first line $1437\n buffer_value = connection.recv(self.SOCKET_RECV_MAX)\n lines = buffer_value.split('\\r\\n')\n\n if lines[0][0] == '$':\n byte_size = int(lines[0][1:].strip())\n else:\n return None\n\n while len(buffer_value) < byte_size:\n buffer_value += connection.recv(self.SOCKET_RECV_MAX)\n\n lines = buffer_value.split('\\r\\n')\n values = dict()\n for line in lines:\n if ':' in line:\n key, value = line.strip().split(':',1)\n if key[:2] == 'db':\n values[key] = dict()\n subvalues = value.split(',')\n for temp in subvalues:\n subvalue = temp.split('=')\n value = subvalue[-1]\n try:\n values[key][subvalue[0]] = int(value)\n except ValueError:\n try:\n values[key][subvalue[0]] = float(value)\n except ValueError:\n values[key][subvalue[0]] = value\n continue\n try:\n values[key] = int(value)\n except ValueError:\n try:\n values[key] = float(value)\n except ValueError:\n values[key] = value\n return values", "metadata": "root.Redis.fetch_data", "header": "['class', 'Redis', '(', 'base', '.', 'SocketStatsPlugin', ')', ':', '___EOS___']", "index": 122 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Redis_", "(_", "base_", "._", "Sock", "et", "Stat", "s", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fetch", "\\u", "data_", "(_", "self_", ",_", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Loop", " ", "in", " ", "and", " ", "read", " ", "in", " ", "all", " ", "the", " ", "data", " ", "unti", "l", " ", "we", " ", "have", " ", "receive", "d", " ", "it", " ", "all", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", " ", "socket", " ", "connecti", "on", ":", " ", "The", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "send_", "(_", "\"*", "0", "\\\\", "r", "\\\\", "nin", "fo", "\\\\", "r", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Read", " ", "in", " ", "the", " ", "first", " ", "line", " ", "$", "143", "7_", "\\u\\u\\uNL\\u\\u\\u_", "buffer", "\\u", "value_", "=_", "connection_", "._", "recv_", "(_", "self_", "._", "SOCKET", "\\u", "REC", "V", "\\u", "MAX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "buffer", "\\u", "value_", "._", "split_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lines_", "[_", "0_", "]_", "[_", "0_", "]_", "==_", "'$'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "byte", "\\u", "size_", "=_", "int_", "(_", "lines_", "[_", "0_", "]_", "[_", "1_", ":_", "]_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "len_", "(_", "buffer", "\\u", "value_", ")_", "<_", "byte", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer", "\\u", "value_", "+=_", "connection_", "._", "recv_", "(_", "self_", "._", "SOCKET", "\\u", "REC", "V", "\\u", "MAX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "buffer", "\\u", "value_", "._", "split_", "(_", "'\\\\", "r", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "':'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "value_", "=_", "line_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "[_", ":_", "2_", "]_", "==_", "'", "db", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values_", "[_", "key_", "]_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subv", "alues", "_", "=_", "value_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "temp_", "in_", "subv", "alues", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subv", "alue_", "=_", "temp_", "._", "split_", "(_", "'='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "subv", "alue_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "key_", "]_", "[_", "subv", "alue_", "[_", "0_", "]_", "]_", "=_", "int_", "(_", "value_", ")_", "\\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 ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "key_", "]_", "[_", "subv", "alue_", "[_", "0_", "]_", "]_", "=_", "float_", "(_", "value_", ")_", "\\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 ", " ", " _", "values_", "[_", "key_", "]_", "[_", "subv", "alue_", "[_", "0_", "]_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "values_", "[_", "key_", "]_", "=_", "int_", "(_", "value_", ")_", "\\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 ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "values_", "[_", "key_", "]_", "=_", "float_", "(_", "value_", ")_", "\\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 ", " ", " _", "values_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "values_" ]
[ 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,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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 ]
Constant in conditional expression or statement
PyTables/PyTables/tables/scripts/ptrepack.py
[ { "content": "def main():\n global verbose\n global regoldindexes\n global createsysattrs\n\n parser = _get_parser()\n args = parser.parse_args()\n\n # check arguments\n if args.rng:\n try:\n args.rng = eval(\"slice(\" + args.rng + \")\")\n except Exception:\n parser.error(\"Error when getting the range parameter.\")\n\n if args.chunkshape.isdigit() or args.chunkshape.startswith('('):\n args.chunkshape = eval(args.chunkshape)\n\n if args.complevel < 0 or args.complevel > 9:\n parser.error(\n 'invalid \"complevel\" value, it sould be in te range [0, 9]'\n )\n\n # Catch the files passed as the last arguments\n src = args.src.split(':')\n dst = args.dst.split(':')\n if len(src) == 1:\n srcfile, srcnode = src[0], \"/\"\n else:\n srcfile, srcnode = src\n if len(dst) == 1:\n dstfile, dstnode = dst[0], \"/\"\n else:\n dstfile, dstnode = dst\n\n if srcnode == \"\":\n # case where filename == \"filename:\" instead of \"filename:/\"\n srcnode = \"/\"\n\n if dstnode == \"\":\n # case where filename == \"filename:\" instead of \"filename:/\"\n dstnode = \"/\"\n\n # Ignore the warnings for tables that contains oldindexes\n # (these will be handled by the copying routines)\n warnings.filterwarnings(\"ignore\", category=OldIndexWarning)\n\n # Ignore the flavors warnings during upgrading flavor operations\n if args.upgradeflavors:\n warnings.filterwarnings(\"ignore\", category=FlavorWarning)\n\n # Build the Filters instance\n filter_params = (\n args.complevel,\n args.complib,\n args.shuffle,\n args.bitshuffle,\n args.fletcher32,\n )\n if (filter_params == (None,) * 4 or args.keepfilters):\n filters = None\n else:\n if args.complevel is None:\n args.complevel = 0\n if args.shuffle is None:\n if args.complevel > 0:\n args.shuffle = True\n else:\n args.shuffle = False\n if args.bitshuffle is None:\n args.bitshuffle = False\n if args.bitshuffle:\n # Shuffle and bitshuffle are mutually exclusive\n args.shuffle = False\n if args.complib is None:\n args.complib = \"zlib\"\n if args.fletcher32 is None:\n args.fletcher32 = False\n filters = Filters(complevel=args.complevel, complib=args.complib,\n shuffle=args.shuffle, bitshuffle=args.bitshuffle,\n fletcher32=args.fletcher32)\n\n # The start, stop and step params:\n start, stop, step = None, None, 1 # Defaults\n if args.rng:\n start, stop, step = args.rng.start, args.rng.stop, args.rng.step\n\n # Set globals\n verbose = args.verbose\n regoldindexes = args.regoldindexes\n createsysattrs = args.createsysattrs\n\n # Some timing\n t1 = time.time()\n cpu1 = time.clock()\n # Copy the file\n if verbose:\n print(\"+=+\" * 20)\n print(\"Recursive copy:\", args.recursive)\n print(\"Applying filters:\", filters)\n if args.sortby is not None:\n print(\"Sorting table(s) by column:\", args.sortby)\n print(\"Forcing a CSI creation:\", args.checkCSI)\n if args.propindexes:\n print(\"Recreating indexes in copied table(s)\")\n print(\"Start copying %s:%s to %s:%s\" % (srcfile, srcnode,\n dstfile, dstnode))\n print(\"+=+\" * 20)\n\n # Check whether the specified source node is a group or a leaf\n h5srcfile = open_file(srcfile, 'r')\n srcnodeobject = h5srcfile.get_node(srcnode)\n\n # Close the file again\n h5srcfile.close()\n\n stats = {'groups': 0, 'leaves': 0, 'links': 0, 'bytes': 0, 'hardlinks': 0}\n if isinstance(srcnodeobject, Group):\n copy_children(\n srcfile, dstfile, srcnode, dstnode,\n title=args.title, recursive=args.recursive, filters=filters,\n copyuserattrs=args.copyuserattrs, overwritefile=args.overwritefile,\n overwrtnodes=args.overwrtnodes, stats=stats,\n start=start, stop=stop, step=step, chunkshape=args.chunkshape,\n sortby=args.sortby, check_CSI=args.checkCSI,\n propindexes=args.propindexes,\n upgradeflavors=args.upgradeflavors,\n use_hardlinks=True)\n else:\n # If not a Group, it should be a Leaf\n copy_leaf(\n srcfile, dstfile, srcnode, dstnode,\n title=args.title, filters=filters,\n copyuserattrs=args.copyuserattrs,\n overwritefile=args.overwritefile, overwrtnodes=args.overwrtnodes,\n stats=stats, start=start, stop=stop, step=step,\n chunkshape=args.chunkshape,\n sortby=args.sortby, check_CSI=args.checkCSI,\n propindexes=args.propindexes,\n upgradeflavors=args.upgradeflavors)\n\n # Gather some statistics\n t2 = time.time()\n cpu2 = time.clock()\n tcopy = round(t2 - t1, 3)\n cpucopy = round(cpu2 - cpu1, 3)\n tpercent = int(round(cpucopy / tcopy, 2) * 100)\n\n if verbose:\n ngroups = stats['groups']\n nleaves = stats['leaves']\n nlinks = stats['links']\n nhardlinks = stats['hardlinks']\n nbytescopied = stats['bytes']\n nnodes = ngroups + nleaves + nlinks + nhardlinks\n\n print(\n \"Groups copied:\", ngroups,\n \", Leaves copied:\", nleaves,\n \", Links copied:\", nlinks,\n \", Hard links copied:\", nhardlinks,\n )\n if args.copyuserattrs:\n print(\"User attrs copied\")\n else:\n print(\"User attrs not copied\")\n print(\"KBytes copied:\", round(nbytescopied / 1024., 3))\n print(\"Time copying: %s s (real) %s s (cpu) %s%%\" % (\n tcopy, cpucopy, tpercent))\n print(\"Copied nodes/sec: \", round((nnodes) / float(tcopy), 1))\n print(\"Copied KB/s :\", int(nbytescopied / (tcopy * 1024)))", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 404 } ]
[]
[]
0
true
[ "[CLS]_", "Constant_", "in_", "conditional", "_", "expression_", "or_", "statement_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "reg", "oldi", "nde", "xes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "create", "sys", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "\\u", "get", "\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "rng_", ":_", "\\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 ", " _", "args_", "._", "rng_", "=_", "eval_", "(_", "\"", "slice", "(\"_", "+_", "args_", "._", "rng_", "+_", "\")\"_", ")_", "\\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 ", " _", "parser_", "._", "error_", "(_", "\"", "Error", " ", "whe", "n", " ", "getti", "ng", " ", "the", " ", "range", " ", "parameter", ".\"_", ")_", "\\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_", "args_", "._", "chunks", "hape_", "._", "isdigit_", "(_", ")_", "or_", "args_", "._", "chunks", "hape_", "._", "startswith_", "(_", "'('_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "chunks", "hape_", "=_", "eval_", "(_", "args_", "._", "chunks", "hape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "compl", "evel_", "<_", "0_", "or_", "args_", "._", "compl", "evel_", ">_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "\"", "compl", "evel", "\"", " ", "value", ",", " ", "it", " ", "sou", "ld", " ", "be", " ", "in", " ", "te", " ", "range", " ", "[", "0", ",", " ", "9", "]'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Catch", " ", "the", " ", "files", " ", "pass", "ed", " ", "as", " ", "the", " ", "last", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "args_", "._", "src_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dst_", "=_", "args_", "._", "dst_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "src_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "srcfile", "_", ",_", "src", "node_", "=_", "src_", "[_", "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 ", " _", "srcfile", "_", ",_", "src", "node_", "=_", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "dst_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst", "file_", ",_", "dst", "node_", "=_", "dst_", "[_", "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 ", " _", "dst", "file_", ",_", "dst", "node_", "=_", "dst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "src", "node_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "case", " ", "where", " ", "filename", " ", "==", " ", "\"", "filename", ":\"", " ", "inst", "ead", " ", "of", " ", "\"", "filename", ":/", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "node_", "=_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dst", "node_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "case", " ", "where", " ", "filename", " ", "==", " ", "\"", "filename", ":\"", " ", "inst", "ead", " ", "of", " ", "\"", "filename", ":/", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst", "node_", "=_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "the", " ", "warn", "ings", " ", "for", " ", "tables", " ", "tha", "t", " ", "contain", "s", " ", "oldi", "nde", "xes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "these", " ", "will", " ", "be", " ", "handle", "d", " ", "by", " ", "the", " ", "copy", "ing", " ", "routin", "es", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "ignore", "\"_", ",_", "category_", "=_", "Old", "Index", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "the", " ", "flavor", "s", " ", "warn", "ings", " ", "dur", "ing", " ", "up", "gradi", "ng", " ", "flavor", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "upgrade", "flavors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "filterw", "arnings", "_", "(_", "\"", "ignore", "\"_", ",_", "category_", "=_", "Fla", "vor", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "Filter", "s", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filter", "\\u", "params_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "compl", "evel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "compli", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "shuffle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "bits", "huff", "le_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "fle", "tche", "r3", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "filter", "\\u", "params_", "==_", "(_", "None_", ",_", ")_", "*_", "4_", "or_", "args_", "._", "keep", "filters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "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 ", " _", "if_", "args_", "._", "compl", "evel_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "compl", "evel_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "shuffle_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "compl", "evel_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "shuffle_", "=_", "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 ", " _", "args_", "._", "shuffle_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "bits", "huff", "le_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "bits", "huff", "le_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "bits", "huff", "le_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Shuffle", " ", "and", " ", "bits", "huff", "le", " ", "are", " ", "mutual", "ly", " ", "exclusive_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "shuffle_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "compli", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "compli", "b_", "=_", "\"", "zli", "b", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "fle", "tche", "r3", "2_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "fle", "tche", "r3", "2_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filters_", "=_", "Filters_", "(_", "compl", "evel_", "=_", "args_", "._", "compl", "evel_", ",_", "compli", "b_", "=_", "args_", "._", "compli", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shuffle_", "=_", "args_", "._", "shuffle_", ",_", "bits", "huff", "le_", "=_", "args_", "._", "bits", "huff", "le_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fle", "tche", "r3", "2_", "=_", "args_", "._", "fle", "tche", "r3", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "start", ",", " ", "stop", " ", "and", " ", "step", " ", "params", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", ",_", "stop_", ",_", "step_", "=_", "None_", ",_", "None_", ",_", "1_", "#", " ", "Defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "rng_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "stop_", ",_", "step_", "=_", "args_", "._", "rng_", "._", "start_", ",_", "args_", "._", "rng_", "._", "stop_", ",_", "args_", "._", "rng_", "._", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "globals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "verbose_", "=_", "args_", "._", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg", "oldi", "nde", "xes_", "=_", "args_", "._", "reg", "oldi", "nde", "xes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "sys", "attrs_", "=_", "args_", "._", "create", "sys", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "timing_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu", "1_", "=_", "time_", "._", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"+", "=+", "\"_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Recursive", " ", "copy", ":\"_", ",_", "args_", "._", "recursive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Apply", "ing", " ", "filter", "s", ":\"_", ",_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "sortby", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Sort", "ing", " ", "table", "(", "s", ")", " ", "by", " ", "column", ":\"_", ",_", "args_", "._", "sortby", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "For", "cing", " ", "a", " ", "CSI", " ", "creati", "on", ":\"_", ",_", "args_", "._", "check", "CSI", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "prop", "indexes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Rec", "rea", "ting", " ", "indexe", "s", " ", "in", " ", "copie", "d", " ", "table", "(", "s", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Start", " ", "copy", "ing", " ", "%", "s", ":", "%", "s", " ", "to", " ", "%", "s", ":", "%", "s", "\"_", "%_", "(_", "srcfile", "_", ",_", "src", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dst", "file_", ",_", "dst", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"+", "=+", "\"_", "*_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "whe", "ther", " ", "the", " ", "specified", " ", "source", " ", "node", " ", "is", " ", "a", " ", "group", " ", "or", " ", "a", " ", "leaf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h5", "srcfile", "_", "=_", "open", "\\u", "file_", "(_", "srcfile", "_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "node", "object_", "=_", "h5", "srcfile", "_", "._", "get", "\\u", "node_", "(_", "src", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "e", " ", "the", " ", "file", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "h5", "srcfile", "_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "{_", "'", "group", "s", "'_", ":_", "0_", ",_", "'", "lea", "ves", "'_", ":_", "0_", ",_", "'", "link", "s", "'_", ":_", "0_", ",_", "'", "bytes", "'_", ":_", "0_", ",_", "'", "hard", "link", "s", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "src", "node", "object_", ",_", "Group_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "children_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "srcfile", "_", ",_", "dst", "file_", ",_", "src", "node_", ",_", "dst", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "args_", "._", "title_", ",_", "recursive_", "=_", "args_", "._", "recursive_", ",_", "filters_", "=_", "filters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "copy", "usera", "ttr", "s_", "=_", "args_", "._", "copy", "usera", "ttr", "s_", ",_", "overwrit", "efi", "le_", "=_", "args_", "._", "overwrit", "efi", "le_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "over", "wrt", "nodes_", "=_", "args_", "._", "over", "wrt", "nodes_", ",_", "stats_", "=_", "stats_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "start_", ",_", "stop_", "=_", "stop_", ",_", "step_", "=_", "step_", ",_", "chunks", "hape_", "=_", "args_", "._", "chunks", "hape_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sortby", "_", "=_", "args_", "._", "sortby", "_", ",_", "check", "\\u", "CSI", "_", "=_", "args_", "._", "check", "CSI", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prop", "indexes_", "=_", "args_", "._", "prop", "indexes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upgrade", "flavors_", "=_", "args_", "._", "upgrade", "flavors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "hard", "links_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "a", " ", "Group", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "a", " ", "Leaf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "\\u", "leaf_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "srcfile", "_", ",_", "dst", "file_", ",_", "src", "node_", ",_", "dst", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "args_", "._", "title_", ",_", "filters_", "=_", "filters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "copy", "usera", "ttr", "s_", "=_", "args_", "._", "copy", "usera", "ttr", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "efi", "le_", "=_", "args_", "._", "overwrit", "efi", "le_", ",_", "over", "wrt", "nodes_", "=_", "args_", "._", "over", "wrt", "nodes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stats_", "=_", "stats_", ",_", "start_", "=_", "start_", ",_", "stop_", "=_", "stop_", ",_", "step_", "=_", "step_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunks", "hape_", "=_", "args_", "._", "chunks", "hape_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sortby", "_", "=_", "args_", "._", "sortby", "_", ",_", "check", "\\u", "CSI", "_", "=_", "args_", "._", "check", "CSI", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prop", "indexes_", "=_", "args_", "._", "prop", "indexes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "upgrade", "flavors_", "=_", "args_", "._", "upgrade", "flavors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gather", " ", "some", " ", "statistics_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "t2_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu", "2_", "=_", "time_", "._", "clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tco", "py_", "=_", "round_", "(_", "t2_", "-_", "t1_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu", "copy_", "=_", "round_", "(_", "cpu", "2_", "-_", "cpu", "1_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp", "erc", "ent_", "=_", "int_", "(_", "round_", "(_", "cpu", "copy_", "/_", "tco", "py_", ",_", "2_", ")_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ngr", "oup", "s_", "=_", "stats_", "[_", "'", "group", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nle", "ave", "s_", "=_", "stats_", "[_", "'", "lea", "ves", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nli", "nks", "_", "=_", "stats_", "[_", "'", "link", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nha", "rd", "links_", "=_", "stats_", "[_", "'", "hard", "link", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "ytes", "copied_", "=_", "stats_", "[_", "'", "bytes", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nno", "des_", "=_", "ngr", "oup", "s_", "+_", "nle", "ave", "s_", "+_", "nli", "nks", "_", "+_", "nha", "rd", "links_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Group", "s", " ", "copie", "d", ":\"_", ",_", "ngr", "oup", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "Leav", "es", " ", "copie", "d", ":\"_", ",_", "nle", "ave", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "Link", "s", " ", "copie", "d", ":\"_", ",_", "nli", "nks", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "Hard", " ", "link", "s", " ", "copie", "d", ":\"_", ",_", "nha", "rd", "links_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "copy", "usera", "ttr", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "User", " ", "attr", "s", " ", "copie", "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 ", " _", "print_", "(_", "\"", "User", " ", "attr", "s", " ", "not", " ", "copie", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "KB", "ytes", " ", "copie", "d", ":\"_", ",_", "round_", "(_", "nb", "ytes", "copied_", "/_", "1024.", "_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Time", " ", "copy", "ing", ":", " ", "%", "s", " ", "s", " ", "(", "real", ")", " ", "%", "s", " ", "s", " ", "(", "cpu", ")", " ", " ", "%", "s", "%%\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tco", "py_", ",_", "cpu", "copy_", ",_", "tp", "erc", "ent_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Copie", "d", " ", "nodes", "/", "sec", ":", " ", "\"_", ",_", "round_", "(_", "(_", "nno", "des_", ")_", "/_", "float_", "(_", "tco", "py_", ")_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Copie", "d", " ", "KB", "/", "s", " ", ":\"_", ",_", "int_", "(_", "nb", "ytes", "copied_", "/_", "(_", "tco", "py_", "*_", "1024_", ")_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
zzzeek/sqlalchemy/lib/sqlalchemy/orm/interfaces.py
[ { "content": "# orm/interfaces.py\n# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors\n# <see AUTHORS file>\n#\n# This module is part of SQLAlchemy and is released under\n# the MIT License: http://www.opensource.org/licenses/mit-license.php\n\n\"\"\"\n\nContains various base classes used throughout the ORM.\n\nDefines some key base classes prominent within the internals,\nas well as the now-deprecated ORM extension classes.\n\nOther than the deprecated extensions, this module and the\nclasses within are mostly private, though some attributes\nare exposed when inspecting mappings.\n\n\"\"\"\n\nfrom __future__ import absolute_import\n\nfrom .. import util\nfrom ..sql import operators\nfrom .base import (ONETOMANY, MANYTOONE, MANYTOMANY,\n EXT_CONTINUE, EXT_STOP, NOT_EXTENSION)\nfrom .base import (InspectionAttr, InspectionAttr,\n InspectionAttrInfo, _MappedAttribute)\nimport collections\nfrom .. import inspect\n\n# imported later\nMapperExtension = SessionExtension = AttributeExtension = None\n\n__all__ = (\n 'AttributeExtension',\n 'EXT_CONTINUE',\n 'EXT_STOP',\n 'ONETOMANY',\n 'MANYTOMANY',\n 'MANYTOONE',\n 'NOT_EXTENSION',\n 'LoaderStrategy',\n 'MapperExtension',\n 'MapperOption',\n 'MapperProperty',\n 'PropComparator',\n 'SessionExtension',\n 'StrategizedProperty',\n)\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MapperProperty(_MappedAttribute, InspectionAttr, util.MemoizedSlots):\n \"\"\"Represent a particular class attribute mapped by :class:`.Mapper`.\n\n The most common occurrences of :class:`.MapperProperty` are the\n mapped :class:`.Column`, which is represented in a mapping as\n an instance of :class:`.ColumnProperty`,\n and a reference to another class produced by :func:`.relationship`,\n represented in the mapping as an instance of\n :class:`.RelationshipProperty`.\n\n \"\"\"\n\n __slots__ = (\n '_configure_started', '_configure_finished', 'parent', 'key',\n 'info'\n )\n\n cascade = frozenset()\n \"\"\"The set of 'cascade' attribute names.\n\n This collection is checked before the 'cascade_iterator' method is called.\n\n The collection typically only applies to a RelationshipProperty.\n\n \"\"\"\n\n is_property = True\n \"\"\"Part of the InspectionAttr interface; states this object is a\n mapper property.\n\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MapperProperty", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def _memoized_attr_info(self):\n \"\"\"Info dictionary associated with the object, allowing user-defined\n data to be associated with this :class:`.InspectionAttr`.\n\n The dictionary is generated when first accessed. Alternatively,\n it can be specified as a constructor argument to the\n :func:`.column_property`, :func:`.relationship`, or :func:`.composite`\n functions.\n\n .. versionadded:: 0.8 Added support for .info to all\n :class:`.MapperProperty` subclasses.\n\n .. versionchanged:: 1.0.0 :attr:`.MapperProperty.info` is also\n available on extension types via the\n :attr:`.InspectionAttrInfo.info` attribute, so that it can apply\n to a wider variety of ORM and extension constructs.\n\n .. seealso::\n\n :attr:`.QueryableAttribute.info`\n\n :attr:`.SchemaItem.info`\n\n \"\"\"\n return {}", "metadata": "root.MapperProperty._memoized_attr_info", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 84 }, { "content": " def setup(self, context, entity, path, adapter, **kwargs):\n \"\"\"Called by Query for the purposes of constructing a SQL statement.\n\n Each MapperProperty associated with the target mapper processes the\n statement referenced by the query context, adding columns and/or\n criterion as appropriate.\n\n \"\"\"", "metadata": "root.MapperProperty.setup", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 110 }, { "content": " def create_row_processor(self, context, path,\n mapper, result, adapter, populators):\n \"\"\"Produce row processing functions and append to the given\n set of populators lists.\n\n \"\"\"", "metadata": "root.MapperProperty.create_row_processor", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 119 }, { "content": " def cascade_iterator(self, type_, state, visited_instances=None,\n halt_on=None):\n \"\"\"Iterate through instances related to the given instance for\n a particular 'cascade', starting with this MapperProperty.\n\n Return an iterator3-tuples (instance, mapper, state).\n\n Note that the 'cascade' collection on this MapperProperty is\n checked first for the given type before cascade_iterator is called.\n\n This method typically only applies to RelationshipProperty.\n\n \"\"\"\n\n return iter(())", "metadata": "root.MapperProperty.cascade_iterator", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 126 }, { "content": " def set_parent(self, parent, init):\n \"\"\"Set the parent mapper that references this MapperProperty.\n\n This method is overridden by some subclasses to perform extra\n setup when the mapper is first known.\n\n \"\"\"\n self.parent = parent", "metadata": "root.MapperProperty.set_parent", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 142 }, { "content": " def instrument_class(self, mapper):\n \"\"\"Hook called by the Mapper to the property to initiate\n instrumentation of the class attribute managed by this\n MapperProperty.\n\n The MapperProperty here will typically call out to the\n attributes module to set up an InstrumentedAttribute.\n\n This step is the first of two steps to set up an InstrumentedAttribute,\n and is called early in the mapper setup process.\n\n The second step is typically the init_class_attribute step,\n called from StrategizedProperty via the post_instrument_class()\n hook. This step assigns additional state to the InstrumentedAttribute\n (specifically the \"impl\") which has been determined after the\n MapperProperty has determined what kind of persistence\n management it needs to do (e.g. scalar, object, collection, etc).\n\n \"\"\"", "metadata": "root.MapperProperty.instrument_class", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 151 }, { "content": " def __init__(self):\n self._configure_started = False\n self._configure_finished = False", "metadata": "root.MapperProperty.__init__", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 171 }, { "content": " def init(self):\n \"\"\"Called after all mappers are created to assemble\n relationships between mappers and perform other post-mapper-creation\n initialization steps.\n\n \"\"\"\n self._configure_started = True\n self.do_init()\n self._configure_finished = True", "metadata": "root.MapperProperty.init", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 175 }, { "content": " @property\n def class_attribute(self):\n \"\"\"Return the class-bound descriptor corresponding to this\n :class:`.MapperProperty`.\n\n This is basically a ``getattr()`` call::\n\n return getattr(self.parent.class_, self.key)\n\n I.e. if this :class:`.MapperProperty` were named ``addresses``,\n and the class to which it is mapped is ``User``, this sequence\n is possible::\n\n >>> from sqlalchemy import inspect\n >>> mapper = inspect(User)\n >>> addresses_property = mapper.attrs.addresses\n >>> addresses_property.class_attribute is User.addresses\n True\n >>> User.addresses.property is addresses_property\n True\n\n\n \"\"\"\n\n return getattr(self.parent.class_, self.key)", "metadata": "root.MapperProperty.class_attribute", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 185 }, { "content": " def do_init(self):\n \"\"\"Perform subclass-specific initialization post-mapper-creation\n steps.\n\n This is a template method called by the ``MapperProperty``\n object's init() method.\n\n \"\"\"", "metadata": "root.MapperProperty.do_init", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 211 }, { "content": " def post_instrument_class(self, mapper):\n \"\"\"Perform instrumentation adjustments that need to occur\n after init() has completed.\n\n The given Mapper is the Mapper invoking the operation, which\n may not be the same Mapper as self.parent in an inheritance\n scenario; however, Mapper will always at least be a sub-mapper of\n self.parent.\n\n This method is typically used by StrategizedProperty, which delegates\n it to LoaderStrategy.init_class_attribute() to perform final setup\n on the class-bound InstrumentedAttribute.\n\n \"\"\"", "metadata": "root.MapperProperty.post_instrument_class", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 220 }, { "content": " def merge(self, session, source_state, source_dict, dest_state,\n dest_dict, load, _recursive, _resolve_conflict_map):\n \"\"\"Merge the attribute represented by this ``MapperProperty``\n from source to destination object.\n\n \"\"\"", "metadata": "root.MapperProperty.merge", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 235 }, { "content": " def __repr__(self):\n return '<%s at 0x%x; %s>' % (\n self.__class__.__name__,\n id(self), getattr(self, 'key', 'no key'))", "metadata": "root.MapperProperty.__repr__", "header": "['class', 'MapperProperty', '(', '_MappedAttribute', ',', 'InspectionAttr', ',', 'util', '.', 'MemoizedSlots', ')', ':', '___EOS___']", "index": 242 }, { "content": "class PropComparator(operators.ColumnOperators):\n \"\"\"Defines SQL operators for :class:`.MapperProperty` objects.\n\n SQLAlchemy allows for operators to\n be redefined at both the Core and ORM level. :class:`.PropComparator`\n is the base class of operator redefinition for ORM-level operations,\n including those of :class:`.ColumnProperty`,\n :class:`.RelationshipProperty`, and :class:`.CompositeProperty`.\n\n .. note:: With the advent of Hybrid properties introduced in SQLAlchemy\n 0.7, as well as Core-level operator redefinition in\n SQLAlchemy 0.8, the use case for user-defined :class:`.PropComparator`\n instances is extremely rare. See :ref:`hybrids_toplevel` as well\n as :ref:`types_operators`.\n\n User-defined subclasses of :class:`.PropComparator` may be created. The\n built-in Python comparison and math operator methods, such as\n :meth:`.operators.ColumnOperators.__eq__`,\n :meth:`.operators.ColumnOperators.__lt__`, and\n :meth:`.operators.ColumnOperators.__add__`, can be overridden to provide\n new operator behavior. The custom :class:`.PropComparator` is passed to\n the :class:`.MapperProperty` instance via the ``comparator_factory``\n argument. In each case,\n the appropriate subclass of :class:`.PropComparator` should be used::\n\n # definition of custom PropComparator subclasses\n\n from sqlalchemy.orm.properties import \\\\\n ColumnProperty,\\\\\n CompositeProperty,\\\\\n RelationshipProperty\n\n class MyColumnComparator(ColumnProperty.Comparator):\n def __eq__(self, other):\n return self.__clause_element__() == other\n\n class MyRelationshipComparator(RelationshipProperty.Comparator):\n def any(self, expression):\n \"define the 'any' operation\"\n # ...\n\n class MyCompositeComparator(CompositeProperty.Comparator):\n def __gt__(self, other):\n \"redefine the 'greater than' operation\"\n\n return sql.and_(*[a>b for a, b in\n zip(self.__clause_element__().clauses,\n other.__composite_values__())])\n\n\n # application of custom PropComparator subclasses\n\n from sqlalchemy.orm import column_property, relationship, composite\n from sqlalchemy import Column, String\n\n class SomeMappedClass(Base):\n some_column = column_property(Column(\"some_column\", String),\n comparator_factory=MyColumnComparator)\n\n some_relationship = relationship(SomeOtherClass,\n comparator_factory=MyRelationshipComparator)\n\n some_composite = composite(\n Column(\"a\", String), Column(\"b\", String),\n comparator_factory=MyCompositeComparator\n )\n\n Note that for column-level operator redefinition, it's usually\n simpler to define the operators at the Core level, using the\n :attr:`.TypeEngine.comparator_factory` attribute. See\n :ref:`types_operators` for more detail.\n\n See also:\n\n :class:`.ColumnProperty.Comparator`\n\n :class:`.RelationshipProperty.Comparator`\n\n :class:`.CompositeProperty.Comparator`\n\n :class:`.ColumnOperators`\n\n :ref:`types_operators`\n\n :attr:`.TypeEngine.comparator_factory`\n\n \"\"\"\n\n __slots__ = 'prop', 'property', '_parententity', '_adapt_to_entity'\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PropComparator", "header": "['module', '___EOS___']", "index": 248 }, { "content": " def __init__(self, prop, parentmapper, adapt_to_entity=None):\n self.prop = self.property = prop\n self._parententity = adapt_to_entity or parentmapper\n self._adapt_to_entity = adapt_to_entity", "metadata": "root.PropComparator.__init__", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 338 }, { "content": " def __clause_element__(self):\n raise NotImplementedError(\"%r\" % self)", "metadata": "root.PropComparator.__clause_element__", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 343 }, { "content": " def _query_clause_element(self):\n return self.__clause_element__()", "metadata": "root.PropComparator._query_clause_element", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 346 }, { "content": " def adapt_to_entity(self, adapt_to_entity):\n \"\"\"Return a copy of this PropComparator which will use the given\n :class:`.AliasedInsp` to produce corresponding expressions.\n \"\"\"\n return self.__class__(self.prop, self._parententity, adapt_to_entity)", "metadata": "root.PropComparator.adapt_to_entity", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 349 }, { "content": " @property\n def _parentmapper(self):\n \"\"\"legacy; this is renamed to _parententity to be\n compatible with QueryableAttribute.\"\"\"\n return inspect(self._parententity).mapper", "metadata": "root.PropComparator._parentmapper", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 355 }, { "content": " @property\n def adapter(self):\n \"\"\"Produce a callable that adapts column expressions\n to suit an aliased version of this comparator.\n\n \"\"\"\n if self._adapt_to_entity is None:\n return None\n else:\n return self._adapt_to_entity._adapt_element", "metadata": "root.PropComparator.adapter", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 361 }, { "content": " @property\n def info(self):\n return self.property.info", "metadata": "root.PropComparator.info", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 372 }, { "content": " @staticmethod\n def any_op(a, b, **kwargs):\n return a.any(b, **kwargs)", "metadata": "root.PropComparator.any_op", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 376 }, { "content": " @staticmethod\n def has_op(a, b, **kwargs):\n return a.has(b, **kwargs)", "metadata": "root.PropComparator.has_op", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 380 }, { "content": " @staticmethod\n def of_type_op(a, class_):\n return a.of_type(class_)", "metadata": "root.PropComparator.of_type_op", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 384 }, { "content": " def of_type(self, class_):\n \"\"\"Redefine this object in terms of a polymorphic subclass.\n\n Returns a new PropComparator from which further criterion can be\n evaluated.\n\n e.g.::\n\n query.join(Company.employees.of_type(Engineer)).\\\\\n filter(Engineer.name=='foo')\n\n :param \\class_: a class or mapper indicating that criterion will be\n against this specific subclass.\n\n\n \"\"\"\n\n return self.operate(PropComparator.of_type_op, class_)", "metadata": "root.PropComparator.of_type", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 388 }, { "content": " def any(self, criterion=None, **kwargs):\n \"\"\"Return true if this collection contains any member that meets the\n given criterion.\n\n The usual implementation of ``any()`` is\n :meth:`.RelationshipProperty.Comparator.any`.\n\n :param criterion: an optional ClauseElement formulated against the\n member class' table or attributes.\n\n :param \\**kwargs: key/value pairs corresponding to member class\n attribute names which will be compared via equality to the\n corresponding values.\n\n \"\"\"\n\n return self.operate(PropComparator.any_op, criterion, **kwargs)", "metadata": "root.PropComparator.any", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 407 }, { "content": " def has(self, criterion=None, **kwargs):\n \"\"\"Return true if this element references a member which meets the\n given criterion.\n\n The usual implementation of ``has()`` is\n :meth:`.RelationshipProperty.Comparator.has`.\n\n :param criterion: an optional ClauseElement formulated against the\n member class' table or attributes.\n\n :param \\**kwargs: key/value pairs corresponding to member class\n attribute names which will be compared via equality to the\n corresponding values.\n\n \"\"\"\n\n return self.operate(PropComparator.has_op, criterion, **kwargs)", "metadata": "root.PropComparator.has", "header": "['class', 'PropComparator', '(', 'operators', '.', 'ColumnOperators', ')', ':', '___EOS___']", "index": 425 }, { "content": "class StrategizedProperty(MapperProperty):\n \"\"\"A MapperProperty which uses selectable strategies to affect\n loading behavior.\n\n There is a single strategy selected by default. Alternate\n strategies can be selected at Query time through the usage of\n ``StrategizedOption`` objects via the Query.options() method.\n\n The mechanics of StrategizedProperty are used for every Query\n invocation for every mapped attribute participating in that Query,\n to determine first how the attribute will be rendered in SQL\n and secondly how the attribute will retrieve a value from a result\n row and apply it to a mapped object. The routines here are very\n performance-critical.\n\n \"\"\"\n\n __slots__ = '_strategies', 'strategy'\n\n strategy_wildcard_key = None\n\n\n\n\n\n\n\n\n _all_strategies = collections.defaultdict(dict)\n\n", "metadata": "root.StrategizedProperty", "header": "['module', '___EOS___']", "index": 444 }, { "content": " def _get_context_loader(self, context, path):\n load = None\n\n # use EntityRegistry.__getitem__()->PropRegistry here so\n # that the path is stated in terms of our base\n search_path = dict.__getitem__(path, self)\n\n # search among: exact match, \"attr.*\", \"default\" strategy\n # if any.\n for path_key in (\n search_path._loader_key,\n search_path._wildcard_path_loader_key,\n search_path._default_path_loader_key\n ):\n if path_key in context.attributes:\n load = context.attributes[path_key]\n break\n\n return load", "metadata": "root.StrategizedProperty._get_context_loader", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 465 }, { "content": " def _get_strategy(self, key):\n try:\n return self._strategies[key]\n except KeyError:\n cls = self._strategy_lookup(*key)\n self._strategies[key] = self._strategies[\n cls] = strategy = cls(self)\n return strategy", "metadata": "root.StrategizedProperty._get_strategy", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 485 }, { "content": " def _get_strategy_by_cls(self, cls):\n return self._get_strategy(cls._strategy_keys[0])", "metadata": "root.StrategizedProperty._get_strategy_by_cls", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 494 }, { "content": " def setup(\n self, context, entity, path, adapter, **kwargs):\n loader = self._get_context_loader(context, path)\n if loader and loader.strategy:\n strat = self._get_strategy(loader.strategy)\n else:\n strat = self.strategy\n strat.setup_query(context, entity, path, loader, adapter, **kwargs)", "metadata": "root.StrategizedProperty.setup", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 497 }, { "content": " def create_row_processor(\n self, context, path, mapper,\n result, adapter, populators):\n loader = self._get_context_loader(context, path)\n if loader and loader.strategy:\n strat = self._get_strategy(loader.strategy)\n else:\n strat = self.strategy\n strat.create_row_processor(\n context, path, loader,\n mapper, result, adapter, populators)", "metadata": "root.StrategizedProperty.create_row_processor", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 506 }, { "content": " def do_init(self):\n self._strategies = {}\n self.strategy = self._get_strategy_by_cls(self.strategy_class)", "metadata": "root.StrategizedProperty.do_init", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 518 }, { "content": " def post_instrument_class(self, mapper):\n if not self.parent.non_primary and \\\n not mapper.class_manager._attr_has_impl(self.key):\n self.strategy.init_class_attribute(mapper)", "metadata": "root.StrategizedProperty.post_instrument_class", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 522 }, { "content": " @classmethod\n def strategy_for(cls, **kw):\n def decorate(dec_cls):\n # ensure each subclass of the strategy has its\n # own _strategy_keys collection\n if '_strategy_keys' not in dec_cls.__dict__:\n dec_cls._strategy_keys = []\n key = tuple(sorted(kw.items()))\n cls._all_strategies[cls][key] = dec_cls\n dec_cls._strategy_keys.append(key)\n return dec_cls\n return decorate", "metadata": "root.StrategizedProperty.strategy_for", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 529 }, { "content": " @classmethod\n def _strategy_lookup(cls, *key):\n for prop_cls in cls.__mro__:\n if prop_cls in cls._all_strategies:\n strategies = cls._all_strategies[prop_cls]\n try:\n return strategies[key]\n except KeyError:\n pass\n raise Exception(\"can't locate strategy for %s %s\" % (cls, key))", "metadata": "root.StrategizedProperty._strategy_lookup", "header": "['class', 'StrategizedProperty', '(', 'MapperProperty', ')', ':', '___EOS___']", "index": 542 }, { "content": "class MapperOption(object):\n \"\"\"Describe a modification to a Query.\"\"\"\n\n propagate_to_loaders = False\n \"\"\"if True, indicate this option should be carried along\n to \"secondary\" Query objects produced during lazy loads\n or refresh operations.\n\n \"\"\"\n\n", "metadata": "root.MapperOption", "header": "['module', '___EOS___']", "index": 554 }, { "content": " def process_query(self, query):\n \"\"\"Apply a modification to the given :class:`.Query`.\"\"\"", "metadata": "root.MapperOption.process_query", "header": "['class', 'MapperOption', '(', 'object', ')', ':', '___EOS___']", "index": 564 }, { "content": " def process_query_conditionally(self, query):\n \"\"\"same as process_query(), except that this option may not\n apply to the given query.\n\n This is typically used during a lazy load or scalar refresh\n operation to propagate options stated in the original Query to the\n new Query being used for the load. It occurs for those options that\n specify propagate_to_loaders=True.\n\n \"\"\"\n\n self.process_query(query)", "metadata": "root.MapperOption.process_query_conditionally", "header": "['class', 'MapperOption', '(', 'object', ')', ':', '___EOS___']", "index": 567 }, { "content": "class LoaderStrategy(object):\n \"\"\"Describe the loading behavior of a StrategizedProperty object.\n\n The ``LoaderStrategy`` interacts with the querying process in three\n ways:\n\n * it controls the configuration of the ``InstrumentedAttribute``\n placed on a class to handle the behavior of the attribute. this\n may involve setting up class-level callable functions to fire\n off a select operation when the attribute is first accessed\n (i.e. a lazy load)\n\n * it processes the ``QueryContext`` at statement construction time,\n where it can modify the SQL statement that is being produced.\n For example, simple column attributes will add their represented\n column to the list of selected columns, a joined eager loader\n may establish join clauses to add to the statement.\n\n * It produces \"row processor\" functions at result fetching time.\n These \"row processor\" functions populate a particular attribute\n on a particular mapped instance.\n\n \"\"\"\n\n __slots__ = 'parent_property', 'is_class_level', 'parent', 'key'\n\n\n\n\n", "metadata": "root.LoaderStrategy", "header": "['module', '___EOS___']", "index": 581 }, { "content": " def __init__(self, parent):\n self.parent_property = parent\n self.is_class_level = False\n self.parent = self.parent_property.parent\n self.key = self.parent_property.key", "metadata": "root.LoaderStrategy.__init__", "header": "['class', 'LoaderStrategy', '(', 'object', ')', ':', '___EOS___']", "index": 607 }, { "content": " def init_class_attribute(self, mapper):\n pass", "metadata": "root.LoaderStrategy.init_class_attribute", "header": "['class', 'LoaderStrategy', '(', 'object', ')', ':', '___EOS___']", "index": 613 }, { "content": " def setup_query(self, context, entity, path, loadopt, adapter, **kwargs):\n \"\"\"Establish column and other state for a given QueryContext.\n\n This method fulfills the contract specified by MapperProperty.setup().\n\n StrategizedProperty delegates its setup() method\n directly to this method.\n\n \"\"\"", "metadata": "root.LoaderStrategy.setup_query", "header": "['class', 'LoaderStrategy', '(', 'object', ')', ':', '___EOS___']", "index": 616 }, { "content": " def create_row_processor(self, context, path, loadopt, mapper,\n result, adapter, populators):\n \"\"\"Establish row processing functions for a given QueryContext.\n\n This method fulfills the contract specified by\n MapperProperty.create_row_processor().\n\n StrategizedProperty delegates its create_row_processor() method\n directly to this method.\n\n \"\"\"", "metadata": "root.LoaderStrategy.create_row_processor", "header": "['class', 'LoaderStrategy', '(', 'object', ')', ':', '___EOS___']", "index": 626 }, { "content": " def __str__(self):\n return str(self.parent_property)", "metadata": "root.LoaderStrategy.__str__", "header": "['class', 'LoaderStrategy', '(', 'object', ')', ':', '___EOS___']", "index": 638 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "orm", "/", "interface", "s", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2005", "-", "2016", " ", "the", " ", "SQL", "Al", "chem", "y", " ", "author", "s", " ", "and", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "<", "see", " ", "AUTHOR", "S", " ", "file", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "module", " ", "is", " ", "part", " ", "of", " ", "SQL", "Al", "chem", "y", " ", "and", " ", "is", " ", "released", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "MIT", " ", "License", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Contain", "s", " ", "vari", "ous", " ", "base", " ", "classe", "s", " ", "used", " ", "through", "out", " ", "the", " ", "ORM", ".", "\\", "10", ";", "\\", "10", ";", "Define", "s", " ", "some", " ", "key", " ", "base", " ", "classe", "s", " ", "prom", "inen", "t", " ", "within", " ", "the", " ", "internals", ",", "\\", "10", ";", "as", " ", "well", " ", "as", " ", "the", " ", "now", "-", "depre", "cated", " ", "ORM", " ", "extensi", "on", " ", "classe", "s", ".", "\\", "10", ";", "\\", "10", ";", "Ot", "her", " ", "than", " ", "the", " ", "depre", "cated", " ", "extensi", "ons", ",", " ", "this", " ", "module", " ", "and", " ", "the", "\\", "10", ";", "classe", "s", " ", "within", " ", "are", " ", "most", "ly", " ", "private", ",", " ", "tho", "ugh", " ", "some", " ", "attribute", "s", "\\", "10", ";", "are", " ", "exposed", " ", "whe", "n", " ", "inspect", "ing", " ", "mapping", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "sql_", "import_", "operators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "(_", "ONE", "TOM", "ANY_", ",_", "MAN", "YT", "OO", "NE_", ",_", "MAN", "YT", "OM", "ANY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "EXT", "\\u", "CONTINUE", "_", ",_", "EXT", "\\u", "STOP_", ",_", "NOT", "\\u", "EXTENSION", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "base_", "import_", "(_", "Inspect", "ion", "Attr_", ",_", "Inspect", "ion", "Attr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Inspect", "ion", "Attr", "Info_", ",_", "\\u", "Map", "ped", "Attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", "ed", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "Map", "per", "Extension_", "=_", "Sess", "ion", "Extension_", "=_", "Attribute", "Extension_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Attribute", "Ext", "ensi", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EXT", "\\u", "CONTINUE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EXT", "\\u", "STOP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ONE", "TOM", "ANY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAN", "YT", "OM", "ANY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAN", "YT", "OO", "NE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NOT", "\\u", "EXTENSION", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Load", "er", "Strat", "eg", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", "per", "Ext", "ensi", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", "per", "Optio", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Map", "per", "Proper", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Prop", "Compara", "tor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sess", "ion", "Ext", "ensi", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Strat", "egi", "zed", "Proper", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", " ", "a", " ", "partic", "ular", " ", "class", " ", "attribute", " ", "mapp", "ed", " ", "by", " ", ":", "class", ":`", ".", "Map", "per", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "most", " ", "common", " ", "occurrences", " ", "of", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`", " ", "are", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "mapp", "ed", " ", ":", "class", ":`", ".", "Colum", "n", "`", ",", " ", "whi", "ch", " ", "is", " ", "represent", "ed", " ", "in", " ", "a", " ", "mapping", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "instance", " ", "of", " ", ":", "class", ":`", ".", "Colum", "n", "Proper", "ty", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "a", " ", "reference", " ", "to", " ", "anot", "her", " ", "class", " ", "produce", "d", " ", "by", " ", ":", "func", ":`", ".", "relation", "ship", "`", ",", "\\", "10", ";", " ", " ", " ", " ", "represent", "ed", " ", "in", " ", "the", " ", "mapping", " ", "as", " ", "an", " ", "instance", " ", "of", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Relationship", "Proper", "ty", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "configur", "e\\u", "start", "ed", "'_", ",_", "'\\u", "configur", "e\\u", "finish", "ed", "'_", ",_", "'", "parent", "'_", ",_", "'", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "info", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cascade_", "=_", "frozenset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "The", " ", "set", " ", "of", " ", "'", "cascade", "'", " ", "attribute", " ", "names", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "collection", " ", "is", " ", "checke", "d", " ", "bef", "ore", " ", "the", " ", "'", "cascade", "\\u", "iter", "ator", "'", " ", "method", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "collection", " ", "typical", "ly", " ", "only", " ", "appli", "es", " ", "to", " ", "a", " ", "Relationship", "Proper", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "property_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Part", " ", "of", " ", "the", " ", "Inspect", "ion", "Attr", " ", "interface", ";", " ", "state", "s", " ", "this", " ", "object", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "mapper", " ", "property", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "memoized", "\\u", "attr", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Info", " ", "dictionar", "y", " ", "associate", "d", " ", "with", " ", "the", " ", "object", ",", " ", "allow", "ing", " ", "user", "-", "defin", "ed", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "to", " ", "be", " ", "associate", "d", " ", "with", " ", "this", " ", ":", "class", ":`", ".", "Inspect", "ion", "Attr", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "dictionar", "y", " ", "is", " ", "generat", "ed", " ", "whe", "n", " ", "first", " ", "accesse", "d", ".", " ", " ", "Alternative", "ly", ",", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "can", " ", "be", " ", "specified", " ", "as", " ", "a", " ", "construct", "or", " ", "argu", "ment", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", ":", "func", ":`", ".", "column", "\\u", "property", "`", ",", " ", ":", "func", ":`", ".", "relation", "ship", "`", ",", " ", "or", " ", ":", "func", ":`", ".", "composi", "te", "`", "\\", "10", ";", " ", " ", " ", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "adde", "d", "::", " ", "0.", "8", " ", " ", "Added", " ", "support", " ", "for", " ", ".", "info", " ", "to", " ", "all", "\\", "10", ";", " ", " ", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`", " ", "subclasses", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "version", "change", "d", "::", " ", "1.0", ".0", " ", ":", "attr", ":`", ".", "Map", "per", "Proper", "ty", ".", "info", "`", " ", "is", " ", "als", "o", "\\", "10", ";", " ", " ", " ", "avail", "able", " ", "on", " ", "extensi", "on", " ", "types", " ", "via", " ", "the", "\\", "10", ";", " ", " ", " ", ":", "attr", ":`", ".", "Inspect", "ion", "Attr", "Info", ".", "info", "`", " ", "attribute", ",", " ", "so", " ", "tha", "t", " ", "it", " ", "can", " ", "appl", "y", "\\", "10", ";", " ", " ", " ", "to", " ", "a", " ", "wide", "r", " ", "variet", "y", " ", "of", " ", "ORM", " ", "and", " ", "extensi", "on", " ", "construct", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "see", "als", "o", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", ".", "Query", "able", "Attribute", ".", "info", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", ".", "Schema", "Item", ".", "info", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ",_", "context_", ",_", "entity_", ",_", "path_", ",_", "adapter_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "by", " ", "Query", " ", "for", " ", "the", " ", "purpose", "s", " ", "of", " ", "constructi", "ng", " ", "a", " ", "SQL", " ", "statem", "ent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "Map", "per", "Proper", "ty", " ", "associate", "d", " ", "with", " ", "the", " ", "target", " ", "mapper", " ", "process", "es", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "statem", "ent", " ", "referenced", " ", "by", " ", "the", " ", "query", " ", "context", ",", " ", "addin", "g", " ", "column", "s", " ", "and", "/", "or", "\\", "10", ";", " ", " ", " ", " ", "criterio", "n", " ", "as", " ", "appropr", "iate", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "row", "\\u", "processor_", "(_", "self_", ",_", "context_", ",_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper_", ",_", "result_", ",_", "adapter_", ",_", "popul", "ator", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", " ", "row", " ", "process", "ing", " ", "function", "s", " ", "and", " ", "append", " ", "to", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "popul", "ator", "s", " ", "lists", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cascade", "\\u", "iterator_", "(_", "self_", ",_", "type\\u_", ",_", "state_", ",_", "visit", "ed", "\\u", "instances_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "halt", "\\u", "on_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Iterat", "e", " ", "through", " ", "instance", "s", " ", "relate", "d", " ", "to", " ", "the", " ", "give", "n", " ", "instance", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "partic", "ular", " ", "'", "cascade", "',", " ", "startin", "g", " ", "with", " ", "this", " ", "Map", "per", "Proper", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "an", " ", "iter", "ator", "3", "-", "tuple", "s", " ", "(", "instance", ",", " ", "mapper", ",", " ", "state", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "the", " ", "'", "cascade", "'", " ", "collection", " ", "on", " ", "this", " ", "Map", "per", "Proper", "ty", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "checke", "d", " ", "first", " ", "for", " ", "the", " ", "give", "n", " ", "type", " ", "bef", "ore", " ", "cascade", "\\u", "iter", "ator", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "typical", "ly", " ", "only", " ", "appli", "es", " ", "to", " ", "Relationship", "Proper", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "iter_", "(_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "parent_", "(_", "self_", ",_", "parent_", ",_", "init_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "parent", " ", "mapper", " ", "tha", "t", " ", "reference", "s", " ", "this", " ", "Map", "per", "Proper", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "overrid", "den", " ", "by", " ", "some", " ", "subclasses", " ", "to", " ", "perform", " ", "extra", "\\", "10", ";", " ", " ", " ", " ", "setup", " ", "whe", "n", " ", "the", " ", "mapper", " ", "is", " ", "first", " ", "know", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "instrument", "\\u", "class_", "(_", "self_", ",_", "mapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Hook", " ", "call", "ed", " ", "by", " ", "the", " ", "Map", "per", " ", "to", " ", "the", " ", "property", " ", "to", " ", "initiate", "\\", "10", ";", " ", " ", " ", " ", "instrument", "ation", " ", "of", " ", "the", " ", "class", " ", "attribute", " ", "manage", "d", " ", "by", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "Map", "per", "Proper", "ty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Map", "per", "Proper", "ty", " ", "here", " ", "will", " ", "typical", "ly", " ", "call", " ", "out", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "module", " ", "to", " ", "set", " ", "up", " ", "an", " ", "Instrum", "ente", "d", "Attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "step", " ", "is", " ", "the", " ", "first", " ", "of", " ", "two", " ", "step", "s", " ", "to", " ", "set", " ", "up", " ", "an", " ", "Instrum", "ente", "d", "Attribute", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "is", " ", "call", "ed", " ", "ear", "ly", " ", "in", " ", "the", " ", "mapper", " ", "setup", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "second", " ", "step", " ", "is", " ", "typical", "ly", " ", "the", " ", "init", "\\u", "class", "\\u", "attribute", " ", "step", ",", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "from", " ", "Strat", "egi", "zed", "Proper", "ty", " ", "via", " ", "the", " ", "post", "\\u", "instrument", "\\u", "class", "()", "\\", "10", ";", " ", " ", " ", " ", "hook", ".", " ", " ", "Thi", "s", " ", "step", " ", "assign", "s", " ", "addition", "al", " ", "state", " ", "to", " ", "the", " ", "Instrum", "ente", "d", "Attribute", "\\", "10", ";", " ", " ", " ", " ", "(", "specifica", "ll", "y", " ", "the", " ", "\"", "impl", "\")", " ", "whi", "ch", " ", "has", " ", "bee", "n", " ", "dete", "rmin", "ed", " ", "after", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Map", "per", "Proper", "ty", " ", "has", " ", "dete", "rmin", "ed", " ", "what", " ", "kind", " ", "of", " ", "persiste", "nce", "\\", "10", ";", " ", " ", " ", " ", "manage", "ment", " ", "it", " ", "need", "s", " ", "to", " ", "do", " ", "(", "e", ".", "g", ".", " ", "scala", "r", ",", " ", "object", ",", " ", "collection", ",", " ", "etc", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\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_", "._", "\\u", "configur", "e\\u", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configur", "e\\u", "finished_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "after", " ", "all", " ", "mapper", "s", " ", "are", " ", "created", " ", "to", " ", "assemble", "\\", "10", ";", " ", " ", " ", " ", "relation", "ships", " ", "bet", "ween", " ", "mapper", "s", " ", "and", " ", "perform", " ", "other", " ", "post", "-", "mapper", "-", "creati", "on", "\\", "10", ";", " ", " ", " ", " ", "initialization", " ", "step", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configur", "e\\u", "started_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "do", "\\u", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "configur", "e\\u", "finished_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "class", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "class", "-", "bound", " ", "descrip", "tor", " ", "correspond", "ing", " ", "to", " ", "this", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "basic", "ally", " ", "a", " ", "``", "getattr", "()``", " ", "call", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "getattr", "(", "self", ".", "parent", ".", "class", "\\u", ",", " ", "self", ".", "key", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "I", ".", "e", ".", " ", "if", " ", "this", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`", " ", "wer", "e", " ", "named", " ", "``", "addresse", "s", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "the", " ", "class", " ", "to", " ", "whi", "ch", " ", "it", " ", "is", " ", "mapp", "ed", " ", "is", " ", "``", "User", "``", ",", " ", "this", " ", "sequence", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "possib", "le", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "sqla", "lche", "my", " ", "import", " ", "inspect", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mapper", " ", "=", " ", "inspect", "(", "User", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "addresse", "s", "\\u", "property", " ", "=", " ", "mapper", ".", "attr", "s", ".", "addresse", "s", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "addresse", "s", "\\u", "property", ".", "class", "\\u", "attribute", " ", "is", " ", "User", ".", "addresse", "s", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "User", ".", "addresse", "s", ".", "property", " ", "is", " ", "addresse", "s", "\\u", "property", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "getattr_", "(_", "self_", "._", "parent_", "._", "class\\u_", ",_", "self_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "subclass", "-", "specific", " ", "initialization", " ", "post", "-", "mapper", "-", "creati", "on", "\\", "10", ";", " ", " ", " ", " ", "step", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "template", " ", "method", " ", "call", "ed", " ", "by", " ", "the", " ", "``", "Map", "per", "Proper", "ty", "``", "\\", "10", ";", " ", " ", " ", " ", "object", "'", "s", " ", "init", "()", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "instrument", "\\u", "class_", "(_", "self_", ",_", "mapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Perform", " ", "instrument", "ation", " ", "adjustment", "s", " ", "tha", "t", " ", "need", " ", "to", " ", "occur", "\\", "10", ";", " ", " ", " ", " ", "after", " ", "init", "()", " ", "has", " ", "complete", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "give", "n", " ", "Map", "per", " ", "is", " ", "the", " ", "Map", "per", " ", "inv", "oki", "ng", " ", "the", " ", "operati", "on", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "not", " ", "be", " ", "the", " ", "same", " ", "Map", "per", " ", "as", " ", "self", ".", "parent", " ", "in", " ", "an", " ", "inherita", "nce", "\\", "10", ";", " ", " ", " ", " ", "scen", "ario", ";", " ", "how", "ever", ",", " ", "Map", "per", " ", "will", " ", "alw", "ay", "s", " ", "at", " ", "leas", "t", " ", "be", " ", "a", " ", "sub", "-", "mapper", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "parent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "typical", "ly", " ", "used", " ", "by", " ", "Strat", "egi", "zed", "Proper", "ty", ",", " ", "whi", "ch", " ", "delegate", "s", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "to", " ", "Load", "er", "Strat", "eg", "y", ".", "init", "\\u", "class", "\\u", "attribute", "()", " ", "to", " ", "perform", " ", "final", " ", "setup", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "class", "-", "bound", " ", "Instrum", "ente", "d", "Attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ",_", "session_", ",_", "source", "\\u", "state_", ",_", "source", "\\u", "dict_", ",_", "dest", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest", "\\u", "dict_", ",_", "load_", ",_", "\\u", "recursive_", ",_", "\\u", "resolve", "\\u", "confl", "ict", "\\u", "map_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Merge", " ", "the", " ", "attribute", " ", "represent", "ed", " ", "by", " ", "this", " ", "``", "Map", "per", "Proper", "ty", "``", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "source", " ", "to", " ", "destinat", "ion", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Property_", "(_", "\\u", "Map", "ped", "Attribute_", ",_", "Inspect", "ion", "Attr_", ",_", "util_", "._", "Memo", "ize", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "%", "s", " ", "at", " ", "0", "x", "%", "x", ";", " ", "%", "s", ">'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "(_", "self_", ")_", ",_", "getattr_", "(_", "self_", ",_", "'", "key", "'_", ",_", "'", "no", " ", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Define", "s", " ", "SQL", " ", "opera", "tors", " ", "for", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "SQL", "Al", "chem", "y", " ", "allow", "s", " ", "for", " ", "opera", "tors", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "rede", "fined", " ", "at", " ", "bot", "h", " ", "the", " ", "Core", " ", "and", " ", "ORM", " ", "level", ".", " ", " ", ":", "class", ":`", ".", "Prop", "Compara", "tor", "`", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "the", " ", "base", " ", "class", " ", "of", " ", "opera", "tor", " ", "rede", "fini", "tion", " ", "for", " ", "ORM", "-", "level", " ", "operati", "ons", ",", "\\", "10", ";", " ", " ", " ", " ", "inclu", "ding", " ", "tho", "se", " ", "of", " ", ":", "class", ":`", ".", "Colum", "n", "Proper", "ty", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Relationship", "Proper", "ty", "`", ",", " ", "and", " ", ":", "class", ":`", ".", "Composit", "e", "Proper", "ty", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "note", "::", " ", "With", " ", "the", " ", "adve", "nt", " ", "of", " ", "Hy", "bri", "d", " ", "proper", "ties", " ", "introduce", "d", " ", "in", " ", "SQL", "Al", "chem", "y", "\\", "10", ";", " ", " ", " ", "0.", "7", ",", " ", "as", " ", "well", " ", "as", " ", "Core", "-", "level", " ", "opera", "tor", " ", "rede", "fini", "tion", " ", "in", "\\", "10", ";", " ", " ", " ", "SQL", "Al", "chem", "y", " ", "0.", "8", ",", " ", "the", " ", "use", " ", "case", " ", "for", " ", "user", "-", "defin", "ed", " ", ":", "class", ":`", ".", "Prop", "Compara", "tor", "`", "\\", "10", ";", " ", " ", " ", "instance", "s", " ", "is", " ", "extreme", "ly", " ", "rare", ".", " ", " ", "See", " ", ":", "ref", ":`", "hybrid", "s", "\\u", "toplevel", "`", " ", "as", " ", "well", "\\", "10", ";", " ", " ", " ", "as", " ", ":", "ref", ":`", "types", "\\u", "opera", "tors", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "User", "-", "defin", "ed", " ", "subclasses", " ", "of", " ", ":", "class", ":`", ".", "Prop", "Compara", "tor", "`", " ", "may", " ", "be", " ", "created", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "bui", "lt", "-", "in", " ", "Pyth", "on", " ", "compa", "ris", "on", " ", "and", " ", "math", " ", "opera", "tor", " ", "method", "s", ",", " ", "suc", "h", " ", "as", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", ".", "opera", "tors", ".", "Colum", "n", "Operators", ".\\u", "\\u", "eq", "\\u\\u", "`", ",", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", ".", "opera", "tors", ".", "Colum", "n", "Operators", ".\\u", "\\u", "lt", "\\u\\u", "`", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", ".", "opera", "tors", ".", "Colum", "n", "Operators", ".\\u", "\\u", "add", "\\u\\u", "`", ",", " ", "can", " ", "be", " ", "overrid", "den", " ", "to", " ", "provide", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "opera", "tor", " ", "behavior", ".", " ", "The", " ", "custom", " ", ":", "class", ":`", ".", "Prop", "Compara", "tor", "`", " ", "is", " ", "pass", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", ":", "class", ":`", ".", "Map", "per", "Proper", "ty", "`", " ", "instance", " ", "via", " ", "the", " ", "``", "comparator", "\\u", "factor", "y", "``", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", ".", " ", "In", " ", "each", " ", "case", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "appropr", "iate", " ", "subclass", " ", "of", " ", ":", "class", ":`", ".", "Prop", "Compara", "tor", "`", " ", "shou", "ld", " ", "be", " ", "used", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "definit", "ion", " ", "of", " ", "custom", " ", "Prop", "Compara", "tor", " ", "subclasses", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "sqla", "lche", "my", ".", "orm", ".", "proper", "ties", " ", "import", " ", "\\\\\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Colum", "n", "Proper", "ty", ",\\\\", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Composit", "e", "Proper", "ty", ",\\\\", "\\\\", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Relationship", "Proper", "ty", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Colum", "n", "Compara", "tor", "(", "Colum", "n", "Proper", "ty", ".", "Compara", "tor", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "eq", "\\u\\u", "(", "self", ",", " ", "other", "):", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "self", ".\\u", "\\u", "clause", "\\u", "element", "\\u\\u()", " ", "==", " ", "other", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Relationship", "Compara", "tor", "(", "Relationship", "Proper", "ty", ".", "Compara", "tor", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "any", "(", "self", ",", " ", "express", "ion", "):", "\\", "10", ";", " ", " ", " ", " ", "\"", "defin", "e", " ", "the", " ", "'", "any", "'", " ", "operati", "on", "\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "My", "Composit", "e", "Compara", "tor", "(", "Composit", "e", "Proper", "ty", ".", "Compara", "tor", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u\\u", "gt", "\\u\\u", "(", "self", ",", " ", "other", "):", "\\", "10", ";", " ", " ", " ", " ", "\"", "rede", "fine", " ", "the", " ", "'", "great", "er", " ", "than", "'", " ", "operati", "on", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "sql", ".", "and", "\\u(", "*[", "a", ">", "b", " ", "for", " ", "a", ",", " ", "b", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "zip", "(", "self", ".\\u", "\\u", "clause", "\\u", "element", "\\u\\u()", ".", "clause", "s", ",", "\\", "10", ";", " ", " ", "other", ".\\u", "\\u", "composi", "te", "\\u", "values", "\\u\\u()", ")])", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "applica", "tion", " ", "of", " ", "custom", " ", "Prop", "Compara", "tor", " ", "subclasses", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "sqla", "lche", "my", ".", "orm", " ", "import", " ", "column", "\\u", "property", ",", " ", "relation", "ship", ",", " ", "composi", "te", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "sqla", "lche", "my", " ", "import", " ", "Colum", "n", ",", " ", "String", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Some", "Map", "ped", "Class", "(", "Base", "):", "\\", "10", ";", " ", " ", " ", " ", "some", "\\u", "column", " ", "=", " ", "column", "\\u", "property", "(", "Colum", "n", "(\"", "some", "\\u", "column", "\",", " ", "String", "),", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "comparator", "\\u", "factor", "y", "=", "My", "Colum", "n", "Compara", "tor", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "some", "\\u", "relation", "ship", " ", "=", " ", "relation", "ship", "(", "Some", "Ot", "her", "Class", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "comparator", "\\u", "factor", "y", "=", "My", "Relationship", "Compara", "tor", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "some", "\\u", "composi", "te", " ", "=", " ", "composi", "te", "(", "\\", "10", ";", " ", " ", "Colum", "n", "(\"", "a", "\",", " ", "String", "),", " ", "Colum", "n", "(\"", "b", "\",", " ", "String", "),", "\\", "10", ";", " ", " ", "comparator", "\\u", "factor", "y", "=", "My", "Composit", "e", "Compara", "tor", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "for", " ", "column", "-", "level", " ", "opera", "tor", " ", "rede", "fini", "tion", ",", " ", "it", "'", "s", " ", "usual", "ly", "\\", "10", ";", " ", " ", " ", " ", "simple", "r", " ", "to", " ", "defin", "e", " ", "the", " ", "opera", "tors", " ", "at", " ", "the", " ", "Core", " ", "level", ",", " ", "usi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", ".", "Type", "Engine", ".", "comparator", "\\u", "factor", "y", "`", " ", "attribute", ".", " ", " ", "See", "\\", "10", ";", " ", " ", " ", " ", ":", "ref", ":`", "types", "\\u", "opera", "tors", "`", " ", "for", " ", "more", " ", "deta", "il", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Colum", "n", "Proper", "ty", ".", "Compara", "tor", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Relationship", "Proper", "ty", ".", "Compara", "tor", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Composit", "e", "Proper", "ty", ".", "Compara", "tor", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Colum", "n", "Operators", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "ref", ":`", "types", "\\u", "opera", "tors", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "attr", ":`", ".", "Type", "Engine", ".", "comparator", "\\u", "factor", "y", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "'", "prop", "'_", ",_", "'", "property", "'_", ",_", "'\\u", "parent", "entity", "'_", ",_", "'\\u", "adapt", "\\u", "to", "\\u", "entity", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "prop_", ",_", "parent", "mapper_", ",_", "adapt", "\\u", "to", "\\u", "entity_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prop_", "=_", "self_", "._", "property_", "=_", "prop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parent", "entity_", "=_", "adapt", "\\u", "to", "\\u", "entity_", "or_", "parent", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "adapt", "\\u", "to", "\\u", "entity_", "=_", "adapt", "\\u", "to", "\\u", "entity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "clause", "\\u", "element", "\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"%", "r", "\"_", "%_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "query", "\\u", "clause", "\\u", "element_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "clause", "\\u", "element", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "adapt", "\\u", "to", "\\u", "entity_", "(_", "self_", ",_", "adapt", "\\u", "to", "\\u", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "Prop", "Compara", "tor", " ", "whi", "ch", " ", "will", " ", "use", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", ".", "Aliase", "d", "Ins", "p", "`", " ", "to", " ", "produce", " ", "correspond", "ing", " ", "express", "ion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", "._", "prop_", ",_", "self_", "._", "\\u", "parent", "entity_", ",_", "adapt", "\\u", "to", "\\u", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "\\u", "parent", "mapper_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "lega", "cy", ";", " ", "this", " ", "is", " ", "renamed", " ", "to", " ", "\\u", "parent", "entity", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "compatible", " ", "with", " ", "Query", "able", "Attribute", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "inspect_", "(_", "self_", "._", "\\u", "parent", "entity_", ")_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "adapter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Produce", " ", "a", " ", "calla", "ble", " ", "tha", "t", " ", "adapt", "s", " ", "column", " ", "express", "ion", "s", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "suit", " ", "an", " ", "aliased", " ", "version", " ", "of", " ", "this", " ", "comparator", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "adapt", "\\u", "to", "\\u", "entity_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "adapt", "\\u", "to", "\\u", "entity_", "._", "\\u", "adapt", "\\u", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "property_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "any", "\\u", "op_", "(_", "a_", ",_", "b_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "._", "any_", "(_", "b_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "has", "\\u", "op_", "(_", "a_", ",_", "b_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "._", "has_", "(_", "b_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\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_", "of", "\\u", "type", "\\u", "op_", "(_", "a_", ",_", "class\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "._", "of", "\\u", "type_", "(_", "class\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "of", "\\u", "type_", "(_", "self_", ",_", "class\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Red", "efin", "e", " ", "this", " ", "object", " ", "in", " ", "term", "s", " ", "of", " ", "a", " ", "polymorphic", " ", "subclass", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "new", " ", "Prop", "Compara", "tor", " ", "from", " ", "whi", "ch", " ", "fur", "ther", " ", "criterio", "n", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "evaluate", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".:", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "query", ".", "join", "(", "Compa", "ny", ".", "employees", ".", "of", "\\u", "type", "(", "Engine", "er", "))", ".\\\\", "\\\\", "\\", "10", ";", " ", " ", " ", "filter", "(", "Engine", "er", ".", "name", "=='", "foo", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "\\\\", "class", "\\u", ":", " ", "a", " ", "class", " ", "or", " ", "mapper", " ", "indicati", "ng", " ", "tha", "t", " ", "criterio", "n", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "against", " ", "this", " ", "specific", " ", "subclass", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "operate", "_", "(_", "Prop", "Compara", "tor_", "._", "of", "\\u", "type", "\\u", "op_", ",_", "class\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "any_", "(_", "self_", ",_", "criterion_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "true", " ", "if", " ", "this", " ", "collection", " ", "contain", "s", " ", "any", " ", "member", " ", "tha", "t", " ", "meet", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "criterio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "usual", " ", "implementation", " ", "of", " ", "``", "any", "()``", " ", "is", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", ".", "Relationship", "Proper", "ty", ".", "Compara", "tor", ".", "any", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "criterio", "n", ":", " ", "an", " ", "option", "al", " ", "Cla", "use", "Element", " ", "formula", "ted", " ", "against", " ", "the", "\\", "10", ";", " ", " ", "member", " ", "class", "'", " ", "table", " ", "or", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "\\\\*", "*", "kwarg", "s", ":", " ", "key", "/", "value", " ", "pair", "s", " ", "correspond", "ing", " ", "to", " ", "member", " ", "class", "\\", "10", ";", " ", " ", "attribute", " ", "names", " ", "whi", "ch", " ", "will", " ", "be", " ", "compare", "d", " ", "via", " ", "equality", " ", "to", " ", "the", "\\", "10", ";", " ", " ", "correspond", "ing", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "operate", "_", "(_", "Prop", "Compara", "tor_", "._", "any", "\\u", "op_", ",_", "criterion_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prop", "Compara", "tor_", "(_", "operators_", "._", "Colum", "n", "Operators", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has_", "(_", "self_", ",_", "criterion_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "true", " ", "if", " ", "this", " ", "element", " ", "reference", "s", " ", "a", " ", "member", " ", "whi", "ch", " ", "meet", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "criterio", "n", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "usual", " ", "implementation", " ", "of", " ", "``", "has", "()``", " ", "is", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", ".", "Relationship", "Proper", "ty", ".", "Compara", "tor", ".", "has", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "criterio", "n", ":", " ", "an", " ", "option", "al", " ", "Cla", "use", "Element", " ", "formula", "ted", " ", "against", " ", "the", "\\", "10", ";", " ", " ", "member", " ", "class", "'", " ", "table", " ", "or", " ", "attribute", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "\\\\*", "*", "kwarg", "s", ":", " ", "key", "/", "value", " ", "pair", "s", " ", "correspond", "ing", " ", "to", " ", "member", " ", "class", "\\", "10", ";", " ", " ", "attribute", " ", "names", " ", "whi", "ch", " ", "will", " ", "be", " ", "compare", "d", " ", "via", " ", "equality", " ", "to", " ", "the", "\\", "10", ";", " ", " ", "correspond", "ing", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "operate", "_", "(_", "Prop", "Compara", "tor_", "._", "has", "\\u", "op_", ",_", "criterion_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\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_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Map", "per", "Proper", "ty", " ", "whi", "ch", " ", "use", "s", " ", "selectable", " ", "strategi", "es", " ", "to", " ", "affect", "\\", "10", ";", " ", " ", " ", " ", "load", "ing", " ", "behavior", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "a", " ", "single", " ", "strat", "eg", "y", " ", "selecte", "d", " ", "by", " ", "default", ".", " ", " ", "Alternate", "\\", "10", ";", " ", " ", " ", " ", "strategi", "es", " ", "can", " ", "be", " ", "selecte", "d", " ", "at", " ", "Query", " ", "time", " ", "through", " ", "the", " ", "usage", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "``", "Strat", "egi", "zed", "Optio", "n", "``", " ", "object", "s", " ", "via", " ", "the", " ", "Query", ".", "options", "()", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "mechani", "cs", " ", "of", " ", "Strat", "egi", "zed", "Proper", "ty", " ", "are", " ", "used", " ", "for", " ", "every", " ", "Query", "\\", "10", ";", " ", " ", " ", " ", "invocation", " ", "for", " ", "every", " ", "mapp", "ed", " ", "attribute", " ", "participati", "ng", " ", "in", " ", "tha", "t", " ", "Query", ",", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "dete", "rmin", "e", " ", "first", " ", "how", " ", "the", " ", "attribute", " ", "will", " ", "be", " ", "render", "ed", " ", "in", " ", "SQL", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "second", "ly", " ", "how", " ", "the", " ", "attribute", " ", "will", " ", "retrieve", " ", "a", " ", "value", " ", "from", " ", "a", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "row", " ", "and", " ", "appl", "y", " ", "it", " ", "to", " ", "a", " ", "mapp", "ed", " ", "object", ".", " ", " ", "The", " ", "routin", "es", " ", "here", " ", "are", " ", "very", "\\", "10", ";", " ", " ", " ", " ", "perform", "anc", "e-", "critic", "al", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "'\\u", "strategi", "es", "'_", ",_", "'", "strat", "eg", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "strat", "eg", "y", "\\u", "wild", "card", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "all", "\\u", "strategies_", "=_", "collections_", "._", "defaultdict_", "(_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "context", "\\u", "loader_", "(_", "self_", ",_", "context_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "Entit", "y", "Regi", "stry", ".\\u", "\\u", "getitem", "\\u\\u()", "->", "Prop", "Regi", "stry", " ", "here", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "the", " ", "path", " ", "is", " ", "state", "d", " ", "in", " ", "term", "s", " ", "of", " ", "our", " ", "base_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "path_", "=_", "dict_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "path_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", " ", "amo", "ng", ":", " ", "exact", " ", "match", ",", " ", "\"", "attr", ".*", "\",", " ", "\"", "default", "\"", " ", "strategy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "any", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "path", "\\u", "key_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "path_", "._", "\\u", "load", "er", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "path_", "._", "\\u", "wild", "card", "\\u", "path", "\\u", "load", "er", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "path_", "._", "\\u", "default", "\\u", "path", "\\u", "load", "er", "\\u", "key_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path", "\\u", "key_", "in_", "context_", "._", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "load_", "=_", "context_", "._", "attributes_", "[_", "path", "\\u", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "load_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "strategy_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "strategies_", "[_", "key_", "]_", "\\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 ", " _", "cls_", "=_", "self_", "._", "\\u", "strat", "eg", "y", "\\u", "lookup_", "(_", "*_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "strategies_", "[_", "key_", "]_", "=_", "self_", "._", "\\u", "strategies_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "]_", "=_", "strategy_", "=_", "cls_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\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", "strat", "eg", "y", "\\u", "by", "\\u", "cls_", "(_", "self_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "get", "\\u", "strategy_", "(_", "cls_", "._", "\\u", "strat", "eg", "y", "\\u", "keys_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "context_", ",_", "entity_", ",_", "path_", ",_", "adapter_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "self_", "._", "\\u", "get", "\\u", "context", "\\u", "loader_", "(_", "context_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loader_", "and_", "loader_", "._", "strategy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "_", "=_", "self_", "._", "\\u", "get", "\\u", "strategy_", "(_", "loader_", "._", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "_", "=_", "self_", "._", "strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "strat", "_", "._", "setup", "\\u", "query_", "(_", "context_", ",_", "entity_", ",_", "path_", ",_", "loader_", ",_", "adapter_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "row", "\\u", "processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "context_", ",_", "path_", ",_", "mapper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "adapter_", ",_", "popul", "ator", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "loader_", "=_", "self_", "._", "\\u", "get", "\\u", "context", "\\u", "loader_", "(_", "context_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loader_", "and_", "loader_", "._", "strategy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "_", "=_", "self_", "._", "\\u", "get", "\\u", "strategy_", "(_", "loader_", "._", "strategy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strat", "_", "=_", "self_", "._", "strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "strat", "_", "._", "create", "\\u", "row", "\\u", "processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "path_", ",_", "loader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper_", ",_", "result_", ",_", "adapter_", ",_", "popul", "ator", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "strategies_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "strategy_", "=_", "self_", "._", "\\u", "get", "\\u", "strat", "eg", "y", "\\u", "by", "\\u", "cls_", "(_", "self_", "._", "strat", "eg", "y", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "instrument", "\\u", "class_", "(_", "self_", ",_", "mapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "parent_", "._", "non", "\\u", "primary_", "and_", "not_", "mapper_", "._", "class", "\\u", "manager_", "._", "\\u", "attr", "\\u", "has", "\\u", "impl_", "(_", "self_", "._", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "strategy_", "._", "init", "\\u", "class", "\\u", "attribute_", "(_", "mapper_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "strat", "eg", "y", "\\u", "for_", "(_", "cls_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "decorate", "_", "(_", "dec", "\\u", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "each", " ", "subclass", " ", "of", " ", "the", " ", "strat", "eg", "y", " ", "has", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "own", " ", "\\u", "strat", "eg", "y", "\\u", "keys", " ", "collection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'\\u", "strat", "eg", "y", "\\u", "keys", "'_", "not_", "in_", "dec", "\\u", "cls_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dec", "\\u", "cls_", "._", "\\u", "strat", "eg", "y", "\\u", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "tuple_", "(_", "sorted_", "(_", "kw_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "all", "\\u", "strategies_", "[_", "cls_", "]_", "[_", "key_", "]_", "=_", "dec", "\\u", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "cls_", "._", "\\u", "strat", "eg", "y", "\\u", "keys_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dec", "\\u", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Strat", "egi", "zed", "Property_", "(_", "Map", "per", "Property_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "strat", "eg", "y", "\\u", "lookup_", "(_", "cls_", ",_", "*_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "prop", "\\u", "cls_", "in_", "cls_", "._", "\\u\\u", "mro", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prop", "\\u", "cls_", "in_", "cls_", "._", "\\u", "all", "\\u", "strategies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "strategies_", "=_", "cls_", "._", "\\u", "all", "\\u", "strategies_", "[_", "prop", "\\u", "cls_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "strategies_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Exception_", "(_", "\"", "can", "'", "t", " ", "locat", "e", " ", "strat", "eg", "y", " ", "for", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "cls_", ",_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Map", "per", "Option_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Describe", " ", "a", " ", "modification", " ", "to", " ", "a", " ", "Query", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "propagate", "\\u", "to", "\\u", "loaders_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "if", " ", "Tru", "e", ",", " ", "indicat", "e", " ", "this", " ", "option", " ", "shou", "ld", " ", "be", " ", "carri", "ed", " ", "along", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "\"", "second", "ary", "\"", " ", "Query", " ", "object", "s", " ", "produce", "d", " ", "dur", "ing", " ", "lazy", " ", "load", "s", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "refre", "sh", " ", "operati", "ons", ".", "\\", "10", ";", "\\", "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_", "Map", "per", "Option_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process", "\\u", "query_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Apply", " ", "a", " ", "modification", " ", "to", " ", "the", " ", "give", "n", " ", ":", "class", ":`", ".", "Query", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Option_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "query", "\\u", "conditional", "ly_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "same", " ", "as", " ", "process", "\\u", "query", "()", ",", " ", "except", " ", "tha", "t", " ", "this", " ", "option", " ", "may", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "appl", "y", " ", "to", " ", "the", " ", "give", "n", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "typical", "ly", " ", "used", " ", "dur", "ing", " ", "a", " ", "lazy", " ", "load", " ", "or", " ", "scala", "r", " ", "refre", "sh", "\\", "10", ";", " ", " ", " ", " ", "operati", "on", " ", "to", " ", "propagate", " ", "options", " ", "state", "d", " ", "in", " ", "the", " ", "original", " ", "Query", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "Query", " ", "bei", "ng", " ", "used", " ", "for", " ", "the", " ", "load", ".", " ", " ", "It", " ", "occur", "s", " ", "for", " ", "tho", "se", " ", "options", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", " ", "propagate", "\\u", "to", "\\u", "load", "ers", "=", "Tru", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "process", "\\u", "query_", "(_", "query_", ")_", "\\u\\u\\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_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Describe", " ", "the", " ", "load", "ing", " ", "behavior", " ", "of", " ", "a", " ", "Strat", "egi", "zed", "Proper", "ty", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "``", "Load", "er", "Strat", "eg", "y", "``", " ", "interact", "s", " ", "with", " ", "the", " ", "query", "ing", " ", "process", " ", "in", " ", "three", "\\", "10", ";", " ", " ", " ", " ", "way", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "it", " ", "controls", " ", "the", " ", "configura", "tion", " ", "of", " ", "the", " ", "``", "Instrum", "ente", "d", "Attribute", "``", "\\", "10", ";", " ", " ", "place", "d", " ", "on", " ", "a", " ", "class", " ", "to", " ", "handle", " ", "the", " ", "behavior", " ", "of", " ", "the", " ", "attribute", ".", " ", " ", "this", "\\", "10", ";", " ", " ", "may", " ", "involv", "e", " ", "setti", "ng", " ", "up", " ", "class", "-", "level", " ", "calla", "ble", " ", "function", "s", " ", "to", " ", "fire", "\\", "10", ";", " ", " ", "off", " ", "a", " ", "select", " ", "operati", "on", " ", "whe", "n", " ", "the", " ", "attribute", " ", "is", " ", "first", " ", "accesse", "d", "\\", "10", ";", " ", " ", "(", "i", ".", "e", ".", " ", "a", " ", "lazy", " ", "load", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "it", " ", "process", "es", " ", "the", " ", "``", "Query", "Context", "``", " ", "at", " ", "statem", "ent", " ", "constructi", "on", " ", "time", ",", "\\", "10", ";", " ", " ", "where", " ", "it", " ", "can", " ", "modif", "y", " ", "the", " ", "SQL", " ", "statem", "ent", " ", "tha", "t", " ", "is", " ", "bei", "ng", " ", "produce", "d", ".", "\\", "10", ";", " ", " ", "For", " ", "example", ",", " ", "simple", " ", "column", " ", "attribute", "s", " ", "will", " ", "add", " ", "thei", "r", " ", "represent", "ed", "\\", "10", ";", " ", " ", "column", " ", "to", " ", "the", " ", "list", " ", "of", " ", "selecte", "d", " ", "column", "s", ",", " ", "a", " ", "joine", "d", " ", "eage", "r", " ", "load", "er", "\\", "10", ";", " ", " ", "may", " ", "establish", " ", "join", " ", "clause", "s", " ", "to", " ", "add", " ", "to", " ", "the", " ", "statem", "ent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "It", " ", "produce", "s", " ", "\"", "row", " ", "process", "or", "\"", " ", "function", "s", " ", "at", " ", "result", " ", "fetch", "ing", " ", "time", ".", "\\", "10", ";", " ", " ", "The", "se", " ", "\"", "row", " ", "process", "or", "\"", " ", "function", "s", " ", "populate", " ", "a", " ", "partic", "ular", " ", "attribute", "\\", "10", ";", " ", " ", "on", " ", "a", " ", "partic", "ular", " ", "mapp", "ed", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "'", "parent", "\\u", "property", "'_", ",_", "'", "is", "\\u", "class", "\\u", "level", "'_", ",_", "'", "parent", "'_", ",_", "'", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent", "\\u", "property_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "class", "\\u", "level_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "self_", "._", "parent", "\\u", "property_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key_", "=_", "self_", "._", "parent", "\\u", "property_", "._", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "class", "\\u", "attribute_", "(_", "self_", ",_", "mapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "query_", "(_", "self_", ",_", "context_", ",_", "entity_", ",_", "path_", ",_", "load", "opt_", ",_", "adapter_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Esta", "blis", "h", " ", "column", " ", "and", " ", "other", " ", "state", " ", "for", " ", "a", " ", "give", "n", " ", "Query", "Context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "fulfill", "s", " ", "the", " ", "contract", " ", "specified", " ", "by", " ", "Map", "per", "Proper", "ty", ".", "setup", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Strat", "egi", "zed", "Proper", "ty", " ", "delegate", "s", " ", "its", " ", "setup", "()", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "direct", "ly", " ", "to", " ", "this", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "row", "\\u", "processor_", "(_", "self_", ",_", "context_", ",_", "path_", ",_", "load", "opt_", ",_", "mapper_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", ",_", "adapter_", ",_", "popul", "ator", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Esta", "blis", "h", " ", "row", " ", "process", "ing", " ", "function", "s", " ", "for", " ", "a", " ", "give", "n", " ", "Query", "Context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "fulfill", "s", " ", "the", " ", "contract", " ", "specified", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "Map", "per", "Proper", "ty", ".", "create", "\\u", "row", "\\u", "process", "or", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Strat", "egi", "zed", "Proper", "ty", " ", "delegate", "s", " ", "its", " ", "create", "\\u", "row", "\\u", "process", "or", "()", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "direct", "ly", " ", "to", " ", "this", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Load", "er", "Strategy_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "parent", "\\u", "property_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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_or_none(module):\n \"\"\"Like import_module, but returns None if the module does not exist.\n This will properly handle nested ImportErrors in such a way that, if the\n module should exist but throws ImportError, we *will* raise through\n that error.\n \"\"\"\n try:\n __import__(module)\n return sys.modules[module]\n except ImportError, ie:\n # If the exception came from us importing, we want to just\n # return None. We need to inspect the stack, though, so we properly\n # reraise in the case that the module we're importing triggered\n # an import error itself.\n tb = sys.exc_info()[2]\n top_frame = traceback.extract_tb(tb)[-1]\n err_file = re.sub(r'\\.pyc','.py', top_frame[0])\n my_file = re.sub(r'\\.pyc','.py', __file__)\n if err_file == my_file:\n return None\n else:\n LOG.error(\"Failed to import '%s'\" % (module,))\n raise", "metadata": "root._import_module_or_none", "header": "['module', '___EOS___']", "index": 45 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "import", "\\u", "module", "\\u", "or", "\\u", "none_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Lik", "e", " ", "import", "\\u", "module", ",", " ", "but", " ", "return", "s", " ", "Non", "e", " ", "if", " ", "the", " ", "module", " ", "doe", "s", " ", "not", " ", "exist", ".", "\\", "10", ";", " ", " ", "Thi", "s", " ", "will", " ", "proper", "ly", " ", "handle", " ", "nest", "ed", " ", "Import", "Error", "s", " ", "in", " ", "suc", "h", " ", "a", " ", "way", " ", "tha", "t", ",", " ", "if", " ", "the", "\\", "10", ";", " ", " ", "module", " ", "shou", "ld", " ", "exist", " ", "but", " ", "throw", "s", " ", "Import", "Error", ",", " ", "we", " ", "*", "will", "*", " ", "raise", " ", "through", "\\", "10", ";", " ", " ", "tha", "t", " ", "error", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "import\\u\\u_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sys_", "._", "modules_", "[_", "module_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ",_", "ie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "exception", " ", "came", " ", "from", " ", "us", " ", "import", "ing", ",", " ", "we", " ", "want", " ", "to", " ", "just", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Non", "e", ".", " ", "We", " ", "need", " ", "to", " ", "inspect", " ", "the", " ", "stack", ",", " ", "tho", "ugh", ",", " ", "so", " ", "we", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reraise", " ", "in", " ", "the", " ", "case", " ", "tha", "t", " ", "the", " ", "module", " ", "we", "'", "re", " ", "import", "ing", " ", "triggered_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "import", " ", "error", " ", "its", "elf", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top", "\\u", "frame_", "=_", "traceback_", "._", "extract", "\\u", "tb_", "(_", "tb_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err", "\\u", "file_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\.", "pyc", "'_", ",_", "'.", "py", "'_", ",_", "top", "\\u", "frame_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "file_", "=_", "re_", "._", "sub_", "(_", "r", "'\\\\.", "pyc", "'_", ",_", "'.", "py", "'_", ",_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "err", "\\u", "file_", "==_", "my", "\\u", "file_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "import", " ", "'%", "s", "'\"_", "%_", "(_", "module_", ",_", ")_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
django-bmf/django-bmf/djangobmf/models/activity.py
[ { "content": "class Activity(models.Model):\n \"\"\"\n Model which is accessed by en BMFModel with history\n \"\"\"\n\n user = models.ForeignKey(\n getattr(settings, 'AUTH_USER_MODEL', 'auth.User'),\n blank=True,\n null=True,\n on_delete=models.CASCADE,\n )\n topic = models.CharField(_(\"Topic\"), max_length=100, blank=True, null=True,)\n text = models.TextField(_(\"Text\"), blank=True, null=True,)\n action = models.PositiveSmallIntegerField(\n _(\"Action\"),\n blank=False,\n null=True,\n editable=False,\n default=ACTION_COMMENT,\n choices=ACTION_TYPES,\n )\n template = models.CharField(_(\"Template\"), max_length=100, editable=False, blank=False, null=True)\n parent_id = models.PositiveIntegerField()\n parent_ct = models.ForeignKey(\n ContentType, related_name=\"bmf_history_parent\", on_delete=models.CASCADE,\n )\n parent_object = GenericForeignKey('parent_ct', 'parent_id')\n\n modified = models.DateTimeField(_(\"Modified\"), auto_now=True, editable=False,)\n\n objects = ActivityManager()\n\n class Meta:\n ordering = ('-modified',)\n verbose_name = _('Activity')\n verbose_name_plural = _('Activity')\n get_latest_by = \"modified\"\n abstract = True", "metadata": "root.Activity", "header": "['module', '___EOS___']", "index": 44 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Activity_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Model", " ", "whi", "ch", " ", "is", " ", "accesse", "d", " ", "by", " ", "en", " ", "BM", "FM", "odel", " ", "with", " ", "histo", "ry", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "settings_", ",_", "'", "AUTH", "\\u", "USER", "\\u", "MODEL", "'_", ",_", "'", "auth", ".", "User", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blank_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "null_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "delete_", "=_", "models_", "._", "CASCADE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "Topic", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "100_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "models_", "._", "Text", "Field_", "(_", "\\u_", "(_", "\"", "Text", "\"_", ")_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "models_", "._", "Posi", "tiv", "e", "Small", "Integer", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Action", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "blank_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "null_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "editable_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "ACTI", "ON", "\\u", "COMMENT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ACTI", "ON", "\\u", "TYPES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "Templa", "te", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "100_", ",_", "editable_", "=_", "False_", ",_", "blank_", "=_", "False_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "id_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "ct_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Conten", "t", "Type_", ",_", "relate", "d\\u", "name_", "=_", "\"", "bm", "f", "\\u", "histo", "ry", "\\u", "parent", "\"_", ",_", "on", "\\u", "delete_", "=_", "models_", "._", "CASCADE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "object_", "=_", "Gene", "ric", "Fore", "ign", "Key_", "(_", "'", "parent", "\\u", "ct", "'_", ",_", "'", "parent", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modified_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "\\u_", "(_", "\"", "Modifie", "d", "\"_", ")_", ",_", "auto", "\\u", "now_", "=_", "True_", ",_", "editable_", "=_", "False_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "=_", "Activ", "it", "y", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ordering_", "=_", "(_", "'-", "modifi", "ed", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "'", "Activ", "it", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "'", "Activ", "it", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "late", "st", "\\u", "by_", "=_", "\"", "modifi", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abstract_", "=_", "True_" ]
[ 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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 2, 2, 2, 2 ]
Except block handles 'BaseException'
rackspace/pyrax/pyrax/cloudblockstorage.py
[ { "content": " def delete(self):\n \"\"\"\n Adds a check to make sure that the snapshot is able to be deleted.\n \"\"\"\n if self.status not in (\"available\", \"error\"):\n raise exc.SnapshotNotAvailable(\"Snapshot must be in 'available' \"\n \"or 'error' status before deleting. Current status: %s\" %\n self.status)\n # When there are more thann one snapshot for a given volume, attempting to\n # delete them all will throw a 409 exception. This will help by retrying\n # such an error once after a RETRY_INTERVAL second delay.\n try:\n super(CloudBlockStorageSnapshot, self).delete()\n except exc.ClientException as e:\n if \"Request conflicts with in-progress 'DELETE\" in str(e):\n time.sleep(RETRY_INTERVAL)\n # Try again; if it fails, oh, well...\n super(CloudBlockStorageSnapshot, self).delete()", "metadata": "root.CloudBlockStorageSnapshot.delete", "header": "['class', 'CloudBlockStorageSnapshot', '(', 'BaseResource', ')', ':', '___EOS___']", "index": 76 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Cloud", "Block", "Stor", "age", "Snapshot_", "(_", "Base", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", "s", " ", "a", " ", "check", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "snapshot", " ", "is", " ", "able", " ", "to", " ", "be", " ", "delete", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "status_", "not_", "in_", "(_", "\"", "avail", "able", "\"_", ",_", "\"", "error", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Snapshot", "Not", "Available_", "(_", "\"", "Snapshot", " ", "must", " ", "be", " ", "in", " ", "'", "avail", "able", "'", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "or", " ", "'", "error", "'", " ", "status", " ", "bef", "ore", " ", "delet", "ing", ".", " ", "Curr", "ent", " ", "status", ":", " ", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "there", " ", "are", " ", "more", " ", "than", "n", " ", "one", " ", "snapshot", " ", "for", " ", "a", " ", "give", "n", " ", "volume", ",", " ", "atte", "mpt", "ing", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "them", " ", "all", " ", "will", " ", "throw", " ", "a", " ", "409", " ", "exception", ".", " ", "Thi", "s", " ", "will", " ", "help", " ", "by", " ", "retrying", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "suc", "h", " ", "an", " ", "error", " ", "onc", "e", " ", "after", " ", "a", " ", "RETRY", "\\u", "INTERVAL", " ", "second", " ", "dela", "y", "._", "\\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 ", " _", "super_", "(_", "Cloud", "Block", "Stor", "age", "Snapshot_", ",_", "self_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exc_", "._", "Client", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "Request", " ", "confl", "icts", " ", "with", " ", "in", "-", "progress", " ", "'", "DELET", "E", "\"_", "in_", "str_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "RETRY", "\\u", "INTERVAL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "again", ";", " ", "if", " ", "it", " ", "fail", "s", ",", " ", "oh", ",", " ", "well", "..._", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Cloud", "Block", "Stor", "age", "Snapshot_", ",_", "self_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
giampaolo/psutil/setup.py
[ { "content": " def get_ethtool_macro():\n # see: https://github.com/giampaolo/psutil/issues/659\n from distutils.unixccompiler import UnixCCompiler\n from distutils.errors import CompileError\n\n with tempfile.NamedTemporaryFile(\n suffix='.c', delete=False, mode=\"wt\") as f:\n f.write(\"#include <linux/ethtool.h>\")\n\n @atexit.register\n def on_exit():\n try:\n os.remove(f.name)\n except OSError:\n pass\n\n compiler = UnixCCompiler()\n try:\n with silenced_output('stderr'):\n with silenced_output('stdout'):\n compiler.compile([f.name])\n except CompileError:\n return (\"PSUTIL_ETHTOOL_MISSING_TYPES\", 1)\n else:\n return None", "metadata": "root.get_ethtool_macro", "header": "['module', '___EOS___']", "index": 168 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "eth", "tool", "\\u", "macro_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "gia", "mpa", "olo", "/", "psu", "til", "/", "issue", "s", "/", "659", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "unix", "cco", "mpi", "ler_", "import_", "Uni", "x", "CC", "omp", "iler", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "._", "errors_", "import_", "Compil", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "=_", "'.", "c", "'_", ",_", "delete_", "=_", "False_", ",_", "mode_", "=_", "\"", "wt", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "\"#", "include", " ", "<", "linux", "/", "eth", "tool", ".", "h", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "atexit_", "._", "register_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "on", "\\u", "exit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "f_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "compiler_", "=_", "Uni", "x", "CC", "omp", "iler", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "silence", "d\\u", "output_", "(_", "'", "std", "err", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "silence", "d\\u", "output_", "(_", "'", "stdout", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "compiler_", "._", "compile_", "(_", "[_", "f_", "._", "name_", "]_", ")_", "\\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_", "Compil", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "\"", "PS", "UTIL", "\\u", "ETH", "TOOL", "\\u", "MISSING", "\\u", "TYPES", "\"_", ",_", "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_" ]
[ 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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